libv8 7.3.492.27.0 → 8.4.255.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +11 -14
- data/CHANGELOG.md +10 -0
- data/README.md +10 -11
- data/Rakefile +30 -36
- data/ext/libv8/builder.rb +1 -1
- data/lib/libv8/version.rb +1 -1
- data/libv8.gemspec +1 -3
- data/vendor/depot_tools/{cipd.ps1 → .cipd_impl.ps1} +0 -0
- data/vendor/depot_tools/.gitattributes +1 -1
- data/vendor/depot_tools/.gitignore +7 -2
- data/vendor/depot_tools/.style.yapf +3 -1
- data/vendor/depot_tools/.vpython +55 -0
- data/vendor/depot_tools/.vpython3 +23 -0
- data/vendor/depot_tools/CROS_OWNERS +3 -1
- data/vendor/depot_tools/GOMA_OWNERS +9 -0
- data/vendor/depot_tools/LUCI_OWNERS +5 -0
- data/vendor/depot_tools/OWNERS +21 -6
- data/vendor/depot_tools/PRESUBMIT.py +35 -18
- data/vendor/depot_tools/README.git-cl.md +0 -14
- data/vendor/depot_tools/README.md +1 -1
- data/vendor/depot_tools/WATCHLISTS +2 -2
- data/vendor/depot_tools/auth.py +60 -772
- data/vendor/depot_tools/autoninja +12 -6
- data/vendor/depot_tools/autoninja.bat +14 -6
- data/vendor/depot_tools/autoninja.py +64 -27
- data/vendor/depot_tools/bb +1 -1
- data/vendor/depot_tools/bootstrap/{win/README.md → README.md} +28 -14
- data/vendor/depot_tools/bootstrap/{win/win_tools.py → bootstrap.py} +60 -43
- data/vendor/depot_tools/bootstrap/{win/git-bash.template.sh → git-bash.template.sh} +1 -1
- data/vendor/depot_tools/bootstrap/{win/git.template.bat → git.template.bat} +0 -0
- data/vendor/depot_tools/bootstrap/manifest.txt +27 -0
- data/vendor/depot_tools/bootstrap/manifest_bleeding_edge.txt +27 -0
- data/vendor/depot_tools/bootstrap/{win/profile.d.python.sh → profile.d.python.sh} +0 -0
- data/vendor/depot_tools/bootstrap/{win/python27.bleeding_edge.bat → python27.bat} +0 -0
- data/vendor/depot_tools/bootstrap/{win/python27.new.bat → python3.bat} +3 -3
- data/vendor/depot_tools/bootstrap/{win/win_tools.bat → win_tools.bat} +21 -16
- data/vendor/depot_tools/bootstrap_python3 +35 -0
- data/vendor/depot_tools/cbuildbot +1 -1
- data/vendor/depot_tools/chrome_set_ver +1 -1
- data/vendor/depot_tools/cipd +43 -39
- data/vendor/depot_tools/cipd.bat +2 -2
- data/vendor/depot_tools/cipd_client_version +1 -1
- data/vendor/depot_tools/cipd_client_version.digests +15 -14
- data/vendor/depot_tools/cipd_manifest.txt +31 -8
- data/vendor/depot_tools/cipd_manifest.versions +278 -158
- data/vendor/depot_tools/cit.py +9 -7
- data/vendor/depot_tools/clang_format.py +4 -1
- data/vendor/depot_tools/clang_format_merge_driver.py +10 -8
- data/vendor/depot_tools/compile_single_file.py +7 -2
- data/vendor/depot_tools/cpplint.py +51 -45
- data/vendor/depot_tools/cros +87 -0
- data/vendor/depot_tools/cros_sdk +1 -1
- data/vendor/depot_tools/crosjobs +13 -0
- data/vendor/depot_tools/detect_host_arch.py +0 -1
- data/vendor/depot_tools/dirmd +12 -0
- data/vendor/depot_tools/dirmd.bat +7 -0
- data/vendor/depot_tools/download_from_google_storage.py +47 -27
- data/vendor/depot_tools/ensure_bootstrap +14 -0
- data/vendor/depot_tools/fetch +14 -1
- data/vendor/depot_tools/fetch.bat +14 -1
- data/vendor/depot_tools/fetch.py +5 -7
- data/vendor/depot_tools/fetch_configs/chromium.py +6 -4
- data/vendor/depot_tools/fetch_configs/devtools-frontend.py +44 -0
- data/vendor/depot_tools/fetch_configs/ios_internal.py +10 -19
- data/vendor/depot_tools/fix_encoding.py +19 -5
- data/vendor/depot_tools/gclient +28 -12
- data/vendor/depot_tools/gclient-new-workdir.py +2 -0
- data/vendor/depot_tools/gclient.bat +18 -1
- data/vendor/depot_tools/gclient.py +160 -119
- data/vendor/depot_tools/gclient_eval.py +119 -107
- data/vendor/depot_tools/gclient_paths.py +67 -57
- data/vendor/depot_tools/gclient_scm.py +181 -159
- data/vendor/depot_tools/gclient_utils.py +177 -124
- data/vendor/depot_tools/gerrit_client.py +21 -13
- data/vendor/depot_tools/gerrit_util.py +188 -228
- data/vendor/depot_tools/git-cache +1 -1
- data/vendor/depot_tools/git-cl +1 -1
- data/vendor/depot_tools/git-drover +1 -1
- data/vendor/depot_tools/git-find-releases +1 -1
- data/vendor/depot_tools/git-footers +1 -1
- data/vendor/depot_tools/git-freeze +1 -1
- data/vendor/depot_tools/git-hyper-blame +1 -1
- data/vendor/depot_tools/git-map +1 -1
- data/vendor/depot_tools/git-map-branches +1 -1
- data/vendor/depot_tools/git-mark-merge-base +1 -1
- data/vendor/depot_tools/git-nav-downstream +1 -1
- data/vendor/depot_tools/git-new-branch +1 -1
- data/vendor/depot_tools/git-number +1 -1
- data/vendor/depot_tools/git-rebase-update +1 -1
- data/vendor/depot_tools/git-rename-branch +1 -1
- data/vendor/depot_tools/git-reparent-branch +1 -1
- data/vendor/depot_tools/git-retry +1 -1
- data/vendor/depot_tools/git-squash-branch +1 -1
- data/vendor/depot_tools/git-thaw +1 -1
- data/vendor/depot_tools/git-upstream-diff +1 -1
- data/vendor/depot_tools/git_cache.py +255 -360
- data/vendor/depot_tools/git_cl.py +1562 -2059
- data/vendor/depot_tools/git_cl_completion.sh +16 -2
- data/vendor/depot_tools/git_common.py +77 -32
- data/vendor/depot_tools/git_drover.py +17 -8
- data/vendor/depot_tools/git_find_releases.py +11 -9
- data/vendor/depot_tools/git_footers.py +13 -9
- data/vendor/depot_tools/git_freezer.py +3 -1
- data/vendor/depot_tools/git_hyper_blame.py +25 -32
- data/vendor/depot_tools/git_map.py +115 -93
- data/vendor/depot_tools/git_map_branches.py +11 -10
- data/vendor/depot_tools/git_mark_merge_base.py +8 -6
- data/vendor/depot_tools/git_nav_downstream.py +9 -6
- data/vendor/depot_tools/git_new_branch.py +39 -33
- data/vendor/depot_tools/git_number.py +28 -17
- data/vendor/depot_tools/git_rebase_update.py +50 -49
- data/vendor/depot_tools/git_rename_branch.py +2 -2
- data/vendor/depot_tools/git_reparent_branch.py +8 -6
- data/vendor/depot_tools/git_upstream_diff.py +4 -2
- data/vendor/depot_tools/gn.py +6 -4
- data/vendor/depot_tools/goma_auth +12 -0
- data/vendor/depot_tools/goma_auth.bat +8 -0
- data/vendor/depot_tools/goma_ctl +12 -0
- data/vendor/depot_tools/goma_ctl.bat +8 -0
- data/vendor/depot_tools/gsutil.py +5 -2
- data/vendor/depot_tools/gsutil.py.bat +8 -0
- data/vendor/depot_tools/gsutil.vpython +3 -1
- data/vendor/depot_tools/infra/config/OWNERS +2 -2
- data/vendor/depot_tools/infra/config/recipes.cfg +3 -2
- data/vendor/depot_tools/led +1 -1
- data/vendor/depot_tools/lockfile.py +116 -0
- data/vendor/depot_tools/luci-auth +1 -1
- data/vendor/depot_tools/lucicfg +1 -1
- data/vendor/depot_tools/mac_toolchain +1 -1
- data/vendor/depot_tools/man/html/depot_tools.html +1 -1
- data/vendor/depot_tools/man/html/depot_tools_tutorial.html +31 -25
- data/vendor/depot_tools/man/html/git-cl.html +1 -1
- data/vendor/depot_tools/man/html/git-drover.html +18 -18
- data/vendor/depot_tools/man/html/git-footers.html +1 -1
- data/vendor/depot_tools/man/html/git-freeze.html +3 -3
- data/vendor/depot_tools/man/html/git-hyper-blame.html +1 -1
- data/vendor/depot_tools/man/html/git-map-branches.html +2 -2
- data/vendor/depot_tools/man/html/git-map.html +1 -1
- data/vendor/depot_tools/man/html/git-mark-merge-base.html +1 -1
- data/vendor/depot_tools/man/html/git-nav-downstream.html +3 -3
- data/vendor/depot_tools/man/html/git-nav-upstream.html +12 -6
- data/vendor/depot_tools/man/html/git-new-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-rebase-update.html +20 -1
- data/vendor/depot_tools/man/html/git-rename-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-reparent-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-retry.html +1 -1
- data/vendor/depot_tools/man/html/git-squash-branch.html +1 -1
- data/vendor/depot_tools/man/html/git-thaw.html +1 -1
- data/vendor/depot_tools/man/html/git-upstream-diff.html +10 -6
- data/vendor/depot_tools/man/man1/git-cl.1 +4 -4
- data/vendor/depot_tools/man/man1/git-drover.1 +21 -21
- data/vendor/depot_tools/man/man1/git-footers.1 +4 -4
- data/vendor/depot_tools/man/man1/git-freeze.1 +6 -6
- data/vendor/depot_tools/man/man1/git-hyper-blame.1 +4 -4
- data/vendor/depot_tools/man/man1/git-map-branches.1 +4 -4
- data/vendor/depot_tools/man/man1/git-map.1 +4 -4
- data/vendor/depot_tools/man/man1/git-mark-merge-base.1 +4 -4
- data/vendor/depot_tools/man/man1/git-nav-downstream.1 +6 -6
- data/vendor/depot_tools/man/man1/git-nav-upstream.1 +15 -9
- data/vendor/depot_tools/man/man1/git-new-branch.1 +3 -3
- data/vendor/depot_tools/man/man1/git-rebase-update.1 +14 -4
- data/vendor/depot_tools/man/man1/git-rename-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-reparent-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-retry.1 +4 -4
- data/vendor/depot_tools/man/man1/git-squash-branch.1 +4 -4
- data/vendor/depot_tools/man/man1/git-thaw.1 +4 -4
- data/vendor/depot_tools/man/man1/git-upstream-diff.1 +7 -13
- data/vendor/depot_tools/man/man7/depot_tools.7 +4 -4
- data/vendor/depot_tools/man/man7/depot_tools_tutorial.7 +31 -25
- data/vendor/depot_tools/man/src/common_demo_functions.sh +2 -2
- data/vendor/depot_tools/man/src/depot_tools_tutorial.txt +3 -3
- data/vendor/depot_tools/man/src/filter_demo_output.py +4 -2
- data/vendor/depot_tools/man/src/git-new-branch.txt +2 -1
- data/vendor/depot_tools/man/src/git-rebase-update.txt +8 -1
- data/vendor/depot_tools/metrics.README.md +8 -5
- data/vendor/depot_tools/metrics.py +7 -6
- data/vendor/depot_tools/metrics_utils.py +4 -14
- data/vendor/depot_tools/my_activity.py +85 -251
- data/vendor/depot_tools/ninja +1 -0
- data/vendor/depot_tools/ninja-mac +0 -0
- data/vendor/depot_tools/ninjalog_uploader.py +146 -145
- data/vendor/depot_tools/ninjalog_uploader_wrapper.py +69 -60
- data/vendor/depot_tools/owners.py +156 -43
- data/vendor/depot_tools/owners_finder.py +28 -14
- data/vendor/depot_tools/post_build_ninja_summary.py +76 -48
- data/vendor/depot_tools/presubmit_canned_checks.py +293 -106
- data/vendor/depot_tools/presubmit_support.py +527 -333
- data/vendor/depot_tools/prpc +1 -1
- data/vendor/depot_tools/pylint +2 -12
- data/vendor/depot_tools/pylint-1.5 +78 -0
- data/vendor/depot_tools/pylint-1.6 +78 -0
- data/vendor/depot_tools/pylint-1.7 +78 -0
- data/vendor/depot_tools/pylint-1.8 +78 -0
- data/vendor/depot_tools/pylint-1.9 +78 -0
- data/vendor/depot_tools/{depot-tools-auth.bat → pylint.bat} +2 -2
- data/vendor/depot_tools/pylint_main.py +45 -0
- data/vendor/depot_tools/pylintrc +14 -1
- data/vendor/depot_tools/python-bin/python3 +7 -0
- data/vendor/depot_tools/python_runner.sh +13 -8
- data/vendor/depot_tools/rdb +12 -0
- data/vendor/depot_tools/rdb.bat +7 -0
- data/vendor/depot_tools/recipes/OWNERS +0 -1
- data/vendor/depot_tools/recipes/README.recipes.md +218 -151
- data/vendor/depot_tools/recipes/recipe_modules/OWNERS +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +17 -16
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +127 -78
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +19 -4
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json +18 -3
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +19 -4
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +28 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/input_commit_with_id_without_repo.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/multiple_patch_refs.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{with_manifest_name.json → no_cp_checkout_HEAD.json} +25 -15
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_branch_head.json +65 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_a_specific_commit.json +65 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_cp_checkout_master.json +65 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/refs.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/resolve_chromium_fixed_version.json +117 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +17 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +41 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +24 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json +38 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json +36 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +35 -10
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/unrecognized_commit_repo.json +0 -5
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json +29 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +95 -22
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +187 -114
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +2 -2
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/tests/do_not_retry_patch_failures_in_cq.py +42 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/tests/ensure_checkout.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/cipd/__init__.py +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/api.py +2 -2
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic_pkg.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-failed.json +2 -4
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-many-instances.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/mac64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_file.json +26 -6
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_mode.json +23 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_verfile.json +23 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/win64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk arch.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk bits.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_32.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_32.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_mips_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/mac_intel_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_32.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_64.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/cipd/test_api.py +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/api.py +4 -1
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +4 -2
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json +3 -1
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +4 -2
- data/vendor/depot_tools/recipes/recipe_modules/gclient/__init__.py +2 -1
- data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +82 -13
- data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +23 -11
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +3 -4
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +3 -6
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +3 -4
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +7 -7
- data/vendor/depot_tools/recipes/recipe_modules/gclient/resources/diff_deps.py +16 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/test_api.py +4 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/basic.json +55 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/dont have revision yet.json +84 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/no change, exception.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.expected/windows.json +55 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/diff_deps.py +88 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/patch_project.py +9 -21
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/sync_failure.py +24 -0
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +2 -1
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +7 -12
- data/vendor/depot_tools/recipes/recipe_modules/git/__init__.py +0 -2
- data/vendor/depot_tools/recipes/recipe_modules/git/api.py +9 -17
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_branch.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_hash.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_ref.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_tags.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +3 -13
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json +4 -12
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json +2 -10
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json +1 -7
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json +1 -7
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +0 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json +3 -10
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json +3 -11
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/platform_win.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +3 -13
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json +2 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.py +0 -5
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/__init__.py +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/api.py +7 -13
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/examples/full.expected/basic.json +21 -16
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/examples/full.py +1 -2
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/api.py +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.expected/basic.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/resources/gerrit_client.py +2 -2
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.expected/basic.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/api.py +23 -8
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/examples/full.expected/basic.json +52 -1
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/examples/full.py +15 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/__init__.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/api.py +32 -8
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/ancient_version.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/automatic_version.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/explicit_version.json +83 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/linux.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/mac.json +5 -4
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/win.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.py +21 -2
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/__init__.py +20 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/api.py +235 -3
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/examples/full.expected/basic.json +13 -5
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/examples/full.py +5 -1
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/properties.proto +14 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/test_api.py +19 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/tests/execute.py +247 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/tests/prepare.py +49 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +33 -45
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/basic_tags.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +64 -21
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json +64 -21
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +1 -22
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +1 -22
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +5 -32
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_fetch_ref_timeout.py +29 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.expected/basic.json +5 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_owner.py +22 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/tests/gerrit_change_target_ref.py +32 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/linux.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/mac.json +0 -1
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/win.json +2 -1
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.py +1 -6
- data/vendor/depot_tools/recipes/recipes.py +49 -28
- data/vendor/depot_tools/recipes/recipes/fetch_end_to_end_test.expected/basic.json +11 -6
- data/vendor/depot_tools/repo +698 -540
- data/vendor/depot_tools/roll-dep +14 -1
- data/vendor/depot_tools/roll-dep.bat +10 -1
- data/vendor/depot_tools/roll_dep.py +15 -10
- data/vendor/depot_tools/scm.py +95 -75
- data/vendor/depot_tools/setup_color.py +36 -2
- data/vendor/depot_tools/split_cl.py +44 -32
- data/vendor/depot_tools/subcommand.py +6 -6
- data/vendor/depot_tools/subprocess2.py +38 -322
- data/vendor/depot_tools/third_party/colorama/LICENSE.txt +0 -1
- data/vendor/depot_tools/third_party/colorama/README.chromium +4 -5
- data/vendor/depot_tools/third_party/colorama/README.rst +346 -0
- data/vendor/depot_tools/third_party/colorama/__init__.py +3 -4
- data/vendor/depot_tools/third_party/colorama/ansi.py +82 -30
- data/vendor/depot_tools/third_party/colorama/ansitowin32.py +105 -37
- data/vendor/depot_tools/third_party/colorama/initialise.py +39 -15
- data/vendor/depot_tools/third_party/colorama/win32.py +46 -28
- data/vendor/depot_tools/third_party/colorama/winterm.py +80 -31
- data/vendor/depot_tools/update_depot_tools +18 -8
- data/vendor/depot_tools/update_depot_tools.bat +19 -15
- data/vendor/depot_tools/upload_metrics.py +7 -6
- data/vendor/depot_tools/upload_to_google_storage.py +23 -16
- data/vendor/depot_tools/vpython +4 -4
- data/vendor/depot_tools/vpython.bat +1 -1
- data/vendor/depot_tools/vpython3 +55 -0
- data/vendor/depot_tools/vpython3.bat +12 -0
- data/vendor/depot_tools/watchlists.py +14 -11
- data/vendor/depot_tools/weekly +4 -2
- data/vendor/depot_tools/win32imports.py +61 -0
- data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +49 -41
- data/vendor/depot_tools/win_toolchain/package_from_installed.py +142 -149
- data/vendor/depot_tools/wtf +5 -3
- data/vendor/depot_tools/yapf +5 -1
- metadata +68 -343
- data/vendor/depot_tools/README.testing +0 -23
- data/vendor/depot_tools/annotated_gclient.py +0 -89
- data/vendor/depot_tools/appengine_mapper.py +0 -23
- data/vendor/depot_tools/bootstrap/win/manifest.txt +0 -20
- data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +0 -20
- data/vendor/depot_tools/bootstrap/win/pylint.new.bat +0 -7
- data/vendor/depot_tools/buildbucket.py +0 -186
- data/vendor/depot_tools/checkout.py +0 -431
- data/vendor/depot_tools/cros +0 -1
- data/vendor/depot_tools/dart_format.py +0 -58
- data/vendor/depot_tools/depot-tools-auth +0 -8
- data/vendor/depot_tools/depot-tools-auth.py +0 -102
- data/vendor/depot_tools/my_reviews.py +0 -396
- data/vendor/depot_tools/patch.py +0 -548
- data/vendor/depot_tools/pylint.py +0 -30
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +0 -239
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_luci.json +0 -222
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/__init__.py +0 -4
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/api.py +0 -29
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/basic.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_linux.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_mac.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_win.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_linux.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_mac.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_win.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_linux.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_mac.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_win.json +0 -15
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.py +0 -33
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/path_config.py +0 -66
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/set_failure_hash_with_no_steps.json +0 -11
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +0 -45
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +0 -45
- data/vendor/depot_tools/rietveld.py +0 -779
- data/vendor/depot_tools/roll-dep-svn +0 -8
- data/vendor/depot_tools/roll-dep-svn.bat +0 -12
- data/vendor/depot_tools/roll_dep_svn.py +0 -430
- data/vendor/depot_tools/support/chromite_wrapper +0 -96
- data/vendor/depot_tools/third_party/boto/LICENSE +0 -18
- data/vendor/depot_tools/third_party/boto/README.chromium +0 -43
- data/vendor/depot_tools/third_party/boto/README.rst +0 -163
- data/vendor/depot_tools/third_party/boto/__init__.py +0 -793
- data/vendor/depot_tools/third_party/boto/auth.py +0 -682
- data/vendor/depot_tools/third_party/boto/auth_handler.py +0 -58
- data/vendor/depot_tools/third_party/boto/cacerts/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/cacerts/cacerts.txt +0 -2183
- data/vendor/depot_tools/third_party/boto/compat.py +0 -28
- data/vendor/depot_tools/third_party/boto/connection.py +0 -1081
- data/vendor/depot_tools/third_party/boto/contrib/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/contrib/ymlmessage.py +0 -52
- data/vendor/depot_tools/third_party/boto/core/README +0 -58
- data/vendor/depot_tools/third_party/boto/core/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/core/auth.py +0 -78
- data/vendor/depot_tools/third_party/boto/core/credentials.py +0 -154
- data/vendor/depot_tools/third_party/boto/core/dictresponse.py +0 -178
- data/vendor/depot_tools/third_party/boto/core/service.py +0 -67
- data/vendor/depot_tools/third_party/boto/datapipeline/__init__.py +0 -0
- data/vendor/depot_tools/third_party/boto/datapipeline/exceptions.py +0 -42
- data/vendor/depot_tools/third_party/boto/datapipeline/layer1.py +0 -546
- data/vendor/depot_tools/third_party/boto/ecs/__init__.py +0 -90
- data/vendor/depot_tools/third_party/boto/ecs/item.py +0 -153
- data/vendor/depot_tools/third_party/boto/exception.py +0 -476
- data/vendor/depot_tools/third_party/boto/file/README +0 -49
- data/vendor/depot_tools/third_party/boto/file/__init__.py +0 -28
- data/vendor/depot_tools/third_party/boto/file/bucket.py +0 -112
- data/vendor/depot_tools/third_party/boto/file/connection.py +0 -33
- data/vendor/depot_tools/third_party/boto/file/key.py +0 -199
- data/vendor/depot_tools/third_party/boto/file/simpleresultset.py +0 -30
- data/vendor/depot_tools/third_party/boto/fps/__init__.py +0 -21
- data/vendor/depot_tools/third_party/boto/fps/connection.py +0 -369
- data/vendor/depot_tools/third_party/boto/fps/exception.py +0 -344
- data/vendor/depot_tools/third_party/boto/fps/response.py +0 -175
- data/vendor/depot_tools/third_party/boto/gs/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/gs/acl.py +0 -304
- data/vendor/depot_tools/third_party/boto/gs/bucket.py +0 -870
- data/vendor/depot_tools/third_party/boto/gs/bucketlistresultset.py +0 -64
- data/vendor/depot_tools/third_party/boto/gs/connection.py +0 -103
- data/vendor/depot_tools/third_party/boto/gs/cors.py +0 -169
- data/vendor/depot_tools/third_party/boto/gs/key.py +0 -704
- data/vendor/depot_tools/third_party/boto/gs/resumable_upload_handler.py +0 -659
- data/vendor/depot_tools/third_party/boto/gs/user.py +0 -54
- data/vendor/depot_tools/third_party/boto/handler.py +0 -44
- data/vendor/depot_tools/third_party/boto/https_connection.py +0 -124
- data/vendor/depot_tools/third_party/boto/jsonresponse.py +0 -163
- data/vendor/depot_tools/third_party/boto/manage/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/manage/cmdshell.py +0 -241
- data/vendor/depot_tools/third_party/boto/manage/propget.py +0 -64
- data/vendor/depot_tools/third_party/boto/manage/server.py +0 -556
- data/vendor/depot_tools/third_party/boto/manage/task.py +0 -175
- data/vendor/depot_tools/third_party/boto/manage/test_manage.py +0 -34
- data/vendor/depot_tools/third_party/boto/manage/volume.py +0 -420
- data/vendor/depot_tools/third_party/boto/mashups/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/mashups/interactive.py +0 -97
- data/vendor/depot_tools/third_party/boto/mashups/iobject.py +0 -115
- data/vendor/depot_tools/third_party/boto/mashups/order.py +0 -211
- data/vendor/depot_tools/third_party/boto/mashups/server.py +0 -395
- data/vendor/depot_tools/third_party/boto/plugin.py +0 -90
- data/vendor/depot_tools/third_party/boto/provider.py +0 -337
- data/vendor/depot_tools/third_party/boto/pyami/__init__.py +0 -22
- data/vendor/depot_tools/third_party/boto/pyami/bootstrap.py +0 -134
- data/vendor/depot_tools/third_party/boto/pyami/config.py +0 -229
- data/vendor/depot_tools/third_party/boto/pyami/copybot.cfg +0 -60
- data/vendor/depot_tools/third_party/boto/pyami/copybot.py +0 -97
- data/vendor/depot_tools/third_party/boto/pyami/helloworld.py +0 -28
- data/vendor/depot_tools/third_party/boto/pyami/launch_ami.py +0 -178
- data/vendor/depot_tools/third_party/boto/pyami/scriptbase.py +0 -44
- data/vendor/depot_tools/third_party/boto/pyami/startup.py +0 -60
- data/vendor/depot_tools/third_party/boto/regioninfo.py +0 -63
- data/vendor/depot_tools/third_party/boto/resultset.py +0 -169
- data/vendor/depot_tools/third_party/boto/roboto/__init__.py +0 -1
- data/vendor/depot_tools/third_party/boto/roboto/awsqueryrequest.py +0 -504
- data/vendor/depot_tools/third_party/boto/roboto/awsqueryservice.py +0 -121
- data/vendor/depot_tools/third_party/boto/roboto/param.py +0 -147
- data/vendor/depot_tools/third_party/boto/s3/__init__.py +0 -84
- data/vendor/depot_tools/third_party/boto/s3/acl.py +0 -164
- data/vendor/depot_tools/third_party/boto/s3/bucket.py +0 -1634
- data/vendor/depot_tools/third_party/boto/s3/bucketlistresultset.py +0 -139
- data/vendor/depot_tools/third_party/boto/s3/bucketlogging.py +0 -83
- data/vendor/depot_tools/third_party/boto/s3/connection.py +0 -540
- data/vendor/depot_tools/third_party/boto/s3/cors.py +0 -210
- data/vendor/depot_tools/third_party/boto/s3/deletemarker.py +0 -55
- data/vendor/depot_tools/third_party/boto/s3/key.py +0 -1712
- data/vendor/depot_tools/third_party/boto/s3/keyfile.py +0 -134
- data/vendor/depot_tools/third_party/boto/s3/lifecycle.py +0 -231
- data/vendor/depot_tools/third_party/boto/s3/multidelete.py +0 -138
- data/vendor/depot_tools/third_party/boto/s3/multipart.py +0 -315
- data/vendor/depot_tools/third_party/boto/s3/prefix.py +0 -42
- data/vendor/depot_tools/third_party/boto/s3/resumable_download_handler.py +0 -339
- data/vendor/depot_tools/third_party/boto/s3/tagging.py +0 -71
- data/vendor/depot_tools/third_party/boto/s3/user.py +0 -49
- data/vendor/depot_tools/third_party/boto/s3/website.py +0 -237
- data/vendor/depot_tools/third_party/boto/services/__init__.py +0 -23
- data/vendor/depot_tools/third_party/boto/services/bs.py +0 -179
- data/vendor/depot_tools/third_party/boto/services/message.py +0 -58
- data/vendor/depot_tools/third_party/boto/services/result.py +0 -136
- data/vendor/depot_tools/third_party/boto/services/service.py +0 -161
- data/vendor/depot_tools/third_party/boto/services/servicedef.py +0 -91
- data/vendor/depot_tools/third_party/boto/services/sonofmmm.cfg +0 -43
- data/vendor/depot_tools/third_party/boto/services/sonofmmm.py +0 -81
- data/vendor/depot_tools/third_party/boto/services/submit.py +0 -88
- data/vendor/depot_tools/third_party/boto/ses/__init__.py +0 -54
- data/vendor/depot_tools/third_party/boto/ses/connection.py +0 -521
- data/vendor/depot_tools/third_party/boto/ses/exceptions.py +0 -77
- data/vendor/depot_tools/third_party/boto/storage_uri.py +0 -835
- data/vendor/depot_tools/third_party/boto/sts/__init__.py +0 -55
- data/vendor/depot_tools/third_party/boto/sts/connection.py +0 -207
- data/vendor/depot_tools/third_party/boto/sts/credentials.py +0 -215
- data/vendor/depot_tools/third_party/boto/utils.py +0 -927
- data/vendor/depot_tools/third_party/colorama/README.txt +0 -304
- data/vendor/depot_tools/third_party/fancy_urllib/README +0 -22
- data/vendor/depot_tools/third_party/fancy_urllib/__init__.py +0 -460
- data/vendor/depot_tools/third_party/logilab/README.chromium +0 -6
- data/vendor/depot_tools/third_party/logilab/__init__.py +0 -0
- data/vendor/depot_tools/third_party/logilab/astroid/LICENSE.txt +0 -340
- data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +0 -11
- data/vendor/depot_tools/third_party/logilab/astroid/__init__.py +0 -136
- data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +0 -42
- data/vendor/depot_tools/third_party/logilab/astroid/arguments.py +0 -233
- data/vendor/depot_tools/third_party/logilab/astroid/as_string.py +0 -548
- data/vendor/depot_tools/third_party/logilab/astroid/astpeephole.py +0 -86
- data/vendor/depot_tools/third_party/logilab/astroid/bases.py +0 -636
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_builtin_inference.py +0 -336
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_dateutil.py +0 -15
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_gi.py +0 -195
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_mechanize.py +0 -18
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_nose.py +0 -82
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_numpy.py +0 -62
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_pytest.py +0 -76
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_qt.py +0 -44
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_six.py +0 -288
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_ssl.py +0 -65
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_stdlib.py +0 -473
- data/vendor/depot_tools/third_party/logilab/astroid/builder.py +0 -263
- data/vendor/depot_tools/third_party/logilab/astroid/context.py +0 -81
- data/vendor/depot_tools/third_party/logilab/astroid/decorators.py +0 -75
- data/vendor/depot_tools/third_party/logilab/astroid/exceptions.py +0 -71
- data/vendor/depot_tools/third_party/logilab/astroid/inference.py +0 -359
- data/vendor/depot_tools/third_party/logilab/astroid/manager.py +0 -267
- data/vendor/depot_tools/third_party/logilab/astroid/mixins.py +0 -147
- data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +0 -741
- data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +0 -1053
- data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +0 -87
- data/vendor/depot_tools/third_party/logilab/astroid/objects.py +0 -186
- data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +0 -470
- data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +0 -390
- data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +0 -989
- data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +0 -1716
- data/vendor/depot_tools/third_party/logilab/astroid/test_utils.py +0 -201
- data/vendor/depot_tools/third_party/logilab/astroid/transforms.py +0 -96
- data/vendor/depot_tools/third_party/logilab/astroid/util.py +0 -89
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/LICENSE +0 -19
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/README.chromium +0 -11
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/__init__.py +0 -20
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/cext.c +0 -1421
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/compat.py +0 -9
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/simple.py +0 -246
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/slots.py +0 -414
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/utils.py +0 -13
- data/vendor/depot_tools/third_party/logilab/wrapt/LICENSE +0 -24
- data/vendor/depot_tools/third_party/logilab/wrapt/README.chromium +0 -11
- data/vendor/depot_tools/third_party/logilab/wrapt/__init__.py +0 -19
- data/vendor/depot_tools/third_party/logilab/wrapt/_wrappers.c +0 -2729
- data/vendor/depot_tools/third_party/logilab/wrapt/arguments.py +0 -96
- data/vendor/depot_tools/third_party/logilab/wrapt/decorators.py +0 -512
- data/vendor/depot_tools/third_party/logilab/wrapt/importer.py +0 -228
- data/vendor/depot_tools/third_party/logilab/wrapt/wrappers.py +0 -901
- data/vendor/depot_tools/third_party/mock/LICENSE.txt +0 -26
- data/vendor/depot_tools/third_party/mock/README.chromium +0 -24
- data/vendor/depot_tools/third_party/mock/__init__.py +0 -2366
- data/vendor/depot_tools/third_party/oauth2client/LICENSE +0 -202
- data/vendor/depot_tools/third_party/oauth2client/MODIFICATIONS.diff +0 -66
- data/vendor/depot_tools/third_party/oauth2client/README.chromium +0 -15
- data/vendor/depot_tools/third_party/oauth2client/__init__.py +0 -5
- data/vendor/depot_tools/third_party/oauth2client/anyjson.py +0 -32
- data/vendor/depot_tools/third_party/oauth2client/appengine.py +0 -963
- data/vendor/depot_tools/third_party/oauth2client/client.py +0 -1363
- data/vendor/depot_tools/third_party/oauth2client/clientsecrets.py +0 -153
- data/vendor/depot_tools/third_party/oauth2client/crypt.py +0 -377
- data/vendor/depot_tools/third_party/oauth2client/django_orm.py +0 -134
- data/vendor/depot_tools/third_party/oauth2client/file.py +0 -124
- data/vendor/depot_tools/third_party/oauth2client/gce.py +0 -90
- data/vendor/depot_tools/third_party/oauth2client/keyring_storage.py +0 -109
- data/vendor/depot_tools/third_party/oauth2client/locked_file.py +0 -373
- data/vendor/depot_tools/third_party/oauth2client/multistore_file.py +0 -465
- data/vendor/depot_tools/third_party/oauth2client/old_run.py +0 -160
- data/vendor/depot_tools/third_party/oauth2client/tools.py +0 -243
- data/vendor/depot_tools/third_party/oauth2client/util.py +0 -196
- data/vendor/depot_tools/third_party/oauth2client/xsrfutil.py +0 -113
- data/vendor/depot_tools/third_party/protobuf26/README.chromium +0 -23
- data/vendor/depot_tools/third_party/protobuf26/__init__.py +0 -0
- data/vendor/depot_tools/third_party/protobuf26/compiler/__init__.py +0 -0
- data/vendor/depot_tools/third_party/protobuf26/compiler/plugin_pb2.py +0 -184
- data/vendor/depot_tools/third_party/protobuf26/descriptor.py +0 -849
- data/vendor/depot_tools/third_party/protobuf26/descriptor_database.py +0 -137
- data/vendor/depot_tools/third_party/protobuf26/descriptor_pb2.py +0 -1522
- data/vendor/depot_tools/third_party/protobuf26/descriptor_pool.py +0 -643
- data/vendor/depot_tools/third_party/protobuf26/internal/__init__.py +0 -0
- data/vendor/depot_tools/third_party/protobuf26/internal/api_implementation.py +0 -89
- data/vendor/depot_tools/third_party/protobuf26/internal/containers.py +0 -269
- data/vendor/depot_tools/third_party/protobuf26/internal/cpp_message.py +0 -663
- data/vendor/depot_tools/third_party/protobuf26/internal/decoder.py +0 -831
- data/vendor/depot_tools/third_party/protobuf26/internal/encoder.py +0 -788
- data/vendor/depot_tools/third_party/protobuf26/internal/enum_type_wrapper.py +0 -89
- data/vendor/depot_tools/third_party/protobuf26/internal/message_listener.py +0 -78
- data/vendor/depot_tools/third_party/protobuf26/internal/python_message.py +0 -1247
- data/vendor/depot_tools/third_party/protobuf26/internal/type_checkers.py +0 -328
- data/vendor/depot_tools/third_party/protobuf26/internal/wire_format.py +0 -268
- data/vendor/depot_tools/third_party/protobuf26/message.py +0 -284
- data/vendor/depot_tools/third_party/protobuf26/message_factory.py +0 -155
- data/vendor/depot_tools/third_party/protobuf26/reflection.py +0 -205
- data/vendor/depot_tools/third_party/protobuf26/service.py +0 -226
- data/vendor/depot_tools/third_party/protobuf26/service_reflection.py +0 -284
- data/vendor/depot_tools/third_party/protobuf26/symbol_database.py +0 -185
- data/vendor/depot_tools/third_party/protobuf26/text_encoding.py +0 -110
- data/vendor/depot_tools/third_party/protobuf26/text_format.py +0 -873
- data/vendor/depot_tools/third_party/pylint.py +0 -37
- data/vendor/depot_tools/third_party/pylint/LICENSE.txt +0 -340
- data/vendor/depot_tools/third_party/pylint/README.chromium +0 -30
- data/vendor/depot_tools/third_party/pylint/__init__.py +0 -46
- data/vendor/depot_tools/third_party/pylint/__main__.py +0 -3
- data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +0 -80
- data/vendor/depot_tools/third_party/pylint/checkers/__init__.py +0 -123
- data/vendor/depot_tools/third_party/pylint/checkers/async.py +0 -82
- data/vendor/depot_tools/third_party/pylint/checkers/base.py +0 -2010
- data/vendor/depot_tools/third_party/pylint/checkers/classes.py +0 -1120
- data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +0 -348
- data/vendor/depot_tools/third_party/pylint/checkers/exceptions.py +0 -369
- data/vendor/depot_tools/third_party/pylint/checkers/format.py +0 -993
- data/vendor/depot_tools/third_party/pylint/checkers/imports.py +0 -654
- data/vendor/depot_tools/third_party/pylint/checkers/logging.py +0 -258
- data/vendor/depot_tools/third_party/pylint/checkers/misc.py +0 -105
- data/vendor/depot_tools/third_party/pylint/checkers/newstyle.py +0 -169
- data/vendor/depot_tools/third_party/pylint/checkers/python3.py +0 -591
- data/vendor/depot_tools/third_party/pylint/checkers/raw_metrics.py +0 -129
- data/vendor/depot_tools/third_party/pylint/checkers/similar.py +0 -371
- data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +0 -264
- data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +0 -280
- data/vendor/depot_tools/third_party/pylint/checkers/strings.py +0 -618
- data/vendor/depot_tools/third_party/pylint/checkers/typecheck.py +0 -974
- data/vendor/depot_tools/third_party/pylint/checkers/utils.py +0 -741
- data/vendor/depot_tools/third_party/pylint/checkers/variables.py +0 -1191
- data/vendor/depot_tools/third_party/pylint/config.py +0 -820
- data/vendor/depot_tools/third_party/pylint/epylint.py +0 -181
- data/vendor/depot_tools/third_party/pylint/extensions/__init__.py +0 -0
- data/vendor/depot_tools/third_party/pylint/extensions/check_docs.py +0 -311
- data/vendor/depot_tools/third_party/pylint/extensions/check_elif.py +0 -62
- data/vendor/depot_tools/third_party/pylint/graph.py +0 -179
- data/vendor/depot_tools/third_party/pylint/gui.py +0 -531
- data/vendor/depot_tools/third_party/pylint/interfaces.py +0 -102
- data/vendor/depot_tools/third_party/pylint/lint.py +0 -1381
- data/vendor/depot_tools/third_party/pylint/pyreverse/__init__.py +0 -5
- data/vendor/depot_tools/third_party/pylint/pyreverse/diadefslib.py +0 -230
- data/vendor/depot_tools/third_party/pylint/pyreverse/diagrams.py +0 -258
- data/vendor/depot_tools/third_party/pylint/pyreverse/inspector.py +0 -372
- data/vendor/depot_tools/third_party/pylint/pyreverse/main.py +0 -147
- data/vendor/depot_tools/third_party/pylint/pyreverse/utils.py +0 -210
- data/vendor/depot_tools/third_party/pylint/pyreverse/vcgutils.py +0 -198
- data/vendor/depot_tools/third_party/pylint/pyreverse/writer.py +0 -198
- data/vendor/depot_tools/third_party/pylint/reporters/__init__.py +0 -149
- data/vendor/depot_tools/third_party/pylint/reporters/guireporter.py +0 -27
- data/vendor/depot_tools/third_party/pylint/reporters/html.py +0 -108
- data/vendor/depot_tools/third_party/pylint/reporters/json.py +0 -64
- data/vendor/depot_tools/third_party/pylint/reporters/text.py +0 -237
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/__init__.py +0 -106
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/html_writer.py +0 -93
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/nodes.py +0 -181
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/text_writer.py +0 -99
- data/vendor/depot_tools/third_party/pylint/testutils.py +0 -414
- data/vendor/depot_tools/third_party/pylint/utils.py +0 -1148
- data/vendor/depot_tools/third_party/pymox/COPYING +0 -202
- data/vendor/depot_tools/third_party/pymox/MANIFEST.in +0 -5
- data/vendor/depot_tools/third_party/pymox/README +0 -56
- data/vendor/depot_tools/third_party/pymox/__init__.py +0 -0
- data/vendor/depot_tools/third_party/pymox/mox.py +0 -1643
- data/vendor/depot_tools/third_party/pymox/mox_test.py +0 -1708
- data/vendor/depot_tools/third_party/pymox/mox_test_helper.py +0 -76
- data/vendor/depot_tools/third_party/pymox/setup.py +0 -14
- data/vendor/depot_tools/third_party/pymox/stubout.py +0 -142
- data/vendor/depot_tools/third_party/pymox/stubout_test.py +0 -47
- data/vendor/depot_tools/third_party/pymox/stubout_testee.py +0 -2
- data/vendor/depot_tools/third_party/simplejson/LICENSE.txt +0 -19
- data/vendor/depot_tools/third_party/simplejson/PKG-INFO +0 -29
- data/vendor/depot_tools/third_party/simplejson/__init__.py +0 -437
- data/vendor/depot_tools/third_party/simplejson/decoder.py +0 -421
- data/vendor/depot_tools/third_party/simplejson/encoder.py +0 -501
- data/vendor/depot_tools/third_party/simplejson/ordered_dict.py +0 -119
- data/vendor/depot_tools/third_party/simplejson/scanner.py +0 -77
- data/vendor/depot_tools/third_party/simplejson/tool.py +0 -39
- data/vendor/depot_tools/third_party/upload.py +0 -2565
|
@@ -1,390 +0,0 @@
|
|
|
1
|
-
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
|
2
|
-
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
|
3
|
-
#
|
|
4
|
-
# This file is part of astroid.
|
|
5
|
-
#
|
|
6
|
-
# astroid is free software: you can redistribute it and/or modify it
|
|
7
|
-
# under the terms of the GNU Lesser General Public License as published by the
|
|
8
|
-
# Free Software Foundation, either version 2.1 of the License, or (at your
|
|
9
|
-
# option) any later version.
|
|
10
|
-
#
|
|
11
|
-
# astroid is distributed in the hope that it will be useful, but
|
|
12
|
-
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
14
|
-
# for more details.
|
|
15
|
-
#
|
|
16
|
-
# You should have received a copy of the GNU Lesser General Public License along
|
|
17
|
-
# with astroid. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
-
"""this module contains a set of functions to create astroid trees from scratch
|
|
19
|
-
(build_* functions) or from living object (object_build_* functions)
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
import sys
|
|
23
|
-
import os
|
|
24
|
-
from os.path import abspath
|
|
25
|
-
from inspect import (getargspec, isdatadescriptor, isfunction, ismethod,
|
|
26
|
-
ismethoddescriptor, isclass, isbuiltin, ismodule)
|
|
27
|
-
import six
|
|
28
|
-
|
|
29
|
-
from astroid.node_classes import CONST_CLS
|
|
30
|
-
from astroid.nodes import (Module, Class, Const, const_factory, From,
|
|
31
|
-
Function, EmptyNode, Name, Arguments)
|
|
32
|
-
from astroid.bases import BUILTINS, Generator
|
|
33
|
-
from astroid.manager import AstroidManager
|
|
34
|
-
MANAGER = AstroidManager()
|
|
35
|
-
|
|
36
|
-
_CONSTANTS = tuple(CONST_CLS) # the keys of CONST_CLS eg python builtin types
|
|
37
|
-
_JYTHON = os.name == 'java'
|
|
38
|
-
_BUILTINS = vars(six.moves.builtins)
|
|
39
|
-
|
|
40
|
-
def _io_discrepancy(member):
|
|
41
|
-
# _io module names itself `io`: http://bugs.python.org/issue18602
|
|
42
|
-
member_self = getattr(member, '__self__', None)
|
|
43
|
-
return (member_self and
|
|
44
|
-
ismodule(member_self) and
|
|
45
|
-
member_self.__name__ == '_io' and
|
|
46
|
-
member.__module__ == 'io')
|
|
47
|
-
|
|
48
|
-
def _attach_local_node(parent, node, name):
|
|
49
|
-
node.name = name # needed by add_local_node
|
|
50
|
-
parent.add_local_node(node)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
def _add_dunder_class(func, member):
|
|
54
|
-
"""Add a __class__ member to the given func node, if we can determine it."""
|
|
55
|
-
python_cls = member.__class__
|
|
56
|
-
cls_name = getattr(python_cls, '__name__', None)
|
|
57
|
-
if not cls_name:
|
|
58
|
-
return
|
|
59
|
-
bases = [ancestor.__name__ for ancestor in python_cls.__bases__]
|
|
60
|
-
ast_klass = build_class(cls_name, bases, python_cls.__doc__)
|
|
61
|
-
func._instance_attrs['__class__'] = [ast_klass]
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
_marker = object()
|
|
65
|
-
|
|
66
|
-
def attach_dummy_node(node, name, object=_marker):
|
|
67
|
-
"""create a dummy node and register it in the locals of the given
|
|
68
|
-
node with the specified name
|
|
69
|
-
"""
|
|
70
|
-
enode = EmptyNode()
|
|
71
|
-
enode.object = object
|
|
72
|
-
_attach_local_node(node, enode, name)
|
|
73
|
-
|
|
74
|
-
def _has_underlying_object(self):
|
|
75
|
-
return hasattr(self, 'object') and self.object is not _marker
|
|
76
|
-
|
|
77
|
-
EmptyNode.has_underlying_object = _has_underlying_object
|
|
78
|
-
|
|
79
|
-
def attach_const_node(node, name, value):
|
|
80
|
-
"""create a Const node and register it in the locals of the given
|
|
81
|
-
node with the specified name
|
|
82
|
-
"""
|
|
83
|
-
if not name in node.special_attributes:
|
|
84
|
-
_attach_local_node(node, const_factory(value), name)
|
|
85
|
-
|
|
86
|
-
def attach_import_node(node, modname, membername):
|
|
87
|
-
"""create a From node and register it in the locals of the given
|
|
88
|
-
node with the specified name
|
|
89
|
-
"""
|
|
90
|
-
from_node = From(modname, [(membername, None)])
|
|
91
|
-
_attach_local_node(node, from_node, membername)
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
def build_module(name, doc=None):
|
|
95
|
-
"""create and initialize a astroid Module node"""
|
|
96
|
-
node = Module(name, doc, pure_python=False)
|
|
97
|
-
node.package = False
|
|
98
|
-
node.parent = None
|
|
99
|
-
return node
|
|
100
|
-
|
|
101
|
-
def build_class(name, basenames=(), doc=None):
|
|
102
|
-
"""create and initialize a astroid Class node"""
|
|
103
|
-
node = Class(name, doc)
|
|
104
|
-
for base in basenames:
|
|
105
|
-
basenode = Name()
|
|
106
|
-
basenode.name = base
|
|
107
|
-
node.bases.append(basenode)
|
|
108
|
-
basenode.parent = node
|
|
109
|
-
return node
|
|
110
|
-
|
|
111
|
-
def build_function(name, args=None, defaults=None, flag=0, doc=None):
|
|
112
|
-
"""create and initialize a astroid Function node"""
|
|
113
|
-
args, defaults = args or [], defaults or []
|
|
114
|
-
# first argument is now a list of decorators
|
|
115
|
-
func = Function(name, doc)
|
|
116
|
-
func.args = argsnode = Arguments()
|
|
117
|
-
argsnode.args = []
|
|
118
|
-
for arg in args:
|
|
119
|
-
argsnode.args.append(Name())
|
|
120
|
-
argsnode.args[-1].name = arg
|
|
121
|
-
argsnode.args[-1].parent = argsnode
|
|
122
|
-
argsnode.defaults = []
|
|
123
|
-
for default in defaults:
|
|
124
|
-
argsnode.defaults.append(const_factory(default))
|
|
125
|
-
argsnode.defaults[-1].parent = argsnode
|
|
126
|
-
argsnode.kwarg = None
|
|
127
|
-
argsnode.vararg = None
|
|
128
|
-
argsnode.parent = func
|
|
129
|
-
if args:
|
|
130
|
-
register_arguments(func)
|
|
131
|
-
return func
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
def build_from_import(fromname, names):
|
|
135
|
-
"""create and initialize an astroid From import statement"""
|
|
136
|
-
return From(fromname, [(name, None) for name in names])
|
|
137
|
-
|
|
138
|
-
def register_arguments(func, args=None):
|
|
139
|
-
"""add given arguments to local
|
|
140
|
-
|
|
141
|
-
args is a list that may contains nested lists
|
|
142
|
-
(i.e. def func(a, (b, c, d)): ...)
|
|
143
|
-
"""
|
|
144
|
-
if args is None:
|
|
145
|
-
args = func.args.args
|
|
146
|
-
if func.args.vararg:
|
|
147
|
-
func.set_local(func.args.vararg, func.args)
|
|
148
|
-
if func.args.kwarg:
|
|
149
|
-
func.set_local(func.args.kwarg, func.args)
|
|
150
|
-
for arg in args:
|
|
151
|
-
if isinstance(arg, Name):
|
|
152
|
-
func.set_local(arg.name, arg)
|
|
153
|
-
else:
|
|
154
|
-
register_arguments(func, arg.elts)
|
|
155
|
-
|
|
156
|
-
def object_build_class(node, member, localname):
|
|
157
|
-
"""create astroid for a living class object"""
|
|
158
|
-
basenames = [base.__name__ for base in member.__bases__]
|
|
159
|
-
return _base_class_object_build(node, member, basenames,
|
|
160
|
-
localname=localname)
|
|
161
|
-
|
|
162
|
-
def object_build_function(node, member, localname):
|
|
163
|
-
"""create astroid for a living function object"""
|
|
164
|
-
args, varargs, varkw, defaults = getargspec(member)
|
|
165
|
-
if varargs is not None:
|
|
166
|
-
args.append(varargs)
|
|
167
|
-
if varkw is not None:
|
|
168
|
-
args.append(varkw)
|
|
169
|
-
func = build_function(getattr(member, '__name__', None) or localname, args,
|
|
170
|
-
defaults, six.get_function_code(member).co_flags, member.__doc__)
|
|
171
|
-
node.add_local_node(func, localname)
|
|
172
|
-
|
|
173
|
-
def object_build_datadescriptor(node, member, name):
|
|
174
|
-
"""create astroid for a living data descriptor object"""
|
|
175
|
-
return _base_class_object_build(node, member, [], name)
|
|
176
|
-
|
|
177
|
-
def object_build_methoddescriptor(node, member, localname):
|
|
178
|
-
"""create astroid for a living method descriptor object"""
|
|
179
|
-
# FIXME get arguments ?
|
|
180
|
-
func = build_function(getattr(member, '__name__', None) or localname,
|
|
181
|
-
doc=member.__doc__)
|
|
182
|
-
# set node's arguments to None to notice that we have no information, not
|
|
183
|
-
# and empty argument list
|
|
184
|
-
func.args.args = None
|
|
185
|
-
node.add_local_node(func, localname)
|
|
186
|
-
_add_dunder_class(func, member)
|
|
187
|
-
|
|
188
|
-
def _base_class_object_build(node, member, basenames, name=None, localname=None):
|
|
189
|
-
"""create astroid for a living class object, with a given set of base names
|
|
190
|
-
(e.g. ancestors)
|
|
191
|
-
"""
|
|
192
|
-
klass = build_class(name or getattr(member, '__name__', None) or localname,
|
|
193
|
-
basenames, member.__doc__)
|
|
194
|
-
klass._newstyle = isinstance(member, type)
|
|
195
|
-
node.add_local_node(klass, localname)
|
|
196
|
-
try:
|
|
197
|
-
# limit the instantiation trick since it's too dangerous
|
|
198
|
-
# (such as infinite test execution...)
|
|
199
|
-
# this at least resolves common case such as Exception.args,
|
|
200
|
-
# OSError.errno
|
|
201
|
-
if issubclass(member, Exception):
|
|
202
|
-
instdict = member().__dict__
|
|
203
|
-
else:
|
|
204
|
-
raise TypeError
|
|
205
|
-
except:
|
|
206
|
-
pass
|
|
207
|
-
else:
|
|
208
|
-
for name, obj in instdict.items():
|
|
209
|
-
valnode = EmptyNode()
|
|
210
|
-
valnode.object = obj
|
|
211
|
-
valnode.parent = klass
|
|
212
|
-
valnode.lineno = 1
|
|
213
|
-
klass._instance_attrs[name] = [valnode]
|
|
214
|
-
return klass
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
class InspectBuilder(object):
|
|
220
|
-
"""class for building nodes from living object
|
|
221
|
-
|
|
222
|
-
this is actually a really minimal representation, including only Module,
|
|
223
|
-
Function and Class nodes and some others as guessed.
|
|
224
|
-
"""
|
|
225
|
-
|
|
226
|
-
# astroid from living objects ###############################################
|
|
227
|
-
|
|
228
|
-
def __init__(self):
|
|
229
|
-
self._done = {}
|
|
230
|
-
self._module = None
|
|
231
|
-
|
|
232
|
-
def inspect_build(self, module, modname=None, path=None):
|
|
233
|
-
"""build astroid from a living module (i.e. using inspect)
|
|
234
|
-
this is used when there is no python source code available (either
|
|
235
|
-
because it's a built-in module or because the .py is not available)
|
|
236
|
-
"""
|
|
237
|
-
self._module = module
|
|
238
|
-
if modname is None:
|
|
239
|
-
modname = module.__name__
|
|
240
|
-
try:
|
|
241
|
-
node = build_module(modname, module.__doc__)
|
|
242
|
-
except AttributeError:
|
|
243
|
-
# in jython, java modules have no __doc__ (see #109562)
|
|
244
|
-
node = build_module(modname)
|
|
245
|
-
node.source_file = path and abspath(path) or path
|
|
246
|
-
node.name = modname
|
|
247
|
-
MANAGER.cache_module(node)
|
|
248
|
-
node.package = hasattr(module, '__path__')
|
|
249
|
-
self._done = {}
|
|
250
|
-
self.object_build(node, module)
|
|
251
|
-
return node
|
|
252
|
-
|
|
253
|
-
def object_build(self, node, obj):
|
|
254
|
-
"""recursive method which create a partial ast from real objects
|
|
255
|
-
(only function, class, and method are handled)
|
|
256
|
-
"""
|
|
257
|
-
if obj in self._done:
|
|
258
|
-
return self._done[obj]
|
|
259
|
-
self._done[obj] = node
|
|
260
|
-
for name in dir(obj):
|
|
261
|
-
try:
|
|
262
|
-
member = getattr(obj, name)
|
|
263
|
-
except AttributeError:
|
|
264
|
-
# damned ExtensionClass.Base, I know you're there !
|
|
265
|
-
attach_dummy_node(node, name)
|
|
266
|
-
continue
|
|
267
|
-
if ismethod(member):
|
|
268
|
-
member = six.get_method_function(member)
|
|
269
|
-
if isfunction(member):
|
|
270
|
-
# verify this is not an imported function
|
|
271
|
-
filename = getattr(six.get_function_code(member),
|
|
272
|
-
'co_filename', None)
|
|
273
|
-
if filename is None:
|
|
274
|
-
assert isinstance(member, object)
|
|
275
|
-
object_build_methoddescriptor(node, member, name)
|
|
276
|
-
elif filename != getattr(self._module, '__file__', None):
|
|
277
|
-
attach_dummy_node(node, name, member)
|
|
278
|
-
else:
|
|
279
|
-
object_build_function(node, member, name)
|
|
280
|
-
elif isbuiltin(member):
|
|
281
|
-
if (not _io_discrepancy(member) and
|
|
282
|
-
self.imported_member(node, member, name)):
|
|
283
|
-
continue
|
|
284
|
-
object_build_methoddescriptor(node, member, name)
|
|
285
|
-
elif isclass(member):
|
|
286
|
-
if self.imported_member(node, member, name):
|
|
287
|
-
continue
|
|
288
|
-
if member in self._done:
|
|
289
|
-
class_node = self._done[member]
|
|
290
|
-
if not class_node in node._locals.get(name, ()):
|
|
291
|
-
node.add_local_node(class_node, name)
|
|
292
|
-
else:
|
|
293
|
-
class_node = object_build_class(node, member, name)
|
|
294
|
-
# recursion
|
|
295
|
-
self.object_build(class_node, member)
|
|
296
|
-
if name == '__class__' and class_node.parent is None:
|
|
297
|
-
class_node.parent = self._done[self._module]
|
|
298
|
-
elif ismethoddescriptor(member):
|
|
299
|
-
assert isinstance(member, object)
|
|
300
|
-
object_build_methoddescriptor(node, member, name)
|
|
301
|
-
elif isdatadescriptor(member):
|
|
302
|
-
assert isinstance(member, object)
|
|
303
|
-
object_build_datadescriptor(node, member, name)
|
|
304
|
-
elif type(member) in _CONSTANTS:
|
|
305
|
-
attach_const_node(node, name, member)
|
|
306
|
-
else:
|
|
307
|
-
# create an empty node so that the name is actually defined
|
|
308
|
-
attach_dummy_node(node, name, member)
|
|
309
|
-
|
|
310
|
-
def imported_member(self, node, member, name):
|
|
311
|
-
"""verify this is not an imported class or handle it"""
|
|
312
|
-
# /!\ some classes like ExtensionClass doesn't have a __module__
|
|
313
|
-
# attribute ! Also, this may trigger an exception on badly built module
|
|
314
|
-
# (see http://www.logilab.org/ticket/57299 for instance)
|
|
315
|
-
try:
|
|
316
|
-
modname = getattr(member, '__module__', None)
|
|
317
|
-
except:
|
|
318
|
-
# XXX use logging
|
|
319
|
-
print('unexpected error while building astroid from living object')
|
|
320
|
-
import traceback
|
|
321
|
-
traceback.print_exc()
|
|
322
|
-
modname = None
|
|
323
|
-
if modname is None:
|
|
324
|
-
if (name in ('__new__', '__subclasshook__')
|
|
325
|
-
or (name in _BUILTINS and _JYTHON)):
|
|
326
|
-
# Python 2.5.1 (r251:54863, Sep 1 2010, 22:03:14)
|
|
327
|
-
# >>> print object.__new__.__module__
|
|
328
|
-
# None
|
|
329
|
-
modname = BUILTINS
|
|
330
|
-
else:
|
|
331
|
-
attach_dummy_node(node, name, member)
|
|
332
|
-
return True
|
|
333
|
-
|
|
334
|
-
real_name = {
|
|
335
|
-
'gtk': 'gtk_gtk',
|
|
336
|
-
'_io': 'io',
|
|
337
|
-
}.get(modname, modname)
|
|
338
|
-
|
|
339
|
-
if real_name != self._module.__name__:
|
|
340
|
-
# check if it sounds valid and then add an import node, else use a
|
|
341
|
-
# dummy node
|
|
342
|
-
try:
|
|
343
|
-
getattr(sys.modules[modname], name)
|
|
344
|
-
except (KeyError, AttributeError):
|
|
345
|
-
attach_dummy_node(node, name, member)
|
|
346
|
-
else:
|
|
347
|
-
attach_import_node(node, modname, name)
|
|
348
|
-
return True
|
|
349
|
-
return False
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
### astroid bootstrapping ######################################################
|
|
353
|
-
Astroid_BUILDER = InspectBuilder()
|
|
354
|
-
|
|
355
|
-
_CONST_PROXY = {}
|
|
356
|
-
def _astroid_bootstrapping(astroid_builtin=None):
|
|
357
|
-
"""astroid boot strapping the builtins module"""
|
|
358
|
-
# this boot strapping is necessary since we need the Const nodes to
|
|
359
|
-
# inspect_build builtins, and then we can proxy Const
|
|
360
|
-
if astroid_builtin is None:
|
|
361
|
-
from six.moves import builtins
|
|
362
|
-
astroid_builtin = Astroid_BUILDER.inspect_build(builtins)
|
|
363
|
-
|
|
364
|
-
for cls, node_cls in CONST_CLS.items():
|
|
365
|
-
if cls is type(None):
|
|
366
|
-
proxy = build_class('NoneType')
|
|
367
|
-
proxy.parent = astroid_builtin
|
|
368
|
-
elif cls is type(NotImplemented):
|
|
369
|
-
proxy = build_class('NotImplementedType')
|
|
370
|
-
proxy.parent = astroid_builtin
|
|
371
|
-
else:
|
|
372
|
-
proxy = astroid_builtin.getattr(cls.__name__)[0]
|
|
373
|
-
if cls in (dict, list, set, tuple):
|
|
374
|
-
node_cls._proxied = proxy
|
|
375
|
-
else:
|
|
376
|
-
_CONST_PROXY[cls] = proxy
|
|
377
|
-
|
|
378
|
-
_astroid_bootstrapping()
|
|
379
|
-
|
|
380
|
-
# TODO : find a nicer way to handle this situation;
|
|
381
|
-
# However __proxied introduced an
|
|
382
|
-
# infinite recursion (see https://bugs.launchpad.net/pylint/+bug/456870)
|
|
383
|
-
def _set_proxied(const):
|
|
384
|
-
return _CONST_PROXY[const.value.__class__]
|
|
385
|
-
Const._proxied = property(_set_proxied)
|
|
386
|
-
|
|
387
|
-
from types import GeneratorType
|
|
388
|
-
Generator._proxied = Class(GeneratorType.__name__, GeneratorType.__doc__)
|
|
389
|
-
Astroid_BUILDER.object_build(Generator._proxied, GeneratorType)
|
|
390
|
-
|
|
@@ -1,989 +0,0 @@
|
|
|
1
|
-
# copyright 2003-2013 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
|
|
2
|
-
# contact http://www.logilab.fr/ -- mailto:contact@logilab.fr
|
|
3
|
-
#
|
|
4
|
-
# This file is part of astroid.
|
|
5
|
-
#
|
|
6
|
-
# astroid is free software: you can redistribute it and/or modify it
|
|
7
|
-
# under the terms of the GNU Lesser General Public License as published by the
|
|
8
|
-
# Free Software Foundation, either version 2.1 of the License, or (at your
|
|
9
|
-
# option) any later version.
|
|
10
|
-
#
|
|
11
|
-
# astroid is distributed in the hope that it will be useful, but
|
|
12
|
-
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13
|
-
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
|
14
|
-
# for more details.
|
|
15
|
-
#
|
|
16
|
-
# You should have received a copy of the GNU Lesser General Public License along
|
|
17
|
-
# with astroid. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
-
"""this module contains utilities for rebuilding a _ast tree in
|
|
19
|
-
order to get a single Astroid representation
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
import sys
|
|
23
|
-
import _ast
|
|
24
|
-
from _ast import (
|
|
25
|
-
# binary operators
|
|
26
|
-
Add, Div, FloorDiv, Mod, Mult, Pow, Sub, BitAnd, BitOr, BitXor,
|
|
27
|
-
LShift, RShift,
|
|
28
|
-
# logical operators
|
|
29
|
-
And, Or,
|
|
30
|
-
# unary operators
|
|
31
|
-
UAdd, USub, Not, Invert,
|
|
32
|
-
# comparison operators
|
|
33
|
-
Eq, Gt, GtE, In, Is, IsNot, Lt, LtE, NotEq, NotIn,
|
|
34
|
-
)
|
|
35
|
-
|
|
36
|
-
from astroid import nodes as new
|
|
37
|
-
from astroid import astpeephole
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
_BIN_OP_CLASSES = {Add: '+',
|
|
41
|
-
BitAnd: '&',
|
|
42
|
-
BitOr: '|',
|
|
43
|
-
BitXor: '^',
|
|
44
|
-
Div: '/',
|
|
45
|
-
FloorDiv: '//',
|
|
46
|
-
Mod: '%',
|
|
47
|
-
Mult: '*',
|
|
48
|
-
Pow: '**',
|
|
49
|
-
Sub: '-',
|
|
50
|
-
LShift: '<<',
|
|
51
|
-
RShift: '>>',
|
|
52
|
-
}
|
|
53
|
-
if sys.version_info >= (3, 5):
|
|
54
|
-
from _ast import MatMult
|
|
55
|
-
_BIN_OP_CLASSES[MatMult] = '@'
|
|
56
|
-
|
|
57
|
-
_BOOL_OP_CLASSES = {And: 'and',
|
|
58
|
-
Or: 'or',
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
_UNARY_OP_CLASSES = {UAdd: '+',
|
|
62
|
-
USub: '-',
|
|
63
|
-
Not: 'not',
|
|
64
|
-
Invert: '~',
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
_CMP_OP_CLASSES = {Eq: '==',
|
|
68
|
-
Gt: '>',
|
|
69
|
-
GtE: '>=',
|
|
70
|
-
In: 'in',
|
|
71
|
-
Is: 'is',
|
|
72
|
-
IsNot: 'is not',
|
|
73
|
-
Lt: '<',
|
|
74
|
-
LtE: '<=',
|
|
75
|
-
NotEq: '!=',
|
|
76
|
-
NotIn: 'not in',
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
CONST_NAME_TRANSFORMS = {'None': None,
|
|
80
|
-
'True': True,
|
|
81
|
-
'False': False,
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
REDIRECT = {'arguments': 'Arguments',
|
|
85
|
-
'comprehension': 'Comprehension',
|
|
86
|
-
"ListCompFor": 'Comprehension',
|
|
87
|
-
"GenExprFor": 'Comprehension',
|
|
88
|
-
'excepthandler': 'ExceptHandler',
|
|
89
|
-
'keyword': 'Keyword',
|
|
90
|
-
}
|
|
91
|
-
PY3K = sys.version_info >= (3, 0)
|
|
92
|
-
PY34 = sys.version_info >= (3, 4)
|
|
93
|
-
|
|
94
|
-
def _init_set_doc(node, newnode):
|
|
95
|
-
newnode.doc = None
|
|
96
|
-
try:
|
|
97
|
-
if isinstance(node.body[0], _ast.Expr) and isinstance(node.body[0].value, _ast.Str):
|
|
98
|
-
newnode.doc = node.body[0].value.s
|
|
99
|
-
node.body = node.body[1:]
|
|
100
|
-
|
|
101
|
-
except IndexError:
|
|
102
|
-
pass # ast built from scratch
|
|
103
|
-
|
|
104
|
-
def _lineno_parent(oldnode, newnode, parent):
|
|
105
|
-
newnode.parent = parent
|
|
106
|
-
newnode.lineno = oldnode.lineno
|
|
107
|
-
newnode.col_offset = oldnode.col_offset
|
|
108
|
-
|
|
109
|
-
def _set_infos(oldnode, newnode, parent):
|
|
110
|
-
newnode.parent = parent
|
|
111
|
-
if hasattr(oldnode, 'lineno'):
|
|
112
|
-
newnode.lineno = oldnode.lineno
|
|
113
|
-
if hasattr(oldnode, 'col_offset'):
|
|
114
|
-
newnode.col_offset = oldnode.col_offset
|
|
115
|
-
|
|
116
|
-
def _create_yield_node(node, parent, rebuilder, factory):
|
|
117
|
-
newnode = factory()
|
|
118
|
-
_lineno_parent(node, newnode, parent)
|
|
119
|
-
if node.value is not None:
|
|
120
|
-
newnode.value = rebuilder.visit(node.value, newnode, None)
|
|
121
|
-
return newnode
|
|
122
|
-
|
|
123
|
-
def _visit_or_none(node, attr, visitor, parent, assign_ctx, visit='visit',
|
|
124
|
-
**kws):
|
|
125
|
-
"""If the given node has an attribute, visits the attribute, and
|
|
126
|
-
otherwise returns None.
|
|
127
|
-
|
|
128
|
-
"""
|
|
129
|
-
value = getattr(node, attr, None)
|
|
130
|
-
if value:
|
|
131
|
-
return getattr(visitor, visit)(value, parent, assign_ctx, **kws)
|
|
132
|
-
else:
|
|
133
|
-
return None
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
class TreeRebuilder(object):
|
|
137
|
-
"""Rebuilds the _ast tree to become an Astroid tree"""
|
|
138
|
-
|
|
139
|
-
def __init__(self, manager):
|
|
140
|
-
self._manager = manager
|
|
141
|
-
self.asscontext = None
|
|
142
|
-
self._global_names = []
|
|
143
|
-
self._import_from_nodes = []
|
|
144
|
-
self._delayed_assattr = []
|
|
145
|
-
self._visit_meths = {}
|
|
146
|
-
self._peepholer = astpeephole.ASTPeepholeOptimizer()
|
|
147
|
-
|
|
148
|
-
def visit_module(self, node, modname, modpath, package):
|
|
149
|
-
"""visit a Module node by returning a fresh instance of it"""
|
|
150
|
-
newnode = new.Module(modname, None)
|
|
151
|
-
newnode.package = package
|
|
152
|
-
newnode.parent = None
|
|
153
|
-
_init_set_doc(node, newnode)
|
|
154
|
-
newnode.body = [self.visit(child, newnode) for child in node.body]
|
|
155
|
-
newnode.source_file = modpath
|
|
156
|
-
return newnode
|
|
157
|
-
|
|
158
|
-
def visit(self, node, parent, assign_ctx=None):
|
|
159
|
-
cls = node.__class__
|
|
160
|
-
if cls in self._visit_meths:
|
|
161
|
-
visit_method = self._visit_meths[cls]
|
|
162
|
-
else:
|
|
163
|
-
cls_name = cls.__name__
|
|
164
|
-
visit_name = 'visit_' + REDIRECT.get(cls_name, cls_name).lower()
|
|
165
|
-
visit_method = getattr(self, visit_name)
|
|
166
|
-
self._visit_meths[cls] = visit_method
|
|
167
|
-
return visit_method(node, parent, assign_ctx)
|
|
168
|
-
|
|
169
|
-
def _save_assignment(self, node, name=None):
|
|
170
|
-
"""save assignement situation since node.parent is not available yet"""
|
|
171
|
-
if self._global_names and node.name in self._global_names[-1]:
|
|
172
|
-
node.root().set_local(node.name, node)
|
|
173
|
-
else:
|
|
174
|
-
node.parent.set_local(node.name, node)
|
|
175
|
-
|
|
176
|
-
def visit_arguments(self, node, parent, assign_ctx=None):
|
|
177
|
-
"""visit a Arguments node by returning a fresh instance of it"""
|
|
178
|
-
newnode = new.Arguments()
|
|
179
|
-
newnode.parent = parent
|
|
180
|
-
newnode.args = [self.visit(child, newnode, "Assign")
|
|
181
|
-
for child in node.args]
|
|
182
|
-
newnode.defaults = [self.visit(child, newnode, assign_ctx)
|
|
183
|
-
for child in node.defaults]
|
|
184
|
-
newnode.kwonlyargs = []
|
|
185
|
-
newnode.kw_defaults = []
|
|
186
|
-
vararg, kwarg = node.vararg, node.kwarg
|
|
187
|
-
# change added in 82732 (7c5c678e4164), vararg and kwarg
|
|
188
|
-
# are instances of `_ast.arg`, not strings
|
|
189
|
-
if vararg:
|
|
190
|
-
if PY34:
|
|
191
|
-
if vararg.annotation:
|
|
192
|
-
newnode.varargannotation = self.visit(vararg.annotation,
|
|
193
|
-
newnode, assign_ctx)
|
|
194
|
-
vararg = vararg.arg
|
|
195
|
-
elif PY3K and node.varargannotation:
|
|
196
|
-
newnode.varargannotation = self.visit(node.varargannotation,
|
|
197
|
-
newnode, assign_ctx)
|
|
198
|
-
if kwarg:
|
|
199
|
-
if PY34:
|
|
200
|
-
if kwarg.annotation:
|
|
201
|
-
newnode.kwargannotation = self.visit(kwarg.annotation,
|
|
202
|
-
newnode, assign_ctx)
|
|
203
|
-
kwarg = kwarg.arg
|
|
204
|
-
elif PY3K:
|
|
205
|
-
if node.kwargannotation:
|
|
206
|
-
newnode.kwargannotation = self.visit(node.kwargannotation,
|
|
207
|
-
newnode, assign_ctx)
|
|
208
|
-
newnode.vararg = vararg
|
|
209
|
-
newnode.kwarg = kwarg
|
|
210
|
-
# save argument names in locals:
|
|
211
|
-
if vararg:
|
|
212
|
-
newnode.parent.set_local(vararg, newnode)
|
|
213
|
-
if kwarg:
|
|
214
|
-
newnode.parent.set_local(kwarg, newnode)
|
|
215
|
-
return newnode
|
|
216
|
-
|
|
217
|
-
def visit_assignattr(self, node, parent, assign_ctx=None):
|
|
218
|
-
"""visit a AssAttr node by returning a fresh instance of it"""
|
|
219
|
-
newnode = new.AssignAttr()
|
|
220
|
-
_lineno_parent(node, newnode, parent)
|
|
221
|
-
newnode.expr = self.visit(node.expr, newnode, assign_ctx)
|
|
222
|
-
self._delayed_assattr.append(newnode)
|
|
223
|
-
return newnode
|
|
224
|
-
|
|
225
|
-
def visit_assert(self, node, parent, assign_ctx=None):
|
|
226
|
-
"""visit a Assert node by returning a fresh instance of it"""
|
|
227
|
-
newnode = new.Assert()
|
|
228
|
-
_lineno_parent(node, newnode, parent)
|
|
229
|
-
newnode.test = self.visit(node.test, newnode, assign_ctx)
|
|
230
|
-
if node.msg is not None:
|
|
231
|
-
newnode.fail = self.visit(node.msg, newnode, assign_ctx)
|
|
232
|
-
return newnode
|
|
233
|
-
|
|
234
|
-
def visit_assign(self, node, parent, assign_ctx=None):
|
|
235
|
-
"""visit a Assign node by returning a fresh instance of it"""
|
|
236
|
-
newnode = new.Assign()
|
|
237
|
-
_lineno_parent(node, newnode, parent)
|
|
238
|
-
newnode.targets = [self.visit(child, newnode, "Assign")
|
|
239
|
-
for child in node.targets]
|
|
240
|
-
newnode.value = self.visit(node.value, newnode, None)
|
|
241
|
-
return newnode
|
|
242
|
-
|
|
243
|
-
def visit_assignname(self, node, parent, assign_ctx=None, node_name=None):
|
|
244
|
-
'''visit a node and return a AssName node'''
|
|
245
|
-
newnode = new.AssignName()
|
|
246
|
-
_set_infos(node, newnode, parent)
|
|
247
|
-
newnode.name = node_name
|
|
248
|
-
self._save_assignment(newnode)
|
|
249
|
-
return newnode
|
|
250
|
-
|
|
251
|
-
def visit_augassign(self, node, parent, assign_ctx=None):
|
|
252
|
-
"""visit a AugAssign node by returning a fresh instance of it"""
|
|
253
|
-
newnode = new.AugAssign()
|
|
254
|
-
_lineno_parent(node, newnode, parent)
|
|
255
|
-
newnode.op = _BIN_OP_CLASSES[node.op.__class__] + "="
|
|
256
|
-
newnode.target = self.visit(node.target, newnode, "Assign")
|
|
257
|
-
newnode.value = self.visit(node.value, newnode, None)
|
|
258
|
-
return newnode
|
|
259
|
-
|
|
260
|
-
def visit_repr(self, node, parent, assign_ctx=None):
|
|
261
|
-
"""visit a Backquote node by returning a fresh instance of it"""
|
|
262
|
-
newnode = new.Repr()
|
|
263
|
-
_lineno_parent(node, newnode, parent)
|
|
264
|
-
newnode.value = self.visit(node.value, newnode, assign_ctx)
|
|
265
|
-
return newnode
|
|
266
|
-
|
|
267
|
-
def visit_binop(self, node, parent, assign_ctx=None):
|
|
268
|
-
"""visit a BinOp node by returning a fresh instance of it"""
|
|
269
|
-
if isinstance(node.left, _ast.BinOp) and self._manager.optimize_ast:
|
|
270
|
-
# Optimize BinOp operations in order to remove
|
|
271
|
-
# redundant recursion. For instance, if the
|
|
272
|
-
# following code is parsed in order to obtain
|
|
273
|
-
# its ast, then the rebuilder will fail with an
|
|
274
|
-
# infinite recursion, the same will happen with the
|
|
275
|
-
# inference engine as well. There's no need to hold
|
|
276
|
-
# so many objects for the BinOp if they can be reduced
|
|
277
|
-
# to something else (also, the optimization
|
|
278
|
-
# might handle only Const binops, which isn't a big
|
|
279
|
-
# problem for the correctness of the program).
|
|
280
|
-
#
|
|
281
|
-
# ("a" + "b" + # one thousand more + "c")
|
|
282
|
-
optimized = self._peepholer.optimize_binop(node)
|
|
283
|
-
if optimized:
|
|
284
|
-
_lineno_parent(node, optimized, parent)
|
|
285
|
-
return optimized
|
|
286
|
-
|
|
287
|
-
newnode = new.BinOp()
|
|
288
|
-
_lineno_parent(node, newnode, parent)
|
|
289
|
-
newnode.left = self.visit(node.left, newnode, assign_ctx)
|
|
290
|
-
newnode.right = self.visit(node.right, newnode, assign_ctx)
|
|
291
|
-
newnode.op = _BIN_OP_CLASSES[node.op.__class__]
|
|
292
|
-
return newnode
|
|
293
|
-
|
|
294
|
-
def visit_boolop(self, node, parent, assign_ctx=None):
|
|
295
|
-
"""visit a BoolOp node by returning a fresh instance of it"""
|
|
296
|
-
newnode = new.BoolOp()
|
|
297
|
-
_lineno_parent(node, newnode, parent)
|
|
298
|
-
newnode.values = [self.visit(child, newnode, assign_ctx)
|
|
299
|
-
for child in node.values]
|
|
300
|
-
newnode.op = _BOOL_OP_CLASSES[node.op.__class__]
|
|
301
|
-
return newnode
|
|
302
|
-
|
|
303
|
-
def visit_break(self, node, parent, assign_ctx=None):
|
|
304
|
-
"""visit a Break node by returning a fresh instance of it"""
|
|
305
|
-
newnode = new.Break()
|
|
306
|
-
_set_infos(node, newnode, parent)
|
|
307
|
-
return newnode
|
|
308
|
-
|
|
309
|
-
def visit_call(self, node, parent, assign_ctx=None):
|
|
310
|
-
"""visit a CallFunc node by returning a fresh instance of it"""
|
|
311
|
-
newnode = new.Call()
|
|
312
|
-
_lineno_parent(node, newnode, parent)
|
|
313
|
-
newnode.func = self.visit(node.func, newnode, assign_ctx)
|
|
314
|
-
args = [self.visit(child, newnode, assign_ctx)
|
|
315
|
-
for child in node.args]
|
|
316
|
-
|
|
317
|
-
starargs = _visit_or_none(node, 'starargs', self, newnode,
|
|
318
|
-
assign_ctx)
|
|
319
|
-
kwargs = _visit_or_none(node, 'kwargs', self, newnode,
|
|
320
|
-
assign_ctx)
|
|
321
|
-
keywords = None
|
|
322
|
-
if node.keywords:
|
|
323
|
-
keywords = [self.visit(child, newnode, assign_ctx)
|
|
324
|
-
for child in node.keywords]
|
|
325
|
-
|
|
326
|
-
if starargs:
|
|
327
|
-
new_starargs = new.Starred()
|
|
328
|
-
new_starargs.col_offset = starargs.col_offset
|
|
329
|
-
new_starargs.lineno = starargs.lineno
|
|
330
|
-
new_starargs.parent = starargs.parent
|
|
331
|
-
new_starargs.value = starargs
|
|
332
|
-
args.append(new_starargs)
|
|
333
|
-
if kwargs:
|
|
334
|
-
new_kwargs = new.Keyword()
|
|
335
|
-
new_kwargs.arg = None
|
|
336
|
-
new_kwargs.col_offset = kwargs.col_offset
|
|
337
|
-
new_kwargs.lineno = kwargs.lineno
|
|
338
|
-
new_kwargs.parent = kwargs.parent
|
|
339
|
-
new_kwargs.value = kwargs
|
|
340
|
-
if keywords:
|
|
341
|
-
keywords.append(new_kwargs)
|
|
342
|
-
else:
|
|
343
|
-
keywords = [new_kwargs]
|
|
344
|
-
|
|
345
|
-
newnode.args = args
|
|
346
|
-
newnode.keywords = keywords
|
|
347
|
-
return newnode
|
|
348
|
-
|
|
349
|
-
def visit_classdef(self, node, parent, assign_ctx=None):
|
|
350
|
-
"""visit a Class node to become astroid"""
|
|
351
|
-
newnode = new.ClassDef(node.name, None)
|
|
352
|
-
_lineno_parent(node, newnode, parent)
|
|
353
|
-
_init_set_doc(node, newnode)
|
|
354
|
-
newnode.bases = [self.visit(child, newnode, assign_ctx)
|
|
355
|
-
for child in node.bases]
|
|
356
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
357
|
-
for child in node.body]
|
|
358
|
-
if node.decorator_list:
|
|
359
|
-
newnode.decorators = self.visit_decorators(node, newnode, assign_ctx)
|
|
360
|
-
newnode.parent.frame().set_local(newnode.name, newnode)
|
|
361
|
-
return newnode
|
|
362
|
-
|
|
363
|
-
def visit_const(self, node, parent, assign_ctx=None):
|
|
364
|
-
"""visit a Const node by returning a fresh instance of it"""
|
|
365
|
-
newnode = new.Const(node.value)
|
|
366
|
-
_set_infos(node, newnode, parent)
|
|
367
|
-
return newnode
|
|
368
|
-
|
|
369
|
-
def visit_continue(self, node, parent, assign_ctx=None):
|
|
370
|
-
"""visit a Continue node by returning a fresh instance of it"""
|
|
371
|
-
newnode = new.Continue()
|
|
372
|
-
_set_infos(node, newnode, parent)
|
|
373
|
-
return newnode
|
|
374
|
-
|
|
375
|
-
def visit_compare(self, node, parent, assign_ctx=None):
|
|
376
|
-
"""visit a Compare node by returning a fresh instance of it"""
|
|
377
|
-
newnode = new.Compare()
|
|
378
|
-
_lineno_parent(node, newnode, parent)
|
|
379
|
-
newnode.left = self.visit(node.left, newnode, assign_ctx)
|
|
380
|
-
newnode.ops = [(_CMP_OP_CLASSES[op.__class__], self.visit(expr, newnode, assign_ctx))
|
|
381
|
-
for (op, expr) in zip(node.ops, node.comparators)]
|
|
382
|
-
return newnode
|
|
383
|
-
|
|
384
|
-
def visit_comprehension(self, node, parent, assign_ctx=None):
|
|
385
|
-
"""visit a Comprehension node by returning a fresh instance of it"""
|
|
386
|
-
newnode = new.Comprehension()
|
|
387
|
-
newnode.parent = parent
|
|
388
|
-
newnode.target = self.visit(node.target, newnode, 'Assign')
|
|
389
|
-
newnode.iter = self.visit(node.iter, newnode, None)
|
|
390
|
-
newnode.ifs = [self.visit(child, newnode, None)
|
|
391
|
-
for child in node.ifs]
|
|
392
|
-
return newnode
|
|
393
|
-
|
|
394
|
-
def visit_decorators(self, node, parent, assign_ctx=None):
|
|
395
|
-
"""visit a Decorators node by returning a fresh instance of it"""
|
|
396
|
-
# /!\ node is actually a _ast.Function node while
|
|
397
|
-
# parent is a astroid.nodes.Function node
|
|
398
|
-
newnode = new.Decorators()
|
|
399
|
-
_lineno_parent(node, newnode, parent)
|
|
400
|
-
decorators = node.decorator_list
|
|
401
|
-
newnode.nodes = [self.visit(child, newnode, assign_ctx)
|
|
402
|
-
for child in decorators]
|
|
403
|
-
return newnode
|
|
404
|
-
|
|
405
|
-
def visit_delete(self, node, parent, assign_ctx=None):
|
|
406
|
-
"""visit a Delete node by returning a fresh instance of it"""
|
|
407
|
-
newnode = new.Delete()
|
|
408
|
-
_lineno_parent(node, newnode, parent)
|
|
409
|
-
newnode.targets = [self.visit(child, newnode, 'Del')
|
|
410
|
-
for child in node.targets]
|
|
411
|
-
return newnode
|
|
412
|
-
|
|
413
|
-
def _visit_dict_items(self, node, parent, newnode, assign_ctx):
|
|
414
|
-
for key, value in zip(node.keys, node.values):
|
|
415
|
-
rebuilt_value = self.visit(value, newnode, assign_ctx)
|
|
416
|
-
if not key:
|
|
417
|
-
# Python 3.5 and extended unpacking
|
|
418
|
-
rebuilt_key = new.DictUnpack()
|
|
419
|
-
rebuilt_key.lineno = rebuilt_value.lineno
|
|
420
|
-
rebuilt_key.col_offset = rebuilt_value.col_offset
|
|
421
|
-
rebuilt_key.parent = rebuilt_value.parent
|
|
422
|
-
else:
|
|
423
|
-
rebuilt_key = self.visit(key, newnode, assign_ctx)
|
|
424
|
-
yield rebuilt_key, rebuilt_value
|
|
425
|
-
|
|
426
|
-
def visit_dict(self, node, parent, assign_ctx=None):
|
|
427
|
-
"""visit a Dict node by returning a fresh instance of it"""
|
|
428
|
-
newnode = new.Dict()
|
|
429
|
-
_lineno_parent(node, newnode, parent)
|
|
430
|
-
newnode.items = list(self._visit_dict_items(node, parent, newnode, assign_ctx))
|
|
431
|
-
return newnode
|
|
432
|
-
|
|
433
|
-
def visit_dictcomp(self, node, parent, assign_ctx=None):
|
|
434
|
-
"""visit a DictComp node by returning a fresh instance of it"""
|
|
435
|
-
newnode = new.DictComp()
|
|
436
|
-
_lineno_parent(node, newnode, parent)
|
|
437
|
-
newnode.key = self.visit(node.key, newnode, assign_ctx)
|
|
438
|
-
newnode.value = self.visit(node.value, newnode, assign_ctx)
|
|
439
|
-
newnode.generators = [self.visit(child, newnode, assign_ctx)
|
|
440
|
-
for child in node.generators]
|
|
441
|
-
return newnode
|
|
442
|
-
|
|
443
|
-
def visit_expr(self, node, parent, assign_ctx=None):
|
|
444
|
-
"""visit a Discard node by returning a fresh instance of it"""
|
|
445
|
-
newnode = new.Expr()
|
|
446
|
-
_lineno_parent(node, newnode, parent)
|
|
447
|
-
newnode.value = self.visit(node.value, newnode, assign_ctx)
|
|
448
|
-
return newnode
|
|
449
|
-
|
|
450
|
-
def visit_ellipsis(self, node, parent, assign_ctx=None):
|
|
451
|
-
"""visit an Ellipsis node by returning a fresh instance of it"""
|
|
452
|
-
newnode = new.Ellipsis()
|
|
453
|
-
_set_infos(node, newnode, parent)
|
|
454
|
-
return newnode
|
|
455
|
-
|
|
456
|
-
def visit_emptynode(self, node, parent, assign_ctx=None):
|
|
457
|
-
"""visit an EmptyNode node by returning a fresh instance of it"""
|
|
458
|
-
newnode = new.EmptyNode()
|
|
459
|
-
_set_infos(node, newnode, parent)
|
|
460
|
-
return newnode
|
|
461
|
-
|
|
462
|
-
def visit_excepthandler(self, node, parent, assign_ctx=None):
|
|
463
|
-
"""visit an ExceptHandler node by returning a fresh instance of it"""
|
|
464
|
-
newnode = new.ExceptHandler()
|
|
465
|
-
_lineno_parent(node, newnode, parent)
|
|
466
|
-
if node.type is not None:
|
|
467
|
-
newnode.type = self.visit(node.type, newnode, assign_ctx)
|
|
468
|
-
if node.name is not None:
|
|
469
|
-
# /!\ node.name can be a tuple
|
|
470
|
-
newnode.name = self.visit(node.name, newnode, 'Assign')
|
|
471
|
-
newnode.body = [self.visit(child, newnode, None)
|
|
472
|
-
for child in node.body]
|
|
473
|
-
return newnode
|
|
474
|
-
|
|
475
|
-
def visit_exec(self, node, parent, assign_ctx=None):
|
|
476
|
-
"""visit an Exec node by returning a fresh instance of it"""
|
|
477
|
-
newnode = new.Exec()
|
|
478
|
-
_lineno_parent(node, newnode, parent)
|
|
479
|
-
newnode.expr = self.visit(node.body, newnode)
|
|
480
|
-
if node.globals is not None:
|
|
481
|
-
newnode.globals = self.visit(node.globals, newnode,
|
|
482
|
-
assign_ctx)
|
|
483
|
-
if node.locals is not None:
|
|
484
|
-
newnode.locals = self.visit(node.locals, newnode,
|
|
485
|
-
assign_ctx)
|
|
486
|
-
return newnode
|
|
487
|
-
|
|
488
|
-
def visit_extslice(self, node, parent, assign_ctx=None):
|
|
489
|
-
"""visit an ExtSlice node by returning a fresh instance of it"""
|
|
490
|
-
newnode = new.ExtSlice()
|
|
491
|
-
newnode.parent = parent
|
|
492
|
-
newnode.dims = [self.visit(dim, newnode, assign_ctx)
|
|
493
|
-
for dim in node.dims]
|
|
494
|
-
return newnode
|
|
495
|
-
|
|
496
|
-
def _visit_for(self, cls, node, parent, assign_ctx=None):
|
|
497
|
-
"""visit a For node by returning a fresh instance of it"""
|
|
498
|
-
newnode = cls()
|
|
499
|
-
_lineno_parent(node, newnode, parent)
|
|
500
|
-
newnode.target = self.visit(node.target, newnode, "Assign")
|
|
501
|
-
newnode.iter = self.visit(node.iter, newnode, None)
|
|
502
|
-
newnode.body = [self.visit(child, newnode, None)
|
|
503
|
-
for child in node.body]
|
|
504
|
-
newnode.orelse = [self.visit(child, newnode, None)
|
|
505
|
-
for child in node.orelse]
|
|
506
|
-
return newnode
|
|
507
|
-
|
|
508
|
-
def visit_for(self, node, parent, assign_ctx=None):
|
|
509
|
-
return self._visit_for(new.For, node, parent,
|
|
510
|
-
assign_ctx=assign_ctx)
|
|
511
|
-
def visit_importfrom(self, node, parent, assign_ctx=None):
|
|
512
|
-
"""visit a From node by returning a fresh instance of it"""
|
|
513
|
-
names = [(alias.name, alias.asname) for alias in node.names]
|
|
514
|
-
newnode = new.ImportFrom(node.module or '', names, node.level or None)
|
|
515
|
-
_set_infos(node, newnode, parent)
|
|
516
|
-
# store From names to add them to locals after building
|
|
517
|
-
self._import_from_nodes.append(newnode)
|
|
518
|
-
return newnode
|
|
519
|
-
|
|
520
|
-
def _visit_functiondef(self, cls, node, parent, assign_ctx=None):
|
|
521
|
-
"""visit an FunctionDef node to become astroid"""
|
|
522
|
-
self._global_names.append({})
|
|
523
|
-
newnode = cls(node.name, None)
|
|
524
|
-
_lineno_parent(node, newnode, parent)
|
|
525
|
-
_init_set_doc(node, newnode)
|
|
526
|
-
newnode.args = self.visit(node.args, newnode, assign_ctx)
|
|
527
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
528
|
-
for child in node.body]
|
|
529
|
-
decorators = node.decorator_list
|
|
530
|
-
if decorators:
|
|
531
|
-
newnode.decorators = self.visit_decorators(
|
|
532
|
-
node, newnode, assign_ctx)
|
|
533
|
-
if PY3K and node.returns:
|
|
534
|
-
newnode.returns = self.visit(node.returns, newnode,
|
|
535
|
-
assign_ctx)
|
|
536
|
-
self._global_names.pop()
|
|
537
|
-
frame = newnode.parent.frame()
|
|
538
|
-
frame.set_local(newnode.name, newnode)
|
|
539
|
-
return newnode
|
|
540
|
-
|
|
541
|
-
def visit_functiondef(self, node, parent, assign_ctx=None):
|
|
542
|
-
return self._visit_functiondef(new.FunctionDef, node, parent,
|
|
543
|
-
assign_ctx=assign_ctx)
|
|
544
|
-
|
|
545
|
-
def visit_generatorexp(self, node, parent, assign_ctx=None):
|
|
546
|
-
"""visit a GenExpr node by returning a fresh instance of it"""
|
|
547
|
-
newnode = new.GeneratorExp()
|
|
548
|
-
_lineno_parent(node, newnode, parent)
|
|
549
|
-
newnode.elt = self.visit(node.elt, newnode, assign_ctx)
|
|
550
|
-
newnode.generators = [self.visit(child, newnode, assign_ctx)
|
|
551
|
-
for child in node.generators]
|
|
552
|
-
return newnode
|
|
553
|
-
|
|
554
|
-
def visit_attribute(self, node, parent, assign_ctx=None):
|
|
555
|
-
"""visit a Getattr node by returning a fresh instance of it"""
|
|
556
|
-
# pylint: disable=redefined-variable-type
|
|
557
|
-
if assign_ctx == "Del":
|
|
558
|
-
# FIXME : maybe we should reintroduce and visit_delattr ?
|
|
559
|
-
# for instance, deactivating asscontext
|
|
560
|
-
newnode = new.DelAttr()
|
|
561
|
-
elif assign_ctx == "Assign":
|
|
562
|
-
# FIXME : maybe we should call visit_assattr ?
|
|
563
|
-
# Prohibit a local save if we are in an ExceptHandler.
|
|
564
|
-
newnode = new.AssignAttr()
|
|
565
|
-
if not isinstance(parent, new.ExceptHandler):
|
|
566
|
-
self._delayed_assattr.append(newnode)
|
|
567
|
-
else:
|
|
568
|
-
newnode = new.Attribute()
|
|
569
|
-
_lineno_parent(node, newnode, parent)
|
|
570
|
-
newnode.expr = self.visit(node.value, newnode, None)
|
|
571
|
-
newnode.attrname = node.attr
|
|
572
|
-
return newnode
|
|
573
|
-
|
|
574
|
-
def visit_global(self, node, parent, assign_ctx=None):
|
|
575
|
-
"""visit an Global node to become astroid"""
|
|
576
|
-
newnode = new.Global(node.names)
|
|
577
|
-
_set_infos(node, newnode, parent)
|
|
578
|
-
if self._global_names: # global at the module level, no effect
|
|
579
|
-
for name in node.names:
|
|
580
|
-
self._global_names[-1].setdefault(name, []).append(newnode)
|
|
581
|
-
return newnode
|
|
582
|
-
|
|
583
|
-
def visit_if(self, node, parent, assign_ctx=None):
|
|
584
|
-
"""visit a If node by returning a fresh instance of it"""
|
|
585
|
-
newnode = new.If()
|
|
586
|
-
_lineno_parent(node, newnode, parent)
|
|
587
|
-
newnode.test = self.visit(node.test, newnode, assign_ctx)
|
|
588
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
589
|
-
for child in node.body]
|
|
590
|
-
newnode.orelse = [self.visit(child, newnode, assign_ctx)
|
|
591
|
-
for child in node.orelse]
|
|
592
|
-
return newnode
|
|
593
|
-
|
|
594
|
-
def visit_ifexp(self, node, parent, assign_ctx=None):
|
|
595
|
-
"""visit a IfExp node by returning a fresh instance of it"""
|
|
596
|
-
newnode = new.IfExp()
|
|
597
|
-
_lineno_parent(node, newnode, parent)
|
|
598
|
-
newnode.test = self.visit(node.test, newnode, assign_ctx)
|
|
599
|
-
newnode.body = self.visit(node.body, newnode, assign_ctx)
|
|
600
|
-
newnode.orelse = self.visit(node.orelse, newnode, assign_ctx)
|
|
601
|
-
return newnode
|
|
602
|
-
|
|
603
|
-
def visit_import(self, node, parent, assign_ctx=None):
|
|
604
|
-
"""visit a Import node by returning a fresh instance of it"""
|
|
605
|
-
newnode = new.Import()
|
|
606
|
-
_set_infos(node, newnode, parent)
|
|
607
|
-
newnode.names = [(alias.name, alias.asname) for alias in node.names]
|
|
608
|
-
# save import names in parent's locals:
|
|
609
|
-
for (name, asname) in newnode.names:
|
|
610
|
-
name = asname or name
|
|
611
|
-
newnode.parent.set_local(name.split('.')[0], newnode)
|
|
612
|
-
return newnode
|
|
613
|
-
|
|
614
|
-
def visit_index(self, node, parent, assign_ctx=None):
|
|
615
|
-
"""visit a Index node by returning a fresh instance of it"""
|
|
616
|
-
newnode = new.Index()
|
|
617
|
-
newnode.parent = parent
|
|
618
|
-
newnode.value = self.visit(node.value, newnode, assign_ctx)
|
|
619
|
-
return newnode
|
|
620
|
-
|
|
621
|
-
def visit_keyword(self, node, parent, assign_ctx=None):
|
|
622
|
-
"""visit a Keyword node by returning a fresh instance of it"""
|
|
623
|
-
newnode = new.Keyword()
|
|
624
|
-
newnode.parent = parent
|
|
625
|
-
newnode.arg = node.arg
|
|
626
|
-
newnode.value = self.visit(node.value, newnode, assign_ctx)
|
|
627
|
-
return newnode
|
|
628
|
-
|
|
629
|
-
def visit_lambda(self, node, parent, assign_ctx=None):
|
|
630
|
-
"""visit a Lambda node by returning a fresh instance of it"""
|
|
631
|
-
newnode = new.Lambda()
|
|
632
|
-
_lineno_parent(node, newnode, parent)
|
|
633
|
-
newnode.args = self.visit(node.args, newnode, assign_ctx)
|
|
634
|
-
newnode.body = self.visit(node.body, newnode, assign_ctx)
|
|
635
|
-
return newnode
|
|
636
|
-
|
|
637
|
-
def visit_list(self, node, parent, assign_ctx=None):
|
|
638
|
-
"""visit a List node by returning a fresh instance of it"""
|
|
639
|
-
newnode = new.List()
|
|
640
|
-
_lineno_parent(node, newnode, parent)
|
|
641
|
-
newnode.elts = [self.visit(child, newnode, assign_ctx)
|
|
642
|
-
for child in node.elts]
|
|
643
|
-
return newnode
|
|
644
|
-
|
|
645
|
-
def visit_listcomp(self, node, parent, assign_ctx=None):
|
|
646
|
-
"""visit a ListComp node by returning a fresh instance of it"""
|
|
647
|
-
newnode = new.ListComp()
|
|
648
|
-
_lineno_parent(node, newnode, parent)
|
|
649
|
-
newnode.elt = self.visit(node.elt, newnode, assign_ctx)
|
|
650
|
-
newnode.generators = [self.visit(child, newnode, assign_ctx)
|
|
651
|
-
for child in node.generators]
|
|
652
|
-
return newnode
|
|
653
|
-
|
|
654
|
-
def visit_name(self, node, parent, assign_ctx=None):
|
|
655
|
-
"""visit a Name node by returning a fresh instance of it"""
|
|
656
|
-
# True and False can be assigned to something in py2x, so we have to
|
|
657
|
-
# check first the asscontext
|
|
658
|
-
# pylint: disable=redefined-variable-type
|
|
659
|
-
if assign_ctx == "Del":
|
|
660
|
-
newnode = new.DelName()
|
|
661
|
-
elif assign_ctx is not None: # Ass
|
|
662
|
-
newnode = new.AssName()
|
|
663
|
-
elif node.id in CONST_NAME_TRANSFORMS:
|
|
664
|
-
newnode = new.Const(CONST_NAME_TRANSFORMS[node.id])
|
|
665
|
-
_set_infos(node, newnode, parent)
|
|
666
|
-
return newnode
|
|
667
|
-
else:
|
|
668
|
-
newnode = new.Name()
|
|
669
|
-
_lineno_parent(node, newnode, parent)
|
|
670
|
-
newnode.name = node.id
|
|
671
|
-
# XXX REMOVE me :
|
|
672
|
-
if assign_ctx in ('Del', 'Assign'): # 'Aug' ??
|
|
673
|
-
self._save_assignment(newnode)
|
|
674
|
-
return newnode
|
|
675
|
-
|
|
676
|
-
def visit_bytes(self, node, parent, assign_ctx=None):
|
|
677
|
-
"""visit a Bytes node by returning a fresh instance of Const"""
|
|
678
|
-
newnode = new.Const(node.s)
|
|
679
|
-
_set_infos(node, newnode, parent)
|
|
680
|
-
return newnode
|
|
681
|
-
|
|
682
|
-
def visit_num(self, node, parent, assign_ctx=None):
|
|
683
|
-
"""visit a Num node by returning a fresh instance of Const"""
|
|
684
|
-
newnode = new.Const(node.n)
|
|
685
|
-
_set_infos(node, newnode, parent)
|
|
686
|
-
return newnode
|
|
687
|
-
|
|
688
|
-
def visit_pass(self, node, parent, assign_ctx=None):
|
|
689
|
-
"""visit a Pass node by returning a fresh instance of it"""
|
|
690
|
-
newnode = new.Pass()
|
|
691
|
-
_set_infos(node, newnode, parent)
|
|
692
|
-
return newnode
|
|
693
|
-
|
|
694
|
-
def visit_str(self, node, parent, assign_ctx=None):
|
|
695
|
-
"""visit a Str node by returning a fresh instance of Const"""
|
|
696
|
-
newnode = new.Const(node.s)
|
|
697
|
-
_set_infos(node, newnode, parent)
|
|
698
|
-
return newnode
|
|
699
|
-
|
|
700
|
-
def visit_print(self, node, parent, assign_ctx=None):
|
|
701
|
-
"""visit a Print node by returning a fresh instance of it"""
|
|
702
|
-
newnode = new.Print()
|
|
703
|
-
_lineno_parent(node, newnode, parent)
|
|
704
|
-
newnode.nl = node.nl
|
|
705
|
-
if node.dest is not None:
|
|
706
|
-
newnode.dest = self.visit(node.dest, newnode, assign_ctx)
|
|
707
|
-
newnode.values = [self.visit(child, newnode, assign_ctx)
|
|
708
|
-
for child in node.values]
|
|
709
|
-
return newnode
|
|
710
|
-
|
|
711
|
-
def visit_raise(self, node, parent, assign_ctx=None):
|
|
712
|
-
"""visit a Raise node by returning a fresh instance of it"""
|
|
713
|
-
newnode = new.Raise()
|
|
714
|
-
_lineno_parent(node, newnode, parent)
|
|
715
|
-
if node.type is not None:
|
|
716
|
-
newnode.exc = self.visit(node.type, newnode, assign_ctx)
|
|
717
|
-
if node.inst is not None:
|
|
718
|
-
newnode.inst = self.visit(node.inst, newnode, assign_ctx)
|
|
719
|
-
if node.tback is not None:
|
|
720
|
-
newnode.tback = self.visit(node.tback, newnode, assign_ctx)
|
|
721
|
-
return newnode
|
|
722
|
-
|
|
723
|
-
def visit_return(self, node, parent, assign_ctx=None):
|
|
724
|
-
"""visit a Return node by returning a fresh instance of it"""
|
|
725
|
-
newnode = new.Return()
|
|
726
|
-
_lineno_parent(node, newnode, parent)
|
|
727
|
-
if node.value is not None:
|
|
728
|
-
newnode.value = self.visit(node.value, newnode, assign_ctx)
|
|
729
|
-
return newnode
|
|
730
|
-
|
|
731
|
-
def visit_set(self, node, parent, assign_ctx=None):
|
|
732
|
-
"""visit a Set node by returning a fresh instance of it"""
|
|
733
|
-
newnode = new.Set()
|
|
734
|
-
_lineno_parent(node, newnode, parent)
|
|
735
|
-
newnode.elts = [self.visit(child, newnode, assign_ctx)
|
|
736
|
-
for child in node.elts]
|
|
737
|
-
return newnode
|
|
738
|
-
|
|
739
|
-
def visit_setcomp(self, node, parent, assign_ctx=None):
|
|
740
|
-
"""visit a SetComp node by returning a fresh instance of it"""
|
|
741
|
-
newnode = new.SetComp()
|
|
742
|
-
_lineno_parent(node, newnode, parent)
|
|
743
|
-
newnode.elt = self.visit(node.elt, newnode, assign_ctx)
|
|
744
|
-
newnode.generators = [self.visit(child, newnode, assign_ctx)
|
|
745
|
-
for child in node.generators]
|
|
746
|
-
return newnode
|
|
747
|
-
|
|
748
|
-
def visit_slice(self, node, parent, assign_ctx=None):
|
|
749
|
-
"""visit a Slice node by returning a fresh instance of it"""
|
|
750
|
-
newnode = new.Slice()
|
|
751
|
-
newnode.parent = parent
|
|
752
|
-
if node.lower is not None:
|
|
753
|
-
newnode.lower = self.visit(node.lower, newnode, assign_ctx)
|
|
754
|
-
if node.upper is not None:
|
|
755
|
-
newnode.upper = self.visit(node.upper, newnode, assign_ctx)
|
|
756
|
-
if node.step is not None:
|
|
757
|
-
newnode.step = self.visit(node.step, newnode, assign_ctx)
|
|
758
|
-
return newnode
|
|
759
|
-
|
|
760
|
-
def visit_subscript(self, node, parent, assign_ctx=None):
|
|
761
|
-
"""visit a Subscript node by returning a fresh instance of it"""
|
|
762
|
-
newnode = new.Subscript()
|
|
763
|
-
_lineno_parent(node, newnode, parent)
|
|
764
|
-
newnode.value = self.visit(node.value, newnode, None)
|
|
765
|
-
newnode.slice = self.visit(node.slice, newnode, None)
|
|
766
|
-
return newnode
|
|
767
|
-
|
|
768
|
-
def visit_tryexcept(self, node, parent, assign_ctx=None):
|
|
769
|
-
"""visit a TryExcept node by returning a fresh instance of it"""
|
|
770
|
-
newnode = new.TryExcept()
|
|
771
|
-
_lineno_parent(node, newnode, parent)
|
|
772
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
773
|
-
for child in node.body]
|
|
774
|
-
newnode.handlers = [self.visit(child, newnode, assign_ctx)
|
|
775
|
-
for child in node.handlers]
|
|
776
|
-
newnode.orelse = [self.visit(child, newnode, assign_ctx)
|
|
777
|
-
for child in node.orelse]
|
|
778
|
-
return newnode
|
|
779
|
-
|
|
780
|
-
def visit_tryfinally(self, node, parent, assign_ctx=None):
|
|
781
|
-
"""visit a TryFinally node by returning a fresh instance of it"""
|
|
782
|
-
newnode = new.TryFinally()
|
|
783
|
-
_lineno_parent(node, newnode, parent)
|
|
784
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
785
|
-
for child in node.body]
|
|
786
|
-
newnode.finalbody = [self.visit(n, newnode, assign_ctx)
|
|
787
|
-
for n in node.finalbody]
|
|
788
|
-
return newnode
|
|
789
|
-
|
|
790
|
-
def visit_tuple(self, node, parent, assign_ctx=None):
|
|
791
|
-
"""visit a Tuple node by returning a fresh instance of it"""
|
|
792
|
-
newnode = new.Tuple()
|
|
793
|
-
_lineno_parent(node, newnode, parent)
|
|
794
|
-
newnode.elts = [self.visit(child, newnode, assign_ctx)
|
|
795
|
-
for child in node.elts]
|
|
796
|
-
return newnode
|
|
797
|
-
|
|
798
|
-
def visit_unaryop(self, node, parent, assign_ctx=None):
|
|
799
|
-
"""visit a UnaryOp node by returning a fresh instance of it"""
|
|
800
|
-
newnode = new.UnaryOp()
|
|
801
|
-
_lineno_parent(node, newnode, parent)
|
|
802
|
-
newnode.operand = self.visit(node.operand, newnode, assign_ctx)
|
|
803
|
-
newnode.op = _UNARY_OP_CLASSES[node.op.__class__]
|
|
804
|
-
return newnode
|
|
805
|
-
|
|
806
|
-
def visit_while(self, node, parent, assign_ctx=None):
|
|
807
|
-
"""visit a While node by returning a fresh instance of it"""
|
|
808
|
-
newnode = new.While()
|
|
809
|
-
_lineno_parent(node, newnode, parent)
|
|
810
|
-
newnode.test = self.visit(node.test, newnode, assign_ctx)
|
|
811
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
812
|
-
for child in node.body]
|
|
813
|
-
newnode.orelse = [self.visit(child, newnode, assign_ctx)
|
|
814
|
-
for child in node.orelse]
|
|
815
|
-
return newnode
|
|
816
|
-
|
|
817
|
-
def visit_with(self, node, parent, assign_ctx=None):
|
|
818
|
-
newnode = new.With()
|
|
819
|
-
_lineno_parent(node, newnode, parent)
|
|
820
|
-
expr = self.visit(node.context_expr, newnode, assign_ctx)
|
|
821
|
-
if node.optional_vars is not None:
|
|
822
|
-
vars = self.visit(node.optional_vars, newnode, 'Assign')
|
|
823
|
-
else:
|
|
824
|
-
vars = None
|
|
825
|
-
self.asscontext = None
|
|
826
|
-
newnode.items = [(expr, vars)]
|
|
827
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
828
|
-
for child in node.body]
|
|
829
|
-
return newnode
|
|
830
|
-
|
|
831
|
-
def visit_yield(self, node, parent, assign_ctx=None):
|
|
832
|
-
"""visit a Yield node by returning a fresh instance of it"""
|
|
833
|
-
return _create_yield_node(node, parent, self, new.Yield)
|
|
834
|
-
|
|
835
|
-
class TreeRebuilder3k(TreeRebuilder):
|
|
836
|
-
"""extend and overwrite TreeRebuilder for python3k"""
|
|
837
|
-
|
|
838
|
-
def visit_arg(self, node, parent, assign_ctx=None):
|
|
839
|
-
"""visit a arg node by returning a fresh AssName instance"""
|
|
840
|
-
# TODO(cpopa): introduce an Arg node instead of using AssignName.
|
|
841
|
-
return self.visit_assignname(node, parent, assign_ctx, node.arg)
|
|
842
|
-
|
|
843
|
-
def visit_nameconstant(self, node, parent, assign_ctx=None):
|
|
844
|
-
# in Python 3.4 we have NameConstant for True / False / None
|
|
845
|
-
newnode = new.Const(node.value)
|
|
846
|
-
_set_infos(node, newnode, parent)
|
|
847
|
-
return newnode
|
|
848
|
-
|
|
849
|
-
def visit_arguments(self, node, parent, assign_ctx=None):
|
|
850
|
-
newnode = super(TreeRebuilder3k, self).visit_arguments(node, parent, assign_ctx)
|
|
851
|
-
newnode.kwonlyargs = [self.visit(child, newnode, 'Assign')
|
|
852
|
-
for child in node.kwonlyargs]
|
|
853
|
-
newnode.kw_defaults = [self.visit(child, newnode, None)
|
|
854
|
-
if child else None for child in node.kw_defaults]
|
|
855
|
-
newnode.annotations = [
|
|
856
|
-
self.visit(arg.annotation, newnode, None) if arg.annotation else None
|
|
857
|
-
for arg in node.args]
|
|
858
|
-
return newnode
|
|
859
|
-
|
|
860
|
-
def visit_excepthandler(self, node, parent, assign_ctx=None):
|
|
861
|
-
"""visit an ExceptHandler node by returning a fresh instance of it"""
|
|
862
|
-
newnode = new.ExceptHandler()
|
|
863
|
-
_lineno_parent(node, newnode, parent)
|
|
864
|
-
if node.type is not None:
|
|
865
|
-
newnode.type = self.visit(node.type, newnode, assign_ctx)
|
|
866
|
-
if node.name is not None:
|
|
867
|
-
newnode.name = self.visit_assignname(node, newnode, 'Assign', node.name)
|
|
868
|
-
newnode.body = [self.visit(child, newnode, None)
|
|
869
|
-
for child in node.body]
|
|
870
|
-
return newnode
|
|
871
|
-
|
|
872
|
-
def visit_nonlocal(self, node, parent, assign_ctx=None):
|
|
873
|
-
"""visit a Nonlocal node and return a new instance of it"""
|
|
874
|
-
newnode = new.Nonlocal(node.names)
|
|
875
|
-
_set_infos(node, newnode, parent)
|
|
876
|
-
return newnode
|
|
877
|
-
|
|
878
|
-
def visit_raise(self, node, parent, assign_ctx=None):
|
|
879
|
-
"""visit a Raise node by returning a fresh instance of it"""
|
|
880
|
-
newnode = new.Raise()
|
|
881
|
-
_lineno_parent(node, newnode, parent)
|
|
882
|
-
# no traceback; anyway it is not used in Pylint
|
|
883
|
-
if node.exc is not None:
|
|
884
|
-
newnode.exc = self.visit(node.exc, newnode, assign_ctx)
|
|
885
|
-
if node.cause is not None:
|
|
886
|
-
newnode.cause = self.visit(node.cause, newnode, assign_ctx)
|
|
887
|
-
return newnode
|
|
888
|
-
|
|
889
|
-
def visit_starred(self, node, parent, assign_ctx=None):
|
|
890
|
-
"""visit a Starred node and return a new instance of it"""
|
|
891
|
-
newnode = new.Starred()
|
|
892
|
-
_lineno_parent(node, newnode, parent)
|
|
893
|
-
newnode.value = self.visit(node.value, newnode, assign_ctx)
|
|
894
|
-
return newnode
|
|
895
|
-
|
|
896
|
-
def visit_try(self, node, parent, assign_ctx=None):
|
|
897
|
-
# python 3.3 introduce a new Try node replacing TryFinally/TryExcept nodes
|
|
898
|
-
# pylint: disable=redefined-variable-type
|
|
899
|
-
if node.finalbody:
|
|
900
|
-
newnode = new.TryFinally()
|
|
901
|
-
_lineno_parent(node, newnode, parent)
|
|
902
|
-
newnode.finalbody = [self.visit(n, newnode, assign_ctx)
|
|
903
|
-
for n in node.finalbody]
|
|
904
|
-
if node.handlers:
|
|
905
|
-
excnode = new.TryExcept()
|
|
906
|
-
_lineno_parent(node, excnode, newnode)
|
|
907
|
-
excnode.body = [self.visit(child, excnode, assign_ctx)
|
|
908
|
-
for child in node.body]
|
|
909
|
-
excnode.handlers = [self.visit(child, excnode, assign_ctx)
|
|
910
|
-
for child in node.handlers]
|
|
911
|
-
excnode.orelse = [self.visit(child, excnode, assign_ctx)
|
|
912
|
-
for child in node.orelse]
|
|
913
|
-
newnode.body = [excnode]
|
|
914
|
-
else:
|
|
915
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
916
|
-
for child in node.body]
|
|
917
|
-
elif node.handlers:
|
|
918
|
-
newnode = new.TryExcept()
|
|
919
|
-
_lineno_parent(node, newnode, parent)
|
|
920
|
-
newnode.body = [self.visit(child, newnode, assign_ctx)
|
|
921
|
-
for child in node.body]
|
|
922
|
-
newnode.handlers = [self.visit(child, newnode, assign_ctx)
|
|
923
|
-
for child in node.handlers]
|
|
924
|
-
newnode.orelse = [self.visit(child, newnode, assign_ctx)
|
|
925
|
-
for child in node.orelse]
|
|
926
|
-
return newnode
|
|
927
|
-
|
|
928
|
-
def _visit_with(self, cls, node, parent, assign_ctx=None):
|
|
929
|
-
if 'items' not in node._fields:
|
|
930
|
-
# python < 3.3
|
|
931
|
-
return super(TreeRebuilder3k, self).visit_with(node, parent,
|
|
932
|
-
assign_ctx)
|
|
933
|
-
|
|
934
|
-
newnode = cls()
|
|
935
|
-
_lineno_parent(node, newnode, parent)
|
|
936
|
-
def visit_child(child):
|
|
937
|
-
expr = self.visit(child.context_expr, newnode)
|
|
938
|
-
if child.optional_vars:
|
|
939
|
-
var = self.visit(child.optional_vars, newnode,
|
|
940
|
-
'Assign')
|
|
941
|
-
else:
|
|
942
|
-
var = None
|
|
943
|
-
return expr, var
|
|
944
|
-
newnode.items = [visit_child(child)
|
|
945
|
-
for child in node.items]
|
|
946
|
-
newnode.body = [self.visit(child, newnode, None)
|
|
947
|
-
for child in node.body]
|
|
948
|
-
return newnode
|
|
949
|
-
|
|
950
|
-
def visit_with(self, node, parent, assign_ctx=None):
|
|
951
|
-
return self._visit_with(new.With, node, parent, assign_ctx=assign_ctx)
|
|
952
|
-
|
|
953
|
-
def visit_yieldfrom(self, node, parent, assign_ctx=None):
|
|
954
|
-
return _create_yield_node(node, parent, self, new.YieldFrom)
|
|
955
|
-
|
|
956
|
-
def visit_classdef(self, node, parent, assign_ctx=None):
|
|
957
|
-
newnode = super(TreeRebuilder3k, self).visit_classdef(node, parent, assign_ctx)
|
|
958
|
-
newnode._newstyle = True
|
|
959
|
-
for keyword in node.keywords:
|
|
960
|
-
if keyword.arg == 'metaclass':
|
|
961
|
-
newnode._metaclass = self.visit(keyword, newnode, assign_ctx).value
|
|
962
|
-
break
|
|
963
|
-
return newnode
|
|
964
|
-
|
|
965
|
-
# Async structs added in Python 3.5
|
|
966
|
-
def visit_asyncfunctiondef(self, node, parent, assign_ctx=None):
|
|
967
|
-
return self._visit_functiondef(new.AsyncFunctionDef, node, parent,
|
|
968
|
-
assign_ctx=assign_ctx)
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
def visit_asyncfor(self, node, parent, assign_ctx=None):
|
|
972
|
-
return self._visit_for(new.AsyncFor, node, parent,
|
|
973
|
-
assign_ctx=assign_ctx)
|
|
974
|
-
|
|
975
|
-
def visit_await(self, node, parent, assign_ctx=None):
|
|
976
|
-
newnode = new.Await()
|
|
977
|
-
newnode.lineno = node.lineno
|
|
978
|
-
newnode.col_offset = node.col_offset
|
|
979
|
-
newnode.parent = parent
|
|
980
|
-
newnode.value = self.visit(node.value, newnode, None)
|
|
981
|
-
return newnode
|
|
982
|
-
|
|
983
|
-
def visit_asyncwith(self, node, parent, assign_ctx=None):
|
|
984
|
-
return self._visit_with(new.AsyncWith, node, parent,
|
|
985
|
-
assign_ctx=assign_ctx)
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
if sys.version_info >= (3, 0):
|
|
989
|
-
TreeRebuilder = TreeRebuilder3k
|