libv8 6.3.292.48.1 → 6.7.288.46.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (195) hide show
  1. checksums.yaml +5 -5
  2. data/.travis.yml +10 -34
  3. data/CHANGELOG.md +16 -0
  4. data/README.md +9 -63
  5. data/Rakefile +2 -2
  6. data/ext/libv8/builder.rb +22 -87
  7. data/ext/libv8/extconf.rb +1 -1
  8. data/ext/libv8/paths.rb +5 -18
  9. data/lib/libv8/version.rb +1 -1
  10. data/spec/location_spec.rb +1 -2
  11. data/spec/spec_helper.rb +0 -1
  12. data/vendor/depot_tools/.gitattributes +1 -2
  13. data/vendor/depot_tools/OWNERS +0 -1
  14. data/vendor/depot_tools/PRESUBMIT.py +11 -6
  15. data/vendor/depot_tools/README.md +0 -1
  16. data/vendor/depot_tools/WATCHLISTS +0 -6
  17. data/vendor/depot_tools/auth.py +129 -87
  18. data/vendor/depot_tools/autoninja +11 -1
  19. data/vendor/depot_tools/autoninja.bat +7 -1
  20. data/vendor/depot_tools/autoninja.py +14 -6
  21. data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
  22. data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
  23. data/vendor/depot_tools/cipd +23 -2
  24. data/vendor/depot_tools/cipd.bat +2 -2
  25. data/vendor/depot_tools/cipd_client_version +1 -1
  26. data/vendor/depot_tools/cipd_manifest.txt +17 -7
  27. data/vendor/depot_tools/cit.py +7 -6
  28. data/vendor/depot_tools/cpplint.py +195 -35
  29. data/vendor/depot_tools/detect_host_arch.py +51 -0
  30. data/vendor/depot_tools/download_from_google_storage.py +85 -26
  31. data/vendor/depot_tools/fetch.py +11 -6
  32. data/vendor/depot_tools/fetch_configs/chromium.py +0 -1
  33. data/vendor/depot_tools/fetch_configs/goma_client.py +41 -0
  34. data/vendor/depot_tools/fetch_configs/infra.py +0 -1
  35. data/vendor/depot_tools/fetch_configs/infra_internal.py +0 -1
  36. data/vendor/depot_tools/gclient-new-workdir.py +4 -0
  37. data/vendor/depot_tools/gclient.py +732 -476
  38. data/vendor/depot_tools/gclient_eval.py +569 -58
  39. data/vendor/depot_tools/gclient_scm.py +258 -46
  40. data/vendor/depot_tools/gclient_utils.py +17 -1
  41. data/vendor/depot_tools/gerrit_util.py +46 -13
  42. data/vendor/depot_tools/git_cache.py +0 -2
  43. data/vendor/depot_tools/git_cl.py +176 -335
  44. data/vendor/depot_tools/git_common.py +19 -16
  45. data/vendor/depot_tools/git_footers.py +19 -5
  46. data/vendor/depot_tools/git_hyper_blame.py +9 -3
  47. data/vendor/depot_tools/git_new_branch.py +15 -3
  48. data/vendor/depot_tools/git_upstream_diff.py +7 -2
  49. data/vendor/depot_tools/gsutil.py +1 -1
  50. data/vendor/depot_tools/infra/config/cq.cfg +1 -2
  51. data/vendor/depot_tools/infra/config/recipes.cfg +1 -1
  52. data/vendor/depot_tools/luci-auth +13 -0
  53. data/vendor/depot_tools/luci-auth.bat +8 -0
  54. data/vendor/depot_tools/man/html/depot_tools.html +0 -8
  55. data/vendor/depot_tools/man/html/git-upstream-diff.html +20 -3
  56. data/vendor/depot_tools/man/man1/git-upstream-diff.1 +27 -6
  57. data/vendor/depot_tools/man/man7/depot_tools.7 +0 -5
  58. data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +2 -2
  59. data/vendor/depot_tools/man/src/git-upstream-diff.txt +21 -3
  60. data/vendor/depot_tools/man/src/make_docs.sh +6 -0
  61. data/vendor/depot_tools/my_activity.py +283 -93
  62. data/vendor/depot_tools/owners.py +9 -4
  63. data/vendor/depot_tools/owners_finder.py +7 -3
  64. data/vendor/depot_tools/post_build_ninja_summary.py +322 -0
  65. data/vendor/depot_tools/presubmit_canned_checks.py +91 -106
  66. data/vendor/depot_tools/presubmit_support.py +219 -157
  67. data/vendor/depot_tools/prpc +13 -0
  68. data/vendor/depot_tools/prpc.bat +8 -0
  69. data/vendor/depot_tools/recipes/OWNERS +3 -1
  70. data/vendor/depot_tools/recipes/README.recipes.md +70 -111
  71. data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +12 -5
  72. data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +36 -68
  73. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +0 -8
  74. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_json.json → no_apply_patch_on_gclient.json} +64 -10
  75. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{no_shallow.json → shallow.json} +1 -1
  76. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob.json +0 -8
  77. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_empty_revision.json +0 -8
  78. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +0 -6
  79. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +0 -7
  80. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +0 -6
  81. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +44 -0
  82. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange_oauth2_buildbot.json → tryjob_gerrit_branch_heads.json} +51 -5
  83. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +0 -8
  84. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +48 -8
  85. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +19 -26
  86. data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +193 -155
  87. data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +9 -0
  88. data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +2 -7
  89. data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +31 -5
  90. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +37 -19
  91. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +37 -19
  92. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +37 -19
  93. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +37 -23
  94. data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +4 -0
  95. data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +40 -8
  96. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +3 -3
  97. data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.py +6 -3
  98. data/vendor/depot_tools/recipes/recipe_modules/gitiles/OWNERS +0 -1
  99. data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +0 -1
  100. data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +7 -56
  101. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +0 -1
  102. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +15 -16
  103. data/vendor/depot_tools/recipes/recipes.py +4 -2
  104. data/vendor/depot_tools/recipes/trigger_recipe_roller.txt +12 -0
  105. data/vendor/depot_tools/roll_dep.py +35 -37
  106. data/vendor/depot_tools/support/chromite_wrapper +1 -1
  107. data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +3 -3
  108. data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +2 -2
  109. data/vendor/depot_tools/third_party/logilab/astroid/astpeephole.py +86 -0
  110. data/vendor/depot_tools/third_party/logilab/astroid/bases.py +53 -66
  111. data/vendor/depot_tools/third_party/logilab/astroid/brain/py2pytest.py +31 -31
  112. data/vendor/depot_tools/third_party/logilab/astroid/brain/pynose.py +39 -16
  113. data/vendor/depot_tools/third_party/logilab/astroid/brain/pysix_moves.py +225 -189
  114. data/vendor/depot_tools/third_party/logilab/astroid/inference.py +45 -41
  115. data/vendor/depot_tools/third_party/logilab/astroid/manager.py +1 -0
  116. data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +2 -2
  117. data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +3 -2
  118. data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +1 -0
  119. data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +57 -3
  120. data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +1 -1
  121. data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +21 -1
  122. data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +58 -33
  123. data/vendor/depot_tools/third_party/pylint/README.chromium +2 -2
  124. data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +3 -3
  125. data/vendor/depot_tools/third_party/pylint/checkers/base.py +6 -18
  126. data/vendor/depot_tools/third_party/pylint/checkers/classes.py +64 -63
  127. data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +25 -57
  128. data/vendor/depot_tools/third_party/pylint/checkers/format.py +14 -10
  129. data/vendor/depot_tools/third_party/pylint/checkers/python3.py +142 -37
  130. data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +10 -1
  131. data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +50 -7
  132. data/vendor/depot_tools/third_party/pylint/checkers/strings.py +1 -1
  133. data/vendor/depot_tools/third_party/pylint/epylint.py +2 -1
  134. data/vendor/depot_tools/third_party/pylint/gui.py +1 -1
  135. data/vendor/depot_tools/third_party/pylint/lint.py +88 -23
  136. data/vendor/depot_tools/third_party/pylint/reporters/html.py +37 -5
  137. data/vendor/depot_tools/third_party/pylint/testutils.py +1 -1
  138. data/vendor/depot_tools/third_party/pylint/utils.py +5 -0
  139. data/vendor/depot_tools/vpython +31 -1
  140. data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +35 -2
  141. data/vendor/depot_tools/win_toolchain/package_from_installed.py +0 -15
  142. data/vendor/depot_tools/yapf +17 -0
  143. data/vendor/depot_tools/{apply_issue.bat → yapf.bat} +2 -2
  144. metadata +16 -58
  145. data/ext/libv8/compiler.rb +0 -39
  146. data/ext/libv8/compiler/apple_llvm.rb +0 -22
  147. data/ext/libv8/compiler/clang.rb +0 -22
  148. data/ext/libv8/compiler/gcc.rb +0 -22
  149. data/ext/libv8/compiler/generic_compiler.rb +0 -66
  150. data/ext/libv8/make.rb +0 -13
  151. data/ext/libv8/patcher.rb +0 -21
  152. data/patches/0001-Build-a-standalone-static-library.patch +0 -26
  153. data/patches/0002-Don-t-compile-unnecessary-stuff.patch +0 -85
  154. data/patches/0003-Use-the-fPIC-flag-for-the-static-library.patch +0 -25
  155. data/patches/0004-Do-not-embed-debug-symbols-in-macOS-libraries.patch +0 -25
  156. data/patches/0005-Remove-TryInstallOptimizedCode.patch +0 -321
  157. data/patches/mingw-generate-makefiles.sh +0 -97
  158. data/spec/compiler/apple_llvm_spec.rb +0 -37
  159. data/spec/compiler/clang_spec.rb +0 -37
  160. data/spec/compiler/gcc_spec.rb +0 -37
  161. data/spec/compiler/generic_compiler_spec.rb +0 -50
  162. data/spec/compiler_spec.rb +0 -45
  163. data/spec/support/compiler_helpers.rb +0 -47
  164. data/vendor/depot_tools/apply_issue +0 -8
  165. data/vendor/depot_tools/apply_issue.py +0 -315
  166. data/vendor/depot_tools/man/html/git-cherry-pick-upload.html +0 -815
  167. data/vendor/depot_tools/man/man1/git-cherry-pick-upload.1 +0 -80
  168. data/vendor/depot_tools/man/src/_git-cherry-pick-upload_desc.helper.txt +0 -1
  169. data/vendor/depot_tools/man/src/git-cherry-pick-upload.demo.1.sh +0 -17
  170. data/vendor/depot_tools/man/src/git-cherry-pick-upload.txt +0 -35
  171. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2.json +0 -8
  172. data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/trychange_oauth2_json_win.json +0 -196
  173. data/vendor/depot_tools/recipes/recipe_modules/rietveld/__init__.py +0 -6
  174. data/vendor/depot_tools/recipes/recipe_modules/rietveld/api.py +0 -97
  175. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/basic.json +0 -8
  176. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/buildbot.json +0 -30
  177. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.expected/no_auth.json +0 -27
  178. data/vendor/depot_tools/recipes/recipe_modules/rietveld/examples/full.py +0 -38
  179. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch.json +0 -69
  180. data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_rietveld_patch_new.json +0 -69
  181. data/vendor/depot_tools/third_party/cq_client/OWNERS +0 -2
  182. data/vendor/depot_tools/third_party/cq_client/README.depot_tools.md +0 -2
  183. data/vendor/depot_tools/third_party/cq_client/README.md +0 -59
  184. data/vendor/depot_tools/third_party/cq_client/__init__.py +0 -3
  185. data/vendor/depot_tools/third_party/cq_client/v1/__init__.py +0 -3
  186. data/vendor/depot_tools/third_party/cq_client/v1/cq.pb.go +0 -810
  187. data/vendor/depot_tools/third_party/cq_client/v1/cq.proto +0 -281
  188. data/vendor/depot_tools/third_party/cq_client/v1/cq_pb2.py +0 -794
  189. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_both.cfg +0 -71
  190. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_gerrit.cfg +0 -58
  191. data/vendor/depot_tools/third_party/cq_client/v1/testdata/cq_rietveld.cfg +0 -60
  192. data/vendor/depot_tools/third_party/cq_client/v2/__init__.py +0 -3
  193. data/vendor/depot_tools/third_party/cq_client/v2/cq.pb.go +0 -792
  194. data/vendor/depot_tools/third_party/cq_client/v2/cq.proto +0 -270
  195. data/vendor/depot_tools/third_party/cq_client/v2/cq_pb2.py +0 -841
