astroid 4.3.1__tar.gz → 4.3.3__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.
Files changed (292) hide show
  1. {astroid-4.3.1/astroid.egg-info → astroid-4.3.3}/PKG-INFO +1 -1
  2. {astroid-4.3.1 → astroid-4.3.3}/astroid/__pkginfo__.py +1 -1
  3. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_builtin_inference.py +2 -1
  4. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_six.py +6 -0
  5. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_typing.py +6 -1
  6. {astroid-4.3.1 → astroid-4.3.3}/astroid/exceptions.py +7 -3
  7. {astroid-4.3.1 → astroid-4.3.3}/astroid/interpreter/objectmodel.py +7 -3
  8. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/node_classes.py +2 -1
  9. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/scoped_nodes/scoped_nodes.py +16 -2
  10. {astroid-4.3.1 → astroid-4.3.3}/astroid/protocols.py +6 -9
  11. {astroid-4.3.1 → astroid-4.3.3/astroid.egg-info}/PKG-INFO +1 -1
  12. {astroid-4.3.1 → astroid-4.3.3}/requirements_minimal.txt +1 -0
  13. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_builtin.py +2 -0
  14. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_named_tuple.py +33 -0
  15. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_six.py +20 -0
  16. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_typing.py +16 -3
  17. {astroid-4.3.1 → astroid-4.3.3}/tests/test_inference.py +79 -1
  18. {astroid-4.3.1 → astroid-4.3.3}/tests/test_object_model.py +40 -4
  19. {astroid-4.3.1 → astroid-4.3.3}/tests/test_scoped_nodes.py +9 -0
  20. {astroid-4.3.1 → astroid-4.3.3}/CONTRIBUTORS.txt +4 -4
  21. {astroid-4.3.1 → astroid-4.3.3}/LICENSE +0 -0
  22. {astroid-4.3.1 → astroid-4.3.3}/MANIFEST.in +0 -0
  23. {astroid-4.3.1 → astroid-4.3.3}/README.rst +0 -0
  24. {astroid-4.3.1 → astroid-4.3.3}/astroid/__init__.py +0 -0
  25. {astroid-4.3.1 → astroid-4.3.3}/astroid/__main__.py +0 -0
  26. {astroid-4.3.1 → astroid-4.3.3}/astroid/_ast.py +0 -0
  27. {astroid-4.3.1 → astroid-4.3.3}/astroid/arguments.py +0 -0
  28. {astroid-4.3.1 → astroid-4.3.3}/astroid/astroid_manager.py +0 -0
  29. {astroid-4.3.1 → astroid-4.3.3}/astroid/bases.py +0 -0
  30. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/__init__.py +0 -0
  31. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_argparse.py +0 -0
  32. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_attrs.py +0 -0
  33. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_boto3.py +0 -0
  34. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_collections.py +0 -0
  35. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_crypt.py +0 -0
  36. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_ctypes.py +0 -0
  37. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_curses.py +0 -0
  38. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_dataclasses.py +0 -0
  39. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_datetime.py +0 -0
  40. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_dateutil.py +0 -0
  41. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_decimal.py +0 -0
  42. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_functools.py +0 -0
  43. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_gi.py +0 -0
  44. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_hashlib.py +0 -0
  45. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_http.py +0 -0
  46. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_hypothesis.py +0 -0
  47. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_io.py +0 -0
  48. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_mechanize.py +0 -0
  49. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_multiprocessing.py +0 -0
  50. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_namedtuple_enum.py +0 -0
  51. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_core_einsumfunc.py +0 -0
  52. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_core_fromnumeric.py +0 -0
  53. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_core_function_base.py +0 -0
  54. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_core_multiarray.py +0 -0
  55. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_core_numeric.py +0 -0
  56. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_core_numerictypes.py +0 -0
  57. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_core_umath.py +0 -0
  58. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_ma.py +0 -0
  59. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_ndarray.py +0 -0
  60. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_random_mtrand.py +0 -0
  61. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_numpy_utils.py +0 -0
  62. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_pathlib.py +0 -0
  63. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_pkg_resources.py +0 -0
  64. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_pytest.py +0 -0
  65. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_qt.py +0 -0
  66. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_random.py +0 -0
  67. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_re.py +0 -0
  68. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_regex.py +0 -0
  69. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_responses.py +0 -0
  70. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_scipy_signal.py +0 -0
  71. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_signal.py +0 -0
  72. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_sqlalchemy.py +0 -0
  73. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_ssl.py +0 -0
  74. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_statistics.py +0 -0
  75. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_subprocess.py +0 -0
  76. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_threading.py +0 -0
  77. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_type.py +0 -0
  78. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_unittest.py +0 -0
  79. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/brain_uuid.py +0 -0
  80. {astroid-4.3.1 → astroid-4.3.3}/astroid/brain/helpers.py +0 -0
  81. {astroid-4.3.1 → astroid-4.3.3}/astroid/builder.py +0 -0
  82. {astroid-4.3.1 → astroid-4.3.3}/astroid/const.py +0 -0
  83. {astroid-4.3.1 → astroid-4.3.3}/astroid/constraint.py +0 -0
  84. {astroid-4.3.1 → astroid-4.3.3}/astroid/context.py +0 -0
  85. {astroid-4.3.1 → astroid-4.3.3}/astroid/decorators.py +0 -0
  86. {astroid-4.3.1 → astroid-4.3.3}/astroid/filter_statements.py +0 -0
  87. {astroid-4.3.1 → astroid-4.3.3}/astroid/helpers.py +0 -0
  88. {astroid-4.3.1 → astroid-4.3.3}/astroid/inference_tip.py +0 -0
  89. {astroid-4.3.1 → astroid-4.3.3}/astroid/interpreter/__init__.py +0 -0
  90. {astroid-4.3.1 → astroid-4.3.3}/astroid/interpreter/_import/__init__.py +0 -0
  91. {astroid-4.3.1 → astroid-4.3.3}/astroid/interpreter/_import/spec.py +0 -0
  92. {astroid-4.3.1 → astroid-4.3.3}/astroid/interpreter/_import/util.py +0 -0
  93. {astroid-4.3.1 → astroid-4.3.3}/astroid/interpreter/dunder_lookup.py +0 -0
  94. {astroid-4.3.1 → astroid-4.3.3}/astroid/manager.py +0 -0
  95. {astroid-4.3.1 → astroid-4.3.3}/astroid/modutils.py +0 -0
  96. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/__init__.py +0 -0
  97. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/_base_nodes.py +0 -0
  98. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/as_string.py +0 -0
  99. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/const.py +0 -0
  100. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/node_ng.py +0 -0
  101. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/scoped_nodes/__init__.py +0 -0
  102. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/scoped_nodes/mixin.py +0 -0
  103. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/scoped_nodes/utils.py +0 -0
  104. {astroid-4.3.1 → astroid-4.3.3}/astroid/nodes/utils.py +0 -0
  105. {astroid-4.3.1 → astroid-4.3.3}/astroid/objects.py +0 -0
  106. {astroid-4.3.1 → astroid-4.3.3}/astroid/raw_building.py +0 -0
  107. {astroid-4.3.1 → astroid-4.3.3}/astroid/rebuilder.py +0 -0
  108. {astroid-4.3.1 → astroid-4.3.3}/astroid/test_utils.py +0 -0
  109. {astroid-4.3.1 → astroid-4.3.3}/astroid/transforms.py +0 -0
  110. {astroid-4.3.1 → astroid-4.3.3}/astroid/typing.py +0 -0
  111. {astroid-4.3.1 → astroid-4.3.3}/astroid/util.py +0 -0
  112. {astroid-4.3.1 → astroid-4.3.3}/astroid.egg-info/SOURCES.txt +0 -0
  113. {astroid-4.3.1 → astroid-4.3.3}/astroid.egg-info/dependency_links.txt +0 -0
  114. {astroid-4.3.1 → astroid-4.3.3}/astroid.egg-info/requires.txt +0 -0
  115. {astroid-4.3.1 → astroid-4.3.3}/astroid.egg-info/top_level.txt +0 -0
  116. {astroid-4.3.1 → astroid-4.3.3}/pyproject.toml +0 -0
  117. {astroid-4.3.1 → astroid-4.3.3}/requirements_dev.txt +0 -0
  118. {astroid-4.3.1 → astroid-4.3.3}/requirements_full.txt +0 -0
  119. {astroid-4.3.1 → astroid-4.3.3}/setup.cfg +0 -0
  120. {astroid-4.3.1 → astroid-4.3.3}/tests/__init__.py +0 -0
  121. {astroid-4.3.1 → astroid-4.3.3}/tests/benchmarks/__init__.py +0 -0
  122. {astroid-4.3.1 → astroid-4.3.3}/tests/benchmarks/conftest.py +0 -0
  123. {astroid-4.3.1 → astroid-4.3.3}/tests/benchmarks/test_bench_endtoend.py +0 -0
  124. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/__init__.py +0 -0
  125. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/__init__.py +0 -0
  126. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_core_einsumfunc.py +0 -0
  127. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_core_fromnumeric.py +0 -0
  128. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_core_function_base.py +0 -0
  129. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_core_multiarray.py +0 -0
  130. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_core_numeric.py +0 -0
  131. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_core_numerictypes.py +0 -0
  132. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_core_umath.py +0 -0
  133. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_ma.py +0 -0
  134. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_ndarray.py +0 -0
  135. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/numpy/test_random_mtrand.py +0 -0
  136. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_argparse.py +0 -0
  137. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_attr.py +0 -0
  138. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_brain.py +0 -0
  139. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_ctypes.py +0 -0
  140. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_dataclasses.py +0 -0
  141. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_dateutil.py +0 -0
  142. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_enum.py +0 -0
  143. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_gi.py +0 -0
  144. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_hashlib.py +0 -0
  145. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_helpers.py +0 -0
  146. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_multiprocessing.py +0 -0
  147. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_pathlib.py +0 -0
  148. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_pytest.py +0 -0
  149. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_qt.py +0 -0
  150. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_regex.py +0 -0
  151. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_signal.py +0 -0
  152. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_ssl.py +0 -0
  153. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_statistics.py +0 -0
  154. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_threading.py +0 -0
  155. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_typing_extensions.py +0 -0
  156. {astroid-4.3.1 → astroid-4.3.3}/tests/brain/test_unittest.py +0 -0
  157. {astroid-4.3.1 → astroid-4.3.3}/tests/resources.py +0 -0
  158. {astroid-4.3.1 → astroid-4.3.3}/tests/test_builder.py +0 -0
  159. {astroid-4.3.1 → astroid-4.3.3}/tests/test_constraint.py +0 -0
  160. {astroid-4.3.1 → astroid-4.3.3}/tests/test_context.py +0 -0
  161. {astroid-4.3.1 → astroid-4.3.3}/tests/test_decorators.py +0 -0
  162. {astroid-4.3.1 → astroid-4.3.3}/tests/test_filter_statements.py +0 -0
  163. {astroid-4.3.1 → astroid-4.3.3}/tests/test_get_relative_base_path.py +0 -0
  164. {astroid-4.3.1 → astroid-4.3.3}/tests/test_group_exceptions.py +0 -0
  165. {astroid-4.3.1 → astroid-4.3.3}/tests/test_helpers.py +0 -0
  166. {astroid-4.3.1 → astroid-4.3.3}/tests/test_inference_calls.py +0 -0
  167. {astroid-4.3.1 → astroid-4.3.3}/tests/test_lookup.py +0 -0
  168. {astroid-4.3.1 → astroid-4.3.3}/tests/test_manager.py +0 -0
  169. {astroid-4.3.1 → astroid-4.3.3}/tests/test_modutils.py +0 -0
  170. {astroid-4.3.1 → astroid-4.3.3}/tests/test_nodes.py +0 -0
  171. {astroid-4.3.1 → astroid-4.3.3}/tests/test_nodes_lineno.py +0 -0
  172. {astroid-4.3.1 → astroid-4.3.3}/tests/test_nodes_position.py +0 -0
  173. {astroid-4.3.1 → astroid-4.3.3}/tests/test_objects.py +0 -0
  174. {astroid-4.3.1 → astroid-4.3.3}/tests/test_protocols.py +0 -0
  175. {astroid-4.3.1 → astroid-4.3.3}/tests/test_python3.py +0 -0
  176. {astroid-4.3.1 → astroid-4.3.3}/tests/test_raw_building.py +0 -0
  177. {astroid-4.3.1 → astroid-4.3.3}/tests/test_regrtest.py +0 -0
  178. {astroid-4.3.1 → astroid-4.3.3}/tests/test_stdlib.py +0 -0
  179. {astroid-4.3.1 → astroid-4.3.3}/tests/test_transforms.py +0 -0
  180. {astroid-4.3.1 → astroid-4.3.3}/tests/test_type_params.py +0 -0
  181. {astroid-4.3.1 → astroid-4.3.3}/tests/test_utils.py +0 -0
  182. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  183. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zip +0 -0
  184. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/SSL1/Connection1.py +0 -0
  185. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/SSL1/__init__.py +0 -0
  186. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/__init__.py +0 -0
  187. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/absimp/__init__.py +0 -0
  188. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/absimp/sidepackage/__init__.py +0 -0
  189. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/absimp/string.py +0 -0
  190. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/absimport.py +0 -0
  191. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/all.py +0 -0
  192. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/appl/__init__.py +0 -0
  193. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/appl/myConnection.py +0 -0
  194. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level/import_package.py +0 -0
  195. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level/namespace_package/lower_level/helper_function.py +0 -0
  196. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level/namespace_package/plugin_api.py +0 -0
  197. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level/namespace_package/top_level_function.py +0 -0
  198. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_three/double_name/__init__.py +0 -0
  199. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_three/module/__init__.py +0 -0
  200. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/__init__.py +0 -0
  201. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/function.py +0 -0
  202. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/__init__.py +0 -0
  203. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/__init__.py +0 -0
  204. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/main.py +0 -0
  205. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_two/__init__.py +0 -0
  206. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_two/a.py +0 -0
  207. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_two/level1/__init__.py +0 -0
  208. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/beyond_top_level_two/level1/beyond_top_level_two.py +0 -0
  209. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/cache/__init__.py +0 -0
  210. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/cache/a.py +0 -0
  211. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/conditional.py +0 -0
  212. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/conditional_import/__init__.py +0 -0
  213. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py +0 -0
  214. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/descriptor_crash.py +0 -0
  215. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/divide_by_zero.py +0 -0
  216. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/email.py +0 -0
  217. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/fake_module_with_broken_getattr.py +0 -0
  218. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/fake_module_with_collection_getattribute.py +0 -0
  219. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/fake_module_with_warnings.py +0 -0
  220. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/find_test/__init__.py +0 -0
  221. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/find_test/module.py +0 -0
  222. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/find_test/module2.py +0 -0
  223. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/find_test/noendingnewline.py +0 -0
  224. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/find_test/nonregr.py +0 -0
  225. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/foogle/fax/__init__.py +0 -0
  226. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/foogle/fax/a.py +0 -0
  227. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth +0 -0
  228. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/format.py +0 -0
  229. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/import_conflicting_names/math.py +0 -0
  230. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/import_setuptools_pep660/__editable___example_0_1_0_finder.py +0 -0
  231. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/import_setuptools_pep660/example/__init__.py +0 -0
  232. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/import_setuptools_pep660/example/subpackage/__init__.py +0 -0
  233. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/invalid_encoding.py +0 -0
  234. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/lmfp/__init__.py +0 -0
  235. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/lmfp/foo.py +0 -0
  236. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/max_inferable_limit_for_classes/main.py +0 -0
  237. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/max_inferable_limit_for_classes/nodes/roles.py +0 -0
  238. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/max_inferable_limit_for_classes/other_funcs.py +0 -0
  239. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/metaclass_recursion/__init__.py +0 -0
  240. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/metaclass_recursion/monkeypatch.py +0 -0
  241. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/metaclass_recursion/parent.py +0 -0
  242. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/module.py +0 -0
  243. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/module1abs/__init__.py +0 -0
  244. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/module1abs/core.py +0 -0
  245. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/module2.py +0 -0
  246. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/module3.14.py +0 -0
  247. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/module_dict_items_call/models.py +0 -0
  248. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/module_dict_items_call/test.py +0 -0
  249. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/namespace_pep_420/module.py +0 -0
  250. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/noendingnewline.py +0 -0
  251. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/nonregr.py +0 -0
  252. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/notall.py +0 -0
  253. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/notamodule/file.py +0 -0
  254. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/operator_precedence.py +0 -0
  255. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/package/__init__.py +0 -0
  256. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/package/absimport.py +0 -0
  257. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/package/hello.py +0 -0
  258. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/package/import_package_subpackage_module.py +0 -0
  259. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/package/subpackage/__init__.py +0 -0
  260. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/package/subpackage/module.py +0 -0
  261. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/parent_of_homonym/__init__.py +0 -0
  262. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/parent_of_homonym/doc/README.md +0 -0
  263. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/parent_of_homonym/doc/__init__.py +0 -0
  264. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py +0 -0
  265. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkg_resources_1/package/foo.py +0 -0
  266. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py +0 -0
  267. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkg_resources_2/package/bar.py +0 -0
  268. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py +0 -0
  269. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkg_resources_3/package/baz.py +0 -0
  270. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkgutil_1/package/__init__.py +0 -0
  271. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkgutil_1/package/foo.py +0 -0
  272. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkgutil_2/package/__init__.py +0 -0
  273. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkgutil_2/package/bar.py +0 -0
  274. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkgutil_3/package/__init__.py +0 -0
  275. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/path_pkgutil_3/package/baz.py +0 -0
  276. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/recursion.py +0 -0
  277. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/tmp__init__.py +0 -0
  278. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/unicode_package/__init__.py +0 -0
  279. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/unicode_package/core/__init__.py +0 -0
  280. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/data/x.zip +0 -0
  281. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/__init__.pyi +0 -0
  282. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/__init__.py +0 -0
  283. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/__init__.pyi +0 -0
  284. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/__init__.weird_ext +0 -0
  285. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/module.py +0 -0
  286. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/module2.py +0 -0
  287. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/noendingnewline.py +0 -0
  288. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/nonregr.py +0 -0
  289. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/find_test/standalone_file.weird_ext +0 -0
  290. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/pyi_data/module.py +0 -0
  291. {astroid-4.3.1 → astroid-4.3.3}/tests/testdata/python3/recursion_error.py +0 -0
  292. {astroid-4.3.1 → astroid-4.3.3}/tox.ini +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astroid
