Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flake8 - primarily fix up imports #27

Merged
merged 9 commits into from
Feb 18, 2020

Conversation

bgrant
Copy link
Collaborator

@bgrant bgrant commented Feb 14, 2020

  • Don't import from * in machinery.__init__

This one might be a bit controversial. The import * is replaced with a pretty long list of imports, but the * import obscured the fact that some base things like logging and abc weren't being imported in machinery.__init__, they were coming in from the attributes module. There are a few attributes that aren't explicitly imported here that I could add to the list if the intention is for this module to be an interface that subsumes attributes.

  • Remove unnecessary imports and sort them (PyCharm's "optimize imports")
  • Wrap a couple of long lines
  • Remove an unnecessary lambda

@@ -21,7 +21,8 @@ def __init__(self):
"There was a problem with your timestamp. Please check your current system time."
"Server time is {0}.".format(time.time())
)
self.auth_header = 'OAuth realm="API",oauth_problem=timestamp_refused&oauth_acceptable_timestamps={0}-{1}'.format(
header_fmt = 'OAuth realm="API",oauth_problem=timestamp_refused&oauth_acceptable_timestamps={0}-{1}'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather just replace this with an f-string if at all possible as we'll be requiring 3.6+

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

from . import errors
from .attributes import *
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't find any arguments from me here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think I should import the rest of the attributes from .attributes (even the ones that aren't used in __init__.py?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, I'll leave that up to you. I'm not a huge fan of this type of root imports anyways.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay- I'm thinking I should, since I think other packages use machinery as an interface. I'll mark the import line noqa.

@bgrant bgrant requested a review from demianbrecht February 14, 2020 23:34
@bgrant bgrant changed the title Fix more flake8 Fix more flake8 - primarily fix up imports Feb 18, 2020
@bgrant bgrant changed the title Fix more flake8 - primarily fix up imports flake8 - primarily fix up imports Feb 18, 2020
demianbrecht
demianbrecht previously approved these changes Feb 18, 2020
Previously we imported `*` from `attributes`, so some values from that file may be used in other projects
even though they are not used in this file, as it appears `machinery` is used as an interface for `attributes`.
@bgrant bgrant merged commit 213088e into master Feb 18, 2020
@bgrant bgrant deleted the feature/medium-controversial-flake8 branch February 18, 2020 19:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants