##// END OF EJS Templates
py3: manually import getattr where it is needed...
Gregory Szorc -
r43359:c59eb156 default
parent child Browse files
Show More
@@ -12,7 +12,10 b' import re'
12 12 import socket
13 13
14 14 from mercurial.i18n import _
15 from mercurial.pycompat import open
15 from mercurial.pycompat import (
16 getattr,
17 open,
18 )
16 19 from mercurial import (
17 20 encoding,
18 21 error,
@@ -25,6 +25,7 b' import svn.ra'
25 25 Pool = svn.core.Pool
26 26 SubversionException = svn.core.SubversionException
27 27
28 from mercurial.pycompat import getattr
28 29 from mercurial import util
29 30
30 31 # Some older versions of the Python bindings need to be
@@ -14,6 +14,7 b' import os'
14 14
15 15 from mercurial.i18n import _
16 16 from mercurial.pycompat import (
17 getattr,
17 18 open,
18 19 setattr,
19 20 )
@@ -7,6 +7,7 b''
7 7
8 8 from __future__ import absolute_import
9 9
10 from mercurial.pycompat import getattr
10 11 from mercurial import (
11 12 context as hgcontext,
12 13 dagop,
@@ -206,7 +206,10 b' import os'
206 206 import struct
207 207
208 208 from mercurial.i18n import _
209 from mercurial.pycompat import open
209 from mercurial.pycompat import (
210 getattr,
211 open,
212 )
210 213 from mercurial import (
211 214 bundle2,
212 215 cmdutil,
@@ -103,7 +103,10 b' from mercurial.node import ('
103 103
104 104 from mercurial.i18n import _
105 105
106 from mercurial.pycompat import open
106 from mercurial.pycompat import (
107 getattr,
108 open,
109 )
107 110
108 111 from mercurial.utils import (
109 112 procutil,
@@ -90,6 +90,7 b' import re'
90 90 import weakref
91 91
92 92 from mercurial.i18n import _
93 from mercurial.pycompat import getattr
93 94 from mercurial.hgweb import webcommands
94 95
95 96 from mercurial import (
@@ -6,7 +6,7 b' from __future__ import absolute_import'
6 6 import re
7 7
8 8 from mercurial.i18n import _
9
9 from mercurial.pycompat import getattr
10 10 from mercurial import (
11 11 error,
12 12 hg,
@@ -16,6 +16,7 b' import re'
16 16 import socket
17 17
18 18 from mercurial.i18n import _
19 from mercurial.pycompat import getattr
19 20
20 21 from mercurial import (
21 22 encoding,
@@ -11,7 +11,10 b' import hashlib'
11 11
12 12 from mercurial.i18n import _
13 13 from mercurial.node import bin, hex, nullid, short
14 from mercurial.pycompat import setattr
14 from mercurial.pycompat import (
15 getattr,
16 setattr,
17 )
15 18
16 19 from mercurial import (
17 20 bundle2,
@@ -76,7 +76,10 b' from mercurial.node import ('
76 76 nullrev,
77 77 short,
78 78 )
79 from mercurial.pycompat import open
79 from mercurial.pycompat import (
80 getattr,
81 open,
82 )
80 83 from mercurial import (
81 84 cmdutil,
82 85 commands,
@@ -49,6 +49,7 b' import re'
49 49
50 50 from mercurial.node import bin, nullid
51 51 from mercurial.i18n import _
52 from mercurial.pycompat import getattr
52 53 from mercurial import (
53 54 cmdutil,
54 55 context,
@@ -9,7 +9,10 b' import struct'
9 9 import time
10 10
11 11 from mercurial.i18n import _
12 from mercurial.pycompat import open
12 from mercurial.pycompat import (
13 getattr,
14 open,
15 )
13 16 from mercurial import (
14 17 node as nodemod,
15 18 policy,
@@ -3,6 +3,7 b' from __future__ import absolute_import'
3 3 import threading
4 4
5 5 from mercurial.node import hex, nullid
6 from mercurial.pycompat import getattr
6 7 from mercurial import (
7 8 mdiff,
8 9 pycompat,
@@ -6,6 +6,7 b' repository. See the command help for det'
6 6 from __future__ import absolute_import
7 7
8 8 from mercurial.i18n import _
9 from mercurial.pycompat import getattr
9 10 from mercurial import (
10 11 bookmarks as bookmarksmod,
11 12 cmdutil,
@@ -50,7 +50,7 b' import os'
50 50 import sys
51 51
52 52 from mercurial.i18n import _
53 from mercurial.pycompat import setattr
53 from mercurial.pycompat import getattr, setattr
54 54 from mercurial import (
55 55 encoding,
56 56 error,
@@ -171,7 +171,7 b' if sys.version_info[0] >= 3:'
171 171 r, c = t.start
172 172 l = (
173 173 b'; from mercurial.pycompat import '
174 b'delattr, getattr\n'
174 b'delattr\n'
175 175 )
176 176 for u in tokenize.tokenize(io.BytesIO(l).readline):
177 177 if u.type in (tokenize.ENCODING, token.ENDMARKER):
@@ -220,7 +220,7 b' if sys.version_info[0] >= 3:'
220 220 # ``replacetoken`` or any mechanism that changes semantics of module
221 221 # loading is changed. Otherwise cached bytecode may get loaded without
222 222 # the new transformation mechanisms applied.
223 BYTECODEHEADER = b'HG\x00\x10'
223 BYTECODEHEADER = b'HG\x00\x11'
224 224
225 225 class hgloader(importlib.machinery.SourceFileLoader):
226 226 """Custom module loader that transforms source code.
@@ -17,6 +17,7 b' from .node import ('
17 17 short,
18 18 wdirid,
19 19 )
20 from .pycompat import getattr
20 21 from . import (
21 22 encoding,
22 23 error,
@@ -51,7 +51,10 b' import struct'
51 51 import time
52 52
53 53 from .i18n import _
54 from .pycompat import setattr
54 from .pycompat import (
55 getattr,
56 setattr,
57 )
55 58
56 59 from . import (
57 60 commandserver,
@@ -20,6 +20,7 b' from .node import ('
20 20 short,
21 21 )
22 22 from .pycompat import (
23 getattr,
23 24 open,
24 25 setattr,
25 26 )
@@ -10,6 +10,7 b' from __future__ import absolute_import'
10 10 import re
11 11
12 12 from .i18n import _
13 from .pycompat import getattr
13 14
14 15 from . import (
15 16 encoding,
@@ -24,6 +24,7 b' except ImportError:'
24 24 from .thirdparty import selectors2 as selectors
25 25
26 26 from .i18n import _
27 from .pycompat import getattr
27 28 from . import (
28 29 encoding,
29 30 error,
@@ -11,6 +11,7 b' import errno'
11 11 import os
12 12
13 13 from .i18n import _
14 from .pycompat import getattr
14 15 from . import (
15 16 error,
16 17 pycompat,
@@ -23,7 +23,10 b' from .node import ('
23 23 wdirfilenodeids,
24 24 wdirhex,
25 25 )
26 from .pycompat import open
26 from .pycompat import (
27 getattr,
28 open,
29 )
27 30 from . import (
28 31 copies,
29 32 dagop,
@@ -16,7 +16,10 b' import re'
16 16 import signal
17 17
18 18 from .i18n import _
19 from .pycompat import open
19 from .pycompat import (
20 getattr,
21 open,
22 )
20 23 from . import (
21 24 encoding,
22 25 error,
@@ -32,7 +32,10 b' from .node import ('
32 32 nullrev,
33 33 short,
34 34 )
35 from .pycompat import open
35 from .pycompat import (
36 getattr,
37 open,
38 )
36 39 from . import (
37 40 bundle2,
38 41 changegroup,
@@ -20,6 +20,7 b' import traceback'
20 20
21 21
22 22 from .i18n import _
23 from .pycompat import getattr
23 24
24 25 from hgdemandimport import tracing
25 26
@@ -11,6 +11,7 b' import locale'
11 11 import os
12 12 import unicodedata
13 13
14 from .pycompat import getattr
14 15 from . import (
15 16 error,
16 17 policy,
@@ -19,6 +19,7 b' from .i18n import ('
19 19 gettext,
20 20 )
21 21 from .pycompat import (
22 getattr,
22 23 open,
23 24 setattr,
24 25 )
@@ -18,7 +18,10 b' from .node import ('
18 18 nullid,
19 19 short,
20 20 )
21 from .pycompat import open
21 from .pycompat import (
22 getattr,
23 open,
24 )
22 25
23 26 from . import (
24 27 encoding,
@@ -11,6 +11,7 b' import errno'
11 11 import re
12 12
13 13 from .i18n import _
14 from .pycompat import getattr
14 15 from . import (
15 16 error,
16 17 filesetlang,
@@ -8,6 +8,7 b''
8 8 from __future__ import absolute_import
9 9
10 10 from .i18n import _
11 from .pycompat import getattr
11 12 from . import (
12 13 error,
13 14 parser,
@@ -16,6 +16,7 b' from .i18n import ('
16 16 _,
17 17 gettext,
18 18 )
19 from .pycompat import getattr
19 20 from . import (
20 21 cmdutil,
21 22 encoding,
@@ -16,6 +16,7 b' import stat'
16 16
17 17 from .i18n import _
18 18 from .node import nullid
19 from .pycompat import getattr
19 20
20 21 from . import (
21 22 bookmarks,
@@ -14,7 +14,10 b' import mimetypes'
14 14 import os
15 15 import stat
16 16
17 from ..pycompat import open
17 from ..pycompat import (
18 getattr,
19 open,
20 )
18 21 from .. import (
19 22 encoding,
20 23 pycompat,
@@ -18,6 +18,7 b' from .common import ('
18 18 permhooks,
19 19 statusmessage,
20 20 )
21 from ..pycompat import getattr
21 22
22 23 from .. import (
23 24 encoding,
@@ -17,7 +17,10 b' import traceback'
17 17 import wsgiref.validate
18 18
19 19 from ..i18n import _
20 from ..pycompat import open
20 from ..pycompat import (
21 getattr,
22 open,
23 )
21 24
22 25 from .. import (
23 26 encoding,
@@ -14,6 +14,7 b' import re'
14 14
15 15 from ..i18n import _
16 16 from ..node import hex, short
17 from ..pycompat import getattr
17 18
18 19 from .common import (
19 20 ErrorResponse,
@@ -12,6 +12,7 b' from __future__ import absolute_import'
12 12
13 13 import os
14 14
15 from ..pycompat import getattr
15 16 from .. import pycompat
16 17
17 18 from ..utils import procutil
@@ -11,6 +11,7 b' import os'
11 11 import sys
12 12
13 13 from .i18n import _
14 from .pycompat import getattr
14 15 from . import (
15 16 demandimport,
16 17 encoding,
@@ -16,6 +16,7 b' import struct'
16 16 import weakref
17 17
18 18 from .i18n import _
19 from .pycompat import getattr
19 20 from . import (
20 21 bundle2,
21 22 error,
@@ -12,6 +12,7 b' import locale'
12 12 import os
13 13 import sys
14 14
15 from .pycompat import getattr
15 16 from . import (
16 17 encoding,
17 18 pycompat,
@@ -92,6 +92,7 b' import sys'
92 92 import threading
93 93
94 94 from .i18n import _
95 from .pycompat import getattr
95 96 from . import (
96 97 node,
97 98 pycompat,
@@ -23,6 +23,7 b' from .node import ('
23 23 nullrev,
24 24 short,
25 25 )
26 from .pycompat import getattr
26 27 from . import (
27 28 bookmarks,
28 29 branchmap,
@@ -16,6 +16,7 b' import time'
16 16 import warnings
17 17
18 18 from .i18n import _
19 from .pycompat import getattr
19 20
20 21 from . import (
21 22 encoding,
@@ -3,6 +3,8 b' from __future__ import absolute_import, '
3 3 import _lsprof
4 4 import sys
5 5
6 from .pycompat import getattr
7
6 8 Profiler = _lsprof.Profiler
7 9
8 10 # PyPy doesn't expose profiler_entry from the module.
@@ -19,7 +19,10 b' import socket'
19 19 import time
20 20
21 21 from .i18n import _
22 from .pycompat import open
22 from .pycompat import (
23 getattr,
24 open,
25 )
23 26 from . import (
24 27 encoding,
25 28 error,
@@ -19,6 +19,7 b' from .node import ('
19 19 nullid,
20 20 nullrev,
21 21 )
22 from .pycompat import getattr
22 23 from . import (
23 24 error,
24 25 mdiff,
@@ -12,7 +12,10 b' import struct'
12 12 import zlib
13 13
14 14 from .i18n import _
15 from .pycompat import setattr
15 from .pycompat import (
16 getattr,
17 setattr,
18 )
16 19 from . import (
17 20 encoding,
18 21 error,
@@ -8,6 +8,7 b''
8 8 from __future__ import absolute_import
9 9
10 10 from .i18n import _
11 from .pycompat import getattr
11 12 from .interfaces import repository
12 13 from . import (
13 14 error,
@@ -74,6 +74,7 b' import hashlib'
74 74 import struct
75 75
76 76 from .i18n import _
77 from .pycompat import getattr
77 78 from . import (
78 79 encoding,
79 80 error,
@@ -113,7 +113,10 b' from .node import ('
113 113 nullrev,
114 114 short,
115 115 )
116 from .pycompat import setattr
116 from .pycompat import (
117 getattr,
118 setattr,
119 )
117 120 from . import (
118 121 error,
119 122 pycompat,
@@ -10,6 +10,8 b' from __future__ import absolute_import'
10 10 import os
11 11 import sys
12 12
13 from .pycompat import getattr
14
13 15 # Rules for how modules can be loaded. Values are:
14 16 #
15 17 # c - require C extensions
@@ -21,7 +21,10 b' import tempfile'
21 21 import unicodedata
22 22
23 23 from .i18n import _
24 from .pycompat import open
24 from .pycompat import (
25 getattr,
26 open,
27 )
25 28 from . import (
26 29 encoding,
27 30 error,
@@ -10,7 +10,10 b' from __future__ import absolute_import, '
10 10 import contextlib
11 11
12 12 from .i18n import _
13 from .pycompat import open
13 from .pycompat import (
14 getattr,
15 open,
16 )
14 17 from . import (
15 18 encoding,
16 19 error,
@@ -13,6 +13,7 b' import os'
13 13 import socket
14 14 import stat as statmod
15 15
16 from ..pycompat import getattr
16 17 from .. import (
17 18 encoding,
18 19 pycompat,
@@ -355,6 +355,7 b' else:'
355 355 strurl = identity
356 356 bytesurl = identity
357 357 open = open
358 getattr = getattr
358 359 hasattr = hasattr
359 360 setattr = setattr
360 361
@@ -12,7 +12,10 b' import copy'
12 12 import weakref
13 13
14 14 from .node import nullrev
15 from .pycompat import setattr
15 from .pycompat import (
16 getattr,
17 setattr,
18 )
16 19 from . import (
17 20 obsolete,
18 21 phases,
@@ -35,6 +35,7 b' from .node import ('
35 35 wdirrev,
36 36 )
37 37 from .i18n import _
38 from .pycompat import getattr
38 39 from .revlogutils.constants import (
39 40 FLAG_GENERALDELTA,
40 41 FLAG_INLINE_DATA,
@@ -15,6 +15,7 b' import struct'
15 15 # import stuff from node for others to import from revlog
16 16 from ..node import nullrev
17 17 from ..i18n import _
18 from ..pycompat import getattr
18 19
19 20 from .constants import (
20 21 REVIDX_ISCENSORED,
@@ -10,6 +10,7 b' from __future__ import absolute_import'
10 10 import re
11 11
12 12 from .i18n import _
13 from .pycompat import getattr
13 14 from . import (
14 15 dagop,
15 16 destutil,
@@ -10,6 +10,7 b' from __future__ import absolute_import'
10 10 import string
11 11
12 12 from .i18n import _
13 from .pycompat import getattr
13 14 from . import (
14 15 error,
15 16 node,
@@ -6,6 +6,7 b' import fcntl'
6 6 import os
7 7 import sys
8 8
9 from .pycompat import getattr
9 10 from . import (
10 11 encoding,
11 12 pycompat,
@@ -26,6 +26,7 b' from .node import ('
26 26 wdirid,
27 27 wdirrev,
28 28 )
29 from .pycompat import getattr
29 30
30 31 from . import (
31 32 copies as copiesmod,
@@ -7,6 +7,7 b''
7 7
8 8 from __future__ import absolute_import
9 9
10 from .pycompat import getattr
10 11 from . import (
11 12 encoding,
12 13 error,
@@ -11,6 +11,7 b' import re'
11 11 import uuid
12 12
13 13 from .i18n import _
14 from .pycompat import getattr
14 15 from . import (
15 16 error,
16 17 pycompat,
@@ -15,6 +15,7 b' import re'
15 15 import ssl
16 16
17 17 from .i18n import _
18 from .pycompat import getattr
18 19 from . import (
19 20 encoding,
20 21 error,
@@ -14,6 +14,7 b' import os'
14 14 import stat
15 15
16 16 from .i18n import _
17 from .pycompat import getattr
17 18 from . import (
18 19 changelog,
19 20 error,
@@ -13,6 +13,7 b' import posixpath'
13 13 import re
14 14
15 15 from .i18n import _
16 from .pycompat import getattr
16 17 from . import (
17 18 config,
18 19 error,
@@ -68,6 +68,7 b' import abc'
68 68 import os
69 69
70 70 from .i18n import _
71 from .pycompat import getattr
71 72 from . import (
72 73 config,
73 74 encoding,
@@ -11,6 +11,7 b' import abc'
11 11 import types
12 12
13 13 from .i18n import _
14 from .pycompat import getattr
14 15 from . import (
15 16 error,
16 17 pycompat,
@@ -14,6 +14,7 b' from ..node import ('
14 14 nullid,
15 15 nullrev,
16 16 )
17 from ..pycompat import getattr
17 18 from .. import (
18 19 error,
19 20 mdiff,
@@ -23,6 +23,7 b' import traceback'
23 23 from .i18n import _
24 24 from .node import hex
25 25 from .pycompat import (
26 getattr,
26 27 open,
27 28 setattr,
28 29 )
@@ -14,6 +14,7 b' allowing operations like diff and log wi'
14 14 from __future__ import absolute_import
15 15
16 16 from .i18n import _
17 from .pycompat import getattr
17 18
18 19 from . import (
19 20 changelog,
@@ -10,6 +10,7 b' from __future__ import absolute_import'
10 10 import stat
11 11
12 12 from .i18n import _
13 from .pycompat import getattr
13 14 from . import (
14 15 changelog,
15 16 error,
@@ -15,6 +15,7 b' import socket'
15 15 import sys
16 16
17 17 from .i18n import _
18 from .pycompat import getattr
18 19 from . import (
19 20 encoding,
20 21 error,
@@ -6,6 +6,7 b''
6 6 # GNU General Public License version 2 or any later version.
7 7 from __future__ import absolute_import
8 8
9 from .pycompat import getattr
9 10 from . import pycompat
10 11
11 12 _sysstr = pycompat.sysstr
@@ -36,6 +36,7 b' import warnings'
36 36
37 37 from .thirdparty import attr
38 38 from .pycompat import (
39 getattr,
39 40 open,
40 41 setattr,
41 42 )
@@ -10,6 +10,7 b' import bz2'
10 10 import collections
11 11 import zlib
12 12
13 from ..pycompat import getattr
13 14 from .. import (
14 15 error,
15 16 i18n,
@@ -20,7 +20,10 b' import sys'
20 20 import time
21 21
22 22 from ..i18n import _
23 from ..pycompat import open
23 from ..pycompat import (
24 getattr,
25 open,
26 )
24 27
25 28 from .. import (
26 29 encoding,
@@ -14,7 +14,10 b' import stat'
14 14 import threading
15 15
16 16 from .i18n import _
17 from .pycompat import setattr
17 from .pycompat import (
18 getattr,
19 setattr,
20 )
18 21 from . import (
19 22 encoding,
20 23 error,
@@ -16,6 +16,7 b' import string'
16 16 import sys
17 17
18 18 from .i18n import _
19 from .pycompat import getattr
19 20 from . import (
20 21 encoding,
21 22 error,
@@ -15,6 +15,7 b' import collections'
15 15 import struct
16 16
17 17 from .i18n import _
18 from .pycompat import getattr
18 19 from .thirdparty import attr
19 20 from . import (
20 21 encoding,
@@ -10,6 +10,7 b' from .node import ('
10 10 hex,
11 11 )
12 12 from .i18n import _
13 from .pycompat import getattr
13 14 from .thirdparty import attr
14 15 from . import (
15 16 error,
@@ -13,7 +13,10 b' import weakref'
13 13
14 14 from .i18n import _
15 15 from .node import bin
16 from .pycompat import setattr
16 from .pycompat import (
17 getattr,
18 setattr,
19 )
17 20 from . import (
18 21 bundle2,
19 22 changegroup as changegroupmod,
@@ -15,6 +15,7 b' from .node import ('
15 15 hex,
16 16 nullid,
17 17 )
18 from .pycompat import getattr
18 19
19 20 from . import (
20 21 bundle2,
General Comments 0
You need to be logged in to leave comments. Login now