libv8 6.7.288.46.1 → 7.3.492.27.0beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -0
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/ext/libv8/builder.rb +6 -2
- data/lib/libv8/version.rb +1 -1
- data/vendor/depot_tools/.gitattributes +1 -0
- data/vendor/depot_tools/.gitignore +7 -0
- data/vendor/depot_tools/CROS_OWNERS +5 -0
- data/vendor/depot_tools/OWNERS +12 -1
- data/vendor/depot_tools/PRESUBMIT.py +16 -9
- data/vendor/depot_tools/README.md +9 -2
- data/vendor/depot_tools/autoninja +14 -6
- data/vendor/depot_tools/autoninja.bat +11 -1
- data/vendor/depot_tools/autoninja.py +40 -18
- data/vendor/depot_tools/bb +12 -0
- data/vendor/depot_tools/bb.bat +7 -0
- data/vendor/depot_tools/bootstrap/win/manifest.txt +1 -1
- data/vendor/depot_tools/bootstrap/win/manifest_bleeding_edge.txt +1 -1
- data/vendor/depot_tools/bootstrap/win/win_tools.py +2 -1
- data/vendor/depot_tools/buildbucket.py +57 -4
- data/vendor/depot_tools/cipd +157 -44
- data/vendor/depot_tools/cipd.bat +51 -14
- data/vendor/depot_tools/cipd.ps1 +104 -42
- data/vendor/depot_tools/cipd_client_version +1 -1
- data/vendor/depot_tools/cipd_client_version.digests +21 -0
- data/vendor/depot_tools/cipd_manifest.txt +19 -6
- data/vendor/depot_tools/cipd_manifest.versions +318 -0
- data/vendor/depot_tools/clang_format.py +4 -4
- data/vendor/depot_tools/cpplint.py +44 -199
- data/vendor/depot_tools/dart_format.py +2 -2
- data/vendor/depot_tools/detect_host_arch.py +8 -3
- data/vendor/depot_tools/download_from_google_storage.py +47 -39
- data/vendor/depot_tools/fetch.py +30 -18
- data/vendor/depot_tools/fetch_configs/android_internal.py +34 -0
- data/vendor/depot_tools/fetch_configs/chromium.py +18 -1
- data/vendor/depot_tools/fetch_configs/config_util.py +4 -2
- data/vendor/depot_tools/fetch_configs/inspector_protocol.py +40 -0
- data/vendor/depot_tools/fetch_configs/node-ci.py +41 -0
- data/vendor/depot_tools/fix_encoding.py +3 -3
- data/vendor/depot_tools/gclient +1 -1
- data/vendor/depot_tools/gclient.py +415 -198
- data/vendor/depot_tools/gclient_eval.py +220 -171
- data/vendor/depot_tools/gclient_paths.py +142 -0
- data/vendor/depot_tools/gclient_scm.py +200 -51
- data/vendor/depot_tools/gclient_utils.py +88 -191
- data/vendor/depot_tools/gerrit_client.py +13 -0
- data/vendor/depot_tools/gerrit_util.py +158 -23
- data/vendor/depot_tools/git-nav-upstream +1 -1
- data/vendor/depot_tools/git_cache.py +77 -24
- data/vendor/depot_tools/git_cl.py +705 -1099
- data/vendor/depot_tools/git_common.py +9 -6
- data/vendor/depot_tools/git_map_branches.py +19 -2
- data/vendor/depot_tools/git_nav_downstream.py +3 -4
- data/vendor/depot_tools/git_rebase_update.py +14 -0
- data/vendor/depot_tools/git_reparent_branch.py +8 -2
- data/vendor/depot_tools/gn.py +38 -3
- data/vendor/depot_tools/gsutil.py +8 -3
- data/vendor/depot_tools/gsutil.py.bat +15 -0
- data/vendor/depot_tools/gsutil.vpython +16 -0
- data/vendor/depot_tools/infra/config/OWNERS +0 -1
- data/vendor/depot_tools/infra/config/recipes.cfg +3 -2
- data/vendor/depot_tools/lucicfg +12 -0
- data/vendor/depot_tools/lucicfg.bat +7 -0
- data/vendor/depot_tools/man/html/git-map-branches.html +34 -2
- data/vendor/depot_tools/man/html/git-new-branch.html +40 -32
- data/vendor/depot_tools/man/man1/git-map-branches.1 +24 -5
- data/vendor/depot_tools/man/man1/git-new-branch.1 +35 -27
- data/vendor/depot_tools/man/src/git-map-branches.demo.1.sh +1 -0
- data/vendor/depot_tools/man/src/git-map-branches.txt +10 -0
- data/vendor/depot_tools/man/src/git-new-branch.demo.1.sh +9 -4
- data/vendor/depot_tools/man/src/git-new-branch.txt +1 -1
- data/vendor/depot_tools/metrics.README.md +98 -0
- data/vendor/depot_tools/metrics.py +296 -0
- data/vendor/depot_tools/metrics_utils.py +303 -0
- data/vendor/depot_tools/my_activity.py +91 -29
- data/vendor/depot_tools/ninja +1 -1
- data/vendor/depot_tools/ninjalog.README.md +64 -0
- data/vendor/depot_tools/ninjalog_uploader.py +232 -0
- data/vendor/depot_tools/ninjalog_uploader_wrapper.py +116 -0
- data/vendor/depot_tools/owners.py +30 -13
- data/vendor/depot_tools/owners_finder.py +5 -2
- data/vendor/depot_tools/presubmit_canned_checks.py +188 -29
- data/vendor/depot_tools/presubmit_support.py +18 -41
- data/vendor/depot_tools/pylintrc +23 -19
- data/vendor/depot_tools/recipes/OWNERS +2 -0
- data/vendor/depot_tools/recipes/README.recipes.md +344 -151
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/OWNERS +2 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/__init__.py +2 -16
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/api.py +141 -99
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic.json +5 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_luci.json +5 -8
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/basic_with_branch_heads.json +6 -98
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/clobber.json +4 -9
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/deprecated_got_revision_mapping.json +45 -5
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_rebase_patch_ref.json +4 -9
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/gerrit_no_reset.json +4 -9
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{tryjob.json → input_commit_with_id_without_repo.json} +6 -11
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{tryjob_empty_revision.json → multiple_patch_refs.json} +8 -9
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/no_apply_patch_on_gclient.json +19 -29
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/{trychange.json → refs.json} +4 -9
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/reset_root_solution_revision.json +4 -9
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail.json +51 -6
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch.json +50 -6
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_fail_patch_download.json +51 -6
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle.json +17 -25
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_branch_heads.json +17 -25
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_feature_branch.json +18 -26
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8_feature_branch.json +18 -26
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_webrtc.json +26 -28
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8.json +45 -5
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_v8_head_by_default.json +17 -25
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/unrecognized_commit_repo.json +13 -0
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name.json +13 -152
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_tags.json +4 -9
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.py +185 -202
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/bot_update.py +52 -157
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/test_api.py +5 -14
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/tests/ensure_checkout.py +34 -0
- data/vendor/depot_tools/recipes/recipe_modules/cipd/api.py +14 -2
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic.json +4 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/basic_pkg.json +4 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-failed.json +7 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/describe-many-instances.json +4 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/mac64.json +4 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_file.json +9 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_mode.json +9 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/pkg_bad_verfile.json +9 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/full.expected/win64.json +4 -5
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk arch.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/junk bits.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_32.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_arm_64.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_32.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_intel_64.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/linux_mips_64.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/mac_intel_64.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_32.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/cipd/examples/platform_suffix.expected/win_intel_64.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/api.py +13 -8
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic.json +18 -12
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/basic_luci.json +18 -12
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.expected/win.json +18 -12
- data/vendor/depot_tools/recipes/recipe_modules/depot_tools/examples/full.py +3 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/__init__.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/gclient/api.py +58 -46
- data/vendor/depot_tools/recipes/recipe_modules/gclient/config.py +65 -22
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/basic.json +20 -21
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/buildbot.json +20 -21
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/revision.json +20 -21
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.expected/tryserver.json +20 -21
- data/vendor/depot_tools/recipes/recipe_modules/gclient/examples/full.py +5 -2
- data/vendor/depot_tools/recipes/recipe_modules/gclient/tests/patch_project.py +62 -14
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/api.py +24 -38
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.expected/basic.json +56 -50
- data/vendor/depot_tools/recipes/recipe_modules/gerrit/examples/full.py +15 -9
- data/vendor/depot_tools/recipes/recipe_modules/git/__init__.py +4 -1
- data/vendor/depot_tools/recipes/recipe_modules/git/api.py +34 -22
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_branch.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_file_name.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_hash.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_luci.json +222 -0
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_ref.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_submodule_update_force.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/basic_tags.json +224 -0
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/can_fail_build.json +10 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cannot_fail_build.json +5 -7
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/cat-file_test.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_delta.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_failed.json +5 -7
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/count-objects_with_bad_output_fails_build.json +10 -5
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/curl_trace_file.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/git-cache-checkout.json +8 -9
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/platform_win.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/rebase_failed.json +12 -8
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/remote_not_origin.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.expected/set_got_revision.json +5 -6
- data/vendor/depot_tools/recipes/recipe_modules/git/examples/full.py +27 -11
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/api.py +1 -1
- data/vendor/depot_tools/recipes/recipe_modules/git_cl/examples/full.expected/basic.json +12 -13
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/__init__.py +5 -0
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/api.py +120 -5
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.expected/basic.json +45 -3
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/examples/full.py +25 -0
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/resources/gerrit_client.py +56 -4
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.expected/basic.json +6 -0
- data/vendor/depot_tools/recipes/recipe_modules/gitiles/tests/parse_repo_url.py +49 -0
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/api.py +24 -13
- data/vendor/depot_tools/recipes/recipe_modules/gsutil/examples/full.expected/basic.json +13 -14
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/basic.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_linux.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_mac.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_buildbot_win.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_linux.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_mac.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_generic_win.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_linux.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_mac.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/examples/full.expected/paths_kitchen_win.json +2 -3
- data/vendor/depot_tools/recipes/recipe_modules/infra_paths/path_config.py +1 -2
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/__init__.py +35 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/api.py +116 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/linux.json +22 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/mac.json +82 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.expected/win.json +22 -0
- data/vendor/depot_tools/recipes/recipe_modules/osx_sdk/examples/full.py +23 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/__init__.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/api.py +2 -7
- data/vendor/depot_tools/recipes/recipe_modules/presubmit/examples/full.expected/basic.json +7 -6
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/__init__.py +1 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/api.py +117 -8
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/basic_tags.json +4 -5
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/set_failure_hash_with_no_steps.json +7 -4
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch.json +98 -7
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_gerrit_patch_and_target_ref.json +147 -0
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch.json +8 -5
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_git_patch_luci.json +8 -5
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch.json +9 -6
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.expected/with_wrong_patch_new.json +9 -6
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/examples/full.py +27 -2
- data/vendor/depot_tools/recipes/recipe_modules/tryserver/test_api.py +14 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/__init__.py +25 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/api.py +137 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/linux.json +22 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/mac.json +22 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.expected/win.json +107 -0
- data/vendor/depot_tools/recipes/recipe_modules/windows_sdk/examples/full.py +26 -0
- data/vendor/depot_tools/recipes/recipes.py +37 -27
- data/vendor/depot_tools/recipes/recipes/fetch_end_to_end_test.expected/basic.json +7 -10
- data/vendor/depot_tools/repo +34 -8
- data/vendor/depot_tools/roll_dep.py +52 -49
- data/vendor/depot_tools/scm.py +38 -23
- data/vendor/depot_tools/setup_color.py +4 -2
- data/vendor/depot_tools/split_cl.py +32 -4
- data/vendor/depot_tools/subprocess2.py +22 -4
- data/vendor/depot_tools/third_party/httplib2/README.chromium +2 -2
- data/vendor/depot_tools/third_party/httplib2/__init__.py +242 -158
- data/vendor/depot_tools/third_party/httplib2/cacerts.txt +57 -44
- data/vendor/depot_tools/third_party/httplib2/socks.py +15 -5
- data/vendor/depot_tools/third_party/logilab/README.chromium +2 -4
- data/vendor/depot_tools/third_party/logilab/astroid/README.chromium +2 -1
- data/vendor/depot_tools/third_party/logilab/astroid/__init__.py +10 -5
- data/vendor/depot_tools/third_party/logilab/astroid/__pkginfo__.py +5 -5
- data/vendor/depot_tools/third_party/logilab/astroid/arguments.py +233 -0
- data/vendor/depot_tools/third_party/logilab/astroid/as_string.py +82 -33
- data/vendor/depot_tools/third_party/logilab/astroid/bases.py +137 -153
- data/vendor/depot_tools/third_party/logilab/astroid/brain/{builtin_inference.py → brain_builtin_inference.py} +117 -26
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_dateutil.py +15 -0
- data/vendor/depot_tools/third_party/logilab/astroid/brain/{py2gi.py → brain_gi.py} +48 -8
- data/vendor/depot_tools/third_party/logilab/astroid/brain/{py2mechanize.py → brain_mechanize.py} +0 -0
- data/vendor/depot_tools/third_party/logilab/astroid/brain/{pynose.py → brain_nose.py} +4 -1
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_numpy.py +62 -0
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_pytest.py +76 -0
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_qt.py +44 -0
- data/vendor/depot_tools/third_party/logilab/astroid/brain/{pysix_moves.py → brain_six.py} +28 -1
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_ssl.py +65 -0
- data/vendor/depot_tools/third_party/logilab/astroid/brain/brain_stdlib.py +473 -0
- data/vendor/depot_tools/third_party/logilab/astroid/builder.py +104 -81
- data/vendor/depot_tools/third_party/logilab/astroid/context.py +81 -0
- data/vendor/depot_tools/third_party/logilab/astroid/decorators.py +75 -0
- data/vendor/depot_tools/third_party/logilab/astroid/exceptions.py +20 -0
- data/vendor/depot_tools/third_party/logilab/astroid/inference.py +137 -183
- data/vendor/depot_tools/third_party/logilab/astroid/manager.py +45 -169
- data/vendor/depot_tools/third_party/logilab/astroid/mixins.py +37 -14
- data/vendor/depot_tools/third_party/logilab/astroid/modutils.py +112 -41
- data/vendor/depot_tools/third_party/logilab/astroid/node_classes.py +243 -156
- data/vendor/depot_tools/third_party/logilab/astroid/nodes.py +35 -22
- data/vendor/depot_tools/third_party/logilab/astroid/objects.py +186 -0
- data/vendor/depot_tools/third_party/logilab/astroid/protocols.py +157 -102
- data/vendor/depot_tools/third_party/logilab/astroid/raw_building.py +32 -8
- data/vendor/depot_tools/third_party/logilab/astroid/rebuilder.py +372 -309
- data/vendor/depot_tools/third_party/logilab/astroid/scoped_nodes.py +652 -420
- data/vendor/depot_tools/third_party/logilab/astroid/test_utils.py +4 -21
- data/vendor/depot_tools/third_party/logilab/astroid/transforms.py +96 -0
- data/vendor/depot_tools/third_party/logilab/astroid/util.py +89 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/LICENSE +19 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/README.chromium +11 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/__init__.py +20 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/cext.c +1421 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/compat.py +9 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/simple.py +246 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/slots.py +414 -0
- data/vendor/depot_tools/third_party/logilab/lazy_object_proxy/utils.py +13 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/LICENSE +24 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/README.chromium +11 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/__init__.py +19 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/_wrappers.c +2729 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/arguments.py +96 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/decorators.py +512 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/importer.py +228 -0
- data/vendor/depot_tools/third_party/logilab/wrapt/wrappers.py +901 -0
- data/vendor/depot_tools/third_party/pylint/README.chromium +2 -25
- data/vendor/depot_tools/third_party/pylint/__pkginfo__.py +13 -3
- data/vendor/depot_tools/third_party/pylint/checkers/__init__.py +1 -2
- data/vendor/depot_tools/third_party/pylint/checkers/async.py +82 -0
- data/vendor/depot_tools/third_party/pylint/checkers/base.py +893 -119
- data/vendor/depot_tools/third_party/pylint/checkers/classes.py +342 -204
- data/vendor/depot_tools/third_party/pylint/checkers/design_analysis.py +51 -34
- data/vendor/depot_tools/third_party/pylint/checkers/exceptions.py +84 -47
- data/vendor/depot_tools/third_party/pylint/checkers/format.py +55 -30
- data/vendor/depot_tools/third_party/pylint/checkers/imports.py +314 -73
- data/vendor/depot_tools/third_party/pylint/checkers/logging.py +10 -8
- data/vendor/depot_tools/third_party/pylint/checkers/misc.py +2 -1
- data/vendor/depot_tools/third_party/pylint/checkers/newstyle.py +45 -48
- data/vendor/depot_tools/third_party/pylint/checkers/python3.py +31 -21
- data/vendor/depot_tools/third_party/pylint/checkers/raw_metrics.py +3 -3
- data/vendor/depot_tools/third_party/pylint/checkers/similar.py +4 -5
- data/vendor/depot_tools/third_party/pylint/checkers/spelling.py +24 -10
- data/vendor/depot_tools/third_party/pylint/checkers/stdlib.py +120 -56
- data/vendor/depot_tools/third_party/pylint/checkers/strings.py +38 -35
- data/vendor/depot_tools/third_party/pylint/checkers/typecheck.py +485 -138
- data/vendor/depot_tools/third_party/pylint/checkers/utils.py +319 -142
- data/vendor/depot_tools/third_party/pylint/checkers/variables.py +329 -207
- data/vendor/depot_tools/third_party/pylint/config.py +739 -76
- data/vendor/depot_tools/third_party/pylint/epylint.py +9 -5
- data/vendor/depot_tools/third_party/pylint/extensions/__init__.py +0 -0
- data/vendor/depot_tools/third_party/pylint/extensions/check_docs.py +311 -0
- data/vendor/depot_tools/third_party/pylint/extensions/check_elif.py +62 -0
- data/vendor/depot_tools/third_party/{logilab/common → pylint}/graph.py +30 -133
- data/vendor/depot_tools/third_party/pylint/gui.py +2 -2
- data/vendor/depot_tools/third_party/pylint/interfaces.py +21 -3
- data/vendor/depot_tools/third_party/pylint/lint.py +123 -140
- data/vendor/depot_tools/third_party/pylint/pyreverse/diadefslib.py +10 -13
- data/vendor/depot_tools/third_party/pylint/pyreverse/diagrams.py +15 -4
- data/vendor/depot_tools/third_party/pylint/pyreverse/inspector.py +372 -0
- data/vendor/depot_tools/third_party/pylint/pyreverse/main.py +30 -7
- data/vendor/depot_tools/third_party/pylint/pyreverse/utils.py +80 -2
- data/vendor/depot_tools/third_party/{logilab/common → pylint/pyreverse}/vcgutils.py +19 -37
- data/vendor/depot_tools/third_party/pylint/pyreverse/writer.py +3 -4
- data/vendor/depot_tools/third_party/pylint/reporters/__init__.py +34 -18
- data/vendor/depot_tools/third_party/pylint/reporters/guireporter.py +1 -1
- data/vendor/depot_tools/third_party/pylint/reporters/html.py +10 -3
- data/vendor/depot_tools/third_party/pylint/reporters/json.py +10 -4
- data/vendor/depot_tools/third_party/pylint/reporters/text.py +94 -3
- data/vendor/depot_tools/third_party/pylint/reporters/ureports/__init__.py +106 -0
- data/vendor/depot_tools/third_party/{logilab/common → pylint/reporters}/ureports/html_writer.py +17 -57
- data/vendor/depot_tools/third_party/{logilab/common → pylint/reporters}/ureports/nodes.py +52 -74
- data/vendor/depot_tools/third_party/{logilab/common → pylint/reporters}/ureports/text_writer.py +14 -60
- data/vendor/depot_tools/third_party/pylint/testutils.py +22 -20
- data/vendor/depot_tools/third_party/pylint/utils.py +268 -44
- data/vendor/depot_tools/third_party/repo/progress.py +42 -0
- data/vendor/depot_tools/update_depot_tools +1 -1
- data/vendor/depot_tools/upload_metrics.py +25 -0
- data/vendor/depot_tools/win_toolchain/get_toolchain_if_necessary.py +45 -15
- data/vendor/depot_tools/win_toolchain/package_from_installed.py +71 -24
- data/vendor/depot_tools/yapf +1 -1
- data/vendor/depot_tools/yapf.bat +1 -1
- metadata +92 -77
- data/vendor/depot_tools/git-crsync +0 -3
- data/vendor/depot_tools/infra/config/cq.cfg +0 -32
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref.json +0 -29
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/apply_gerrit_ref_custom.json +0 -29
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/buildbot.json +0 -105
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/shallow.json +0 -195
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_angle_deprecated.json +0 -248
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/tryjob_gerrit_v8.json +0 -248
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/examples/full.expected/with_manifest_name_no_patch.json +0 -105
- data/vendor/depot_tools/recipes/recipe_modules/bot_update/resources/apply_gerrit.py +0 -33
- data/vendor/depot_tools/third_party/logilab/astroid/brain/py2pytest.py +0 -31
- data/vendor/depot_tools/third_party/logilab/astroid/brain/py2qt4.py +0 -22
- data/vendor/depot_tools/third_party/logilab/astroid/brain/py2stdlib.py +0 -334
- data/vendor/depot_tools/third_party/logilab/astroid/inspector.py +0 -273
- data/vendor/depot_tools/third_party/logilab/astroid/utils.py +0 -239
- data/vendor/depot_tools/third_party/logilab/common/LICENSE.txt +0 -339
- data/vendor/depot_tools/third_party/logilab/common/README.chromium +0 -11
- data/vendor/depot_tools/third_party/logilab/common/__init__.py +0 -175
- data/vendor/depot_tools/third_party/logilab/common/__pkginfo__.py +0 -57
- data/vendor/depot_tools/third_party/logilab/common/cache.py +0 -114
- data/vendor/depot_tools/third_party/logilab/common/changelog.py +0 -238
- data/vendor/depot_tools/third_party/logilab/common/clcommands.py +0 -334
- data/vendor/depot_tools/third_party/logilab/common/cli.py +0 -211
- data/vendor/depot_tools/third_party/logilab/common/compat.py +0 -78
- data/vendor/depot_tools/third_party/logilab/common/configuration.py +0 -1105
- data/vendor/depot_tools/third_party/logilab/common/contexts.py +0 -5
- data/vendor/depot_tools/third_party/logilab/common/corbautils.py +0 -117
- data/vendor/depot_tools/third_party/logilab/common/daemon.py +0 -101
- data/vendor/depot_tools/third_party/logilab/common/date.py +0 -335
- data/vendor/depot_tools/third_party/logilab/common/dbf.py +0 -231
- data/vendor/depot_tools/third_party/logilab/common/debugger.py +0 -214
- data/vendor/depot_tools/third_party/logilab/common/decorators.py +0 -281
- data/vendor/depot_tools/third_party/logilab/common/deprecation.py +0 -189
- data/vendor/depot_tools/third_party/logilab/common/fileutils.py +0 -404
- data/vendor/depot_tools/third_party/logilab/common/interface.py +0 -71
- data/vendor/depot_tools/third_party/logilab/common/logging_ext.py +0 -195
- data/vendor/depot_tools/third_party/logilab/common/modutils.py +0 -702
- data/vendor/depot_tools/third_party/logilab/common/optik_ext.py +0 -392
- data/vendor/depot_tools/third_party/logilab/common/optparser.py +0 -92
- data/vendor/depot_tools/third_party/logilab/common/proc.py +0 -277
- data/vendor/depot_tools/third_party/logilab/common/pyro_ext.py +0 -180
- data/vendor/depot_tools/third_party/logilab/common/pytest.py +0 -1199
- data/vendor/depot_tools/third_party/logilab/common/registry.py +0 -1119
- data/vendor/depot_tools/third_party/logilab/common/shellutils.py +0 -462
- data/vendor/depot_tools/third_party/logilab/common/sphinx_ext.py +0 -87
- data/vendor/depot_tools/third_party/logilab/common/sphinxutils.py +0 -122
- data/vendor/depot_tools/third_party/logilab/common/table.py +0 -929
- data/vendor/depot_tools/third_party/logilab/common/tasksqueue.py +0 -101
- data/vendor/depot_tools/third_party/logilab/common/testlib.py +0 -1392
- data/vendor/depot_tools/third_party/logilab/common/textutils.py +0 -537
- data/vendor/depot_tools/third_party/logilab/common/tree.py +0 -369
- data/vendor/depot_tools/third_party/logilab/common/umessage.py +0 -194
- data/vendor/depot_tools/third_party/logilab/common/ureports/__init__.py +0 -172
- data/vendor/depot_tools/third_party/logilab/common/ureports/docbook_writer.py +0 -140
- data/vendor/depot_tools/third_party/logilab/common/urllib2ext.py +0 -89
- data/vendor/depot_tools/third_party/logilab/common/visitor.py +0 -109
- data/vendor/depot_tools/third_party/logilab/common/xmlrpcutils.py +0 -131
- data/vendor/depot_tools/third_party/logilab/common/xmlutils.py +0 -61
@@ -18,40 +18,47 @@
|
|
18
18
|
"""Module for some node classes. More nodes in scoped_nodes.py
|
19
19
|
"""
|
20
20
|
|
21
|
-
import
|
21
|
+
import abc
|
22
|
+
import warnings
|
22
23
|
|
24
|
+
import lazy_object_proxy
|
23
25
|
import six
|
24
|
-
from logilab.common.decorators import cachedproperty
|
25
26
|
|
26
|
-
from astroid
|
27
|
-
from astroid
|
28
|
-
|
29
|
-
from astroid
|
30
|
-
|
27
|
+
from astroid import bases
|
28
|
+
from astroid import context as contextmod
|
29
|
+
from astroid import decorators
|
30
|
+
from astroid import exceptions
|
31
|
+
from astroid import mixins
|
32
|
+
from astroid import util
|
31
33
|
|
32
|
-
PY3K = sys.version_info >= (3, 0)
|
33
34
|
|
35
|
+
BUILTINS = six.moves.builtins.__name__
|
34
36
|
|
37
|
+
|
38
|
+
@bases.raise_if_nothing_inferred
|
35
39
|
def unpack_infer(stmt, context=None):
|
36
40
|
"""recursively generate nodes inferred by the given statement.
|
37
41
|
If the inferred value is a list or a tuple, recurse on the elements
|
38
42
|
"""
|
39
43
|
if isinstance(stmt, (List, Tuple)):
|
40
44
|
for elt in stmt.elts:
|
41
|
-
|
42
|
-
yield
|
45
|
+
if elt is util.YES:
|
46
|
+
yield elt
|
47
|
+
continue
|
48
|
+
for inferred_elt in unpack_infer(elt, context):
|
49
|
+
yield inferred_elt
|
43
50
|
return
|
44
|
-
# if
|
45
|
-
|
46
|
-
if
|
47
|
-
yield
|
51
|
+
# if inferred is a final node, return it and stop
|
52
|
+
inferred = next(stmt.infer(context))
|
53
|
+
if inferred is stmt:
|
54
|
+
yield inferred
|
48
55
|
return
|
49
56
|
# else, infer recursivly, except YES object that should be returned as is
|
50
|
-
for
|
51
|
-
if
|
52
|
-
yield
|
57
|
+
for inferred in stmt.infer(context):
|
58
|
+
if inferred is util.YES:
|
59
|
+
yield inferred
|
53
60
|
else:
|
54
|
-
for inf_inf in unpack_infer(
|
61
|
+
for inf_inf in unpack_infer(inferred, context):
|
55
62
|
yield inf_inf
|
56
63
|
|
57
64
|
|
@@ -93,7 +100,9 @@ def are_exclusive(stmt1, stmt2, exceptions=None):
|
|
93
100
|
c2attr, c2node = node.locate_child(previous)
|
94
101
|
c1attr, c1node = node.locate_child(children[node])
|
95
102
|
if c1node is not c2node:
|
96
|
-
if ((c2attr == 'body'
|
103
|
+
if ((c2attr == 'body'
|
104
|
+
and c1attr == 'handlers'
|
105
|
+
and children[node].catch(exceptions)) or
|
97
106
|
(c2attr == 'handlers' and c1attr == 'body' and previous.catch(exceptions)) or
|
98
107
|
(c2attr == 'handlers' and c1attr == 'orelse') or
|
99
108
|
(c2attr == 'orelse' and c1attr == 'handlers')):
|
@@ -106,6 +115,31 @@ def are_exclusive(stmt1, stmt2, exceptions=None):
|
|
106
115
|
return False
|
107
116
|
|
108
117
|
|
118
|
+
@six.add_metaclass(abc.ABCMeta)
|
119
|
+
class _BaseContainer(mixins.ParentAssignTypeMixin,
|
120
|
+
bases.NodeNG,
|
121
|
+
bases.Instance):
|
122
|
+
"""Base class for Set, FrozenSet, Tuple and List."""
|
123
|
+
|
124
|
+
_astroid_fields = ('elts',)
|
125
|
+
|
126
|
+
def __init__(self, elts=None):
|
127
|
+
if elts is None:
|
128
|
+
self.elts = []
|
129
|
+
else:
|
130
|
+
self.elts = [const_factory(e) for e in elts]
|
131
|
+
|
132
|
+
def itered(self):
|
133
|
+
return self.elts
|
134
|
+
|
135
|
+
def bool_value(self):
|
136
|
+
return bool(self.elts)
|
137
|
+
|
138
|
+
@abc.abstractmethod
|
139
|
+
def pytype(self):
|
140
|
+
pass
|
141
|
+
|
142
|
+
|
109
143
|
class LookupMixIn(object):
|
110
144
|
"""Mixin looking up a name in the right scope
|
111
145
|
"""
|
@@ -124,14 +158,14 @@ class LookupMixIn(object):
|
|
124
158
|
return self.scope().scope_lookup(self, name)
|
125
159
|
|
126
160
|
def ilookup(self, name):
|
127
|
-
"""
|
161
|
+
"""inferred lookup
|
128
162
|
|
129
|
-
return an iterator on
|
163
|
+
return an iterator on inferred values of the statements returned by
|
130
164
|
the lookup method
|
131
165
|
"""
|
132
166
|
frame, stmts = self.lookup(name)
|
133
|
-
context = InferenceContext()
|
134
|
-
return _infer_stmts(stmts, context, frame)
|
167
|
+
context = contextmod.InferenceContext()
|
168
|
+
return bases._infer_stmts(stmts, context, frame)
|
135
169
|
|
136
170
|
def _filter_stmts(self, stmts, frame, offset):
|
137
171
|
"""filter statements to remove ignorable statements.
|
@@ -163,8 +197,7 @@ class LookupMixIn(object):
|
|
163
197
|
|
164
198
|
if self.statement() is myframe and myframe.parent:
|
165
199
|
myframe = myframe.parent.frame()
|
166
|
-
|
167
|
-
return stmts
|
200
|
+
|
168
201
|
mystmt = self.statement()
|
169
202
|
# line filtering if we are in the same frame
|
170
203
|
#
|
@@ -183,19 +216,18 @@ class LookupMixIn(object):
|
|
183
216
|
# line filtering is on and we have reached our location, break
|
184
217
|
if mylineno > 0 and stmt.fromlineno > mylineno:
|
185
218
|
break
|
186
|
-
assert hasattr(node, '
|
187
|
-
|
188
|
-
|
189
|
-
|
219
|
+
assert hasattr(node, 'assign_type'), (node, node.scope(),
|
220
|
+
node.scope().locals)
|
221
|
+
assign_type = node.assign_type()
|
190
222
|
if node.has_base(self):
|
191
223
|
break
|
192
224
|
|
193
|
-
_stmts, done =
|
225
|
+
_stmts, done = assign_type._get_filtered_stmts(self, node, _stmts, mystmt)
|
194
226
|
if done:
|
195
227
|
break
|
196
228
|
|
197
|
-
optional_assign =
|
198
|
-
if optional_assign and
|
229
|
+
optional_assign = assign_type.optional_assign
|
230
|
+
if optional_assign and assign_type.parent_of(self):
|
199
231
|
# we are inside a loop, loop var assigment is hidding previous
|
200
232
|
# assigment
|
201
233
|
_stmts = [node]
|
@@ -210,7 +242,7 @@ class LookupMixIn(object):
|
|
210
242
|
else:
|
211
243
|
# we got a parent index, this means the currently visited node
|
212
244
|
# is at the same block level as a previously visited node
|
213
|
-
if _stmts[pindex].
|
245
|
+
if _stmts[pindex].assign_type().parent_of(assign_type):
|
214
246
|
# both statements are not at the same block level
|
215
247
|
continue
|
216
248
|
# if currently visited node is following previously considered
|
@@ -239,7 +271,7 @@ class LookupMixIn(object):
|
|
239
271
|
if not (optional_assign or are_exclusive(_stmts[pindex], node)):
|
240
272
|
del _stmt_parents[pindex]
|
241
273
|
del _stmts[pindex]
|
242
|
-
if isinstance(node,
|
274
|
+
if isinstance(node, AssignName):
|
243
275
|
if not optional_assign and stmt.parent is mystmt.parent:
|
244
276
|
_stmts = []
|
245
277
|
_stmt_parents = []
|
@@ -252,27 +284,24 @@ class LookupMixIn(object):
|
|
252
284
|
_stmt_parents.append(stmt.parent)
|
253
285
|
return _stmts
|
254
286
|
|
287
|
+
|
255
288
|
# Name classes
|
256
289
|
|
257
|
-
class
|
290
|
+
class AssignName(LookupMixIn, mixins.ParentAssignTypeMixin, bases.NodeNG):
|
258
291
|
"""class representing an AssName node"""
|
259
292
|
|
260
293
|
|
261
|
-
class DelName(LookupMixIn, ParentAssignTypeMixin, NodeNG):
|
294
|
+
class DelName(LookupMixIn, mixins.ParentAssignTypeMixin, bases.NodeNG):
|
262
295
|
"""class representing a DelName node"""
|
263
296
|
|
264
297
|
|
265
|
-
class Name(LookupMixIn, NodeNG):
|
298
|
+
class Name(LookupMixIn, bases.NodeNG):
|
266
299
|
"""class representing a Name node"""
|
267
300
|
|
268
301
|
|
269
|
-
|
270
|
-
|
271
|
-
##################### node classes ########################################
|
272
|
-
|
273
|
-
class Arguments(NodeNG, AssignTypeMixin):
|
302
|
+
class Arguments(mixins.AssignTypeMixin, bases.NodeNG):
|
274
303
|
"""class representing an Arguments node"""
|
275
|
-
if
|
304
|
+
if six.PY3:
|
276
305
|
# Python 3.4+ uses a different approach regarding annotations,
|
277
306
|
# each argument is a new class, _ast.arg, which exposes an
|
278
307
|
# 'annotation' attribute. In astroid though, arguments are exposed
|
@@ -306,7 +335,7 @@ class Arguments(NodeNG, AssignTypeMixin):
|
|
306
335
|
return name
|
307
336
|
return None
|
308
337
|
|
309
|
-
@cachedproperty
|
338
|
+
@decorators.cachedproperty
|
310
339
|
def fromlineno(self):
|
311
340
|
lineno = super(Arguments, self).fromlineno
|
312
341
|
return max(lineno, self.parent.fromlineno or 0)
|
@@ -315,15 +344,18 @@ class Arguments(NodeNG, AssignTypeMixin):
|
|
315
344
|
"""return arguments formatted as string"""
|
316
345
|
result = []
|
317
346
|
if self.args:
|
318
|
-
result.append(
|
347
|
+
result.append(
|
348
|
+
_format_args(self.args, self.defaults,
|
349
|
+
getattr(self, 'annotations', None))
|
350
|
+
)
|
319
351
|
if self.vararg:
|
320
352
|
result.append('*%s' % self.vararg)
|
321
|
-
if self.kwarg:
|
322
|
-
result.append('**%s' % self.kwarg)
|
323
353
|
if self.kwonlyargs:
|
324
354
|
if not self.vararg:
|
325
355
|
result.append('*')
|
326
356
|
result.append(_format_args(self.kwonlyargs, self.kw_defaults))
|
357
|
+
if self.kwarg:
|
358
|
+
result.append('**%s' % self.kwarg)
|
327
359
|
return ', '.join(result)
|
328
360
|
|
329
361
|
def default_value(self, argname):
|
@@ -339,7 +371,7 @@ class Arguments(NodeNG, AssignTypeMixin):
|
|
339
371
|
i = _find_arg(argname, self.kwonlyargs)[0]
|
340
372
|
if i is not None and self.kw_defaults[i] is not None:
|
341
373
|
return self.kw_defaults[i]
|
342
|
-
raise NoDefault()
|
374
|
+
raise exceptions.NoDefault()
|
343
375
|
|
344
376
|
def is_argument(self, name):
|
345
377
|
"""return True if the name is defined in arguments"""
|
@@ -374,79 +406,91 @@ def _find_arg(argname, args, rec=False):
|
|
374
406
|
return None, None
|
375
407
|
|
376
408
|
|
377
|
-
def _format_args(args, defaults=None):
|
409
|
+
def _format_args(args, defaults=None, annotations=None):
|
378
410
|
values = []
|
379
411
|
if args is None:
|
380
412
|
return ''
|
413
|
+
if annotations is None:
|
414
|
+
annotations = []
|
381
415
|
if defaults is not None:
|
382
416
|
default_offset = len(args) - len(defaults)
|
383
|
-
|
417
|
+
packed = six.moves.zip_longest(args, annotations)
|
418
|
+
for i, (arg, annotation) in enumerate(packed):
|
384
419
|
if isinstance(arg, Tuple):
|
385
420
|
values.append('(%s)' % _format_args(arg.elts))
|
386
421
|
else:
|
387
|
-
|
422
|
+
argname = arg.name
|
423
|
+
if annotation is not None:
|
424
|
+
argname += ':' + annotation.as_string()
|
425
|
+
values.append(argname)
|
426
|
+
|
388
427
|
if defaults is not None and i >= default_offset:
|
389
428
|
if defaults[i-default_offset] is not None:
|
390
429
|
values[-1] += '=' + defaults[i-default_offset].as_string()
|
391
430
|
return ', '.join(values)
|
392
431
|
|
393
432
|
|
394
|
-
class
|
395
|
-
"""class representing an
|
433
|
+
class AssignAttr(mixins.ParentAssignTypeMixin, bases.NodeNG):
|
434
|
+
"""class representing an AssignAttr node"""
|
396
435
|
_astroid_fields = ('expr',)
|
397
436
|
expr = None
|
398
437
|
|
399
|
-
class Assert(Statement):
|
438
|
+
class Assert(bases.Statement):
|
400
439
|
"""class representing an Assert node"""
|
401
440
|
_astroid_fields = ('test', 'fail',)
|
402
441
|
test = None
|
403
442
|
fail = None
|
404
443
|
|
405
|
-
class Assign(Statement, AssignTypeMixin):
|
444
|
+
class Assign(bases.Statement, mixins.AssignTypeMixin):
|
406
445
|
"""class representing an Assign node"""
|
407
446
|
_astroid_fields = ('targets', 'value',)
|
408
447
|
targets = None
|
409
448
|
value = None
|
410
449
|
|
411
|
-
class AugAssign(Statement, AssignTypeMixin):
|
450
|
+
class AugAssign(bases.Statement, mixins.AssignTypeMixin):
|
412
451
|
"""class representing an AugAssign node"""
|
413
452
|
_astroid_fields = ('target', 'value',)
|
414
453
|
target = None
|
415
454
|
value = None
|
416
455
|
|
417
|
-
class
|
456
|
+
class Repr(bases.NodeNG):
|
418
457
|
"""class representing a Backquote node"""
|
419
458
|
_astroid_fields = ('value',)
|
420
459
|
value = None
|
421
460
|
|
422
|
-
class BinOp(NodeNG):
|
461
|
+
class BinOp(bases.NodeNG):
|
423
462
|
"""class representing a BinOp node"""
|
424
463
|
_astroid_fields = ('left', 'right',)
|
425
464
|
left = None
|
426
465
|
right = None
|
427
466
|
|
428
|
-
class BoolOp(NodeNG):
|
467
|
+
class BoolOp(bases.NodeNG):
|
429
468
|
"""class representing a BoolOp node"""
|
430
469
|
_astroid_fields = ('values',)
|
431
470
|
values = None
|
432
471
|
|
433
|
-
class Break(Statement):
|
472
|
+
class Break(bases.Statement):
|
434
473
|
"""class representing a Break node"""
|
435
474
|
|
436
475
|
|
437
|
-
class
|
438
|
-
"""class representing a
|
439
|
-
_astroid_fields = ('func', 'args', '
|
476
|
+
class Call(bases.NodeNG):
|
477
|
+
"""class representing a Call node"""
|
478
|
+
_astroid_fields = ('func', 'args', 'keywords')
|
440
479
|
func = None
|
441
480
|
args = None
|
442
|
-
|
443
|
-
|
481
|
+
keywords = None
|
482
|
+
|
483
|
+
@property
|
484
|
+
def starargs(self):
|
485
|
+
args = self.args or []
|
486
|
+
return [arg for arg in args if isinstance(arg, Starred)]
|
444
487
|
|
445
|
-
|
446
|
-
|
447
|
-
self.
|
488
|
+
@property
|
489
|
+
def kwargs(self):
|
490
|
+
keywords = self.keywords or []
|
491
|
+
return [keyword for keyword in keywords if keyword.arg is None]
|
448
492
|
|
449
|
-
class Compare(NodeNG):
|
493
|
+
class Compare(bases.NodeNG):
|
450
494
|
"""class representing a Compare node"""
|
451
495
|
_astroid_fields = ('left', 'ops',)
|
452
496
|
left = None
|
@@ -464,7 +508,8 @@ class Compare(NodeNG):
|
|
464
508
|
return self.ops[-1][1]
|
465
509
|
#return self.left
|
466
510
|
|
467
|
-
|
511
|
+
|
512
|
+
class Comprehension(bases.NodeNG):
|
468
513
|
"""class representing a Comprehension node"""
|
469
514
|
_astroid_fields = ('target', 'iter', 'ifs')
|
470
515
|
target = None
|
@@ -472,9 +517,16 @@ class Comprehension(NodeNG):
|
|
472
517
|
ifs = None
|
473
518
|
|
474
519
|
optional_assign = True
|
475
|
-
def
|
520
|
+
def assign_type(self):
|
476
521
|
return self
|
477
522
|
|
523
|
+
def ass_type(self):
|
524
|
+
warnings.warn('%s.ass_type() is deprecated and slated for removal'
|
525
|
+
'in astroid 2.0, use %s.assign_type() instead.'
|
526
|
+
% (type(self).__name__, type(self).__name__),
|
527
|
+
PendingDeprecationWarning, stacklevel=2)
|
528
|
+
return self.assign_type()
|
529
|
+
|
478
530
|
def _get_filtered_stmts(self, lookup_node, node, stmts, mystmt):
|
479
531
|
"""method used in filter_stmts"""
|
480
532
|
if self is mystmt:
|
@@ -490,7 +542,7 @@ class Comprehension(NodeNG):
|
|
490
542
|
return stmts, False
|
491
543
|
|
492
544
|
|
493
|
-
class Const(NodeNG, Instance):
|
545
|
+
class Const(bases.NodeNG, bases.Instance):
|
494
546
|
"""represent a constant node like num, str, bool, None, bytes"""
|
495
547
|
|
496
548
|
def __init__(self, value=None):
|
@@ -499,6 +551,11 @@ class Const(NodeNG, Instance):
|
|
499
551
|
def getitem(self, index, context=None):
|
500
552
|
if isinstance(self.value, six.string_types):
|
501
553
|
return Const(self.value[index])
|
554
|
+
if isinstance(self.value, bytes) and six.PY3:
|
555
|
+
# Bytes aren't instances of six.string_types
|
556
|
+
# on Python 3. Also, indexing them should return
|
557
|
+
# integers.
|
558
|
+
return Const(self.value[index])
|
502
559
|
raise TypeError('%r (value=%s)' % (self, self.value))
|
503
560
|
|
504
561
|
def has_dynamic_getattr(self):
|
@@ -513,11 +570,11 @@ class Const(NodeNG, Instance):
|
|
513
570
|
return self._proxied.qname()
|
514
571
|
|
515
572
|
|
516
|
-
class Continue(Statement):
|
573
|
+
class Continue(bases.Statement):
|
517
574
|
"""class representing a Continue node"""
|
518
575
|
|
519
576
|
|
520
|
-
class Decorators(NodeNG):
|
577
|
+
class Decorators(bases.NodeNG):
|
521
578
|
"""class representing a Decorators node"""
|
522
579
|
_astroid_fields = ('nodes',)
|
523
580
|
nodes = None
|
@@ -529,19 +586,21 @@ class Decorators(NodeNG):
|
|
529
586
|
# skip the function node to go directly to the upper level scope
|
530
587
|
return self.parent.parent.scope()
|
531
588
|
|
532
|
-
|
589
|
+
|
590
|
+
class DelAttr(mixins.ParentAssignTypeMixin, bases.NodeNG):
|
533
591
|
"""class representing a DelAttr node"""
|
534
592
|
_astroid_fields = ('expr',)
|
535
593
|
expr = None
|
536
594
|
|
537
595
|
|
538
|
-
|
596
|
+
|
597
|
+
class Delete(mixins.AssignTypeMixin, bases.Statement):
|
539
598
|
"""class representing a Delete node"""
|
540
599
|
_astroid_fields = ('targets',)
|
541
600
|
targets = None
|
542
601
|
|
543
602
|
|
544
|
-
class Dict(NodeNG, Instance):
|
603
|
+
class Dict(bases.NodeNG, bases.Instance):
|
545
604
|
"""class representing a Dict node"""
|
546
605
|
_astroid_fields = ('items',)
|
547
606
|
|
@@ -550,7 +609,7 @@ class Dict(NodeNG, Instance):
|
|
550
609
|
self.items = []
|
551
610
|
else:
|
552
611
|
self.items = [(const_factory(k), const_factory(v))
|
553
|
-
for k, v in items.items()]
|
612
|
+
for k, v in list(items.items())]
|
554
613
|
|
555
614
|
def pytype(self):
|
556
615
|
return '%s.dict' % BUILTINS
|
@@ -573,39 +632,45 @@ class Dict(NodeNG, Instance):
|
|
573
632
|
|
574
633
|
def getitem(self, lookup_key, context=None):
|
575
634
|
for key, value in self.items:
|
576
|
-
for
|
577
|
-
|
635
|
+
# TODO(cpopa): no support for overriding yet, {1:2, **{1: 3}}.
|
636
|
+
if isinstance(key, DictUnpack):
|
637
|
+
try:
|
638
|
+
return value.getitem(lookup_key, context)
|
639
|
+
except IndexError:
|
578
640
|
continue
|
579
|
-
|
580
|
-
|
641
|
+
for inferredkey in key.infer(context):
|
642
|
+
if inferredkey is util.YES:
|
643
|
+
continue
|
644
|
+
if isinstance(inferredkey, Const) \
|
645
|
+
and inferredkey.value == lookup_key:
|
581
646
|
return value
|
582
647
|
# This should raise KeyError, but all call sites only catch
|
583
648
|
# IndexError. Let's leave it like that for now.
|
584
649
|
raise IndexError(lookup_key)
|
585
650
|
|
586
651
|
|
587
|
-
class
|
588
|
-
"""class representing a
|
652
|
+
class Expr(bases.Statement):
|
653
|
+
"""class representing a Expr node"""
|
589
654
|
_astroid_fields = ('value',)
|
590
655
|
value = None
|
591
656
|
|
592
657
|
|
593
|
-
class Ellipsis(NodeNG):
|
658
|
+
class Ellipsis(bases.NodeNG): # pylint: disable=redefined-builtin
|
594
659
|
"""class representing an Ellipsis node"""
|
595
660
|
|
596
661
|
|
597
|
-
class EmptyNode(NodeNG):
|
662
|
+
class EmptyNode(bases.NodeNG):
|
598
663
|
"""class representing an EmptyNode node"""
|
599
664
|
|
600
665
|
|
601
|
-
class ExceptHandler(
|
666
|
+
class ExceptHandler(mixins.AssignTypeMixin, bases.Statement):
|
602
667
|
"""class representing an ExceptHandler node"""
|
603
668
|
_astroid_fields = ('type', 'name', 'body',)
|
604
669
|
type = None
|
605
670
|
name = None
|
606
671
|
body = None
|
607
672
|
|
608
|
-
@cachedproperty
|
673
|
+
@decorators.cachedproperty
|
609
674
|
def blockstart_tolineno(self):
|
610
675
|
if self.name:
|
611
676
|
return self.name.tolineno
|
@@ -622,7 +687,7 @@ class ExceptHandler(Statement, AssignTypeMixin):
|
|
622
687
|
return True
|
623
688
|
|
624
689
|
|
625
|
-
class Exec(Statement):
|
690
|
+
class Exec(bases.Statement):
|
626
691
|
"""class representing an Exec node"""
|
627
692
|
_astroid_fields = ('expr', 'globals', 'locals',)
|
628
693
|
expr = None
|
@@ -630,12 +695,12 @@ class Exec(Statement):
|
|
630
695
|
locals = None
|
631
696
|
|
632
697
|
|
633
|
-
class ExtSlice(NodeNG):
|
698
|
+
class ExtSlice(bases.NodeNG):
|
634
699
|
"""class representing an ExtSlice node"""
|
635
700
|
_astroid_fields = ('dims',)
|
636
701
|
dims = None
|
637
702
|
|
638
|
-
class For(BlockRangeMixIn, AssignTypeMixin, Statement):
|
703
|
+
class For(mixins.BlockRangeMixIn, mixins.AssignTypeMixin, bases.Statement):
|
639
704
|
"""class representing a For node"""
|
640
705
|
_astroid_fields = ('target', 'iter', 'body', 'orelse',)
|
641
706
|
target = None
|
@@ -644,12 +709,26 @@ class For(BlockRangeMixIn, AssignTypeMixin, Statement):
|
|
644
709
|
orelse = None
|
645
710
|
|
646
711
|
optional_assign = True
|
647
|
-
@cachedproperty
|
712
|
+
@decorators.cachedproperty
|
648
713
|
def blockstart_tolineno(self):
|
649
714
|
return self.iter.tolineno
|
650
715
|
|
651
716
|
|
652
|
-
class
|
717
|
+
class AsyncFor(For):
|
718
|
+
"""Asynchronous For built with `async` keyword."""
|
719
|
+
|
720
|
+
|
721
|
+
class Await(bases.NodeNG):
|
722
|
+
"""Await node for the `await` keyword."""
|
723
|
+
|
724
|
+
_astroid_fields = ('value', )
|
725
|
+
value = None
|
726
|
+
|
727
|
+
def postinit(self, value=None):
|
728
|
+
self.value = value
|
729
|
+
|
730
|
+
|
731
|
+
class ImportFrom(mixins.ImportFromMixin, bases.Statement):
|
653
732
|
"""class representing a From node"""
|
654
733
|
|
655
734
|
def __init__(self, fromname, names, level=0):
|
@@ -657,13 +736,13 @@ class From(FromImportMixIn, Statement):
|
|
657
736
|
self.names = names
|
658
737
|
self.level = level
|
659
738
|
|
660
|
-
class
|
661
|
-
"""class representing a
|
739
|
+
class Attribute(bases.NodeNG):
|
740
|
+
"""class representing a Attribute node"""
|
662
741
|
_astroid_fields = ('expr',)
|
663
742
|
expr = None
|
664
743
|
|
665
744
|
|
666
|
-
class Global(Statement):
|
745
|
+
class Global(bases.Statement):
|
667
746
|
"""class representing a Global node"""
|
668
747
|
|
669
748
|
def __init__(self, names):
|
@@ -673,14 +752,14 @@ class Global(Statement):
|
|
673
752
|
return name
|
674
753
|
|
675
754
|
|
676
|
-
class If(BlockRangeMixIn, Statement):
|
755
|
+
class If(mixins.BlockRangeMixIn, bases.Statement):
|
677
756
|
"""class representing an If node"""
|
678
757
|
_astroid_fields = ('test', 'body', 'orelse')
|
679
758
|
test = None
|
680
759
|
body = None
|
681
760
|
orelse = None
|
682
761
|
|
683
|
-
@cachedproperty
|
762
|
+
@decorators.cachedproperty
|
684
763
|
def blockstart_tolineno(self):
|
685
764
|
return self.test.tolineno
|
686
765
|
|
@@ -694,7 +773,7 @@ class If(BlockRangeMixIn, Statement):
|
|
694
773
|
self.body[0].fromlineno - 1)
|
695
774
|
|
696
775
|
|
697
|
-
class IfExp(NodeNG):
|
776
|
+
class IfExp(bases.NodeNG):
|
698
777
|
"""class representing an IfExp node"""
|
699
778
|
_astroid_fields = ('test', 'body', 'orelse')
|
700
779
|
test = None
|
@@ -702,31 +781,24 @@ class IfExp(NodeNG):
|
|
702
781
|
orelse = None
|
703
782
|
|
704
783
|
|
705
|
-
class Import(
|
784
|
+
class Import(mixins.ImportFromMixin, bases.Statement):
|
706
785
|
"""class representing an Import node"""
|
707
786
|
|
708
787
|
|
709
|
-
class Index(NodeNG):
|
788
|
+
class Index(bases.NodeNG):
|
710
789
|
"""class representing an Index node"""
|
711
790
|
_astroid_fields = ('value',)
|
712
791
|
value = None
|
713
792
|
|
714
793
|
|
715
|
-
class Keyword(NodeNG):
|
794
|
+
class Keyword(bases.NodeNG):
|
716
795
|
"""class representing a Keyword node"""
|
717
796
|
_astroid_fields = ('value',)
|
718
797
|
value = None
|
719
798
|
|
720
799
|
|
721
|
-
class List(
|
800
|
+
class List(_BaseContainer):
|
722
801
|
"""class representing a List node"""
|
723
|
-
_astroid_fields = ('elts',)
|
724
|
-
|
725
|
-
def __init__(self, elts=None):
|
726
|
-
if elts is None:
|
727
|
-
self.elts = []
|
728
|
-
else:
|
729
|
-
self.elts = [const_factory(e) for e in elts]
|
730
802
|
|
731
803
|
def pytype(self):
|
732
804
|
return '%s.list' % BUILTINS
|
@@ -734,11 +806,8 @@ class List(NodeNG, Instance, ParentAssignTypeMixin):
|
|
734
806
|
def getitem(self, index, context=None):
|
735
807
|
return self.elts[index]
|
736
808
|
|
737
|
-
def itered(self):
|
738
|
-
return self.elts
|
739
|
-
|
740
809
|
|
741
|
-
class Nonlocal(Statement):
|
810
|
+
class Nonlocal(bases.Statement):
|
742
811
|
"""class representing a Nonlocal node"""
|
743
812
|
|
744
813
|
def __init__(self, names):
|
@@ -748,21 +817,21 @@ class Nonlocal(Statement):
|
|
748
817
|
return name
|
749
818
|
|
750
819
|
|
751
|
-
class Pass(Statement):
|
820
|
+
class Pass(bases.Statement):
|
752
821
|
"""class representing a Pass node"""
|
753
822
|
|
754
823
|
|
755
|
-
class Print(Statement):
|
824
|
+
class Print(bases.Statement):
|
756
825
|
"""class representing a Print node"""
|
757
826
|
_astroid_fields = ('dest', 'values',)
|
758
827
|
dest = None
|
759
828
|
values = None
|
760
829
|
|
761
830
|
|
762
|
-
class Raise(Statement):
|
831
|
+
class Raise(bases.Statement):
|
763
832
|
"""class representing a Raise node"""
|
764
833
|
exc = None
|
765
|
-
if
|
834
|
+
if six.PY2:
|
766
835
|
_astroid_fields = ('exc', 'inst', 'tback')
|
767
836
|
inst = None
|
768
837
|
tback = None
|
@@ -779,50 +848,40 @@ class Raise(Statement):
|
|
779
848
|
return True
|
780
849
|
|
781
850
|
|
782
|
-
class Return(Statement):
|
851
|
+
class Return(bases.Statement):
|
783
852
|
"""class representing a Return node"""
|
784
853
|
_astroid_fields = ('value',)
|
785
854
|
value = None
|
786
855
|
|
787
856
|
|
788
|
-
class Set(
|
857
|
+
class Set(_BaseContainer):
|
789
858
|
"""class representing a Set node"""
|
790
|
-
_astroid_fields = ('elts',)
|
791
|
-
|
792
|
-
def __init__(self, elts=None):
|
793
|
-
if elts is None:
|
794
|
-
self.elts = []
|
795
|
-
else:
|
796
|
-
self.elts = [const_factory(e) for e in elts]
|
797
859
|
|
798
860
|
def pytype(self):
|
799
861
|
return '%s.set' % BUILTINS
|
800
862
|
|
801
|
-
def itered(self):
|
802
|
-
return self.elts
|
803
|
-
|
804
863
|
|
805
|
-
class Slice(NodeNG):
|
864
|
+
class Slice(bases.NodeNG):
|
806
865
|
"""class representing a Slice node"""
|
807
866
|
_astroid_fields = ('lower', 'upper', 'step')
|
808
867
|
lower = None
|
809
868
|
upper = None
|
810
869
|
step = None
|
811
870
|
|
812
|
-
class Starred(
|
871
|
+
class Starred(mixins.ParentAssignTypeMixin, bases.NodeNG):
|
813
872
|
"""class representing a Starred node"""
|
814
873
|
_astroid_fields = ('value',)
|
815
874
|
value = None
|
816
875
|
|
817
876
|
|
818
|
-
class Subscript(NodeNG):
|
877
|
+
class Subscript(bases.NodeNG):
|
819
878
|
"""class representing a Subscript node"""
|
820
879
|
_astroid_fields = ('value', 'slice')
|
821
880
|
value = None
|
822
881
|
slice = None
|
823
882
|
|
824
883
|
|
825
|
-
class TryExcept(BlockRangeMixIn, Statement):
|
884
|
+
class TryExcept(mixins.BlockRangeMixIn, bases.Statement):
|
826
885
|
"""class representing a TryExcept node"""
|
827
886
|
_astroid_fields = ('body', 'handlers', 'orelse',)
|
828
887
|
body = None
|
@@ -845,7 +904,7 @@ class TryExcept(BlockRangeMixIn, Statement):
|
|
845
904
|
return self._elsed_block_range(lineno, self.orelse, last)
|
846
905
|
|
847
906
|
|
848
|
-
class TryFinally(BlockRangeMixIn, Statement):
|
907
|
+
class TryFinally(mixins.BlockRangeMixIn, bases.Statement):
|
849
908
|
"""class representing a TryFinally node"""
|
850
909
|
_astroid_fields = ('body', 'finalbody',)
|
851
910
|
body = None
|
@@ -861,15 +920,8 @@ class TryFinally(BlockRangeMixIn, Statement):
|
|
861
920
|
return self._elsed_block_range(lineno, self.finalbody)
|
862
921
|
|
863
922
|
|
864
|
-
class Tuple(
|
923
|
+
class Tuple(_BaseContainer):
|
865
924
|
"""class representing a Tuple node"""
|
866
|
-
_astroid_fields = ('elts',)
|
867
|
-
|
868
|
-
def __init__(self, elts=None):
|
869
|
-
if elts is None:
|
870
|
-
self.elts = []
|
871
|
-
else:
|
872
|
-
self.elts = [const_factory(e) for e in elts]
|
873
925
|
|
874
926
|
def pytype(self):
|
875
927
|
return '%s.tuple' % BUILTINS
|
@@ -877,24 +929,21 @@ class Tuple(NodeNG, Instance, ParentAssignTypeMixin):
|
|
877
929
|
def getitem(self, index, context=None):
|
878
930
|
return self.elts[index]
|
879
931
|
|
880
|
-
def itered(self):
|
881
|
-
return self.elts
|
882
932
|
|
883
|
-
|
884
|
-
class UnaryOp(NodeNG):
|
933
|
+
class UnaryOp(bases.NodeNG):
|
885
934
|
"""class representing an UnaryOp node"""
|
886
935
|
_astroid_fields = ('operand',)
|
887
936
|
operand = None
|
888
937
|
|
889
938
|
|
890
|
-
class While(BlockRangeMixIn, Statement):
|
939
|
+
class While(mixins.BlockRangeMixIn, bases.Statement):
|
891
940
|
"""class representing a While node"""
|
892
941
|
_astroid_fields = ('test', 'body', 'orelse',)
|
893
942
|
test = None
|
894
943
|
body = None
|
895
944
|
orelse = None
|
896
945
|
|
897
|
-
@cachedproperty
|
946
|
+
@decorators.cachedproperty
|
898
947
|
def blockstart_tolineno(self):
|
899
948
|
return self.test.tolineno
|
900
949
|
|
@@ -903,13 +952,13 @@ class While(BlockRangeMixIn, Statement):
|
|
903
952
|
return self. _elsed_block_range(lineno, self.orelse)
|
904
953
|
|
905
954
|
|
906
|
-
class With(BlockRangeMixIn, AssignTypeMixin, Statement):
|
955
|
+
class With(mixins.BlockRangeMixIn, mixins.AssignTypeMixin, bases.Statement):
|
907
956
|
"""class representing a With node"""
|
908
957
|
_astroid_fields = ('items', 'body')
|
909
958
|
items = None
|
910
959
|
body = None
|
911
960
|
|
912
|
-
@cachedproperty
|
961
|
+
@decorators.cachedproperty
|
913
962
|
def blockstart_tolineno(self):
|
914
963
|
return self.items[-1][0].tolineno
|
915
964
|
|
@@ -921,7 +970,12 @@ class With(BlockRangeMixIn, AssignTypeMixin, Statement):
|
|
921
970
|
for elt in self.body:
|
922
971
|
yield elt
|
923
972
|
|
924
|
-
|
973
|
+
|
974
|
+
class AsyncWith(With):
|
975
|
+
"""Asynchronous `with` built with the `async` keyword."""
|
976
|
+
|
977
|
+
|
978
|
+
class Yield(bases.NodeNG):
|
925
979
|
"""class representing a Yield node"""
|
926
980
|
_astroid_fields = ('value',)
|
927
981
|
value = None
|
@@ -929,6 +983,11 @@ class Yield(NodeNG):
|
|
929
983
|
class YieldFrom(Yield):
|
930
984
|
""" Class representing a YieldFrom node. """
|
931
985
|
|
986
|
+
|
987
|
+
class DictUnpack(bases.NodeNG):
|
988
|
+
"""Represents the unpacking of dicts into dicts using PEP 448."""
|
989
|
+
|
990
|
+
|
932
991
|
# constants ##############################################################
|
933
992
|
|
934
993
|
CONST_CLS = {
|
@@ -937,19 +996,20 @@ CONST_CLS = {
|
|
937
996
|
dict: Dict,
|
938
997
|
set: Set,
|
939
998
|
type(None): Const,
|
999
|
+
type(NotImplemented): Const,
|
940
1000
|
}
|
941
1001
|
|
942
1002
|
def _update_const_classes():
|
943
1003
|
"""update constant classes, so the keys of CONST_CLS can be reused"""
|
944
1004
|
klasses = (bool, int, float, complex, str)
|
945
|
-
if
|
1005
|
+
if six.PY2:
|
946
1006
|
klasses += (unicode, long)
|
947
|
-
|
948
|
-
klasses += (bytes,)
|
1007
|
+
klasses += (bytes,)
|
949
1008
|
for kls in klasses:
|
950
1009
|
CONST_CLS[kls] = Const
|
951
1010
|
_update_const_classes()
|
952
1011
|
|
1012
|
+
|
953
1013
|
def const_factory(value):
|
954
1014
|
"""return an astroid node for a python value"""
|
955
1015
|
# XXX we should probably be stricter here and only consider stuff in
|
@@ -957,10 +1017,37 @@ def const_factory(value):
|
|
957
1017
|
# we should rather recall the builder on this value than returning an empty
|
958
1018
|
# node (another option being that const_factory shouldn't be called with something
|
959
1019
|
# not in CONST_CLS)
|
960
|
-
assert not isinstance(value, NodeNG)
|
1020
|
+
assert not isinstance(value, bases.NodeNG)
|
961
1021
|
try:
|
962
1022
|
return CONST_CLS[value.__class__](value)
|
963
1023
|
except (KeyError, AttributeError):
|
964
1024
|
node = EmptyNode()
|
965
1025
|
node.object = value
|
966
1026
|
return node
|
1027
|
+
|
1028
|
+
|
1029
|
+
# Backward-compatibility aliases
|
1030
|
+
def instancecheck(cls, other):
|
1031
|
+
wrapped = cls.__wrapped__
|
1032
|
+
other_cls = other.__class__
|
1033
|
+
is_instance_of = wrapped is other_cls or issubclass(other_cls, wrapped)
|
1034
|
+
warnings.warn("%r is deprecated and slated for removal in astroid "
|
1035
|
+
"2.0, use %r instead" % (cls.__class__.__name__,
|
1036
|
+
wrapped.__name__),
|
1037
|
+
PendingDeprecationWarning, stacklevel=2)
|
1038
|
+
return is_instance_of
|
1039
|
+
|
1040
|
+
|
1041
|
+
def proxy_alias(alias_name, node_type):
|
1042
|
+
proxy = type(alias_name, (lazy_object_proxy.Proxy,),
|
1043
|
+
{'__class__': object.__dict__['__class__'],
|
1044
|
+
'__instancecheck__': instancecheck})
|
1045
|
+
return proxy(lambda: node_type)
|
1046
|
+
|
1047
|
+
Backquote = proxy_alias('Backquote', Repr)
|
1048
|
+
Discard = proxy_alias('Discard', Expr)
|
1049
|
+
AssName = proxy_alias('AssName', AssignName)
|
1050
|
+
AssAttr = proxy_alias('AssAttr', AssignAttr)
|
1051
|
+
Getattr = proxy_alias('Getattr', Attribute)
|
1052
|
+
CallFunc = proxy_alias('CallFunc', Call)
|
1053
|
+
From = proxy_alias('From', ImportFrom)
|