This repository was archived by the owner on Oct 10, 2020. It is now read-only.
Module import (re-)organization [v2]#221
Merged
rhatdan merged 3 commits intoprojectatomic:masterfrom Nov 20, 2015
Merged
Conversation
As per PEP8[1], there are basically three distinct groups of modules: 1) standard library imports 2) related third party imports 3) local application/library specific imports With that classification, we can give a general and consistent order to the module imports. The use of relative imports (the "dot" notation) for local modules is indeed a matter of taste, but backed by PEP-0328[1] and already used on Atomic/__init__.py. [1] - https://www.python.org/dev/peps/pep-0008/#imports [2] - https://www.python.org/dev/peps/pep-0328/ Signed-off-by: Cleber Rosa <crosa@redhat.com>
The same code is used in two different places so far. IMHO it makes sense to have it as an utility function in a single location. Signed-off-by: Cleber Rosa <crosa@redhat.com>
One would think a user of this function would have initially imported the requests library, but, in case that wasn't done, let's import it just as it's done with the urllib3 module. Also, check if the urllib3 module was already imported. If so, skip the import statement. Signed-off-by: Cleber Rosa <crosa@redhat.com>
Contributor
Author
|
Hi, I noticed that the last PRs merged also had similar check results (failures). Is there anything I can do here? |
Member
|
Can we get your check into the make pylint calls. so we can easily see the failure. |
Member
|
LGTM |
rhatdan
added a commit
that referenced
this pull request
Nov 20, 2015
Module import (re-)organization [v2]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a pattern to the module imports used throughout the code, as suggested by PEPs 008 and 328. PEPs aside, the goal is to make it easier to tell the internal and external dependencies of each module.
Also move the urrlib3 warnings handling to the util module.
Change from v1 (PR #212):