@@ -1,31 +1,31 @@
1
- """Astroid hooks for pytest."""
2
-
3
- from astroid import MANAGER, register_module_extender
4
- from astroid.builder import AstroidBuilder
5
-
6
-
7
- def pytest_transform():
8
- return AstroidBuilder(MANAGER).string_build('''
9
-
10
- try:
11
- import _pytest.mark
12
- import _pytest.recwarn
13
- import _pytest.runner
14
- import _pytest.python
15
- except ImportError:
16
- pass
17
- else:
18
- deprecated_call = _pytest.recwarn.deprecated_call
19
- exit = _pytest.runner.exit
20
- fail = _pytest.runner.fail
21
- fixture = _pytest.python.fixture
22
- importorskip = _pytest.runner.importorskip
23
- mark = _pytest.mark.MarkGenerator()
24
- raises = _pytest.python.raises
25
- skip = _pytest.runner.skip
26
- yield_fixture = _pytest.python.yield_fixture
27
-
28
- ''')
29
-
30
- register_module_extender(MANAGER, 'pytest', pytest_transform)
31
- register_module_extender(MANAGER, 'py.test', pytest_transform)
1
+ """Astroid hooks for pytest."""
2
+
3
+ from astroid import MANAGER, register_module_extender
4
+ from astroid.builder import AstroidBuilder
5
+
6
+
7
+ def pytest_transform():
8
+ return AstroidBuilder(MANAGER).string_build('''
9
+
10
+ try:
11
+ import _pytest.mark
12
+ import _pytest.recwarn
13
+ import _pytest.runner
14
+ import _pytest.python
15
+ except ImportError:
16
+ pass
17
+ else:
18
+ deprecated_call = _pytest.recwarn.deprecated_call
19
+ exit = _pytest.runner.exit
20
+ fail = _pytest.runner.fail
21
+ fixture = _pytest.python.fixture
22
+ importorskip = _pytest.runner.importorskip
23
+ mark = _pytest.mark.MarkGenerator()
24
+ raises = _pytest.python.raises
25
+ skip = _pytest.runner.skip
26
+ yield_fixture = _pytest.python.yield_fixture
27
+
28
+ ''')
29
+
30
+ register_module_extender(MANAGER, 'pytest', pytest_transform)
31
+ register_module_extender(MANAGER, 'py.test', pytest_transform)
@@ -19,38 +19,61 @@
19
19
  """Hooks for nose library."""
