diff options
author | Terry Jan Reedy <tjreedy@udel.edu> | 2019-03-23 07:50:15 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-23 07:50:15 (GMT) |
commit | 2b75155590eb42d25e474b776ee9fdcc4b3dc840 (patch) | |
tree | bae874d3d2c176b92a88b27f6918d66516c08ef5 /Lib/idlelib/autocomplete.py | |
parent | 7a2e84c3488cfd6c108c6b41ff040825f1757566 (diff) | |
download | cpython-2b75155590eb42d25e474b776ee9fdcc4b3dc840.zip cpython-2b75155590eb42d25e474b776ee9fdcc4b3dc840.tar.gz cpython-2b75155590eb42d25e474b776ee9fdcc4b3dc840.tar.bz2 |
bpo-36405: Use dict unpacking in idlelib (#12507)
Remove now unneeded imports.
Diffstat (limited to 'Lib/idlelib/autocomplete.py')
-rw-r--r-- | Lib/idlelib/autocomplete.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/Lib/idlelib/autocomplete.py b/Lib/idlelib/autocomplete.py index 9caf50d..6751928 100644 --- a/Lib/idlelib/autocomplete.py +++ b/Lib/idlelib/autocomplete.py @@ -14,7 +14,6 @@ COMPLETE_ATTRIBUTES, COMPLETE_FILES = range(1, 2+1) from idlelib import autocomplete_w from idlelib.config import idleConf from idlelib.hyperparser import HyperParser -import __main__ # This string includes all chars that may be in an identifier. # TODO Update this here and elsewhere. @@ -182,8 +181,7 @@ class AutoComplete: else: if mode == COMPLETE_ATTRIBUTES: if what == "": - namespace = __main__.__dict__.copy() - namespace.update(__main__.__builtins__.__dict__) + namespace = {**__builtins__.__dict__, **globals()} bigl = eval("dir()", namespace) bigl.sort() if "__all__" in bigl: @@ -218,10 +216,8 @@ class AutoComplete: return smalll, bigl def get_entity(self, name): - """Lookup name in a namespace spanning sys.modules and __main.dict__""" - namespace = sys.modules.copy() - namespace.update(__main__.__dict__) - return eval(name, namespace) + "Lookup name in a namespace spanning sys.modules and globals()." + return eval(name, {**sys.modules, **globals()}) AutoComplete.reload() |