3
- Version: 4.3.1
3
+ Version: 4.3.3
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
@@ -2,5 +2,5 @@
2
2
  # For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3
3
  # Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
4
4
 
5
- __version__ = "4.3.1"
5
+ __version__ = "4.3.3"
6
6
  version = __version__
@@ -1142,11 +1142,12 @@ def _infer_str_format_call(
1142
1142
  formatted_string = formatter.format(
1143
1143
  format_template, *pos_values, **keyword_values
1144
1144
  )
1145
- except (AttributeError, IndexError, KeyError, TypeError, ValueError):
1145
+ except (AttributeError, IndexError, KeyError, TypeError, ValueError, OverflowError):
1146
1146
  # AttributeError: named field in format string was not found in the arguments
1147
1147
  # IndexError: there are too few arguments to interpolate
1148
1148
  # TypeError: Unsupported format string
1149
1149
  # ValueError: Unknown format code
1150
+ # OverflowError: "c" with an out-of-range code point, e.g. "{:c}".format(-1)
1150
1151
  return iter([util.Uninferable])
1151
1152
 
1152
1153
  return iter([nodes.const_factory(formatted_string)])
@@ -220,6 +220,12 @@ def transform_six_with_metaclass(node):
220
220
  If so, inject its argument as the metaclass of the underlying class.
221
221
  """
222
222
  call = node.bases[0]
223
+ if not call.args:
224
+ # ``six.with_metaclass()`` written with no positional metaclass
225
+ # argument is invalid, but the predicate still matches it.
226
+ raise InferenceError(
227
+ "six.with_metaclass() call has no metaclass argument", node=node
228
+ )
223
229
  node._metaclass = call.args[0]
224
230
  return node
225
231
 
@@ -126,9 +126,14 @@ def infer_typing_typevar_or_newtype(
126
126
 
127
127
  typename = node.args[0].as_string().strip("'")
128
128
  try:
129
- node = extract_node(TYPING_TYPE_TEMPLATE.format(typename))
129
+ # ``typing`` accepts any string as a name, so don't splice it into the
130
+ # template: a crafted value such as ``"T(Base): #"`` would break out of
131
+ # the identifier position and inject bases and a body into the class.
132
+ # Build the class with a fixed name and assign the real one afterwards.
133
+ node = extract_node(TYPING_TYPE_TEMPLATE.format("_TypeVar"))
130
134
  except AstroidSyntaxError as exc:
131
135
  raise InferenceError from exc
136
+ node.name = typename
132
137
  return node.infer(context=context_itton)
133
138
 
134
139
 
@@ -63,10 +63,14 @@ class AstroidError(Exception):
63
63
  setattr(self, key, value)
64
64
 
65
65
  def __str__(self) -> str:
66
+ # message is the template itself and may embed interpolated user text
67
+ # (e.g. a namedtuple typename), so keep it out of the fields and fall
68
+ # back to it verbatim rather than raising or reinterpreting it.
69
+ fields = {k: v for k, v in vars(self).items() if k != "message"}
66
70
  try:
67
- return self.message.format(**vars(self))
68
- except ValueError:
69
- return self.message # Return raw message if formatting fails
71
+ return self.message.format(**fields)
72
+ except (LookupError, ValueError, AttributeError, TypeError):
73
+ return self.message
70
74
 
71
75
 
72
76
  class AstroidBuildingError(AstroidError):
@@ -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)
@@ -817,8 +817,12 @@ class InstanceModel(ObjectModel):
817
817
 
818
818
  class ExceptionInstanceModel(InstanceModel):
819
819
  @property
820
- def attr_args(self) -> nodes.Tuple:
821
- return nodes.Tuple(parent=self._instance)
820
+ def attr_args(self) -> bases.Instance:
821
+ # The arguments an exception was created with are not known from the
822
+ # instance alone, so ``args`` is a tuple of unknown contents rather
823
+ # than a known empty tuple.
824
+ builtins_ast_module = AstroidManager().builtins_module
825
+ return builtins_ast_module["tuple"].instantiate_class()
822
826
 
823
827
  @property
824
828
  def attr___traceback__(self):
@@ -4770,9 +4770,10 @@ class FormattedValue(NodeNG):
4770
4770
  end_col_offset=self.end_col_offset,
4771
4771
  )
4772
4772
  continue
4773
- except (ValueError, TypeError, MemoryError):
4773
+ except (ValueError, TypeError, MemoryError, OverflowError):
4774
4774
  # ValueError/TypeError: invalid format spec
4775
4775
  # MemoryError: format spec with huge width (e.g. f'{0:11111111111}')
4776
+ # OverflowError: "c" with an out-of-range code point (e.g. f'{-1:c}')
4776
4777
  yield util.Uninferable
4777
4778
  uninferable_already_generated = True
4778
4779
  continue
@@ -1578,13 +1578,22 @@ class FunctionDef(
1578
1578
  ):
1579
1579
  if isinstance(caller.args, node_classes.Arguments):
1580
1580
  assert caller.args.args is not None
1581
- metaclass = next(caller.args.args[0].infer(context), None)
1581
+ call_args = caller.args.args
1582
1582
  elif isinstance(caller.args, list):
1583
- metaclass = next(caller.args[0].infer(context), None)
1583
+ call_args = caller.args
1584
1584
  else:
1585
1585
  raise TypeError( # pragma: no cover
1586
1586
  f"caller.args was neither Arguments nor list; got {type(caller.args)}"
1587
1587
  )
1588
+ if not call_args:
1589
+ # ``with_metaclass()`` called without a metaclass argument is
1590
+ # invalid; there is nothing to infer.
1591
+ raise InferenceError(
1592
+ "with_metaclass() call has no metaclass argument",
1593
+ node=self,
1594
+ context=context,
1595
+ )
1596
+ metaclass = next(call_args[0].infer(context), None)
1588
1597
  if isinstance(metaclass, ClassDef):
1589
1598
  class_bases = [_infer_last(x, context) for x in caller.args[1:]]
1590
1599
  new_class = ClassDef(
@@ -2582,6 +2591,9 @@ class ClassDef(
2582
2591
 
2583
2592
  method = methods[0]
2584
2593
 
2594
+ if isinstance(method, util.UninferableBase):
2595
+ return util.Uninferable
2596
+
2585
2597
  # Create a new callcontext for providing index as an argument.
2586
2598
  new_context = bind_context_to_node(context, self)
2587
2599
  new_context.callcontext = CallContext(args=[index], callee=method)
@@ -2719,6 +2731,8 @@ class ClassDef(
2719
2731
  return None
2720
2732
  for slots in slots_attributes:
2721
2733
  # check if __slots__ is a valid type
2734
+ if not hasattr(slots, "getattr"):
2735
+ continue
2722
2736
  for meth in ITER_METHODS:
2723
2737
  try:
2724
2738
  slots.getattr(meth)
@@ -262,18 +262,15 @@ def _multiply_seq_by_int(
262
262
  return node
263
263
 
264
264
 
265
- def _filter_uninferable_nodes(
265
+ def _infer_sequence_elements(
266
266
  elts: Sequence[InferenceResult], context: InferenceContext
267
267
  ) -> Iterator[SuccessfulInferenceResult]:
268
268
  for elt in elts:
269
- if isinstance(elt, util.UninferableBase):
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
- for inferred in elt.infer(context):
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
- _filter_uninferable_nodes(self.elts, context),
308
- _filter_uninferable_nodes(other.elts, context),
304
+ _infer_sequence_elements(self.elts, context),
305
+ _infer_sequence_elements(other.elts, context),
309
306
  )
310
307
  )
311
308
  yield node
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astroid
3
- Version: 4.3.1
3
+ Version: 4.3.3
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
@@ -1,6 +1,7 @@
1
1
  # Tools used when releasing
2
2
  contributors-txt>=1.1.0
3
3
  tbump~=6.11
4
+ towncrier>=24.8
4
5
 
5
6
  # Tools used to run tests
6
7
  coverage~=7.15
@@ -125,6 +125,8 @@ class TestStringNodes:
125
125
  pytest.param(
126
126
  """"{:>{}}".format("x", 2000000000)""", id="oversized-nested-width"
127
127
  ),
128
+ pytest.param(""""{:c}".format(-1)""", id="char-negative"),
129
+ pytest.param(""""{:c}".format(0x110000)""", id="char-too-large"),
128
130
  ],
129
131
  )
130
132
  def test_string_format_uninferable(self, format_string: str) -> None:
@@ -244,6 +244,39 @@ class NamedTupleTest(unittest.TestCase):
244
244
  inferred = next(node.infer())
245
245
  self.assertIs(util.Uninferable, inferred) # would raise ValueError
246
246
 
247
+ def test_format_placeholder_typename_does_not_crash_inference(self) -> None:
248
+ """A typename containing str.format placeholders must not be formatted.
249
+
250
+ Reported in https://github.com/pylint-dev/astroid/issues/3199.
251
+ """
252
+ node = builder.extract_node("""
253
+ from collections import namedtuple
254
+ Tuple = namedtuple("{0}", "")
255
+ Tuple #@
256
+ """)
257
+ inferred = next(node.infer())
258
+ self.assertIs(util.Uninferable, inferred) # would raise IndexError
259
+
260
+ def test_missing_format_placeholder_typename_does_not_crash_inference(self) -> None:
261
+ node = builder.extract_node("""
262
+ from collections import namedtuple
263
+ Tuple = namedtuple("{missing}", "")
264
+ Tuple #@
265
+ """)
266
+ inferred = next(node.infer())
267
+ self.assertIs(util.Uninferable, inferred) # would raise KeyError
268
+
269
+ def test_attribute_format_placeholder_typename_does_not_crash_inference(
270
+ self,
271
+ ) -> None:
272
+ node = builder.extract_node("""
273
+ from collections import namedtuple
274
+ Tuple = namedtuple("{message.foo}", "")
275
+ Tuple #@
276
+ """)
277
+ inferred = next(node.infer())
278
+ self.assertIs(util.Uninferable, inferred) # would raise AttributeError
279
+
247
280
  def test_keyword_typename_does_not_crash_inference(self) -> None:
248
281
  node = builder.extract_node("""
249
282
  from collections import namedtuple
@@ -138,6 +138,26 @@ class SixBrainTest(unittest.TestCase):
138
138
  klass = astroid.extract_node(code)
139
139
  assert next(klass.ancestors()).name == "Enum"
140
140
 
141
+ def test_with_metaclass_no_arguments(self) -> None:
142
+ # ``six.with_metaclass()`` with no positional metaclass argument is
143
+ # invalid; the transform raises InferenceError instead of IndexError.
144
+ for call in ("six.with_metaclass()", "six.with_metaclass(a=1)"):
145
+ with self.assertRaises(astroid.InferenceError):
146
+ builder.parse(f"""
147
+ import six
148
+ class A({call}):
149
+ pass
150
+ """)
151
+ # With more than one base the class transform does not apply and the
152
+ # call itself is inferred; that raises too instead of yielding a
153
+ # bogus ``temporary_class`` ancestor.
154
+ klass = builder.extract_node("""
155
+ import six
156
+ class B(six.with_metaclass(), object): #@
157
+ pass
158
+ """)
159
+ self.assertEqual([a.name for a in klass.ancestors()], ["object"])
160
+
141
161
  def test_six_with_metaclass_with_additional_transform(self) -> None:
142
162
  def transform_class(cls: Any) -> ClassDef:
143
163
  if cls.name == "A":
@@ -5,7 +5,6 @@
5
5
  import pytest
6
6
 
7
7
  from astroid import bases, builder, nodes
8
- from astroid.exceptions import InferenceError
9
8
 
10
9
 
11
10
  def test_infer_typevar() -> None:
@@ -19,8 +18,22 @@ def test_infer_typevar() -> None:
19
18
  from typing import TypeVar
20
19
  TypeVar('My.Type')
21
20
  """)
22
- with pytest.raises(InferenceError):
23
- call_node.inferred()
21
+ inferred = next(call_node.infer())
22
+ assert isinstance(inferred, nodes.ClassDef)
23
+ assert inferred.name == "My.Type"
24
+
25
+
26
+ def test_infer_typevar_name_injection() -> None:
27
+ """A crafted TypeVar name must not be spliced into the synthesized class."""
28
+ call_node = builder.extract_node("""
29
+ from typing import TypeVar
30
+ TypeVar('T(EvilBase): #')
31
+ """)
32
+ inferred = next(call_node.infer())
33
+ assert isinstance(inferred, nodes.ClassDef)
34
+ # The name is kept verbatim instead of parsed, so no base is injected.
35
+ assert inferred.name == "T(EvilBase): #"
36
+ assert inferred.bases == []
24
37
 
25
38
 
26
39
  class TestTypingAlias:
@@ -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:
@@ -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):
@@ -5392,6 +5462,13 @@ def test_fstring_oversized_width_uninferable(code: str) -> None:
5392
5462
  assert list(node.infer()) == [util.Uninferable]
5393
5463
 
5394
5464
 
5465
+ @pytest.mark.parametrize("code", ["f'{-1:c}'", "f'{0x110000:c}'", "f'{2**64:c}'"])
5466
+ def test_fstring_char_out_of_range_uninferable(code: str) -> None:
5467
+ """Regression test for https://github.com/pylint-dev/astroid/issues/3301."""
5468
+ node = extract_node(code)
5469
+ assert list(node.infer()) == [util.Uninferable]
5470
+
5471
+
5395
5472
  def test_augassign_recursion() -> None:
5396
5473
  """Make sure inference doesn't throw a RecursionError.
5397
5474
 
@@ -6193,7 +6270,8 @@ def test_subclass_of_exception(code) -> None:
6193
6270
  inferred = next(extract_node(code).infer())
6194
6271
  assert isinstance(inferred, Instance)
6195
6272
  args = next(inferred.igetattr("args"))
6196
- assert isinstance(args, nodes.Tuple)
6273
+ assert isinstance(args, Instance)
6274
+ assert args.qname() == "builtins.tuple"
6197
6275
 
6198
6276
 
6199
6277
  def test_ifexp_inference() -> None:
@@ -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:
@@ -698,7 +718,8 @@ class ExceptionModelTest(unittest.TestCase):
698
718
  """)
