comparison mercurial/util.py @ 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 41a8106789ca
children 277f4fe6d01a
comparison
equal deleted inserted replaced
30470:10d15095d7c2 30471:00c9ac4ce816
46 osutil, 46 osutil,
47 parsers, 47 parsers,
48 pycompat, 48 pycompat,
49 ) 49 )
50 50
51 for attr in ( 51 empty = pycompat.empty
52 'empty', 52 httplib = pycompat.httplib
53 'httplib', 53 httpserver = pycompat.httpserver
54 'httpserver', 54 pickle = pycompat.pickle
55 'pickle', 55 queue = pycompat.queue
56 'queue', 56 socketserver = pycompat.socketserver
57 'urlerr', 57 stringio = pycompat.stringio
58 'urlparse', 58 urlerr = pycompat.urlerr
59 # we do import urlreq, but we do it outside the loop 59 urlparse = pycompat.urlparse
60 #'urlreq',
61 'stringio',
62 'socketserver',
63 'xmlrpclib',
64 ):
65 a = pycompat.sysstr(attr)
66 globals()[a] = getattr(pycompat, a)
67
68 # This line is to make pyflakes happy:
69 urlreq = pycompat.urlreq 60 urlreq = pycompat.urlreq
61 xmlrpclib = pycompat.xmlrpclib
70 62
71 if os.name == 'nt': 63 if os.name == 'nt':
72 from . import windows as platform 64 from . import windows as platform
73 else: 65 else:
74 from . import posix as platform 66 from . import posix as platform