20
20
 
21
21
  import re
22
- import unittest
22
+ import textwrap
23
23
 
24
- from astroid import List, MANAGER, register_module_extender
25
- from astroid.builder import AstroidBuilder
24
+ import astroid
25
+ import astroid.builder
26
+
27
+ _BUILDER = astroid.builder.AstroidBuilder(astroid.MANAGER)
26
28
 
27
29
 
28
30
  def _pep8(name, caps=re.compile('([A-Z])')):
29
31
  return caps.sub(lambda m: '_' + m.groups()[0].lower(), name)
30
32
 
31
33
 
32
- def nose_transform():
33
- """Custom transform for the nose.tools module."""
34
+ def _nose_tools_functions():
35
+ """Get an iterator of names and bound methods."""
36
+ module = _BUILDER.string_build(textwrap.dedent('''
37
+ import unittest
38
+
39
+ class Test(unittest.TestCase):
40
+ pass
41
+ a = Test()
42
+ '''))
43
+ try:
44
+ case = next(module['a'].infer())
45
+ except astroid.InferenceError:
46
+ return
47
+ for method in case.methods():
48
+ if method.name.startswith('assert') and '_' not in method.name:
49
+ pep8_name = _pep8(method.name)
50
+ yield pep8_name, astroid.BoundMethod(method, case)
51
+
34
52
 
