changeset 30471:00c9ac4ce816

util: rewrite pycompat imports to make pyflakes always happy I'll add more imports which would confuse pyflakes.
author Yuya Nishihara <yuya@tcha.org>
date Fri, 21 Oct 2016 00:09:38 +0900
parents 10d15095d7c2
children 277f4fe6d01a
files mercurial/util.py
diffstat 1 files changed, 10 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Thu Oct 20 23:27:09 2016 +0900
+++ b/mercurial/util.py	Fri Oct 21 00:09:38 2016 +0900
@@ -48,25 +48,17 @@
     pycompat,
 )
 
-for attr in (
-    'empty',
-    'httplib',
-    'httpserver',
-    'pickle',
-    'queue',
-    'urlerr',
-    'urlparse',
-    # we do import urlreq, but we do it outside the loop
-    #'urlreq',
-    'stringio',
-    'socketserver',
-    'xmlrpclib',
-):
-    a = pycompat.sysstr(attr)
-    globals()[a] = getattr(pycompat, a)
-
-# This line is to make pyflakes happy:
+empty = pycompat.empty
+httplib = pycompat.httplib
+httpserver = pycompat.httpserver
+pickle = pycompat.pickle
+queue = pycompat.queue
+socketserver = pycompat.socketserver
+stringio = pycompat.stringio
+urlerr = pycompat.urlerr
+urlparse = pycompat.urlparse
 urlreq = pycompat.urlreq
+xmlrpclib = pycompat.xmlrpclib
 
 if os.name == 'nt':
     from . import windows as platform