699
719
  assert isinstance(ast_nodes, list)
700
720
  args = next(ast_nodes[0].infer())
701
- assert isinstance(args, nodes.Tuple)
721
+ assert isinstance(args, astroid.Instance)
722
+ assert args.qname() == "builtins.tuple"
702
723
  tb = next(ast_nodes[1].infer())
703
724
  # Python 3.11: If 'contextlib' is loaded, '__traceback__'
704
725
  # could be set inside '__exit__' method in
@@ -836,9 +857,24 @@ class TestExceptionInstanceModel:
836
857
  ast_node = builder.extract_node("""
837
858
  BaseException() #@
838
859
  """)
839
- args: nodes.Tuple = next(ast_node.infer()).getattr("args")[0]
840
- # BaseException doesn't have any required args, not even a string
841
- assert not args.elts
860
+ args = next(ast_node.infer()).getattr("args")[0]
861
+ # BaseException doesn't have any required args, not even a string:
862
+ # ``args`` is a tuple whose contents are not known.
863
+ assert isinstance(args, astroid.Instance)
864
+ assert args.qname() == "builtins.tuple"
865
+
866
+ def test_args_unpacking_has_unknown_length(self) -> None:
867
+ """``args`` is not a known empty tuple: unpacking it cannot be checked."""
868
+ ast_node = builder.extract_node("""
869
+ try:
870
+ pass
871
+ except ValueError as err:
872
+ err.args #@
873
+ """)
874
+ args = next(ast_node.infer())
875
+ assert isinstance(args, astroid.Instance)
876
+ assert args.qname() == "builtins.tuple"
877
+ assert not isinstance(args, nodes.Tuple)
842
878
 