35
- builder = AstroidBuilder(MANAGER)
36
- stub = AstroidBuilder(MANAGER).string_build('''__all__ = []''')
37
- unittest_module = builder.module_build(unittest.case)
38
- case = unittest_module['TestCase']
53
+ def _nose_tools_transform(node):
54
+ for method_name, method in _nose_tools_functions():
55
+ node.locals[method_name] = [method]
56
+
57
+
58
+ def _nose_tools_trivial_transform():
59
+ """Custom transform for the nose.tools module."""
60
+ stub = _BUILDER.string_build('''__all__ = []''')
39
61
  all_entries = ['ok_', 'eq_']
40
62
 
41
- for method_name, method in case.locals.items():
42
- if method_name.startswith('assert') and '_' not in method_name:
43
- pep8_name = _pep8(method_name)
44
- all_entries.append(pep8_name)
45
- stub[pep8_name] = method[0]
63
+ for pep8_name, method in _nose_tools_functions():
64
+ all_entries.append(pep8_name)
65
+ stub[pep8_name] = method
46
66
 
47
67
  # Update the __all__ variable, since nose.tools
48
68
  # does this manually with .append.
49
69
  all_assign = stub['__all__'].parent
50
- all_object = List(all_entries)
70
+ all_object = astroid.List(all_entries)
51
71
  all_object.parent = all_assign
52
72
  all_assign.value = all_object
53
73
  return stub
54
74
 
55
75
 
56
- register_module_extender(MANAGER, 'nose.tools.trivial', nose_transform)
76
+ astroid.register_module_extender(astroid.MANAGER, 'nose.tools.trivial',
77
+ _nose_tools_trivial_transform)
78
+ astroid.MANAGER.register_transform(astroid.Module, _nose_tools_transform,
79
+ lambda n: n.name == 'nose.tools')
@@ -23,203 +23,239 @@ from textwrap import dedent
23
23
 
24
24
  from astroid import MANAGER, register_module_extender
25
25
  from astroid.builder import AstroidBuilder
26
+ from astroid.exceptions import AstroidBuildingException
26
27
 
