astroid 4.3.2__tar.gz → 4.3.4__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.3.2/astroid.egg-info → astroid-4.3.4}/PKG-INFO +1 -1
- {astroid-4.3.2 → astroid-4.3.4}/astroid/__pkginfo__.py +1 -1
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_random.py +5 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/interpreter/objectmodel.py +1 -1
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/node_classes.py +39 -18
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/scoped_nodes/scoped_nodes.py +20 -1
- {astroid-4.3.2 → astroid-4.3.4}/astroid/protocols.py +6 -9
- {astroid-4.3.2 → astroid-4.3.4}/astroid/raw_building.py +23 -1
- {astroid-4.3.2 → astroid-4.3.4/astroid.egg-info}/PKG-INFO +1 -1
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_brain.py +14 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_inference.py +129 -3
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_nodes.py +53 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_object_model.py +20 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_raw_building.py +116 -0
- {astroid-4.3.2 → astroid-4.3.4}/CONTRIBUTORS.txt +4 -4
- {astroid-4.3.2 → astroid-4.3.4}/LICENSE +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/MANIFEST.in +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/README.rst +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/__main__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/_ast.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/arguments.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/astroid_manager.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/bases.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_argparse.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_attrs.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_boto3.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_builtin_inference.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_collections.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_crypt.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_ctypes.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_curses.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_dataclasses.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_datetime.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_dateutil.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_decimal.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_functools.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_gi.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_hashlib.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_http.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_hypothesis.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_io.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_mechanize.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_multiprocessing.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_namedtuple_enum.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_core_einsumfunc.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_core_fromnumeric.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_core_function_base.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_core_multiarray.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_core_numeric.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_core_numerictypes.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_core_umath.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_ma.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_ndarray.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_random_mtrand.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_numpy_utils.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_pathlib.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_pkg_resources.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_pytest.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_qt.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_re.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_regex.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_responses.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_scipy_signal.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_signal.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_six.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_sqlalchemy.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_ssl.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_statistics.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_subprocess.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_threading.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_type.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_typing.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_unittest.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/brain_uuid.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/brain/helpers.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/builder.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/const.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/constraint.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/context.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/decorators.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/exceptions.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/filter_statements.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/helpers.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/inference_tip.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/interpreter/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/interpreter/_import/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/interpreter/_import/spec.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/interpreter/_import/util.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/interpreter/dunder_lookup.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/manager.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/modutils.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/_base_nodes.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/as_string.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/const.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/node_ng.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/scoped_nodes/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/scoped_nodes/mixin.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/scoped_nodes/utils.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/nodes/utils.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/objects.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/rebuilder.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/test_utils.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/transforms.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/typing.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid/util.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid.egg-info/SOURCES.txt +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid.egg-info/dependency_links.txt +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid.egg-info/requires.txt +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/astroid.egg-info/top_level.txt +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/pyproject.toml +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/requirements_dev.txt +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/requirements_full.txt +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/requirements_minimal.txt +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/setup.cfg +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/benchmarks/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/benchmarks/conftest.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/benchmarks/test_bench_endtoend.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_core_einsumfunc.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_core_fromnumeric.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_core_function_base.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_core_multiarray.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_core_numeric.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_core_numerictypes.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_core_umath.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_ma.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_ndarray.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/numpy/test_random_mtrand.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_argparse.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_attr.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_builtin.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_ctypes.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_dataclasses.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_dateutil.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_enum.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_gi.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_hashlib.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_helpers.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_multiprocessing.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_named_tuple.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_pathlib.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_pytest.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_qt.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_regex.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_signal.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_six.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_ssl.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_statistics.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_threading.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_typing.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_typing_extensions.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/brain/test_unittest.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/resources.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_builder.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_constraint.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_context.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_decorators.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_filter_statements.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_get_relative_base_path.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_group_exceptions.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_helpers.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_inference_calls.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_lookup.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_manager.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_modutils.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_nodes_lineno.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_nodes_position.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_objects.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_protocols.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_python3.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_regrtest.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_scoped_nodes.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_stdlib.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_transforms.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_type_params.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/test_utils.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.egg +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zip +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/SSL1/Connection1.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/SSL1/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/absimp/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/absimp/sidepackage/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/absimp/string.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/absimport.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/all.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/appl/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/appl/myConnection.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level/import_package.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level/namespace_package/lower_level/helper_function.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level/namespace_package/plugin_api.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level/namespace_package/top_level_function.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_three/double_name/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_three/module/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/function.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/main.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_two/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_two/a.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_two/level1/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/beyond_top_level_two/level1/beyond_top_level_two.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/cache/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/cache/a.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/conditional.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/conditional_import/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/descriptor_crash.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/divide_by_zero.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/email.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/fake_module_with_broken_getattr.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/fake_module_with_collection_getattribute.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/fake_module_with_warnings.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/find_test/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/find_test/module.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/find_test/module2.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/find_test/noendingnewline.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/find_test/nonregr.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/foogle/fax/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/foogle/fax/a.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/format.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/import_conflicting_names/math.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/import_setuptools_pep660/__editable___example_0_1_0_finder.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/import_setuptools_pep660/example/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/import_setuptools_pep660/example/subpackage/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/invalid_encoding.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/lmfp/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/lmfp/foo.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/max_inferable_limit_for_classes/main.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/max_inferable_limit_for_classes/nodes/roles.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/max_inferable_limit_for_classes/other_funcs.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/metaclass_recursion/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/metaclass_recursion/monkeypatch.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/metaclass_recursion/parent.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/module.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/module1abs/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/module1abs/core.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/module2.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/module3.14.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/module_dict_items_call/models.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/module_dict_items_call/test.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/namespace_pep_420/module.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/noendingnewline.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/nonregr.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/notall.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/notamodule/file.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/operator_precedence.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/package/absimport.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/package/hello.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/package/import_package_subpackage_module.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/package/subpackage/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/package/subpackage/module.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/parent_of_homonym/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/parent_of_homonym/doc/README.md +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/parent_of_homonym/doc/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkg_resources_1/package/foo.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkg_resources_2/package/bar.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkg_resources_3/package/baz.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkgutil_1/package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkgutil_1/package/foo.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkgutil_2/package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkgutil_2/package/bar.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkgutil_3/package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/path_pkgutil_3/package/baz.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/recursion.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/tmp__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/unicode_package/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/unicode_package/core/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/data/x.zip +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/__init__.pyi +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/__init__.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/__init__.pyi +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/__init__.weird_ext +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/module.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/module2.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/noendingnewline.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/nonregr.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/find_test/standalone_file.weird_ext +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/pyi_data/module.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tests/testdata/python3/recursion_error.py +0 -0
- {astroid-4.3.2 → astroid-4.3.4}/tox.ini +0 -0
|
@@ -20,6 +20,11 @@ ACCEPTED_ITERABLES_FOR_SAMPLE = (nodes.List, nodes.Set, nodes.Tuple)
|
|
|
20
20
|
def _clone_node_with_lineno(node, parent, lineno):
|
|
21
21
|
if isinstance(node, nodes.EvaluatedObject):
|
|
22
22
|
node = node.original
|
|
23
|
+
if not isinstance(node, nodes.NodeNG):
|
|
24
|
+
# Inferred objects, such as ``Instance``, are not source nodes: they
|
|
25
|
+
# cannot be rebuilt from constructor arguments, so pass them through
|
|
26
|
+
# untouched instead of attempting to clone them.
|
|
27
|
+
return node
|
|
23
28
|
cls = node.__class__
|
|
24
29
|
other_fields = node._other_fields
|
|
25
30
|
_astroid_fields = node._astroid_fields
|
|
@@ -596,7 +596,7 @@ class ClassModel(ObjectModel):
|
|
|
596
596
|
|
|
597
597
|
@property
|
|
598
598
|
def attr___bases__(self):
|
|
599
|
-
obj = node_classes.Tuple()
|
|
599
|
+
obj = node_classes.Tuple(parent=self._instance)
|
|
600
600
|
context = InferenceContext()
|
|
601
601
|
elts = list(self._instance._inferred_bases(context))
|
|
602
602
|
obj.postinit(elts=elts)
|
|
@@ -935,19 +935,17 @@ class Arguments(
|
|
|
935
935
|
:raises NoDefault: If there is no default value defined for the
|
|
936
936
|
given argument.
|
|
937
937
|
"""
|
|
938
|
-
args = [
|
|
939
|
-
arg for arg in self.arguments if arg.name not in [self.vararg, self.kwarg]
|
|
940
|
-
]
|
|
941
|
-
|
|
942
938
|
index = _find_arg(argname, self.kwonlyargs)[0]
|
|
943
939
|
if (index is not None) and (len(self.kw_defaults) > index):
|
|
944
940
|
if self.kw_defaults[index] is not None:
|
|
945
941
|
return self.kw_defaults[index]
|
|
946
942
|
raise NoDefault(func=self.parent, name=argname)
|
|
947
943
|
|
|
948
|
-
|
|
944
|
+
positional = [*(self.posonlyargs or ()), *(self.args or ())]
|
|
945
|
+
index = _find_arg(argname, positional)[0]
|
|
949
946
|
if index is not None:
|
|
950
|
-
|
|
947
|
+
# ``defaults`` covers the last positional arguments.
|
|
948
|
+
idx = index - (len(positional) - len(self.defaults))
|
|
951
949
|
if idx >= 0:
|
|
952
950
|
return self.defaults[idx]
|
|
953
951
|
|
|
@@ -1902,6 +1900,8 @@ class Compare(NodeNG):
|
|
|
1902
1900
|
expr = op_func(left, right)
|
|
1903
1901
|
except TypeError as exc:
|
|
1904
1902
|
raise AstroidTypeError from exc
|
|
1903
|
+
except ValueError as exc:
|
|
1904
|
+
raise AstroidValueError from exc
|
|
1905
1905
|
|
|
1906
1906
|
if retval is None:
|
|
1907
1907
|
retval = expr
|
|
@@ -1927,7 +1927,7 @@ class Compare(NodeNG):
|
|
|
1927
1927
|
rhs = list(right_node.infer(context=context))
|
|
1928
1928
|
try:
|
|
1929
1929
|
retval = self._do_compare(lhs, op, rhs)
|
|
1930
|
-
except AstroidTypeError:
|
|
1930
|
+
except (AstroidTypeError, AstroidValueError):
|
|
1931
1931
|
retval = util.Uninferable
|
|
1932
1932
|
break
|
|
1933
1933
|
if retval is not True:
|
|
@@ -5685,28 +5685,28 @@ CONST_CLS: dict[type, type[NodeNG]] = {
|
|
|
5685
5685
|
|
|
5686
5686
|
|
|
5687
5687
|
def _create_basic_elements(
|
|
5688
|
-
value: Iterable[Any], node: List | Set | Tuple
|
|
5688
|
+
value: Iterable[Any], node: List | Set | Tuple, building: set[int]
|
|
5689
5689
|
) -> list[NodeNG]:
|
|
5690
5690
|
"""Create a list of nodes to function as the elements of a new node."""
|
|
5691
5691
|
elements: list[NodeNG] = []
|
|
5692
5692
|
for element in value:
|
|
5693
5693
|
# NOTE: avoid accessing any attributes of element in the loop.
|
|
5694
|
-
element_node =
|
|
5694
|
+
element_node = _const_factory(element, building)
|
|
5695
5695
|
element_node.parent = node
|
|
5696
5696
|
elements.append(element_node)
|
|
5697
5697
|
return elements
|
|
5698
5698
|
|
|
5699
5699
|
|
|
5700
5700
|
def _create_dict_items(
|
|
5701
|
-
values: Mapping[Any, Any], node: Dict
|
|
5701
|
+
values: Mapping[Any, Any], node: Dict, building: set[int]
|
|
5702
5702
|
) -> list[tuple[SuccessfulInferenceResult, SuccessfulInferenceResult]]:
|
|
5703
5703
|
"""Create a list of node pairs to function as the items of a new dict node."""
|
|
5704
5704
|
elements: list[tuple[SuccessfulInferenceResult, SuccessfulInferenceResult]] = []
|
|
5705
5705
|
for key, value in values.items():
|
|
5706
5706
|
# NOTE: avoid accessing any attributes of both key and value in the loop.
|
|
5707
|
-
key_node =
|
|
5707
|
+
key_node = _const_factory(key, building)
|
|
5708
5708
|
key_node.parent = node
|
|
5709
|
-
value_node =
|
|
5709
|
+
value_node = _const_factory(value, building)
|
|
5710
5710
|
value_node.parent = node
|
|
5711
5711
|
elements.append((key_node, value_node))
|
|
5712
5712
|
return elements
|
|
@@ -5714,6 +5714,15 @@ def _create_dict_items(
|
|
|
5714
5714
|
|
|
5715
5715
|
def const_factory(value: Any) -> ConstFactoryResult:
|
|
5716
5716
|
"""Return an astroid node for a python value."""
|
|
5717
|
+
return _const_factory(value, set())
|
|
5718
|
+
|
|
5719
|
+
|
|
5720
|
+
def _const_factory(value: Any, building: set[int]) -> ConstFactoryResult:
|
|
5721
|
+
"""Return an astroid node for value.
|
|
5722
|
+
|
|
5723
|
+
``building`` holds the ids of the containers whose elements are being
|
|
5724
|
+
converted, i.e. the containers value is nested in.
|
|
5725
|
+
"""
|
|
5717
5726
|
# NOTE: avoid accessing any attributes of value until it is known that value
|
|
5718
5727
|
# is of a const type, to avoid possibly triggering code for a live object.
|
|
5719
5728
|
# Accesses include value.__class__ and isinstance(value, ...), but not type(value).
|
|
@@ -5731,6 +5740,18 @@ def const_factory(value: Any) -> ConstFactoryResult:
|
|
|
5731
5740
|
|
|
5732
5741
|
instance: List | Set | Tuple | Dict
|
|
5733
5742
|
initializer_cls = CONST_CLS[value_type]
|
|
5743
|
+
if initializer_cls is Const:
|
|
5744
|
+
return Const(value)
|
|
5745
|
+
|
|
5746
|
+
# A live container can hold itself, directly or through other containers
|
|
5747
|
+
# (``namespace = globals()``): converting it again would recurse forever,
|
|
5748
|
+
# so the back reference becomes an EmptyNode, like a non-const object.
|
|
5749
|
+
value_id = id(value)
|
|
5750
|
+
if value_id in building:
|
|
5751
|
+
node = EmptyNode()
|
|
5752
|
+
node.object = value
|
|
5753
|
+
return node
|
|
5754
|
+
building.add(value_id)
|
|
5734
5755
|
if issubclass(initializer_cls, (List, Set, Tuple)):
|
|
5735
5756
|
instance = initializer_cls(
|
|
5736
5757
|
lineno=None,
|
|
@@ -5739,9 +5760,9 @@ def const_factory(value: Any) -> ConstFactoryResult:
|
|
|
5739
5760
|
end_lineno=None,
|
|
5740
5761
|
end_col_offset=None,
|
|
5741
5762
|
)
|
|
5742
|
-
instance.postinit(_create_basic_elements(value, instance))
|
|
5743
|
-
|
|
5744
|
-
|
|
5763
|
+
instance.postinit(_create_basic_elements(value, instance, building))
|
|
5764
|
+
else:
|
|
5765
|
+
assert issubclass(initializer_cls, Dict)
|
|
5745
5766
|
instance = initializer_cls(
|
|
5746
5767
|
lineno=None,
|
|
5747
5768
|
col_offset=None,
|
|
@@ -5749,6 +5770,6 @@ def const_factory(value: Any) -> ConstFactoryResult:
|
|
|
5749
5770
|
end_lineno=None,
|
|
5750
5771
|
end_col_offset=None,
|
|
5751
5772
|
)
|
|
5752
|
-
instance.postinit(_create_dict_items(value, instance))
|
|
5753
|
-
|
|
5754
|
-
return
|
|
5773
|
+
instance.postinit(_create_dict_items(value, instance, building))
|
|
5774
|
+
building.remove(value_id)
|
|
5775
|
+
return instance
|
|
@@ -1547,6 +1547,18 @@ class FunctionDef(
|
|
|
1547
1547
|
elif yield_.scope() == self:
|
|
1548
1548
|
yield from yield_.value.infer(context=context)
|
|
1549
1549
|
|
|
1550
|
+
@staticmethod
|
|
1551
|
+
def _is_stub_placeholder_body(body: list[NodeNG]) -> bool:
|
|
1552
|
+
"""Check if a function body is only ``...`` or ``pass``."""
|
|
1553
|
+
if len(body) != 1:
|
|
1554
|
+
return False
|
|
1555
|
+
statement = body[0]
|
|
1556
|
+
return isinstance(statement, node_classes.Pass) or (
|
|
1557
|
+
isinstance(statement, node_classes.Expr)
|
|
1558
|
+
and isinstance(statement.value, node_classes.Const)
|
|
1559
|
+
and statement.value.value is ...
|
|
1560
|
+
)
|
|
1561
|
+
|
|
1550
1562
|
def infer_call_result(
|
|
1551
1563
|
self,
|
|
1552
1564
|
caller: SuccessfulInferenceResult | None,
|
|
@@ -1622,7 +1634,11 @@ class FunctionDef(
|
|
|
1622
1634
|
first_return = next(returns, None)
|
|
1623
1635
|
if not first_return:
|
|
1624
1636
|
if self.body:
|
|
1625
|
-
|
|
1637
|
+
# A body that is only ``...`` is a placeholder, like ``pass``:
|
|
1638
|
+
# it does not mean the function returns ``None``.
|
|
1639
|
+
if self._is_stub_placeholder_body(self.body) or self.is_abstract(
|
|
1640
|
+
pass_is_abstract=True, any_raise_is_abstract=True
|
|
1641
|
+
):
|
|
1626
1642
|
yield util.Uninferable
|
|
1627
1643
|
else:
|
|
1628
1644
|
yield node_classes.Const(None)
|
|
@@ -2591,6 +2607,9 @@ class ClassDef(
|
|
|
2591
2607
|
|
|
2592
2608
|
method = methods[0]
|
|
2593
2609
|
|
|
2610
|
+
if isinstance(method, util.UninferableBase):
|
|
2611
|
+
return util.Uninferable
|
|
2612
|
+
|
|
2594
2613
|
# Create a new callcontext for providing index as an argument.
|
|
2595
2614
|
new_context = bind_context_to_node(context, self)
|
|
2596
2615
|
new_context.callcontext = CallContext(args=[index], callee=method)
|
|
@@ -262,18 +262,15 @@ def _multiply_seq_by_int(
|
|
|
262
262
|
return node
|
|
263
263
|
|
|
264
264
|
|
|
265
|
-
def
|
|
265
|
+
def _infer_sequence_elements(
|
|
266
266
|
elts: Sequence[InferenceResult], context: InferenceContext
|
|
267
267
|
) -> Iterator[SuccessfulInferenceResult]:
|
|
268
268
|
for elt in elts:
|
|
269
|
-
|
|
269
|
+
inferred = util.safe_infer(elt, context)
|
|
270
|
+
if inferred is None or isinstance(inferred, util.UninferableBase):
|
|
270
271
|
yield node_classes.UNATTACHED_UNKNOWN
|
|
271
272
|
else:
|
|
272
|
-
|
|
273
|
-
if not isinstance(inferred, util.UninferableBase):
|
|
274
|
-
yield inferred
|
|
275
|
-
else:
|
|
276
|
-
yield node_classes.UNATTACHED_UNKNOWN
|
|
273
|
+
yield inferred
|
|
277
274
|
|
|
278
275
|
|
|
279
276
|
@decorators.yes_if_nothing_inferred
|
|
@@ -304,8 +301,8 @@ def tl_infer_binary_op(
|
|
|
304
301
|
node = self.__class__(parent=opnode)
|
|
305
302
|
node.elts = list(
|
|
306
303
|
itertools.chain(
|
|
307
|
-
|
|
308
|
-
|
|
304
|
+
_infer_sequence_elements(self.elts, context),
|
|
305
|
+
_infer_sequence_elements(other.elts, context),
|
|
309
306
|
)
|
|
310
307
|
)
|
|
311
308
|
yield node
|
|
@@ -267,6 +267,19 @@ def register_arguments(func: nodes.FunctionDef, args: list | None = None) -> Non
|
|
|
267
267
|
register_arguments(func, arg.elts)
|
|
268
268
|
|
|
269
269
|
|
|
270
|
+
def _would_create_parent_cycle(node: nodes.NodeNG, child: nodes.NodeNG) -> bool:
|
|
271
|
+
"""Whether making ``node`` the parent of ``child`` would close a parent loop.
|
|
272
|
+
|
|
273
|
+
That happens when ``child`` already is ``node`` or one of its ancestors.
|
|
274
|
+
"""
|
|
275
|
+
ancestor: nodes.NodeNG | None = node
|
|
276
|
+
while ancestor is not None:
|
|
277
|
+
if ancestor is child:
|
|
278
|
+
return True
|
|
279
|
+
ancestor = ancestor.parent
|
|
280
|
+
return False
|
|
281
|
+
|
|
282
|
+
|
|
270
283
|
def object_build_class(
|
|
271
284
|
node: nodes.Module | nodes.ClassDef, member: type
|
|
272
285
|
) -> nodes.ClassDef:
|
|
@@ -538,7 +551,16 @@ class InspectBuilder:
|
|
|
538
551
|
# create an empty node so that the name is actually defined
|
|
539
552
|
child: nodes.NodeNG = build_dummy(member)
|
|
540
553
|
if child not in node.locals.get(alias, ()):
|
|
541
|
-
node
|
|
554
|
+
if _would_create_parent_cycle(node, child):
|
|
555
|
+
# ``child`` was built for another owner and is already an
|
|
556
|
+
# ancestor of ``node`` (or is ``node`` itself). Classes that
|
|
557
|
+
# expose themselves or their siblings as attributes -- pyo3
|
|
558
|
+
# complex enums do -- reach this. Re-parenting would close a
|
|
559
|
+
# parent loop and make ``root()`` spin forever, so only
|
|
560
|
+
# register the name.
|
|
561
|
+
node.set_local(alias, child)
|
|
562
|
+
else:
|
|
563
|
+
node.add_local_node(child, alias)
|
|
542
564
|
return None
|
|
543
565
|
|
|
544
566
|
def imported_member(self, node, member, name: str) -> bool:
|
|
@@ -1068,6 +1068,20 @@ class RandomSampleTest(unittest.TestCase):
|
|
|
1068
1068
|
assert isinstance(inferred.elts[0], nodes.Module)
|
|
1069
1069
|
assert inferred.elts[0].name == "gc"
|
|
1070
1070
|
|
|
1071
|
+
def test_no_crash_on_instance_element(self) -> None:
|
|
1072
|
+
"""Test that random.sample does not crash when an element is not a source node.
|
|
1073
|
+
|
|
1074
|
+
Regression test for https://github.com/pylint-dev/astroid/issues/3310
|
|
1075
|
+
"""
|
|
1076
|
+
node = astroid.extract_node("""
|
|
1077
|
+
from random import sample
|
|
1078
|
+
sample(list({list(None)}) * 1, 1) #@
|
|
1079
|
+
""")
|
|
1080
|
+
inferred = next(node.infer())
|
|
1081
|
+
assert isinstance(inferred, nodes.List)
|
|
1082
|
+
assert len(inferred.elts) == 1
|
|
1083
|
+
assert isinstance(inferred.elts[0], Instance)
|
|
1084
|
+
|
|
1071
1085
|
|
|
1072
1086
|
class SubprocessTest(unittest.TestCase):
|
|
1073
1087
|
"""Test subprocess brain"""
|
|
@@ -1249,6 +1249,62 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
|
|
|
1249
1249
|
self.assertEqual(inferred[0].elts[0].value, 1)
|
|
1250
1250
|
self.assertEqual(inferred[0].elts[1].value, 2)
|
|
1251
1251
|
|
|
1252
|
+
def test_binary_op_tuple_add_preserves_ambiguous_element(self) -> None:
|
|
1253
|
+
node = extract_node("""
|
|
1254
|
+
def choose():
|
|
1255
|
+
value = 1
|
|
1256
|
+
if value < 0:
|
|
1257
|
+
value = -value
|
|
1258
|
+
return value
|
|
1259
|
+
|
|
1260
|
+
(0, choose()) + (2,) #@
|
|
1261
|
+
""")
|
|
1262
|
+
|
|
1263
|
+
inferred = next(node.infer())
|
|
1264
|
+
|
|
1265
|
+
self.assertIsInstance(inferred, nodes.Tuple)
|
|
1266
|
+
self.assertEqual(len(inferred.elts), 3)
|
|
1267
|
+
self.assertIsInstance(inferred.elts[1], nodes.Unknown)
|
|
1268
|
+
|
|
1269
|
+
def test_binary_op_sequence_add_preserves_ambiguous_edge_elements(self) -> None:
|
|
1270
|
+
expressions = extract_node("""
|
|
1271
|
+
def choose():
|
|
1272
|
+
value = 1
|
|
1273
|
+
if value < 0:
|
|
1274
|
+
value = -value
|
|
1275
|
+
return value
|
|
1276
|
+
|
|
1277
|
+
(choose(), 1) + (2, choose()) #@
|
|
1278
|
+
[choose(), 1] + [2, choose()] #@
|
|
1279
|
+
""")
|
|
1280
|
+
|
|
1281
|
+
for expression, sequence_type in zip(expressions, (nodes.Tuple, nodes.List)):
|
|
1282
|
+
with self.subTest(sequence_type=sequence_type):
|
|
1283
|
+
inferred = next(expression.infer())
|
|
1284
|
+
|
|
1285
|
+
self.assertIsInstance(inferred, sequence_type)
|
|
1286
|
+
self.assertEqual(len(inferred.elts), 4)
|
|
1287
|
+
self.assertIsInstance(inferred.elts[0], nodes.Unknown)
|
|
1288
|
+
self.assertEqual(inferred.elts[1].value, 1)
|
|
1289
|
+
self.assertEqual(inferred.elts[2].value, 2)
|
|
1290
|
+
self.assertIsInstance(inferred.elts[3], nodes.Unknown)
|
|
1291
|
+
|
|
1292
|
+
def test_binary_op_tuple_add_preserves_uninferable_elements(self) -> None:
|
|
1293
|
+
node = extract_node("""
|
|
1294
|
+
from missing import Unknown
|
|
1295
|
+
|
|
1296
|
+
(Unknown, 1) + (2, Unknown) #@
|
|
1297
|
+
""")
|
|
1298
|
+
|
|
1299
|
+
inferred = next(node.infer())
|
|
1300
|
+
|
|
1301
|
+
self.assertIsInstance(inferred, nodes.Tuple)
|
|
1302
|
+
self.assertEqual(len(inferred.elts), 4)
|
|
1303
|
+
self.assertIsInstance(inferred.elts[0], nodes.Unknown)
|
|
1304
|
+
self.assertEqual(inferred.elts[1].value, 1)
|
|
1305
|
+
self.assertEqual(inferred.elts[2].value, 2)
|
|
1306
|
+
self.assertIsInstance(inferred.elts[3], nodes.Unknown)
|
|
1307
|
+
|
|
1252
1308
|
def test_binary_op_custom_class(self) -> None:
|
|
1253
1309
|
code = """
|
|
1254
1310
|
class myarray:
|
|
@@ -4232,8 +4288,7 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
|
|
|
4232
4288
|
A().foo() #@
|
|
4233
4289
|
""")
|
|
4234
4290
|
inferred = next(node.infer())
|
|
4235
|
-
assert
|
|
4236
|
-
assert inferred.value is None
|
|
4291
|
+
assert inferred is util.Uninferable
|
|
4237
4292
|
|
|
4238
4293
|
def test_infer_method_overload(self) -> None:
|
|
4239
4294
|
# https://github.com/PyCQA/astroid/issues/1015
|
|
@@ -4348,7 +4403,8 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
|
|
|
4348
4403
|
# Test that we wrap an AttributeInferenceError
|
|
4349
4404
|
# and reraise it as a TypeError in Class.getitem
|
|
4350
4405
|
node = extract_node("""
|
|
4351
|
-
def test():
|
|
4406
|
+
def test():
|
|
4407
|
+
return None
|
|
4352
4408
|
test()
|
|
4353
4409
|
""")
|
|
4354
4410
|
inferred = next(node.infer())
|
|
@@ -4387,6 +4443,20 @@ class InferenceTest(resources.SysPathSetup, unittest.TestCase):
|
|
|
4387
4443
|
with self.assertRaises(AstroidTypeError):
|
|
4388
4444
|
node.getitem(nodes.Const(0))
|
|
4389
4445
|
|
|
4446
|
+
def test_getitem_with_uninferable_class_getitem(self) -> None:
|
|
4447
|
+
"""``__class_getitem__`` may resolve to an ``Uninferable`` node or return
|
|
4448
|
+
``Uninferable``, which is not an iterator.
|
|
4449
|
+
|
|
4450
|
+
Regression test for https://github.com/pylint-dev/astroid/issues/3312
|
|
4451
|
+
"""
|
|
4452
|
+
node = extract_node("""
|
|
4453
|
+
class C: pass
|
|
4454
|
+
type.__class_getitem__ = min()
|
|
4455
|
+
C[0] #@
|
|
4456
|
+
""")
|
|
4457
|
+
inferred = next(node.infer())
|
|
4458
|
+
self.assertIs(inferred, util.Uninferable)
|
|
4459
|
+
|
|
4390
4460
|
def test_infer_arg_called_type_is_uninferable(self) -> None:
|
|
4391
4461
|
node = extract_node("""
|
|
4392
4462
|
def func(type):
|
|
@@ -5840,6 +5910,14 @@ def test_compare_typeerror() -> None:
|
|
|
5840
5910
|
assert inferred[0] is util.Uninferable
|
|
5841
5911
|
|
|
5842
5912
|
|
|
5913
|
+
def test_compare_valueerror() -> None:
|
|
5914
|
+
for code in ('257 in b""', '257 not in b""'):
|
|
5915
|
+
node = extract_node(code)
|
|
5916
|
+
inferred = list(node.infer())
|
|
5917
|
+
assert len(inferred) == 1
|
|
5918
|
+
assert inferred[0] is util.Uninferable
|
|
5919
|
+
|
|
5920
|
+
|
|
5843
5921
|
def test_compare_multiple_possibilites() -> None:
|
|
5844
5922
|
code = """
|
|
5845
5923
|
from unknown import UNKNOWN
|
|
@@ -7444,3 +7522,51 @@ def test_decimal_inference():
|
|
|
7444
7522
|
for node in extract_node(code):
|
|
7445
7523
|
module = node.do_import_module(node.modname)
|
|
7446
7524
|
module.getattr(node.names[0][0])
|
|
7525
|
+
|
|
7526
|
+
|
|
7527
|
+
@pytest.mark.parametrize(
|
|
7528
|
+
"body",
|
|
7529
|
+
[
|
|
7530
|
+
"...",
|
|
7531
|
+
'"""Docstring."""\n ...',
|
|
7532
|
+
"pass",
|
|
7533
|
+
],
|
|
7534
|
+
)
|
|
7535
|
+
def test_placeholder_body_call_result_is_uninferable(body: str) -> None:
|
|
7536
|
+
"""A body that only holds a placeholder does not mean the function returns None."""
|
|
7537
|
+
node = extract_node(f"""
|
|
7538
|
+
def apple() -> int:
|
|
7539
|
+
{body}
|
|
7540
|
+
apple() #@
|
|
7541
|
+
""")
|
|
7542
|
+
assert next(node.infer()) is util.Uninferable
|
|
7543
|
+
|
|
7544
|
+
|
|
7545
|
+
def test_ellipsis_property_stub_is_uninferable() -> None:
|
|
7546
|
+
"""Regression test for https://github.com/pylint-dev/pylint/issues/8138."""
|
|
7547
|
+
node = extract_node("""
|
|
7548
|
+
from typing import TYPE_CHECKING, Type
|
|
7549
|
+
|
|
7550
|
+
class Banana:
|
|
7551
|
+
pass
|
|
7552
|
+
|
|
7553
|
+
class Basket:
|
|
7554
|
+
if TYPE_CHECKING:
|
|
7555
|
+
@property
|
|
7556
|
+
def banana(self) -> Type[Banana]: ...
|
|
7557
|
+
|
|
7558
|
+
Basket().banana #@
|
|
7559
|
+
""")
|
|
7560
|
+
assert next(node.infer()) is util.Uninferable
|
|
7561
|
+
|
|
7562
|
+
|
|
7563
|
+
def test_ellipsis_with_other_statements_still_returns_none() -> None:
|
|
7564
|
+
node = extract_node("""
|
|
7565
|
+
def apple():
|
|
7566
|
+
...
|
|
7567
|
+
color = "red"
|
|
7568
|
+
apple() #@
|
|
7569
|
+
""")
|
|
7570
|
+
inferred = next(node.infer())
|
|
7571
|
+
assert isinstance(inferred, nodes.Const)
|
|
7572
|
+
assert inferred.value is None
|
|
@@ -44,6 +44,7 @@ from astroid.exceptions import (
|
|
|
44
44
|
AstroidSyntaxError,
|
|
45
45
|
AstroidTypeError,
|
|
46
46
|
AttributeInferenceError,
|
|
47
|
+
NoDefault,
|
|
47
48
|
StatementMissing,
|
|
48
49
|
)
|
|
49
50
|
from astroid.nodes.node_classes import UNATTACHED_UNKNOWN
|
|
@@ -706,6 +707,31 @@ class ConstNodeTest(unittest.TestCase):
|
|
|
706
707
|
def test_str(self) -> None:
|
|
707
708
|
self._test("a")
|
|
708
709
|
|
|
710
|
+
def test_self_referencing_containers(self) -> None:
|
|
711
|
+
loop: list[Any] = [1]
|
|
712
|
+
loop.append(loop)
|
|
713
|
+
mapping: dict[str, Any] = {"loop": loop}
|
|
714
|
+
mapping["mapping"] = (mapping,)
|
|
715
|
+
|
|
716
|
+
node = nodes.const_factory(mapping)
|
|
717
|
+
|
|
718
|
+
assert isinstance(node, nodes.Dict)
|
|
719
|
+
(_, loop_node), (_, tuple_node) = node.items
|
|
720
|
+
assert isinstance(loop_node, nodes.List)
|
|
721
|
+
assert isinstance(loop_node.elts[0], nodes.Const)
|
|
722
|
+
assert isinstance(loop_node.elts[1], nodes.EmptyNode)
|
|
723
|
+
assert loop_node.elts[1].object is loop
|
|
724
|
+
assert isinstance(tuple_node, nodes.Tuple)
|
|
725
|
+
assert isinstance(tuple_node.elts[0], nodes.EmptyNode)
|
|
726
|
+
assert tuple_node.elts[0].object is mapping
|
|
727
|
+
|
|
728
|
+
def test_shared_container_is_not_a_cycle(self) -> None:
|
|
729
|
+
shared = [1]
|
|
730
|
+
node = nodes.const_factory([shared, shared])
|
|
731
|
+
assert isinstance(node, nodes.List)
|
|
732
|
+
assert [type(elt) for elt in node.elts] == [nodes.List, nodes.List]
|
|
733
|
+
assert [elt.elts[0].value for elt in node.elts] == [1, 1]
|
|
734
|
+
|
|
709
735
|
def test_unicode(self) -> None:
|
|
710
736
|
self._test("a")
|
|
711
737
|
|
|
@@ -2268,6 +2294,33 @@ def test_arguments_default_value():
|
|
|
2268
2294
|
assert node.args.default_value("flavor").value == "good"
|
|
2269
2295
|
|
|
2270
2296
|
|
|
2297
|
+
@pytest.mark.parametrize("func", ["def f(x, *y, y): ...", "def f(x, *, y, **y): ..."])
|
|
2298
|
+
def test_arguments_default_value_name_shared_with_vararg(func: str) -> None:
|
|
2299
|
+
"""An argument may repeat the name of ``*args`` or ``**kwargs``.
|
|
2300
|
+
|
|
2301
|
+
Such a definition parses even though it does not compile, so the name of a
|
|
2302
|
+
variadic argument does not identify it on its own.
|
|
2303
|
+
"""
|
|
2304
|
+
node = extract_node(func)
|
|
2305
|
+
with pytest.raises(NoDefault):
|
|
2306
|
+
node.args.default_value("x")
|
|
2307
|
+
with pytest.raises(NoDefault):
|
|
2308
|
+
node.args.default_value("y")
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
def test_arguments_default_value_positional_shares_vararg_name() -> None:
|
|
2312
|
+
"""The default of a positional argument shadowed by ``*args`` is still found."""
|
|
2313
|
+
node = extract_node("def f(y=1, *y): ...")
|
|
2314
|
+
assert node.args.default_value("y").value == 1
|
|
2315
|
+
|
|
2316
|
+
|
|
2317
|
+
def test_infer_argument_sharing_vararg_name() -> None:
|
|
2318
|
+
"""Inferring such an argument yields ``Uninferable`` rather than crashing."""
|
|
2319
|
+
node = extract_node("def f(x, *y, y: tuple[x]): ...")
|
|
2320
|
+
subscript = node.args.kwonlyargs_annotations[0]
|
|
2321
|
+
assert next(subscript.slice.infer()) is Uninferable
|
|
2322
|
+
|
|
2323
|
+
|
|
2271
2324
|
def test_arguments_annotations():
|
|
2272
2325
|
node = extract_node(
|
|
2273
2326
|
"def fruit(eat: str, /, peel: bool, *args: int, trim: float, **kwargs: bytes): ..."
|
|
@@ -239,6 +239,8 @@ class ClassModelTest(unittest.TestCase):
|
|
|
239
239
|
base_nodes = next(ast_nodes[6].infer())
|
|
240
240
|
self.assertIsInstance(base_nodes, nodes.Tuple)
|
|
241
241
|
self.assertEqual([cls.name for cls in base_nodes.elts], ["object"])
|
|
242
|
+
self.assertIsInstance(base_nodes.parent, nodes.ClassDef)
|
|
243
|
+
self.assertEqual(base_nodes.root().name, "fake_module")
|
|
242
244
|
|
|
243
245
|
cls = next(ast_nodes[7].infer())
|
|
244
246
|
self.assertIsInstance(cls, nodes.ClassDef)
|
|
@@ -251,6 +253,24 @@ class ClassModelTest(unittest.TestCase):
|
|
|
251
253
|
self.assertIsInstance(subclasses, nodes.List)
|
|
252
254
|
self.assertEqual([cls.name for cls in subclasses.elts], ["B", "C"])
|
|
253
255
|
|
|
256
|
+
def test_class_bases_has_module_root(self) -> None:
|
|
257
|
+
"""Regression test for pylint-dev/pylint#11491.
|
|
258
|
+
|
|
259
|
+
Inferring ``Class.__bases__`` must return a Tuple parented to the class so
|
|
260
|
+
callers can safely use ``.root()`` (e.g. pylint's stdlib checker).
|
|
261
|
+
"""
|
|
262
|
+
node = builder.extract_node("""
|
|
263
|
+
class C:
|
|
264
|
+
pass
|
|
265
|
+
C.__bases__ #@
|
|
266
|
+
""")
|
|
267
|
+
inferred = next(node.infer())
|
|
268
|
+
self.assertIsInstance(inferred, nodes.Tuple)
|
|
269
|
+
self.assertIsInstance(inferred.parent, nodes.ClassDef)
|
|
270
|
+
self.assertEqual(inferred.parent.name, "C")
|
|
271
|
+
# Must not raise AssertionError from NodeNG.root().
|
|
272
|
+
self.assertIsInstance(inferred.root(), nodes.Module)
|
|
273
|
+
|
|
254
274
|
|
|
255
275
|
class ModuleModelTest(unittest.TestCase):
|
|
256
276
|
def test_priority_to_local_defined_values(self) -> None:
|