launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #24289
[Merge] ~cjwatson/launchpad:importpedant-contextlib-exitstack into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:importpedant-contextlib-exitstack into launchpad:master.
Commit message:
Allow importing contextlib.ExitStack
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/378600
This is only imported conditionally (on Python 2 we use contextlib2.ExitStack instead), but we need to mark it as valid anyway to stop the import pedant complaining.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:importpedant-contextlib-exitstack into launchpad:master.
diff --git a/lib/lp/scripts/utilities/importpedant.py b/lib/lp/scripts/utilities/importpedant.py
index 7d7b268..83a62a8 100644
--- a/lib/lp/scripts/utilities/importpedant.py
+++ b/lib/lp/scripts/utilities/importpedant.py
@@ -27,6 +27,8 @@ def text_lines_to_set(text):
# __all__. The following dict maps from such modules to a list of attributes
# that are allowed to be imported, whether or not they are in __all__.
valid_imports_not_in_all = {
+ # Exported in Python 3, but missing and so not exported in Python 2.
+ 'contextlib': set(['ExitStack']),
'cookielib': set(['domain_match']),
# Exported in Python 3, but missing and so not exported in Python 2.
'json.decoder': set(['JSONDecodeError']),