28
+ def _indent(text, prefix, predicate=None):
29
+ """Adds 'prefix' to the beginning of selected lines in 'text'.
27
30
 
28
- def six_moves_transform_py2():
29
- return AstroidBuilder(MANAGER).string_build(dedent('''
30
- import urllib as _urllib
31
- import urllib2 as _urllib2
32
- import urlparse as _urlparse
31
+ If 'predicate' is provided, 'prefix' will only be added to the lines
32
+ where 'predicate(line)' is True. If 'predicate' is not provided,
33
+ it will default to adding 'prefix' to all non-empty lines that do not
34
+ consist solely of whitespace characters.
35
+ """
36
+ if predicate is None:
37
+ predicate = lambda line: line.strip()
33
38
 
34
- class Moves(object):
35
- import BaseHTTPServer
36
- import CGIHTTPServer
37
- import SimpleHTTPServer
38
-
39
- from StringIO import StringIO
40
- from cStringIO import StringIO as cStringIO
41
- from UserDict import UserDict
42
- from UserList import UserList
43
- from UserString import UserString
44
-
45
- import __builtin__ as builtins
46
- import thread as _thread
47
- import dummy_thread as _dummy_thread
48
- import ConfigParser as configparser
49
- import copy_reg as copyreg
50
- from itertools import (imap as map,
51
- ifilter as filter,
52
- ifilterfalse as filterfalse,
53
- izip_longest as zip_longest,
54
- izip as zip)
55
- import htmlentitydefs as html_entities
56
- import HTMLParser as html_parser
57
- import httplib as http_client
58
- import cookielib as http_cookiejar
59
- import Cookie as http_cookies
60
- import Queue as queue
61
- import repr as reprlib
62
- from pipes import quote as shlex_quote
63
- import SocketServer as socketserver
64
- import SimpleXMLRPCServer as xmlrpc_server
65
- import xmlrpclib as xmlrpc_client
66
- import _winreg as winreg
67
- import robotparser as urllib_robotparser
68
-
69
- input = raw_input
70
- intern = intern
71
- range = xrange
72
- xrange = xrange
73
- reduce = reduce
74
- reload_module = reload
75
-
76
- class UrllibParse(object):
77
- ParseResult = _urlparse.ParseResult
78
- SplitResult = _urlparse.SplitResult
79
- parse_qs = _urlparse.parse_qs
80
- parse_qsl = _urlparse.parse_qsl
81
- urldefrag = _urlparse.urldefrag
82
- urljoin = _urlparse.urljoin
83
- urlparse = _urlparse.urlparse
84
- urlsplit = _urlparse.urlsplit
85
- urlunparse = _urlparse.urlunparse
86
- urlunsplit = _urlparse.urlunsplit
87
- quote = _urllib.quote
88
- quote_plus = _urllib.quote_plus
89
- unquote = _urllib.unquote
90
- unquote_plus = _urllib.unquote_plus
91
- urlencode = _urllib.urlencode
92
- splitquery = _urllib.splitquery
93
- splittag = _urllib.splittag
94
- splituser = _urllib.splituser
95
- uses_fragment = _urlparse.uses_fragment
96
- uses_netloc = _urlparse.uses_netloc
97
- uses_params = _urlparse.uses_params
98
- uses_query = _urlparse.uses_query
99
- uses_relative = _urlparse.uses_relative
100
-
101
- class UrllibError(object):
102
- URLError = _urllib2.URLError
103
- HTTPError = _urllib2.HTTPError
104
- ContentTooShortError = _urllib.ContentTooShortError
105
-
106
- class DummyModule(object):
107
- pass
108
-
109
- class UrllibRequest(object):
110
- urlopen = _urllib2.urlopen
111
- install_opener = _urllib2.install_opener
112
- build_opener = _urllib2.build_opener
113
- pathname2url = _urllib.pathname2url
114
- url2pathname = _urllib.url2pathname
115
- getproxies = _urllib.getproxies
116
- Request = _urllib2.Request
117
- OpenerDirector = _urllib2.OpenerDirector
118
- HTTPDefaultErrorHandler = _urllib2.HTTPDefaultErrorHandler
119
- HTTPRedirectHandler = _urllib2.HTTPRedirectHandler
120
- HTTPCookieProcessor = _urllib2.HTTPCookieProcessor
121
- ProxyHandler = _urllib2.ProxyHandler
122
- BaseHandler = _urllib2.BaseHandler
123
- HTTPPasswordMgr = _urllib2.HTTPPasswordMgr
124
- HTTPPasswordMgrWithDefaultRealm = _urllib2.HTTPPasswordMgrWithDefaultRealm
125
- AbstractBasicAuthHandler = _urllib2.AbstractBasicAuthHandler
126
- HTTPBasicAuthHandler = _urllib2.HTTPBasicAuthHandler
127
- ProxyBasicAuthHandler = _urllib2.ProxyBasicAuthHandler
128
- AbstractDigestAuthHandler = _urllib2.AbstractDigestAuthHandler
129
- HTTPDigestAuthHandler = _urllib2.HTTPDigestAuthHandler
130
- ProxyDigestAuthHandler = _urllib2.ProxyDigestAuthHandler
131
- HTTPHandler = _urllib2.HTTPHandler
132
- HTTPSHandler = _urllib2.HTTPSHandler
133
- FileHandler = _urllib2.FileHandler
134
- FTPHandler = _urllib2.FTPHandler
135
- CacheFTPHandler = _urllib2.CacheFTPHandler
136
- UnknownHandler = _urllib2.UnknownHandler
137
- HTTPErrorProcessor = _urllib2.HTTPErrorProcessor
138
- urlretrieve = _urllib.urlretrieve
139
- urlcleanup = _urllib.urlcleanup
140
- proxy_bypass = _urllib.proxy_bypass
141
-
142
- urllib_parse = UrllibParse()
143
- urllib_error = UrllibError()
144
- urllib = DummyModule()
145
- urllib.request = UrllibRequest()
146
- urllib.parse = UrllibParse()
147
- urllib.error = UrllibError()
39
+ def prefixed_lines():
40
+ for line in text.splitlines(True):
41
+ yield prefix + line if predicate(line) else line
42
+ return ''.join(prefixed_lines())
148
43
 