843
879
 
844
880
  @pytest.mark.parametrize("parentheses", (True, False))
@@ -1585,6 +1585,15 @@ class ClassNodeTest(ModuleLoader, unittest.TestCase):
1585
1585
  # must return None instead of raising ``InferenceError``.
1586
1586
  self.assertIsNone(module["Klass"].slots())
1587
1587
 
1588
+ @pytest.mark.skipif(not PY312_PLUS, reason="PEP 695 syntax requires Python 3.12")
1589
+ def test_slots_pep695_type_param_named_slots(self) -> None:
1590
+ module = builder.parse("""
1591
+ class C[__slots__]:
1592
+ def __init__(self):
1593
+ self.a = 1
1594
+ """)
1595
+ self.assertIsNone(module["C"].slots())
1596
+
1588
1597
  def test_slots_added_dynamically_still_inferred(self) -> None:
1589
1598
  code = """
1590
1599
  class NodeBase(object):
@@ -38,8 +38,8 @@ Contributors
38
38
  - Artem Yurchenko <44875844+temyurchenko@users.noreply.github.com>
39
39
  - David Liu <david@cs.toronto.edu>
40
40
  - Alexandre Fayolle <alexandre.fayolle@logilab.fr>
41
- - Emmanuel Ferdman <emmanuelferdman@gmail.com>
42
41
  - Eevee (Alex Munroe) <amunroe@yelp.com>
42
+ - Emmanuel Ferdman <emmanuelferdman@gmail.com>
43
43
  - David Gilman <davidgilman1@gmail.com>
44
44
  - Zen Lee <53538590+zenlyj@users.noreply.github.com>
45
45
  - Tushar Sadhwani <tushar.sadhwani000@gmail.com>
@@ -48,7 +48,6 @@ Contributors
48
48
  - Hugo van Kemenade <hugovk@users.noreply.github.com>
49
49
  - Calen Pennington <calen.pennington@gmail.com>
50
50
  - Antonio <antonio@zoftko.com>
51
- - Fridayworks <aifriday700@gmail.com>
52
51
  - Akhil Kamat <akhil.kamat@gmail.com>
53
52
  - KALI 834X <kali834x@gmail.com>
54
53
  - Tim Martin <tim@asymptotic.co.uk>
@@ -80,6 +79,8 @@ Contributors
80
79
  - FELD Boris <lothiraldan@gmail.com>
81
80
  - Enji Cooper <yaneurabeya@gmail.com>
82
81
  - Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
82
+ - Sayed Nabhan <nabhan@bugqore.com>
83
+ - Fridayworks <aifriday700@gmail.com>
83
84
  - tristanlatr <19967168+tristanlatr@users.noreply.github.com>
84
85
  - kdelay <90545043+kdelay@users.noreply.github.com>
85
86
  - jkmnt <git@firewood.fastmail.com>
@@ -92,7 +93,6 @@ Contributors
92
93
  - Thomas Hisch <t.hisch@gmail.com>
93
94
  - Stefan Scherfke <stefan@sofa-rockers.org>
94
95
  - Sergei Lebedev <185856+superbobry@users.noreply.github.com>
95
- - Sayed Nabhan <nabhan@bugqore.com>
96
96
  - Saugat Pachhai (सौगात) <suagatchhetri@outlook.com>
97
97
  - Sanjay Santhanam <51058514+Sanjays2402@users.noreply.github.com>
98
98
  - Robert Hofer <1058012+hofrob@users.noreply.github.com>
@@ -115,10 +115,10 @@ Contributors
115
115
  - David Euresti <github@euresti.com>
116
116
  - David Douard <david.douard@logilab.fr>
117
117
  - David Cain <davidjosephcain@gmail.com>
118
- - Casey Jones <731937+doctorcolossus@users.noreply.github.com>
119
118
  - Anthony Truchet <anthony.truchet@logilab.fr>
120
119
  - Anthony Sottile <asottile@umich.edu>
121
120
  - Alexander Shadchin <alexandr.shadchin@gmail.com>
121
+ - Casey Jones <731937+doctorcolossus@users.noreply.github.com>
122
122
  - wgehalo <wgehalo@gmail.com>
123
123
  - tejaschauhan36912 <59693377+tejaschauhan36912@users.noreply.github.com>
124
124
  - sergiochan <yuheng9211@qq.com>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes