astroid 4.1.2__tar.gz → 4.2.0b2__tar.gz
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.
- {astroid-4.1.2 → astroid-4.2.0b2}/CONTRIBUTORS.txt +2 -0
- {astroid-4.1.2/astroid.egg-info → astroid-4.2.0b2}/PKG-INFO +2 -2
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/__pkginfo__.py +1 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_typing.py +8 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/const.py +1 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/helpers.py +4 -18
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/interpreter/_import/spec.py +1 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/modutils.py +0 -42
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/_base_nodes.py +32 -3
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/node_classes.py +18 -65
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/scoped_nodes/scoped_nodes.py +19 -6
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/protocols.py +1 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/rebuilder.py +0 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/util.py +0 -13
- {astroid-4.1.2 → astroid-4.2.0b2/astroid.egg-info}/PKG-INFO +2 -2
- {astroid-4.1.2 → astroid-4.2.0b2}/pyproject.toml +8 -7
- {astroid-4.1.2 → astroid-4.2.0b2}/requirements_minimal.txt +1 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_brain.py +5 -2
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_group_exceptions.py +8 -8
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_helpers.py +0 -11
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_modutils.py +0 -76
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_nodes.py +59 -74
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_nodes_lineno.py +4 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_raw_building.py +1 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_regrtest.py +4 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_scoped_nodes.py +24 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tox.ini +1 -1
- {astroid-4.1.2 → astroid-4.2.0b2}/LICENSE +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/MANIFEST.in +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/README.rst +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/__main__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/_ast.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/arguments.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/astroid_manager.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/bases.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_argparse.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_attrs.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_boto3.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_builtin_inference.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_collections.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_crypt.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_ctypes.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_curses.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_dataclasses.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_datetime.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_dateutil.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_functools.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_gi.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_hashlib.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_http.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_hypothesis.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_io.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_mechanize.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_multiprocessing.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_namedtuple_enum.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_core_einsumfunc.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_core_fromnumeric.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_core_function_base.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_core_multiarray.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_core_numeric.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_core_numerictypes.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_core_umath.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_ma.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_ndarray.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_random_mtrand.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_numpy_utils.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_pathlib.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_pkg_resources.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_pytest.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_qt.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_random.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_re.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_regex.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_responses.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_scipy_signal.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_signal.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_six.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_sqlalchemy.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_ssl.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_statistics.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_subprocess.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_threading.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_type.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_unittest.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/brain_uuid.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/brain/helpers.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/builder.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/constraint.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/context.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/decorators.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/exceptions.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/filter_statements.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/inference_tip.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/interpreter/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/interpreter/_import/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/interpreter/_import/util.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/interpreter/dunder_lookup.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/interpreter/objectmodel.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/manager.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/as_string.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/const.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/node_ng.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/scoped_nodes/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/scoped_nodes/mixin.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/scoped_nodes/utils.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/nodes/utils.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/objects.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/raw_building.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/test_utils.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/transforms.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid/typing.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid.egg-info/SOURCES.txt +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid.egg-info/dependency_links.txt +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid.egg-info/requires.txt +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/astroid.egg-info/top_level.txt +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/requirements_dev.txt +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/requirements_full.txt +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/setup.cfg +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_core_einsumfunc.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_core_fromnumeric.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_core_function_base.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_core_multiarray.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_core_numeric.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_core_numerictypes.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_core_umath.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_ma.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_ndarray.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/numpy/test_random_mtrand.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_argparse.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_attr.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_builtin.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_ctypes.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_dataclasses.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_dateutil.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_enum.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_gi.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_hashlib.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_helpers.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_multiprocessing.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_named_tuple.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_pathlib.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_pytest.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_qt.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_regex.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_signal.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_six.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_ssl.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_statistics.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_threading.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_typing.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_typing_extensions.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/brain/test_unittest.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/resources.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_builder.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_constraint.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_decorators.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_filter_statements.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_get_relative_base_path.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_inference.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_inference_calls.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_lookup.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_manager.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_nodes_position.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_object_model.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_objects.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_protocols.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_python3.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_stdlib.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_transforms.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_type_params.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/test_utils.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zip +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/SSL1/Connection1.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/SSL1/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/absimp/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/absimp/sidepackage/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/absimp/string.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/absimport.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/all.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/appl/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/appl/myConnection.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level/import_package.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level/namespace_package/lower_level/helper_function.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level/namespace_package/plugin_api.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level/namespace_package/top_level_function.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_three/double_name/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_three/module/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/function.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/main.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_two/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_two/a.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_two/level1/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/beyond_top_level_two/level1/beyond_top_level_two.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/cache/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/cache/a.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/conditional.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/conditional_import/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/descriptor_crash.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/divide_by_zero.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/email.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/fake_module_with_broken_getattr.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/fake_module_with_collection_getattribute.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/fake_module_with_warnings.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/find_test/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/find_test/module.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/find_test/module2.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/find_test/noendingnewline.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/find_test/nonregr.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/foogle/fax/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/foogle/fax/a.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/format.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/import_conflicting_names/math.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/import_setuptools_pep660/__editable___example_0_1_0_finder.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/import_setuptools_pep660/example/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/import_setuptools_pep660/example/subpackage/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/invalid_encoding.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/lmfp/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/lmfp/foo.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/max_inferable_limit_for_classes/main.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/max_inferable_limit_for_classes/nodes/roles.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/max_inferable_limit_for_classes/other_funcs.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/metaclass_recursion/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/metaclass_recursion/monkeypatch.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/metaclass_recursion/parent.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/module.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/module1abs/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/module1abs/core.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/module2.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/module3.14.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/module_dict_items_call/models.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/module_dict_items_call/test.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/namespace_pep_420/module.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/noendingnewline.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/nonregr.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/notall.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/notamodule/file.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/operator_precedence.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/package/absimport.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/package/hello.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/package/import_package_subpackage_module.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/package/subpackage/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/package/subpackage/module.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/parent_of_homonym/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/parent_of_homonym/doc/README.md +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/parent_of_homonym/doc/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkg_resources_1/package/foo.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkg_resources_2/package/bar.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkg_resources_3/package/baz.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkgutil_1/package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkgutil_1/package/foo.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkgutil_2/package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkgutil_2/package/bar.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkgutil_3/package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/path_pkgutil_3/package/baz.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/recursion.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/tmp__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/unicode_package/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/unicode_package/core/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/data/x.zip +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/__init__.pyi +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/__init__.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/__init__.pyi +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/__init__.weird_ext +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/module.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/module2.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/noendingnewline.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/nonregr.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/find_test/standalone_file.weird_ext +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/pyi_data/module.py +0 -0
- {astroid-4.1.2 → astroid-4.2.0b2}/tests/testdata/python3/recursion_error.py +0 -0
|
@@ -221,6 +221,8 @@ Contributors
|
|
|
221
221
|
- Alexander Presnyakov <flagist0@gmail.com>
|
|
222
222
|
- Ahmed Azzaoui <ahmed.azzaoui@engie.com>
|
|
223
223
|
- Casey Jones <731937+doctorcolossus@users.noreply.github.com>
|
|
224
|
+
- sergiochan <yuheng9211@qq.com>
|
|
225
|
+
- Joshix-1 <57299889+Joshix-1@users.noreply.github.com>
|
|
224
226
|
|
|
225
227
|
Co-Author
|
|
226
228
|
---------
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astroid
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0b2
|
|
4
4
|
Summary: An abstract syntax tree for Python with inference support.
|
|
5
5
|
License-Expression: LGPL-2.1-or-later
|
|
6
6
|
Project-URL: Bug tracker, https://github.com/pylint-dev/astroid/issues
|
|
7
7
|
Project-URL: Discord server, https://discord.gg/Egy6P8AMB5
|
|
8
|
-
Project-URL: Docs, https://pylint.readthedocs.io/projects/astroid/en/latest/
|
|
9
8
|
Project-URL: Source Code, https://github.com/pylint-dev/astroid
|
|
9
|
+
Project-URL: Docs, https://pylint.readthedocs.io/projects/astroid/en/latest/
|
|
10
10
|
Keywords: abstract syntax tree,python,static code analysis
|
|
11
11
|
Classifier: Development Status :: 6 - Mature
|
|
12
12
|
Classifier: Environment :: Console
|
|
@@ -15,7 +15,7 @@ from typing import Final
|
|
|
15
15
|
from astroid import context, nodes
|
|
16
16
|
from astroid.brain.helpers import register_module_extender
|
|
17
17
|
from astroid.builder import AstroidBuilder, _extract_single_node, extract_node
|
|
18
|
-
from astroid.const import PY312_PLUS, PY313_PLUS, PY314_PLUS
|
|
18
|
+
from astroid.const import PY312_PLUS, PY313_PLUS, PY314_PLUS, PY315_PLUS
|
|
19
19
|
from astroid.exceptions import (
|
|
20
20
|
AstroidSyntaxError,
|
|
21
21
|
AttributeInferenceError,
|
|
@@ -464,6 +464,13 @@ def _typing_transform():
|
|
|
464
464
|
@classmethod
|
|
465
465
|
def __class_getitem__(cls, item): return cls
|
|
466
466
|
""")
|
|
467
|
+
if PY315_PLUS:
|
|
468
|
+
# typing.ByteString was removed from the typing module in Python 3.15
|
|
469
|
+
# (it was deprecated since 3.12 and present at module level until 3.14).
|
|
470
|
+
# Inject a stub so code using `typing.ByteString` can still be inferred.
|
|
471
|
+
code += textwrap.dedent("""
|
|
472
|
+
class ByteString: ...
|
|
473
|
+
""")
|
|
467
474
|
return AstroidBuilder(AstroidManager()).string_build(code)
|
|
468
475
|
|
|
469
476
|
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
|
-
import warnings
|
|
10
9
|
from collections.abc import Generator
|
|
11
10
|
|
|
12
11
|
from astroid import bases, manager, nodes, objects, raw_building, util
|
|
@@ -20,20 +19,7 @@ from astroid.exceptions import (
|
|
|
20
19
|
)
|
|
21
20
|
from astroid.nodes import scoped_nodes
|
|
22
21
|
from astroid.typing import InferenceResult
|
|
23
|
-
from astroid.util import safe_infer
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
def safe_infer(
|
|
27
|
-
node: nodes.NodeNG | bases.Proxy | util.UninferableBase,
|
|
28
|
-
context: InferenceContext | None = None,
|
|
29
|
-
) -> InferenceResult | None:
|
|
30
|
-
# When removing, also remove the real_safe_infer alias
|
|
31
|
-
warnings.warn(
|
|
32
|
-
"Import safe_infer from astroid.util; this shim in astroid.helpers will be removed.",
|
|
33
|
-
DeprecationWarning,
|
|
34
|
-
stacklevel=2,
|
|
35
|
-
)
|
|
36
|
-
return real_safe_infer(node, context=context)
|
|
22
|
+
from astroid.util import safe_infer
|
|
37
23
|
|
|
38
24
|
|
|
39
25
|
def _build_proxy_class(cls_name: str, builtins: nodes.Module) -> nodes.ClassDef:
|
|
@@ -130,7 +116,7 @@ def _object_type_is_subclass(
|
|
|
130
116
|
for klass in class_seq:
|
|
131
117
|
if isinstance(klass, util.UninferableBase):
|
|
132
118
|
raise AstroidTypeError(
|
|
133
|
-
|
|
119
|
+
"arg 2 must be a type or tuple of types, not <class 'astroid.util.UninferableBase'>"
|
|
134
120
|
)
|
|
135
121
|
|
|
136
122
|
for obj_subclass in obj_type.mro():
|
|
@@ -201,7 +187,7 @@ def has_known_bases(klass, context: InferenceContext | None = None) -> bool:
|
|
|
201
187
|
except AttributeError:
|
|
202
188
|
pass
|
|
203
189
|
for base in klass.bases:
|
|
204
|
-
result =
|
|
190
|
+
result = safe_infer(base, context=context)
|
|
205
191
|
# TODO: check for A->B->A->B pattern in class structure too?
|
|
206
192
|
if (
|
|
207
193
|
not isinstance(result, scoped_nodes.ClassDef)
|
|
@@ -274,7 +260,7 @@ def object_len(node, context: InferenceContext | None = None):
|
|
|
274
260
|
# pylint: disable=import-outside-toplevel; circular import
|
|
275
261
|
from astroid.objects import FrozenSet
|
|
276
262
|
|
|
277
|
-
inferred_node =
|
|
263
|
+
inferred_node = safe_infer(node, context=context)
|
|
278
264
|
|
|
279
265
|
# prevent self referential length calls from causing a recursion error
|
|
280
266
|
# see https://github.com/pylint-dev/astroid/issues/777
|
|
@@ -185,7 +185,7 @@ class ImportlibFinder(Finder):
|
|
|
185
185
|
and spec.loader # type: ignore[comparison-overlap] # noqa: E501
|
|
186
186
|
is importlib.machinery.FrozenImporter
|
|
187
187
|
):
|
|
188
|
-
return ModuleSpec(
|
|
188
|
+
return ModuleSpec( # type: ignore[unreachable]
|
|
189
189
|
name=modname,
|
|
190
190
|
location=getattr(spec.loader_state, "filename", None),
|
|
191
191
|
type=ModuleType.PY_FROZEN,
|
|
@@ -26,7 +26,6 @@ import os
|
|
|
26
26
|
import sys
|
|
27
27
|
import sysconfig
|
|
28
28
|
import types
|
|
29
|
-
import warnings
|
|
30
29
|
from collections.abc import Callable, Iterable, Sequence
|
|
31
30
|
from contextlib import redirect_stderr, redirect_stdout
|
|
32
31
|
from functools import lru_cache
|
|
@@ -550,47 +549,6 @@ def module_in_path(modname: str, path: str | Iterable[str]) -> bool:
|
|
|
550
549
|
return any(filename.startswith(_cache_normalize_path(entry)) for entry in path)
|
|
551
550
|
|
|
552
551
|
|
|
553
|
-
def is_standard_module(modname: str, std_path: Iterable[str] | None = None) -> bool:
|
|
554
|
-
"""Try to guess if a module is a standard python module (by default,
|
|
555
|
-
see `std_path` parameter's description).
|
|
556
|
-
|
|
557
|
-
:param modname: name of the module we are interested in
|
|
558
|
-
|
|
559
|
-
:param std_path: list of path considered has standard
|
|
560
|
-
|
|
561
|
-
:return:
|
|
562
|
-
true if the module:
|
|
563
|
-
- is located on the path listed in one of the directory in `std_path`
|
|
564
|
-
- is a built-in module
|
|
565
|
-
"""
|
|
566
|
-
warnings.warn(
|
|
567
|
-
"is_standard_module() is deprecated. Use, is_stdlib_module() or module_in_path() instead",
|
|
568
|
-
DeprecationWarning,
|
|
569
|
-
stacklevel=2,
|
|
570
|
-
)
|
|
571
|
-
|
|
572
|
-
modname = modname.split(".")[0]
|
|
573
|
-
try:
|
|
574
|
-
filename = file_from_modpath([modname])
|
|
575
|
-
except ImportError:
|
|
576
|
-
# import failed, i'm probably not so wrong by supposing it's
|
|
577
|
-
# not standard...
|
|
578
|
-
return False
|
|
579
|
-
# modules which are not living in a file are considered standard
|
|
580
|
-
# (sys and __builtin__ for instance)
|
|
581
|
-
if filename is None:
|
|
582
|
-
# we assume there are no namespaces in stdlib
|
|
583
|
-
return not util.is_namespace(modname)
|
|
584
|
-
filename = _normalize_path(filename)
|
|
585
|
-
for path in EXT_LIB_DIRS:
|
|
586
|
-
if filename.startswith(_cache_normalize_path(path)):
|
|
587
|
-
return False
|
|
588
|
-
if std_path is None:
|
|
589
|
-
std_path = STD_LIB_DIRS
|
|
590
|
-
|
|
591
|
-
return any(filename.startswith(_cache_normalize_path(path)) for path in std_path)
|
|
592
|
-
|
|
593
|
-
|
|
594
552
|
def is_relative(modname: str, from_file: str) -> bool:
|
|
595
553
|
"""Return true if the given module name is relative to the given
|
|
596
554
|
file name.
|
|
@@ -237,22 +237,51 @@ class MultiLineBlockNode(NodeNG):
|
|
|
237
237
|
class MultiLineWithElseBlockNode(MultiLineBlockNode):
|
|
238
238
|
"""Base node for multi-line blocks that can have else statements."""
|
|
239
239
|
|
|
240
|
+
body: list[NodeNG]
|
|
241
|
+
"""The contents of the block."""
|
|
242
|
+
|
|
243
|
+
orelse: list[NodeNG]
|
|
244
|
+
"""The contents of the ``else`` block."""
|
|
245
|
+
|
|
240
246
|
@cached_property
|
|
241
247
|
def blockstart_tolineno(self):
|
|
242
248
|
return self.lineno
|
|
243
249
|
|
|
250
|
+
def block_range(self, lineno: int) -> tuple[int, int]:
|
|
251
|
+
"""Get a range from the given line number to where this node ends.
|
|
252
|
+
|
|
253
|
+
:param lineno: The line number to start the range at.
|
|
254
|
+
|
|
255
|
+
:returns: The range of line numbers that this node belongs to,
|
|
256
|
+
starting at the given line number.
|
|
257
|
+
"""
|
|
258
|
+
if lineno < self.fromlineno:
|
|
259
|
+
return lineno, self.tolineno
|
|
260
|
+
if lineno == self.body[0].fromlineno:
|
|
261
|
+
return lineno, lineno
|
|
262
|
+
if lineno <= self.body[-1].tolineno:
|
|
263
|
+
return lineno, self.body[-1].tolineno
|
|
264
|
+
return self._elsed_block_range(lineno, self.orelse, self.body[0].fromlineno - 1)
|
|
265
|
+
|
|
244
266
|
def _elsed_block_range(
|
|
245
267
|
self, lineno: int, orelse: list[nodes.NodeNG], last: int | None = None
|
|
246
268
|
) -> tuple[int, int]:
|
|
247
269
|
"""Handle block line numbers range for try/finally, for, if and while
|
|
248
270
|
statements.
|
|
249
271
|
"""
|
|
250
|
-
|
|
272
|
+
# If at the end of the node, return same line
|
|
273
|
+
if lineno == self.tolineno:
|
|
251
274
|
return lineno, lineno
|
|
252
275
|
if orelse:
|
|
253
|
-
|
|
276
|
+
# If the lineno is beyond the body of the node we check the orelse
|
|
277
|
+
if lineno >= self.body[-1].tolineno + 1:
|
|
278
|
+
# If the orelse has a scope of its own we determine the block range there
|
|
279
|
+
if isinstance(orelse[0], MultiLineWithElseBlockNode):
|
|
280
|
+
return orelse[0]._elsed_block_range(lineno, orelse[0].orelse)
|
|
281
|
+
# Return last line of orelse
|
|
254
282
|
return lineno, orelse[-1].tolineno
|
|
255
|
-
|
|
283
|
+
# If the lineno is within the body we take the last line of the body
|
|
284
|
+
return lineno, self.body[-1].tolineno
|
|
256
285
|
return lineno, last or self.tolineno
|
|
257
286
|
|
|
258
287
|
|
|
@@ -597,9 +597,6 @@ class Name(_base_nodes.LookupMixIn, _base_nodes.NoChildrenNode):
|
|
|
597
597
|
return _infer_stmts(stmts, context, frame)
|
|
598
598
|
|
|
599
599
|
|
|
600
|
-
DEPRECATED_ARGUMENT_DEFAULT = "DEPRECATED_ARGUMENT_DEFAULT"
|
|
601
|
-
|
|
602
|
-
|
|
603
600
|
class Arguments(
|
|
604
601
|
_base_nodes.AssignTypeNode
|
|
605
602
|
): # pylint: disable=too-many-instance-attributes
|
|
@@ -969,7 +966,7 @@ class Arguments(
|
|
|
969
966
|
return True
|
|
970
967
|
return self.find_argname(name)[1] is not None
|
|
971
968
|
|
|
972
|
-
def find_argname(self, argname
|
|
969
|
+
def find_argname(self, argname):
|
|
973
970
|
"""Get the index and :class:`AssignName` node for given name.
|
|
974
971
|
|
|
975
972
|
:param argname: The name of the argument to search for.
|
|
@@ -978,12 +975,6 @@ class Arguments(
|
|
|
978
975
|
:returns: The index and node for the argument.
|
|
979
976
|
:rtype: tuple(str or None, AssignName or None)
|
|
980
977
|
"""
|
|
981
|
-
if rec != DEPRECATED_ARGUMENT_DEFAULT: # pragma: no cover
|
|
982
|
-
warnings.warn(
|
|
983
|
-
"The rec argument will be removed in astroid 3.1.",
|
|
984
|
-
DeprecationWarning,
|
|
985
|
-
stacklevel=2,
|
|
986
|
-
)
|
|
987
978
|
if self.arguments:
|
|
988
979
|
index, argument = _find_arg(argname, self.arguments)
|
|
989
980
|
if argument:
|
|
@@ -3061,20 +3052,6 @@ class If(_base_nodes.MultiLineWithElseBlockNode, _base_nodes.Statement):
|
|
|
3061
3052
|
"""
|
|
3062
3053
|
return self.test.tolineno
|
|
3063
3054
|
|
|
3064
|
-
def block_range(self, lineno: int) -> tuple[int, int]:
|
|
3065
|
-
"""Get a range from the given line number to where this node ends.
|
|
3066
|
-
|
|
3067
|
-
:param lineno: The line number to start the range at.
|
|
3068
|
-
|
|
3069
|
-
:returns: The range of line numbers that this node belongs to,
|
|
3070
|
-
starting at the given line number.
|
|
3071
|
-
"""
|
|
3072
|
-
if lineno == self.body[0].fromlineno:
|
|
3073
|
-
return lineno, lineno
|
|
3074
|
-
if lineno <= self.body[-1].tolineno:
|
|
3075
|
-
return lineno, self.body[-1].tolineno
|
|
3076
|
-
return self._elsed_block_range(lineno, self.orelse, self.body[0].fromlineno - 1)
|
|
3077
|
-
|
|
3078
3055
|
def get_children(self):
|
|
3079
3056
|
yield self.test
|
|
3080
3057
|
|
|
@@ -3915,27 +3892,20 @@ class Try(_base_nodes.MultiLineWithElseBlockNode, _base_nodes.Statement):
|
|
|
3915
3892
|
|
|
3916
3893
|
def block_range(self, lineno: int) -> tuple[int, int]:
|
|
3917
3894
|
"""Get a range from a given line number to where this node ends."""
|
|
3918
|
-
if lineno == self.fromlineno:
|
|
3919
|
-
return lineno, lineno
|
|
3920
|
-
if self.body and self.body[0].fromlineno <= lineno <= self.body[-1].tolineno:
|
|
3921
|
-
# Inside try body - return from lineno till end of try body
|
|
3922
|
-
return lineno, self.body[-1].tolineno
|
|
3923
3895
|
for exhandler in self.handlers:
|
|
3924
3896
|
if exhandler.type and lineno == exhandler.type.fromlineno:
|
|
3925
|
-
return lineno,
|
|
3897
|
+
return lineno, exhandler.tolineno
|
|
3926
3898
|
if exhandler.body[0].fromlineno <= lineno <= exhandler.body[-1].tolineno:
|
|
3927
3899
|
return lineno, exhandler.body[-1].tolineno
|
|
3928
|
-
if self.orelse:
|
|
3929
|
-
if self.orelse[0].fromlineno - 1 == lineno:
|
|
3930
|
-
return lineno, lineno
|
|
3931
|
-
if self.orelse[0].fromlineno <= lineno <= self.orelse[-1].tolineno:
|
|
3932
|
-
return lineno, self.orelse[-1].tolineno
|
|
3933
3900
|
if self.finalbody:
|
|
3934
3901
|
if self.finalbody[0].fromlineno - 1 == lineno:
|
|
3935
|
-
return lineno,
|
|
3902
|
+
return lineno, self.finalbody[0].tolineno
|
|
3936
3903
|
if self.finalbody[0].fromlineno <= lineno <= self.finalbody[-1].tolineno:
|
|
3937
3904
|
return lineno, self.finalbody[-1].tolineno
|
|
3938
|
-
|
|
3905
|
+
|
|
3906
|
+
# If not within any of the ExceptHandlers or `finally` body, fall back to regular
|
|
3907
|
+
# handling of block_range for nodes with a potential `else` statement.
|
|
3908
|
+
return super().block_range(lineno)
|
|
3939
3909
|
|
|
3940
3910
|
def get_children(self):
|
|
3941
3911
|
yield from self.body
|
|
@@ -4014,35 +3984,28 @@ class TryStar(_base_nodes.MultiLineWithElseBlockNode, _base_nodes.Statement):
|
|
|
4014
3984
|
def _infer_name(self, frame, name):
|
|
4015
3985
|
return name
|
|
4016
3986
|
|
|
3987
|
+
def get_children(self):
|
|
3988
|
+
yield from self.body
|
|
3989
|
+
yield from self.handlers
|
|
3990
|
+
yield from self.orelse
|
|
3991
|
+
yield from self.finalbody
|
|
3992
|
+
|
|
4017
3993
|
def block_range(self, lineno: int) -> tuple[int, int]:
|
|
4018
3994
|
"""Get a range from a given line number to where this node ends."""
|
|
4019
|
-
if lineno == self.fromlineno:
|
|
4020
|
-
return lineno, lineno
|
|
4021
|
-
if self.body and self.body[0].fromlineno <= lineno <= self.body[-1].tolineno:
|
|
4022
|
-
# Inside try body - return from lineno till end of try body
|
|
4023
|
-
return lineno, self.body[-1].tolineno
|
|
4024
3995
|
for exhandler in self.handlers:
|
|
4025
3996
|
if exhandler.type and lineno == exhandler.type.fromlineno:
|
|
4026
|
-
return lineno,
|
|
3997
|
+
return lineno, exhandler.tolineno
|
|
4027
3998
|
if exhandler.body[0].fromlineno <= lineno <= exhandler.body[-1].tolineno:
|
|
4028
3999
|
return lineno, exhandler.body[-1].tolineno
|
|
4029
|
-
if self.orelse:
|
|
4030
|
-
if self.orelse[0].fromlineno - 1 == lineno:
|
|
4031
|
-
return lineno, lineno
|
|
4032
|
-
if self.orelse[0].fromlineno <= lineno <= self.orelse[-1].tolineno:
|
|
4033
|
-
return lineno, self.orelse[-1].tolineno
|
|
4034
4000
|
if self.finalbody:
|
|
4035
4001
|
if self.finalbody[0].fromlineno - 1 == lineno:
|
|
4036
|
-
return lineno,
|
|
4002
|
+
return lineno, self.finalbody[0].tolineno
|
|
4037
4003
|
if self.finalbody[0].fromlineno <= lineno <= self.finalbody[-1].tolineno:
|
|
4038
4004
|
return lineno, self.finalbody[-1].tolineno
|
|
4039
|
-
return lineno, self.tolineno
|
|
4040
4005
|
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
yield from self.orelse
|
|
4045
|
-
yield from self.finalbody
|
|
4006
|
+
# If not within any of the ExceptHandlers or `finally` body, fall back to regular
|
|
4007
|
+
# handling of block_range for nodes with a potential `else` statement.
|
|
4008
|
+
return super().block_range(lineno)
|
|
4046
4009
|
|
|
4047
4010
|
|
|
4048
4011
|
class Tuple(BaseContainer):
|
|
@@ -4472,16 +4435,6 @@ class While(_base_nodes.MultiLineWithElseBlockNode, _base_nodes.Statement):
|
|
|
4472
4435
|
"""
|
|
4473
4436
|
return self.test.tolineno
|
|
4474
4437
|
|
|
4475
|
-
def block_range(self, lineno: int) -> tuple[int, int]:
|
|
4476
|
-
"""Get a range from the given line number to where this node ends.
|
|
4477
|
-
|
|
4478
|
-
:param lineno: The line number to start the range at.
|
|
4479
|
-
|
|
4480
|
-
:returns: The range of line numbers that this node belongs to,
|
|
4481
|
-
starting at the given line number.
|
|
4482
|
-
"""
|
|
4483
|
-
return self._elsed_block_range(lineno, self.orelse)
|
|
4484
|
-
|
|
4485
4438
|
def get_children(self):
|
|
4486
4439
|
yield self.test
|
|
4487
4440
|
|
|
@@ -2812,7 +2812,12 @@ class ClassDef(
|
|
|
2812
2812
|
def slots(self):
|
|
2813
2813
|
return self._all_slots
|
|
2814
2814
|
|
|
2815
|
-
def _inferred_bases(
|
|
2815
|
+
def _inferred_bases(
|
|
2816
|
+
self,
|
|
2817
|
+
context: InferenceContext | None = None,
|
|
2818
|
+
*,
|
|
2819
|
+
base_classes: frozenset[ClassDef] = frozenset(),
|
|
2820
|
+
):
|
|
2816
2821
|
# Similar with .ancestors, but the difference is when one base is inferred,
|
|
2817
2822
|
# only the first object is wanted. That's because
|
|
2818
2823
|
# we aren't interested in superclasses, as in the following
|
|
@@ -2841,7 +2846,7 @@ class ClassDef(
|
|
|
2841
2846
|
baseobj = baseobj._proxied
|
|
2842
2847
|
if not isinstance(baseobj, ClassDef):
|
|
2843
2848
|
continue
|
|
2844
|
-
if baseobj is self:
|
|
2849
|
+
if baseobj is self or baseobj in base_classes:
|
|
2845
2850
|
# Circular base due to name rebinding (e.g. pdb.Pdb = CustomPdb
|
|
2846
2851
|
# where CustomPdb inherits from pdb.Pdb). Fall back to the
|
|
2847
2852
|
# first non-circular inferred value from the base expression.
|
|
@@ -2876,17 +2881,25 @@ class ClassDef(
|
|
|
2876
2881
|
pass
|
|
2877
2882
|
return None
|
|
2878
2883
|
|
|
2879
|
-
def _compute_mro(
|
|
2884
|
+
def _compute_mro(
|
|
2885
|
+
self,
|
|
2886
|
+
context: InferenceContext,
|
|
2887
|
+
*,
|
|
2888
|
+
base_chain: frozenset[ClassDef] = frozenset(),
|
|
2889
|
+
):
|
|
2880
2890
|
if self.qname() == "builtins.object":
|
|
2881
2891
|
return [self]
|
|
2882
2892
|
|
|
2883
|
-
inferred_bases = list(
|
|
2893
|
+
inferred_bases = list(
|
|
2894
|
+
self._inferred_bases(context=context, base_classes=base_chain)
|
|
2895
|
+
)
|
|
2884
2896
|
bases_mro = []
|
|
2897
|
+
base_chain |= {self}
|
|
2885
2898
|
for base in inferred_bases:
|
|
2886
|
-
if base
|
|
2899
|
+
if base in base_chain:
|
|
2887
2900
|
continue
|
|
2888
2901
|
|
|
2889
|
-
mro = base._compute_mro(context=context)
|
|
2902
|
+
mro = base._compute_mro(context=context, base_chain=base_chain)
|
|
2890
2903
|
bases_mro.append(mro)
|
|
2891
2904
|
|
|
2892
2905
|
unmerged_mro: list[list[ClassDef]] = [[self], *bases_mro, inferred_bases]
|
|
@@ -545,7 +545,7 @@ ExceptionGroup
|
|
|
545
545
|
""")))
|
|
546
546
|
assigned = objects.ExceptionInstance(eg)
|
|
547
547
|
assigned.instance_attrs["exceptions"] = [
|
|
548
|
-
nodes.
|
|
548
|
+
nodes.Tuple.from_elements(_generate_assigned())
|
|
549
549
|
]
|
|
550
550
|
yield assigned
|
|
551
551
|
else:
|
|
@@ -120,7 +120,6 @@ class TreeRebuilder:
|
|
|
120
120
|
end_lineno = node.end_lineno
|
|
121
121
|
if node.body:
|
|
122
122
|
end_lineno = node.body[0].lineno
|
|
123
|
-
# pylint: disable-next=unsubscriptable-object
|
|
124
123
|
data = "\n".join(self._data[node.lineno - 1 : end_lineno])
|
|
125
124
|
|
|
126
125
|
start_token: TokenInfo | None = None
|
|
@@ -108,19 +108,6 @@ class BadBinaryOperationMessage(BadOperationMessage):
|
|
|
108
108
|
return msg.format(self.op, self.left_type.name, self.right_type.name)
|
|
109
109
|
|
|
110
110
|
|
|
111
|
-
def _instancecheck(cls, other) -> bool:
|
|
112
|
-
wrapped = cls.__wrapped__
|
|
113
|
-
other_cls = other.__class__
|
|
114
|
-
is_instance_of = wrapped is other_cls or issubclass(other_cls, wrapped)
|
|
115
|
-
warnings.warn(
|
|
116
|
-
"%r is deprecated and slated for removal in astroid "
|
|
117
|
-
"2.0, use %r instead" % (cls.__class__.__name__, wrapped.__name__),
|
|
118
|
-
PendingDeprecationWarning,
|
|
119
|
-
stacklevel=2,
|
|
120
|
-
)
|
|
121
|
-
return is_instance_of
|
|
122
|
-
|
|
123
|
-
|
|
124
111
|
def check_warnings_filter() -> bool:
|
|
125
112
|
"""Return True if any other than the default DeprecationWarning filter is enabled.
|
|
126
113
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astroid
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.2.0b2
|
|
4
4
|
Summary: An abstract syntax tree for Python with inference support.
|
|
5
5
|
License-Expression: LGPL-2.1-or-later
|
|
6
6
|
Project-URL: Bug tracker, https://github.com/pylint-dev/astroid/issues
|
|
7
7
|
Project-URL: Discord server, https://discord.gg/Egy6P8AMB5
|
|
8
|
-
Project-URL: Docs, https://pylint.readthedocs.io/projects/astroid/en/latest/
|
|
9
8
|
Project-URL: Source Code, https://github.com/pylint-dev/astroid
|
|
9
|
+
Project-URL: Docs, https://pylint.readthedocs.io/projects/astroid/en/latest/
|
|
10
10
|
Keywords: abstract syntax tree,python,static code analysis
|
|
11
11
|
Classifier: Development Status :: 6 - Mature
|
|
12
12
|
Classifier: Environment :: Console
|
|
@@ -34,8 +34,8 @@ dependencies = [
|
|
|
34
34
|
]
|
|
35
35
|
urls."Bug tracker" = "https://github.com/pylint-dev/astroid/issues"
|
|
36
36
|
urls."Discord server" = "https://discord.gg/Egy6P8AMB5"
|
|
37
|
-
urls."Docs" = "https://pylint.readthedocs.io/projects/astroid/en/latest/"
|
|
38
37
|
urls."Source Code" = "https://github.com/pylint-dev/astroid"
|
|
38
|
+
urls.Docs = "https://pylint.readthedocs.io/projects/astroid/en/latest/"
|
|
39
39
|
|
|
40
40
|
[tool.setuptools]
|
|
41
41
|
dynamic.version = { attr = "astroid.__pkginfo__.__version__" }
|
|
@@ -76,12 +76,6 @@ lint.unfixable = [ "RUF001" ]
|
|
|
76
76
|
[tool.pyproject-fmt]
|
|
77
77
|
max_supported_python = "3.14"
|
|
78
78
|
|
|
79
|
-
[tool.pytest]
|
|
80
|
-
ini_options.addopts = '-m "not acceptance"'
|
|
81
|
-
ini_options.python_files = [ "*test_*.py" ]
|
|
82
|
-
ini_options.testpaths = [ "tests" ]
|
|
83
|
-
ini_options.filterwarnings = "error"
|
|
84
|
-
|
|
85
79
|
[tool.mypy]
|
|
86
80
|
python_version = "3.10"
|
|
87
81
|
files = [
|
|
@@ -135,6 +129,7 @@ show_error_codes = true
|
|
|
135
129
|
strict = true
|
|
136
130
|
warn_redundant_casts = true
|
|
137
131
|
warn_unreachable = true
|
|
132
|
+
warn_unused_configs = false
|
|
138
133
|
|
|
139
134
|
[[tool.mypy.overrides]]
|
|
140
135
|
# Importlib typeshed stubs do not include the private functions we use
|
|
@@ -148,5 +143,11 @@ module = [
|
|
|
148
143
|
]
|
|
149
144
|
ignore_missing_imports = true
|
|
150
145
|
|
|
146
|
+
[tool.pytest]
|
|
147
|
+
ini_options.addopts = '-m "not acceptance"'
|
|
148
|
+
ini_options.python_files = [ "*test_*.py" ]
|
|
149
|
+
ini_options.testpaths = [ "tests" ]
|
|
150
|
+
ini_options.filterwarnings = "error"
|
|
151
|
+
|
|
151
152
|
[tool.aliases]
|
|
152
153
|
test = "pytest"
|
|
@@ -15,7 +15,7 @@ import astroid
|
|
|
15
15
|
from astroid import MANAGER, builder, nodes, objects, test_utils, util
|
|
16
16
|
from astroid.bases import Instance
|
|
17
17
|
from astroid.brain.brain_namedtuple_enum import _get_namedtuple_fields
|
|
18
|
-
from astroid.const import PY312_PLUS, PY313_PLUS
|
|
18
|
+
from astroid.const import PY312_PLUS, PY313_PLUS, PY315_PLUS
|
|
19
19
|
from astroid.exceptions import (
|
|
20
20
|
AttributeInferenceError,
|
|
21
21
|
InferenceError,
|
|
@@ -787,7 +787,10 @@ class TypingBrain(unittest.TestCase):
|
|
|
787
787
|
typing.ByteString
|
|
788
788
|
""")
|
|
789
789
|
inferred = next(right_node.infer())
|
|
790
|
-
|
|
790
|
+
# From Python 3.15 we add a stub definition of `ByteString`. It doesn't need all properties
|
|
791
|
+
# of the original implementation.
|
|
792
|
+
if not PY315_PLUS:
|
|
793
|
+
check_metaclass_is_abc(inferred)
|
|
791
794
|
with self.assertRaises(AttributeInferenceError):
|
|
792
795
|
self.assertIsInstance(
|
|
793
796
|
inferred.getattr("__class_getitem__")[0], nodes.FunctionDef
|
|
@@ -41,7 +41,7 @@ def test_group_exceptions() -> None:
|
|
|
41
41
|
assert isinstance(node, nodes.Try)
|
|
42
42
|
handler = node.handlers[0]
|
|
43
43
|
assert node.block_range(lineno=1) == (1, 9)
|
|
44
|
-
assert node.block_range(lineno=2) == (2,
|
|
44
|
+
assert node.block_range(lineno=2) == (2, 3)
|
|
45
45
|
assert node.block_range(lineno=5) == (5, 9)
|
|
46
46
|
assert isinstance(handler, nodes.ExceptHandler)
|
|
47
47
|
assert handler.type.name == "ExceptionGroup"
|
|
@@ -72,15 +72,15 @@ def test_star_exceptions() -> None:
|
|
|
72
72
|
assert node.as_string() == code.replace('"', "'").strip()
|
|
73
73
|
assert isinstance(node.body[0], nodes.Raise)
|
|
74
74
|
assert node.block_range(1) == (1, 11)
|
|
75
|
-
assert node.block_range(2) == (2,
|
|
75
|
+
assert node.block_range(2) == (2, 3)
|
|
76
76
|
assert node.block_range(3) == (3, 3)
|
|
77
|
-
assert node.block_range(4) == (4,
|
|
77
|
+
assert node.block_range(4) == (4, 5)
|
|
78
78
|
assert node.block_range(5) == (5, 5)
|
|
79
|
-
assert node.block_range(6) == (6,
|
|
79
|
+
assert node.block_range(6) == (6, 7)
|
|
80
80
|
assert node.block_range(7) == (7, 7)
|
|
81
|
-
assert node.block_range(8) == (8,
|
|
81
|
+
assert node.block_range(8) == (8, 9)
|
|
82
82
|
assert node.block_range(9) == (9, 9)
|
|
83
|
-
assert node.block_range(10) == (10,
|
|
83
|
+
assert node.block_range(10) == (10, 11)
|
|
84
84
|
assert node.block_range(11) == (11, 11)
|
|
85
85
|
assert node.handlers
|
|
86
86
|
handler = node.handlers[0]
|
|
@@ -126,12 +126,12 @@ def test_star_exceptions_infer_exceptions() -> None:
|
|
|
126
126
|
assert isinstance(node, nodes.TryStar)
|
|
127
127
|
inferred_ve = next(node.handlers[0].statement().name.infer())
|
|
128
128
|
assert inferred_ve.name == "ExceptionGroup"
|
|
129
|
-
assert isinstance(inferred_ve.getattr("exceptions")[0], nodes.
|
|
129
|
+
assert isinstance(inferred_ve.getattr("exceptions")[0], nodes.Tuple)
|
|
130
130
|
assert (
|
|
131
131
|
inferred_ve.getattr("exceptions")[0].elts[0].pytype() == "builtins.ValueError"
|
|
132
132
|
)
|
|
133
133
|
|
|
134
134
|
inferred_te = next(node.handlers[1].statement().name.infer())
|
|
135
135
|
assert inferred_te.name == "ExceptionGroup"
|
|
136
|
-
assert isinstance(inferred_te.getattr("exceptions")[0], nodes.
|
|
136
|
+
assert isinstance(inferred_te.getattr("exceptions")[0], nodes.Tuple)
|
|
137
137
|
assert inferred_te.getattr("exceptions")[0].elts[0].pytype() == "builtins.TypeError"
|
|
@@ -11,7 +11,6 @@ from astroid import builder, helpers, manager, nodes, raw_building, util
|
|
|
11
11
|
from astroid.builder import AstroidBuilder
|
|
12
12
|
from astroid.const import IS_PYPY
|
|
13
13
|
from astroid.exceptions import InferenceError, _NonDeducibleTypeHierarchy
|
|
14
|
-
from astroid.nodes.node_classes import UNATTACHED_UNKNOWN
|
|
15
14
|
|
|
16
15
|
|
|
17
16
|
class TestHelpers(unittest.TestCase):
|
|
@@ -245,16 +244,6 @@ def test_uninferable_for_safe_infer() -> None:
|
|
|
245
244
|
assert util.safe_infer(util.Uninferable) == uninfer
|
|
246
245
|
|
|
247
246
|
|
|
248
|
-
def test_safe_infer_shim() -> None:
|
|
249
|
-
with pytest.warns(DeprecationWarning) as records:
|
|
250
|
-
helpers.safe_infer(UNATTACHED_UNKNOWN)
|
|
251
|
-
|
|
252
|
-
assert (
|
|
253
|
-
"Import safe_infer from astroid.util; this shim in astroid.helpers will be removed."
|
|
254
|
-
in records[0].message.args[0]
|
|
255
|
-
)
|
|
256
|
-
|
|
257
|
-
|
|
258
247
|
def test_class_to_container() -> None:
|
|
259
248
|
node = builder.extract_node("""isinstance(3, int)""")
|
|
260
249
|
|