149
- moves = Moves()
150
44
 
151
- '''))
45
+ if sys.version_info[0] == 2:
46
+ _IMPORTS_2 = """
47
+ import BaseHTTPServer
48
+ import CGIHTTPServer
49
+ import SimpleHTTPServer
152
50
 
51
+ from StringIO import StringIO
52
+ from cStringIO import StringIO as cStringIO
53
+ from UserDict import UserDict
54
+ from UserList import UserList
55
+ from UserString import UserString
153
56
 
154
- def six_moves_transform_py3():
155
- return AstroidBuilder(MANAGER).string_build(dedent('''
156
- class Moves(object):
157
- import _io
158
- cStringIO = _io.StringIO
159
- filter = filter
160
- from itertools import filterfalse
161
- input = input
162
- from sys import intern
163
- map = map
164
- range = range
165
- from imp import reload as reload_module
166
- from functools import reduce
167
- from shlex import quote as shlex_quote
168
- from io import StringIO
169
- from collections import UserDict, UserList, UserString
170
- xrange = range
171
- zip = zip
172
- from itertools import zip_longest
173
- import builtins
174
- import configparser
175
- import copyreg
176
- import _dummy_thread
177
- import http.cookiejar as http_cookiejar
178
- import http.cookies as http_cookies
179
- import html.entities as html_entities
180
- import html.parser as html_parser
181
- import http.client as http_client
182
- import http.server
183
- BaseHTTPServer = CGIHTTPServer = SimpleHTTPServer = http.server
184
- import pickle as cPickle
185
- import queue
186
- import reprlib
187
- import socketserver
188
- import _thread
189
- import winreg
190
- import xmlrpc.server as xmlrpc_server
191
- import xmlrpc.client as xmlrpc_client
192
- import urllib.robotparser as urllib_robotparser
193
- import email.mime.multipart as email_mime_multipart
194
- import email.mime.nonmultipart as email_mime_nonmultipart
195
- import email.mime.text as email_mime_text
196
- import email.mime.base as email_mime_base
197
- import urllib.parse as urllib_parse
198
- import urllib.error as urllib_error
199
- import tkinter
200
- import tkinter.dialog as tkinter_dialog
201
- import tkinter.filedialog as tkinter_filedialog
202
- import tkinter.scrolledtext as tkinter_scrolledtext
203
- import tkinter.simpledialog as tkinder_simpledialog
204
- import tkinter.tix as tkinter_tix
205
- import tkinter.ttk as tkinter_ttk
206
- import tkinter.constants as tkinter_constants
207
- import tkinter.dnd as tkinter_dnd
208
- import tkinter.colorchooser as tkinter_colorchooser
209
- import tkinter.commondialog as tkinter_commondialog
210
- import tkinter.filedialog as tkinter_tkfiledialog
211
- import tkinter.font as tkinter_font
212
- import tkinter.messagebox as tkinter_messagebox
213
- import urllib.request
214
- import urllib.robotparser as urllib_robotparser
215
- import urllib.parse as urllib_parse
216
- import urllib.error as urllib_error
217
- moves = Moves()
218
- '''))
57
+ import __builtin__ as builtins
58
+ import thread as _thread
59
+ import dummy_thread as _dummy_thread
60
+ import ConfigParser as configparser
61
+ import copy_reg as copyreg
62
+ from itertools import (imap as map,
63
+ ifilter as filter,
64
+ ifilterfalse as filterfalse,
65
+ izip_longest as zip_longest,
66
+ izip as zip)
67
+ import htmlentitydefs as html_entities
68
+ import HTMLParser as html_parser
69
+ import httplib as http_client
70
+ import cookielib as http_cookiejar
71
+ import Cookie as http_cookies
72
+ import Queue as queue
73
+ import repr as reprlib
74
+ from pipes import quote as shlex_quote
75
+ import SocketServer as socketserver
76
+ import SimpleXMLRPCServer as xmlrpc_server
77
+ import xmlrpclib as xmlrpc_client
78
+ import _winreg as winreg
79
+ import robotparser as urllib_robotparser
80
+ import Tkinter as tkinter
81
+ import tkFileDialog as tkinter_tkfiledialog
82
+
83
+ input = raw_input
84
+ intern = intern
85
+ range = xrange
86
+ xrange = xrange
87
+ reduce = reduce
88
+ reload_module = reload
89
+
90
+ class UrllibParse(object):
91
+ import urlparse as _urlparse
92
+ import urllib as _urllib
93
+ ParseResult = _urlparse.ParseResult
94
+ SplitResult = _urlparse.SplitResult
95
+ parse_qs = _urlparse.parse_qs
96
+ parse_qsl = _urlparse.parse_qsl
97
+ urldefrag = _urlparse.urldefrag
98
+ urljoin = _urlparse.urljoin
99
+ urlparse = _urlparse.urlparse
100
+ urlsplit = _urlparse.urlsplit
101
+ urlunparse = _urlparse.urlunparse
102
+ urlunsplit = _urlparse.urlunsplit
103
+ quote = _urllib.quote
104
+ quote_plus = _urllib.quote_plus
105
+ unquote = _urllib.unquote
106
+ unquote_plus = _urllib.unquote_plus
107
+ urlencode = _urllib.urlencode
108
+ splitquery = _urllib.splitquery
109
+ splittag = _urllib.splittag
110
+ splituser = _urllib.splituser
111
+ uses_fragment = _urlparse.uses_fragment
112
+ uses_netloc = _urlparse.uses_netloc
113
+ uses_params = _urlparse.uses_params
114
+ uses_query = _urlparse.uses_query
115
+ uses_relative = _urlparse.uses_relative
116
+
117
+ class UrllibError(object):
118
+ import urllib2 as _urllib2
119
+ import urllib as _urllib
120
+ URLError = _urllib2.URLError
121
+ HTTPError = _urllib2.HTTPError
122
+ ContentTooShortError = _urllib.ContentTooShortError
123
+
124
+ class DummyModule(object):
125
+ pass
219
126
 
127
+ class UrllibRequest(object):
128
+ import urlparse as _urlparse
129
+ import urllib2 as _urllib2
130
+ import urllib as _urllib
131
+ urlopen = _urllib2.urlopen
132
+ install_opener = _urllib2.install_opener
133
+ build_opener = _urllib2.build_opener
134
+ pathname2url = _urllib.pathname2url
135
+ url2pathname = _urllib.url2pathname
136
+ getproxies = _urllib.getproxies
137
+ Request = _urllib2.Request
138
+ OpenerDirector = _urllib2.OpenerDirector
139
+ HTTPDefaultErrorHandler = _urllib2.HTTPDefaultErrorHandler
140
+ HTTPRedirectHandler = _urllib2.HTTPRedirectHandler
141
+ HTTPCookieProcessor = _urllib2.HTTPCookieProcessor
142
+ ProxyHandler = _urllib2.ProxyHandler
143
+ BaseHandler = _urllib2.BaseHandler
144
+ HTTPPasswordMgr = _urllib2.HTTPPasswordMgr
145
+ HTTPPasswordMgrWithDefaultRealm = _urllib2.HTTPPasswordMgrWithDefaultRealm
146
+ AbstractBasicAuthHandler = _urllib2.AbstractBasicAuthHandler
147
+ HTTPBasicAuthHandler = _urllib2.HTTPBasicAuthHandler
148
+ ProxyBasicAuthHandler = _urllib2.ProxyBasicAuthHandler
149
+ AbstractDigestAuthHandler = _urllib2.AbstractDigestAuthHandler
150
+ HTTPDigestAuthHandler = _urllib2.HTTPDigestAuthHandler
151
+ ProxyDigestAuthHandler = _urllib2.ProxyDigestAuthHandler
152
+ HTTPHandler = _urllib2.HTTPHandler
153
+ HTTPSHandler = _urllib2.HTTPSHandler
154
+ FileHandler = _urllib2.FileHandler
155
+ FTPHandler = _urllib2.FTPHandler
156
+ CacheFTPHandler = _urllib2.CacheFTPHandler
157
+ UnknownHandler = _urllib2.UnknownHandler
158
+ HTTPErrorProcessor = _urllib2.HTTPErrorProcessor
159
+ urlretrieve = _urllib.urlretrieve
160
+ urlcleanup = _urllib.urlcleanup
161
+ proxy_bypass = _urllib.proxy_bypass
162
+
163
+ urllib_parse = UrllibParse()
164
+ urllib_error = UrllibError()
165
+ urllib = DummyModule()
166
+ urllib.request = UrllibRequest()
167
+ urllib.parse = UrllibParse()
168
+ urllib.error = UrllibError()
169
+ """
170
+ else:
171
+ _IMPORTS_3 = """
172
+ import _io
173
+ cStringIO = _io.StringIO
174
+ filter = filter
175
+ from itertools import filterfalse
176
+ input = input
177
+ from sys import intern
178
+ map = map
179
+ range = range
180
+ from imp import reload as reload_module
181
+ from functools import reduce
182
+ from shlex import quote as shlex_quote
183
+ from io import StringIO
184
+ from collections import UserDict, UserList, UserString
185
+ xrange = range
186
+ zip = zip
187
+ from itertools import zip_longest
188
+ import builtins
189
+ import configparser
190
+ import copyreg
191
+ import _dummy_thread
192
+ import http.cookiejar as http_cookiejar
193
+ import http.cookies as http_cookies
194
+ import html.entities as html_entities
195
+ import html.parser as html_parser
196
+ import http.client as http_client
197
+ import http.server
198
+ BaseHTTPServer = CGIHTTPServer = SimpleHTTPServer = http.server
199
+ import pickle as cPickle
200
+ import queue
201
+ import reprlib
202
+ import socketserver
203
+ import _thread
204
+ import winreg
205
+ import xmlrpc.server as xmlrpc_server
206
+ import xmlrpc.client as xmlrpc_client
207
+ import urllib.robotparser as urllib_robotparser
208
+ import email.mime.multipart as email_mime_multipart
209
+ import email.mime.nonmultipart as email_mime_nonmultipart
210
+ import email.mime.text as email_mime_text
211
+ import email.mime.base as email_mime_base
212
+ import urllib.parse as urllib_parse
213
+ import urllib.error as urllib_error
214
+ import tkinter
215
+ import tkinter.dialog as tkinter_dialog
216
+ import tkinter.filedialog as tkinter_filedialog
217
+ import tkinter.scrolledtext as tkinter_scrolledtext
218
+ import tkinter.simpledialog as tkinder_simpledialog
219
+ import tkinter.tix as tkinter_tix
220
+ import tkinter.ttk as tkinter_ttk
221
+ import tkinter.constants as tkinter_constants
222
+ import tkinter.dnd as tkinter_dnd
223
+ import tkinter.colorchooser as tkinter_colorchooser
224
+ import tkinter.commondialog as tkinter_commondialog
225
+ import tkinter.filedialog as tkinter_tkfiledialog
226
+ import tkinter.font as tkinter_font
227
+ import tkinter.messagebox as tkinter_messagebox
228
+ import urllib.request
229
+ import urllib.robotparser as urllib_robotparser
230
+ import urllib.parse as urllib_parse
231
+ import urllib.error as urllib_error
232
+ """
220
233
  if sys.version_info[0] == 2:
221
- TRANSFORM = six_moves_transform_py2
234
+ _IMPORTS = dedent(_IMPORTS_2)
222
235
  else:
223
- TRANSFORM = six_moves_transform_py3
236
+ _IMPORTS = dedent(_IMPORTS_3)
237
+
238
+
239
+ def six_moves_transform():
240
+ code = dedent('''
241
+ class Moves(object):
242
+ {}
243
+ moves = Moves()
244
+ ''').format(_indent(_IMPORTS, " "))
245
+ module = AstroidBuilder(MANAGER).string_build(code)
246
+ module.name = 'six.moves'
247
+ return module
248
+
249
+
250
+ def _six_fail_hook(modname):
251
+ if modname != 'six.moves':
252
+ raise AstroidBuildingException
253
+ module = AstroidBuilder(MANAGER).string_build(_IMPORTS)
254
+ module.name = 'six.moves'
255
+ return module
256
+
224
257
 
225
- register_module_extender(MANAGER, 'six', TRANSFORM)
258
+ register_module_extender(MANAGER, 'six', six_moves_transform)
259
+ register_module_extender(MANAGER, 'requests.packages.urllib3.packages.six',
260
+ six_moves_transform)
261
+ MANAGER.register_failed_import_hook(_six_fail_hook)