astroid 4.2.0b4__tar.gz → 4.3.0__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 (294) hide show
  1. {astroid-4.2.0b4 → astroid-4.3.0}/CONTRIBUTORS.txt +25 -13
  2. {astroid-4.2.0b4/astroid.egg-info → astroid-4.3.0}/PKG-INFO +1 -1
  3. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/__pkginfo__.py +1 -1
  4. astroid-4.3.0/astroid/_ast.py +69 -0
  5. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/bases.py +3 -4
  6. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_builtin_inference.py +103 -11
  7. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_collections.py +0 -1
  8. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_dataclasses.py +10 -4
  9. astroid-4.3.0/astroid/brain/brain_decimal.py +20 -0
  10. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_gi.py +21 -3
  11. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_namedtuple_enum.py +23 -5
  12. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_core_multiarray.py +2 -0
  13. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_regex.py +3 -1
  14. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_typing.py +6 -0
  15. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/helpers.py +2 -0
  16. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/builder.py +33 -30
  17. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/constraint.py +42 -3
  18. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/context.py +9 -4
  19. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/helpers.py +5 -0
  20. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/interpreter/dunder_lookup.py +19 -1
  21. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/interpreter/objectmodel.py +7 -1
  22. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/_base_nodes.py +8 -2
  23. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/as_string.py +12 -8
  24. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/node_classes.py +297 -210
  25. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/node_ng.py +6 -9
  26. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/scoped_nodes/mixin.py +2 -2
  27. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/scoped_nodes/scoped_nodes.py +45 -47
  28. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/objects.py +3 -4
  29. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/protocols.py +96 -2
  30. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/raw_building.py +14 -12
  31. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/rebuilder.py +49 -34
  32. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/util.py +24 -2
  33. {astroid-4.2.0b4 → astroid-4.3.0/astroid.egg-info}/PKG-INFO +1 -1
  34. {astroid-4.2.0b4 → astroid-4.3.0}/astroid.egg-info/SOURCES.txt +3 -0
  35. {astroid-4.2.0b4 → astroid-4.3.0}/requirements_minimal.txt +2 -2
  36. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_core_multiarray.py +1 -0
  37. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_brain.py +95 -0
  38. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_builtin.py +5 -0
  39. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_ctypes.py +4 -4
  40. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_dataclasses.py +53 -0
  41. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_enum.py +29 -0
  42. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_regex.py +0 -3
  43. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_builder.py +0 -1
  44. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_constraint.py +175 -0
  45. astroid-4.3.0/tests/test_context.py +173 -0
  46. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_helpers.py +28 -0
  47. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_inference.py +160 -1
  48. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_nodes.py +95 -0
  49. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_object_model.py +57 -4
  50. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_objects.py +128 -0
  51. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_protocols.py +48 -0
  52. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_python3.py +53 -0
  53. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_raw_building.py +11 -0
  54. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_regrtest.py +39 -0
  55. astroid-4.3.0/tox.ini +46 -0
  56. astroid-4.2.0b4/astroid/_ast.py +0 -102
  57. astroid-4.2.0b4/tox.ini +0 -25
  58. {astroid-4.2.0b4 → astroid-4.3.0}/LICENSE +0 -0
  59. {astroid-4.2.0b4 → astroid-4.3.0}/MANIFEST.in +0 -0
  60. {astroid-4.2.0b4 → astroid-4.3.0}/README.rst +0 -0
  61. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/__init__.py +0 -0
  62. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/__main__.py +0 -0
  63. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/arguments.py +0 -0
  64. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/astroid_manager.py +0 -0
  65. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/__init__.py +0 -0
  66. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_argparse.py +0 -0
  67. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_attrs.py +0 -0
  68. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_boto3.py +0 -0
  69. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_crypt.py +0 -0
  70. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_ctypes.py +0 -0
  71. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_curses.py +0 -0
  72. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_datetime.py +0 -0
  73. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_dateutil.py +0 -0
  74. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_functools.py +0 -0
  75. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_hashlib.py +0 -0
  76. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_http.py +0 -0
  77. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_hypothesis.py +0 -0
  78. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_io.py +0 -0
  79. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_mechanize.py +0 -0
  80. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_multiprocessing.py +0 -0
  81. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_core_einsumfunc.py +0 -0
  82. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_core_fromnumeric.py +0 -0
  83. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_core_function_base.py +0 -0
  84. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_core_numeric.py +0 -0
  85. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_core_numerictypes.py +0 -0
  86. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_core_umath.py +0 -0
  87. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_ma.py +0 -0
  88. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_ndarray.py +0 -0
  89. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_random_mtrand.py +0 -0
  90. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_numpy_utils.py +0 -0
  91. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_pathlib.py +0 -0
  92. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_pkg_resources.py +0 -0
  93. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_pytest.py +0 -0
  94. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_qt.py +0 -0
  95. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_random.py +0 -0
  96. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_re.py +0 -0
  97. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_responses.py +0 -0
  98. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_scipy_signal.py +0 -0
  99. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_signal.py +0 -0
  100. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_six.py +0 -0
  101. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_sqlalchemy.py +0 -0
  102. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_ssl.py +0 -0
  103. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_statistics.py +0 -0
  104. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_subprocess.py +0 -0
  105. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_threading.py +0 -0
  106. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_type.py +0 -0
  107. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_unittest.py +0 -0
  108. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/brain/brain_uuid.py +0 -0
  109. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/const.py +0 -0
  110. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/decorators.py +0 -0
  111. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/exceptions.py +0 -0
  112. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/filter_statements.py +0 -0
  113. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/inference_tip.py +0 -0
  114. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/interpreter/__init__.py +0 -0
  115. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/interpreter/_import/__init__.py +0 -0
  116. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/interpreter/_import/spec.py +0 -0
  117. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/interpreter/_import/util.py +0 -0
  118. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/manager.py +0 -0
  119. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/modutils.py +0 -0
  120. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/__init__.py +0 -0
  121. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/const.py +0 -0
  122. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/scoped_nodes/__init__.py +0 -0
  123. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/scoped_nodes/utils.py +0 -0
  124. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/nodes/utils.py +0 -0
  125. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/test_utils.py +0 -0
  126. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/transforms.py +0 -0
  127. {astroid-4.2.0b4 → astroid-4.3.0}/astroid/typing.py +0 -0
  128. {astroid-4.2.0b4 → astroid-4.3.0}/astroid.egg-info/dependency_links.txt +0 -0
  129. {astroid-4.2.0b4 → astroid-4.3.0}/astroid.egg-info/requires.txt +0 -0
  130. {astroid-4.2.0b4 → astroid-4.3.0}/astroid.egg-info/top_level.txt +0 -0
  131. {astroid-4.2.0b4 → astroid-4.3.0}/pyproject.toml +0 -0
  132. {astroid-4.2.0b4 → astroid-4.3.0}/requirements_dev.txt +0 -0
  133. {astroid-4.2.0b4 → astroid-4.3.0}/requirements_full.txt +0 -0
  134. {astroid-4.2.0b4 → astroid-4.3.0}/setup.cfg +0 -0
  135. {astroid-4.2.0b4 → astroid-4.3.0}/tests/__init__.py +0 -0
  136. {astroid-4.2.0b4 → astroid-4.3.0}/tests/benchmarks/__init__.py +0 -0
  137. {astroid-4.2.0b4 → astroid-4.3.0}/tests/benchmarks/conftest.py +0 -0
  138. {astroid-4.2.0b4 → astroid-4.3.0}/tests/benchmarks/test_bench_endtoend.py +0 -0
  139. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/__init__.py +0 -0
  140. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/__init__.py +0 -0
  141. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_core_einsumfunc.py +0 -0
  142. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_core_fromnumeric.py +0 -0
  143. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_core_function_base.py +0 -0
  144. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_core_numeric.py +0 -0
  145. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_core_numerictypes.py +0 -0
  146. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_core_umath.py +0 -0
  147. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_ma.py +0 -0
  148. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_ndarray.py +0 -0
  149. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/numpy/test_random_mtrand.py +0 -0
  150. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_argparse.py +0 -0
  151. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_attr.py +0 -0
  152. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_dateutil.py +0 -0
  153. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_gi.py +0 -0
  154. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_hashlib.py +0 -0
  155. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_helpers.py +0 -0
  156. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_multiprocessing.py +0 -0
  157. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_named_tuple.py +0 -0
  158. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_pathlib.py +0 -0
  159. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_pytest.py +0 -0
  160. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_qt.py +0 -0
  161. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_signal.py +0 -0
  162. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_six.py +0 -0
  163. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_ssl.py +0 -0
  164. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_statistics.py +0 -0
  165. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_threading.py +0 -0
  166. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_typing.py +0 -0
  167. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_typing_extensions.py +0 -0
  168. {astroid-4.2.0b4 → astroid-4.3.0}/tests/brain/test_unittest.py +0 -0
  169. {astroid-4.2.0b4 → astroid-4.3.0}/tests/resources.py +0 -0
  170. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_decorators.py +0 -0
  171. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_filter_statements.py +0 -0
  172. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_get_relative_base_path.py +0 -0
  173. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_group_exceptions.py +0 -0
  174. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_inference_calls.py +0 -0
  175. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_lookup.py +0 -0
  176. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_manager.py +0 -0
  177. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_modutils.py +0 -0
  178. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_nodes_lineno.py +0 -0
  179. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_nodes_position.py +0 -0
  180. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_scoped_nodes.py +0 -0
  181. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_stdlib.py +0 -0
  182. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_transforms.py +0 -0
  183. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_type_params.py +0 -0
  184. {astroid-4.2.0b4 → astroid-4.3.0}/tests/test_utils.py +0 -0
  185. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.egg +0 -0
  186. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/MyPyPa-0.1.0-py2.5.zip +0 -0
  187. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/SSL1/Connection1.py +0 -0
  188. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/SSL1/__init__.py +0 -0
  189. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/__init__.py +0 -0
  190. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/absimp/__init__.py +0 -0
  191. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/absimp/sidepackage/__init__.py +0 -0
  192. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/absimp/string.py +0 -0
  193. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/absimport.py +0 -0
  194. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/all.py +0 -0
  195. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/appl/__init__.py +0 -0
  196. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/appl/myConnection.py +0 -0
  197. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level/import_package.py +0 -0
  198. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level/namespace_package/lower_level/helper_function.py +0 -0
  199. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level/namespace_package/plugin_api.py +0 -0
  200. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level/namespace_package/top_level_function.py +0 -0
  201. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_three/double_name/__init__.py +0 -0
  202. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_three/module/__init__.py +0 -0
  203. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/__init__.py +0 -0
  204. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_three/module/double_name/function.py +0 -0
  205. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/__init__.py +0 -0
  206. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/__init__.py +0 -0
  207. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_three/module/sub_module/sub_sub_module/main.py +0 -0
  208. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_two/__init__.py +0 -0
  209. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_two/a.py +0 -0
  210. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_two/level1/__init__.py +0 -0
  211. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/beyond_top_level_two/level1/beyond_top_level_two.py +0 -0
  212. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/cache/__init__.py +0 -0
  213. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/cache/a.py +0 -0
  214. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/conditional.py +0 -0
  215. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/conditional_import/__init__.py +0 -0
  216. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/contribute_to_namespace/namespace_pep_420/submodule.py +0 -0
  217. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/descriptor_crash.py +0 -0
  218. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/divide_by_zero.py +0 -0
  219. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/email.py +0 -0
  220. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/fake_module_with_broken_getattr.py +0 -0
  221. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/fake_module_with_collection_getattribute.py +0 -0
  222. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/fake_module_with_warnings.py +0 -0
  223. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/find_test/__init__.py +0 -0
  224. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/find_test/module.py +0 -0
  225. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/find_test/module2.py +0 -0
  226. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/find_test/noendingnewline.py +0 -0
  227. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/find_test/nonregr.py +0 -0
  228. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/foogle/fax/__init__.py +0 -0
  229. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/foogle/fax/a.py +0 -0
  230. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/foogle_fax-0.12.5-py2.7-nspkg.pth +0 -0
  231. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/format.py +0 -0
  232. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/import_conflicting_names/math.py +0 -0
  233. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/import_setuptools_pep660/__editable___example_0_1_0_finder.py +0 -0
  234. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/import_setuptools_pep660/example/__init__.py +0 -0
  235. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/import_setuptools_pep660/example/subpackage/__init__.py +0 -0
  236. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/invalid_encoding.py +0 -0
  237. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/lmfp/__init__.py +0 -0
  238. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/lmfp/foo.py +0 -0
  239. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/max_inferable_limit_for_classes/main.py +0 -0
  240. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/max_inferable_limit_for_classes/nodes/roles.py +0 -0
  241. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/max_inferable_limit_for_classes/other_funcs.py +0 -0
  242. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/metaclass_recursion/__init__.py +0 -0
  243. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/metaclass_recursion/monkeypatch.py +0 -0
  244. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/metaclass_recursion/parent.py +0 -0
  245. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/module.py +0 -0
  246. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/module1abs/__init__.py +0 -0
  247. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/module1abs/core.py +0 -0
  248. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/module2.py +0 -0
  249. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/module3.14.py +0 -0
  250. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/module_dict_items_call/models.py +0 -0
  251. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/module_dict_items_call/test.py +0 -0
  252. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/namespace_pep_420/module.py +0 -0
  253. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/noendingnewline.py +0 -0
  254. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/nonregr.py +0 -0
  255. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/notall.py +0 -0
  256. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/notamodule/file.py +0 -0
  257. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/operator_precedence.py +0 -0
  258. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/package/__init__.py +0 -0
  259. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/package/absimport.py +0 -0
  260. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/package/hello.py +0 -0
  261. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/package/import_package_subpackage_module.py +0 -0
  262. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/package/subpackage/__init__.py +0 -0
  263. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/package/subpackage/module.py +0 -0
  264. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/parent_of_homonym/__init__.py +0 -0
  265. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/parent_of_homonym/doc/README.md +0 -0
  266. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/parent_of_homonym/doc/__init__.py +0 -0
  267. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkg_resources_1/package/__init__.py +0 -0
  268. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkg_resources_1/package/foo.py +0 -0
  269. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkg_resources_2/package/__init__.py +0 -0
  270. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkg_resources_2/package/bar.py +0 -0
  271. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkg_resources_3/package/__init__.py +0 -0
  272. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkg_resources_3/package/baz.py +0 -0
  273. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkgutil_1/package/__init__.py +0 -0
  274. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkgutil_1/package/foo.py +0 -0
  275. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkgutil_2/package/__init__.py +0 -0
  276. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkgutil_2/package/bar.py +0 -0
  277. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkgutil_3/package/__init__.py +0 -0
  278. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/path_pkgutil_3/package/baz.py +0 -0
  279. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/recursion.py +0 -0
  280. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/tmp__init__.py +0 -0
  281. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/unicode_package/__init__.py +0 -0
  282. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/unicode_package/core/__init__.py +0 -0
  283. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/data/x.zip +0 -0
  284. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/__init__.pyi +0 -0
  285. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/__init__.py +0 -0
  286. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/__init__.pyi +0 -0
  287. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/__init__.weird_ext +0 -0
  288. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/module.py +0 -0
  289. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/module2.py +0 -0
  290. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/noendingnewline.py +0 -0
  291. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/nonregr.py +0 -0
  292. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/find_test/standalone_file.weird_ext +0 -0
  293. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/pyi_data/module.py +0 -0
  294. {astroid-4.2.0b4 → astroid-4.3.0}/tests/testdata/python3/recursion_error.py +0 -0
@@ -14,8 +14,8 @@ Ex-maintainers
14
14
  Maintainers
15
15
  -----------
16
16
  - Pierre Sassoulas <pierre.sassoulas@gmail.com>
17
- - Jacob Walls <jacobtylerwalls@gmail.com>
18
17
  - Daniël van Noord <13665637+DanielNoord@users.noreply.github.com>
18
+ - Jacob Walls <jacobtylerwalls@gmail.com>
19
19
  - Marc Mueller <30130371+cdce8p@users.noreply.github.com>
20
20
  - Hippo91 <guillaume.peillex@gmail.com>
21
21
  - Bryce Guinta <bryce.paul.guinta@gmail.com>
@@ -52,7 +52,10 @@ Contributors
52
52
  - Akhil Kamat <akhil.kamat@gmail.com>
53
53
  - Tim Martin <tim@asymptotic.co.uk>
54
54
  - Phil Schaf <flying-sheep@web.de>
55
+ - KALI 834X <kali834x@gmail.com>
55
56
  - Alex Hall <alex.mojaki@gmail.com>
57
+ - Vincent Gao <gaobing1230@gmail.com>
58
+ - Samarth D N <dnsam550@gmail.com>
56
59
  - Raphael Gaschignard <raphael@makeleaps.com>
57
60
  - Radosław Ganczarek <radoslaw@ganczarek.in>
58
61
  - Paligot Gérard <androwiiid@gmail.com>
@@ -61,9 +64,11 @@ Contributors
61
64
  - Derek Gustafson <degustaf@gmail.com>
62
65
  - David Shea <dshea@redhat.com>
63
66
  - Daniel Harding <dharding@gmail.com>
67
+ - Dani Alcala <112832187+clavedeluna@users.noreply.github.com>
64
68
  - Christian Clauss <cclauss@me.com>
65
69
  - Ville Skyttä <ville.skytta@iki.fi>
66
70
  - Synrom <30272537+Synrom@users.noreply.github.com>
71
+ - Sai Asish Y <say.apm35@gmail.com>
67
72
  - Rene Zhang <rz99@cornell.edu>
68
73
  - Philip Lorenz <philip@bithub.de>
69
74
  - Nicolas Chauvat <nicolas.chauvat@logilab.fr>
@@ -74,10 +79,10 @@ Contributors
74
79
  - James Addison <55152140+jayaddison@users.noreply.github.com>
75
80
  - FELD Boris <lothiraldan@gmail.com>
76
81
  - Enji Cooper <yaneurabeya@gmail.com>
77
- - Dani Alcala <112832187+clavedeluna@users.noreply.github.com>
78
82
  - Adrien Di Mascio <Adrien.DiMascio@logilab.fr>
79
- - Vincent Gao <gaobing1230@gmail.com>
80
83
  - tristanlatr <19967168+tristanlatr@users.noreply.github.com>
84
+ - kdelay <90545043+kdelay@users.noreply.github.com>
85
+ - jkmnt <git@firewood.fastmail.com>
81
86
  - grayjk <grayjk@gmail.com>
82
87
  - emile@crater.logilab.fr <emile@crater.logilab.fr>
83
88
  - doranid <ddandd@gmail.com>
@@ -87,7 +92,9 @@ Contributors
87
92
  - Thomas Hisch <t.hisch@gmail.com>
88
93
  - Stefan Scherfke <stefan@sofa-rockers.org>
89
94
  - Sergei Lebedev <185856+superbobry@users.noreply.github.com>
95
+ - Sayed Nabhan <nabhan@bugqore.com>
90
96
  - Saugat Pachhai (सौगात) <suagatchhetri@outlook.com>
97
+ - Sanjay Santhanam <51058514+Sanjays2402@users.noreply.github.com>
91
98
  - Robert Hofer <1058012+hofrob@users.noreply.github.com>
92
99
  - Ram Rachum <ram@rachum.com>
93
100
  - Pierre-Yves David <pierre-yves.david@logilab.fr>
@@ -116,23 +123,26 @@ Contributors
116
123
  - tejaschauhan36912 <59693377+tejaschauhan36912@users.noreply.github.com>
117
124
  - sergiochan <yuheng9211@qq.com>
118
125
  - rr- <rr-@sakuya.pl>
126
+ - renechoi <115696395+renechoi@users.noreply.github.com>
119
127
  - raylu <lurayl@gmail.com>
120
128
  - plucury <plucury@gmail.com>
121
129
  - pavan-msys <149513767+pavan-msys@users.noreply.github.com>
122
130
  - ostr00000 <ostr00000@gmail.com>
123
131
  - noah-weingarden <33741795+noah-weingarden@users.noreply.github.com>
124
132
  - nathannaveen <42319948+nathannaveen@users.noreply.github.com>
133
+ - nanookclaw <nanook@agentmail.to>
125
134
  - mathieui <mathieui@users.noreply.github.com>
126
135
  - markmcclain <markmcclain@users.noreply.github.com>
127
- - jkmnt <git@firewood.fastmail.com>
128
- - Sai Asish Y <say.apm35@gmail.com>
136
+ - kdkavanagh-jt <154450911+kdkavanagh-jt@users.noreply.github.com>
129
137
  - ioanatia <ioanatia@users.noreply.github.com>
138
+ - chuenchen309 <48723787+chuenchen309@users.noreply.github.com>
130
139
  - alm <alonme@users.noreply.github.com>
131
140
  - adam-grant-hendry <59346180+adam-grant-hendry@users.noreply.github.com>
132
141
  - aatle <168398276+aatle@users.noreply.github.com>
133
142
  - Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
134
143
  - Zac Hatfield-Dodds <Zac-HD@users.noreply.github.com>
135
144
  - Youngwook Kim <youngwook.kim@gmail.com>
145
+ - Yang Fan <2022112761@stu.hit.edu.cn>
136
146
  - Vilnis Termanis <vilnis.termanis@iotics.com>
137
147
  - Valentin Valls <valentin.valls@esrf.fr>
138
148
  - Uilian Ries <uilianries@gmail.com>
@@ -151,6 +161,7 @@ Contributors
151
161
  - Peter de Blanc <peter@standard.ai>
152
162
  - Peter Talley <peterctalley@gmail.com>
153
163
  - Ovidiu Sabou <ovidiu@sabou.org>
164
+ - Omkar Kabde <omkarkabde@gmail.com>
154
165
  - Oliver Reiche <oliver.reiche@gmail.com>
155
166
  - Oleh Prypin <oleh@pryp.in>
156
167
  - Nicolas Noirbent <nicolas@noirbent.fr>
@@ -159,13 +170,18 @@ Contributors
159
170
  - Michał Masłowski <m.maslowski@clearcode.cc>
160
171
  - Mateusz Bysiek <mb@mbdev.pl>
161
172
  - Matej Aleksandrov <matej.aleksandrov@gmail.com>
173
+ - Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
162
174
  - Marcelo Trylesinski <marcelotryle@gmail.com>
175
+ - MUHAMED FAZAL PS <107547381+muhamedfazalps@users.noreply.github.com>
176
+ - MJSHANG <shangmengjiajiajia@gmail.com>
163
177
  - Low, Zhi Hao <lowzhao@gmail.com>
164
178
  - Leandro T. C. Melo <ltcmelo@gmail.com>
179
+ - Kyle D Kavanagh <kkavanagh@jumptrading.com>
165
180
  - Konrad Weihmann <kweihmann@outlook.com>
166
181
  - Kian Meng, Ang <kianmeng.ang@gmail.com>
167
182
  - Jörg Thalheim <Mic92@users.noreply.github.com>
168
183
  - Jérome Perrin <perrinjerome@gmail.com>
184
+ - June <kimjune01@gmail.com>
169
185
  - JulianJvn <128477611+JulianJvn@users.noreply.github.com>
170
186
  - Joshix-1 <57299889+Joshix-1@users.noreply.github.com>
171
187
  - Josef Kemetmüller <josef.kemetmueller@gmail.com>
@@ -177,20 +193,24 @@ Contributors
177
193
  - Jarrad Hope <me@jarradhope.com>
178
194
  - Jared Garst <jgarst@users.noreply.github.com>
179
195
  - Jamie Scott <jamie@jami.org.uk>
196
+ - Jam Balaya <jambalaya.pyoncafe@outlook.jp>
180
197
  - Jakub Wilk <jwilk@jwilk.net>
181
198
  - Iva Miholic <ivamiho@gmail.com>
182
199
  - Ionel Maries Cristian <contact@ionelmc.ro>
183
200
  - HoverHell <hoverhell@gmail.com>
184
201
  - Hashem Nasarat <Hnasar@users.noreply.github.com>
202
+ - Hariharan Agaranallur Ganesan <hariharan.ganesh07@gmail.com>
185
203
  - HQupgradeHQ <18361586+HQupgradeHQ@users.noreply.github.com>
186
204
  - Gwyn Ciesla <gwync@protonmail.com>
187
205
  - Grygorii Iermolenko <gyermolenko@gmail.com>
188
206
  - Gregory P. Smith <greg@krypto.org>
189
207
  - Giuseppe Scrivano <gscrivan@redhat.com>
208
+ - Genny-oo <156810188+Genny-oo@users.noreply.github.com>
190
209
  - Frédéric Chapoton <fchapoton2@gmail.com>
191
210
  - Francis Charette Migneault <francis.charette.migneault@gmail.com>
192
211
  - Felix Mölder <felix.moelder@uni-due.de>
193
212
  - Federico Bond <federicobond@gmail.com>
213
+ - Eljees <57435526+Eljees@users.noreply.github.com>
194
214
  - DudeNr33 <3929834+DudeNr33@users.noreply.github.com>
195
215
  - Dmitry Shachnev <mitya57@users.noreply.github.com>
196
216
  - Denis Laxalde <denis.laxalde@logilab.fr>
@@ -225,14 +245,6 @@ Contributors
225
245
  - Alexander Scheel <alexander.m.scheel@gmail.com>
226
246
  - Alexander Presnyakov <flagist0@gmail.com>
227
247
  - Ahmed Azzaoui <ahmed.azzaoui@engie.com>
228
- - nanookclaw <nanook@agentmail.to>
229
- - SAY-5 <say.apm35@gmail.com>
230
- - Omkar Kabde <omkarkabde@gmail.com>
231
- - MJSHANG <shangmengjiajiajia@gmail.com>
232
- - Kyle D Kavanagh <kkavanagh@jumptrading.com>
233
- - KALI 834X <kali834x@gmail.com>
234
- - June <kimjune01@gmail.com>
235
- - Jam Balaya <jambalaya.pyoncafe@outlook.jp>
236
248
 
237
249
  Co-Author
238
250
  ---------
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astroid
3
- Version: 4.2.0b4
3
+ Version: 4.3.0
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.2.0b4"
5
+ __version__ = "4.3.0"
6
6
  version = __version__
@@ -0,0 +1,69 @@
1
+ # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2
+ # For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3
+ # Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
4
+
5
+ from __future__ import annotations
6
+
7
+ import ast
8
+ from typing import Final, NamedTuple
9
+
10
+ from astroid.const import Context
11
+
12
+
13
+ class FunctionType(NamedTuple):
14
+ argtypes: list[ast.expr]
15
+ returns: ast.expr
16
+
17
+
18
+ def parse_function_type_comment(type_comment: str) -> FunctionType | None:
19
+ """Given a correct type comment, obtain a FunctionType object."""
20
+ func_type = ast.parse(type_comment, "<type_comment>", "func_type")
21
+ return FunctionType(argtypes=func_type.argtypes, returns=func_type.returns)
22
+
23
+
24
+ UNARY_OP_CLASSES: Final[dict[type[ast.unaryop], str]] = {
25
+ ast.UAdd: "+",
26
+ ast.USub: "-",
27
+ ast.Not: "not",
28
+ ast.Invert: "~",
29
+ }
30
+
31
+ BIN_OP_CLASSES: Final[dict[type[ast.operator], str]] = {
32
+ ast.Add: "+",
33
+ ast.BitAnd: "&",
34
+ ast.BitOr: "|",
35
+ ast.BitXor: "^",
36
+ ast.Div: "/",
37
+ ast.FloorDiv: "//",
38
+ ast.MatMult: "@",
39
+ ast.Mod: "%",
40
+ ast.Mult: "*",
41
+ ast.Pow: "**",
42
+ ast.Sub: "-",
43
+ ast.LShift: "<<",
44
+ ast.RShift: ">>",
45
+ }
46
+
47
+ BOOL_OP_CLASSES: Final[dict[type[ast.boolop], str]] = {
48
+ ast.And: "and",
49
+ ast.Or: "or",
50
+ }
51
+
52
+ CMP_OP_CLASSES: Final[dict[type[ast.cmpop], str]] = {
53
+ ast.Eq: "==",
54
+ ast.Gt: ">",
55
+ ast.GtE: ">=",
56
+ ast.In: "in",
57
+ ast.Is: "is",
58
+ ast.IsNot: "is not",
59
+ ast.Lt: "<",
60
+ ast.LtE: "<=",
61
+ ast.NotEq: "!=",
62
+ ast.NotIn: "not in",
63
+ }
64
+
65
+ CONTEXT_CLASSES: Final[dict[type[ast.expr_context], Context]] = {
66
+ ast.Load: Context.Load,
67
+ ast.Store: Context.Store,
68
+ ast.Del: Context.Del,
69
+ }
@@ -396,9 +396,9 @@ class Instance(BaseInstance):
396
396
 
397
397
  The truth value of an instance is determined by these conditions:
398
398
 
399
- * if it implements __bool__ on Python 3 or __nonzero__
400
- on Python 2, then its bool value will be determined by
401
- calling this special method and checking its result.
399
+ * if it implements __bool__, then its bool value will be
400
+ determined by calling this special method and checking
401
+ its result.
402
402
  * when this method is not defined, __len__() is called, if it
403
403
  is defined, and the object is considered true if its result is
404
404
  nonzero. If a class defines neither __len__() nor __bool__(),
@@ -670,7 +670,6 @@ class BoundMethod(UnboundMethod):
670
670
  bases=bases.elts,
671
671
  body=[empty],
672
672
  decorators=None,
673
- newstyle=True,
674
673
  metaclass=mcs,
675
674
  keywords=[],
676
675
  )
@@ -7,11 +7,13 @@
7
7
  from __future__ import annotations
8
8
 
9
9
  import itertools
10
+ import re
10
11
  from collections.abc import Callable, Iterable, Iterator
11
- from functools import partial
12
- from typing import TYPE_CHECKING, NoReturn, cast
12
+ from functools import lru_cache, partial
13
+ from typing import NoReturn, cast
13
14
 
14
15
  from astroid import arguments, helpers, nodes, objects, util
16
+ from astroid.bases import Instance
15
17
  from astroid.builder import AstroidBuilder
16
18
  from astroid.context import InferenceContext
17
19
  from astroid.exceptions import (
@@ -30,9 +32,6 @@ from astroid.typing import (
30
32
  SuccessfulInferenceResult,
31
33
  )
32
34
 
33
- if TYPE_CHECKING:
34
- from astroid.bases import Instance
35
-
36
35
  ContainerObjects = (
37
36
  objects.FrozenSet | objects.DictItems | objects.DictKeys | objects.DictValues
38
37
  )
@@ -43,6 +42,40 @@ CopyResult = nodes.Dict | nodes.List | nodes.Set | objects.FrozenSet
43
42
 
44
43
  OBJECT_DUNDER_NEW = "object.__new__"
45
44
 
45
+ # Largest field width/precision we are willing to materialize when inferring a
46
+ # str.format() call. A crafted template such as "{:>2000000000}" would otherwise
47
+ # eagerly build a multi-gigabyte string during inference.
48
+ _MAX_FORMAT_FIELD_SIZE = int(1e8)
49
+
50
+ # Largest str/bytes constant we are willing to expand into one node per
51
+ # character when inferring container calls and dict.fromkeys.
52
+ _MAX_INFERABLE_STR_LEN = int(1e8)
53
+
54
+
55
+ @lru_cache(maxsize=1)
56
+ def _get_bounded_formatter():
57
+ """Build the formatter lazily: importing ``string`` is costly at import time."""
58
+ import string # pylint: disable=import-outside-toplevel
59
+
60
+ class _BoundedFormatter(string.Formatter):
61
+ """A ``str.format`` implementation that refuses oversized width/precision.
62
+
63
+ The only multi-digit numbers in a format spec are the width and the
64
+ precision, so bailing when any digit run exceeds the limit covers both.
65
+ Nested replacement fields ("{:>{}}") are already resolved by ``Formatter``
66
+ before ``format_field`` runs, so this also catches sizes passed as
67
+ arguments.
68
+ """
69
+
70
+ def format_field(self, value: object, format_spec: str) -> str:
71
+ for size in re.findall(r"\d+", format_spec):
72
+ if int(size) > _MAX_FORMAT_FIELD_SIZE:
73
+ raise ValueError("format field size exceeds inference limit")
74
+ return cast(str, super().format_field(value, format_spec))
75
+
76
+ return _BoundedFormatter()
77
+
78
+
46
79
  STR_CLASS = """
47
80
  class whatever(object):
48
81
  def join(self, iterable):
@@ -291,6 +324,9 @@ def _container_generic_transform(
291
324
  for item in arg.items
292
325
  ]
293
326
  elif isinstance(arg, nodes.Const) and isinstance(arg.value, (str, bytes)):
327
+ # Don't expand an oversized string into one Const node per character.
328
+ if len(arg.value) > _MAX_INFERABLE_STR_LEN:
329
+ return None
294
330
  elts = arg.value
295
331
  else:
296
332
  return None
@@ -442,6 +478,30 @@ def infer_dict(node: nodes.Call, context: InferenceContext | None = None) -> nod
442
478
  return value
443
479
 
444
480
 
481
+ def _mro_owner(cls: nodes.ClassDef, context: InferenceContext | None) -> nodes.ClassDef:
482
+ """Return the class whose mro a ``super()`` call with no argument walks.
483
+
484
+ ``super()`` with no argument is ``super(__class__, self)``. It starts the
485
+ lookup after the class the method is written in, but it walks the mro of the
486
+ object the method was called on, which can be a subclass, or a class that
487
+ only meets the method's own class in the mro of that subclass (a mixin).
488
+ ``context.boundnode`` is that object when it is known.
489
+ """
490
+ bound = context.boundnode if context is not None else None
491
+ if isinstance(bound, Instance):
492
+ bound_cls = bound._proxied
493
+ elif isinstance(bound, nodes.ClassDef):
494
+ bound_cls = bound
495
+ else:
496
+ return cls
497
+ try:
498
+ if cls in bound_cls.mro():
499
+ return bound_cls
500
+ except MroError:
501
+ pass
502
+ return cls
503
+
504
+
445
505
  def infer_super(
446
506
  node: nodes.Call, context: InferenceContext | None = None
447
507
  ) -> objects.Super:
@@ -473,12 +533,13 @@ def infer_super(
473
533
  assert cls is not None
474
534
  if not node.args:
475
535
  mro_pointer = cls
536
+ mro_owner = _mro_owner(cls, context)
476
537
  # In we are in a classmethod, the interpreter will fill
477
538
  # automatically the class as the second argument, not an instance.
478
539
  if scope.type == "classmethod":
479
- mro_type = cls
540
+ mro_type = mro_owner
480
541
  else:
481
- mro_type = cls.instantiate_class()
542
+ mro_type = mro_owner.instantiate_class()
482
543
  else:
483
544
  try:
484
545
  mro_pointer = next(node.args[0].infer(context=context))
@@ -928,6 +989,16 @@ def infer_dict_fromkeys(node, context: InferenceContext | None = None):
928
989
  new_node.postinit(elements)
929
990
  return new_node
930
991
 
992
+ def _unique_const_keys(keys: Iterable[nodes.Const]) -> list[nodes.Const]:
993
+ # dict.fromkeys deduplicates its keys, so keep only the first Const seen
994
+ # for a given value. Emitting one entry per element is wrong
995
+ # (dict.fromkeys("aab") has keys "a", "b") and lets a repeated string
996
+ # balloon the inferred dict.
997
+ seen: dict[object, nodes.Const] = {}
998
+ for key in keys:
999
+ seen.setdefault(key.value, key)
1000
+ return list(seen.values())
1001
+
931
1002
  call = arguments.CallSite.from_call(node, context=context)
932
1003
  if call.keyword_arguments:
933
1004
  raise UseInferenceDefault("TypeError: int() must take no keyword arguments")
@@ -954,13 +1025,22 @@ def infer_dict_fromkeys(node, context: InferenceContext | None = None):
954
1025
  # Fallback to an empty dict
955
1026
  return _build_dict_with_elements([])
956
1027
 
957
- elements_with_value = [(element, default) for element in elements]
1028
+ elements_with_value = [
1029
+ (element, default) for element in _unique_const_keys(elements)
1030
+ ]
958
1031
  return _build_dict_with_elements(elements_with_value)
959
1032
  if isinstance(inferred_values, nodes.Const) and isinstance(
960
1033
  inferred_values.value, (str, bytes)
961
1034
  ):
1035
+ # Same cap as the container builders above.
1036
+ if len(inferred_values.value) > _MAX_INFERABLE_STR_LEN:
1037
+ return _build_dict_with_elements([])
1038
+ # Deduplicate the characters/bytes before building Const nodes so that a
1039
+ # compact but large string, e.g. dict.fromkeys("x" * 10**8), doesn't
1040
+ # materialize one node per character for what is a single-key dict.
962
1041
  elements_with_value = [
963
- (nodes.Const(element), default) for element in inferred_values.value
1042
+ (nodes.Const(element), default)
1043
+ for element in dict.fromkeys(inferred_values.value)
964
1044
  ]
965
1045
  return _build_dict_with_elements(elements_with_value)
966
1046
  if isinstance(inferred_values, nodes.Dict):
@@ -970,7 +1050,9 @@ def infer_dict_fromkeys(node, context: InferenceContext | None = None):
970
1050
  # Fallback to an empty dict
971
1051
  return _build_dict_with_elements([])
972
1052
 
973
- elements_with_value = [(element, default) for element in keys]
1053
+ elements_with_value = [
1054
+ (element, default) for element in _unique_const_keys(keys)
1055
+ ]
974
1056
  return _build_dict_with_elements(elements_with_value)
975
1057
 
976
1058
  # Fallback to an empty dictionary
@@ -1048,8 +1130,18 @@ def _infer_str_format_call(
1048
1130
 
1049
1131
  keyword_values: dict[str, str] = {k: v.value for k, v in inferred_keyword.items()}
1050
1132
 
1133
+ formatter = _get_bounded_formatter()
1134
+ try:
1135
+ fields = list(formatter.parse(format_template))
1136
+ except ValueError:
1137
+ return iter([util.Uninferable])
1138
+ if any(spec and util.format_spec_too_large(spec) for _, _, spec, _ in fields):
1139
+ return iter([util.Uninferable])
1140
+
1051
1141
  try:
1052
- formatted_string = format_template.format(*pos_values, **keyword_values)
1142
+ formatted_string = formatter.format(
1143
+ format_template, *pos_values, **keyword_values
1144
+ )
1053
1145
  except (AttributeError, IndexError, KeyError, TypeError, ValueError):
1054
1146
  # AttributeError: named field in format string was not found in the arguments
1055
1147
  # IndexError: there are too few arguments to interpolate
@@ -58,7 +58,6 @@ def _deque_mock():
58
58
  def __setitem__(self, index, value): pass
59
59
  def __delitem__(self, index): pass
60
60
  def __bool__(self): return bool(self.iterable)
61
- def __nonzero__(self): return bool(self.iterable)
62
61
  def __contains__(self, o): return o in self.iterable
63
62
  def __len__(self): return len(self.iterable)
64
63
  def __copy__(self): return deque(self.iterable)
@@ -103,7 +103,7 @@ def dataclass_transform(node: nodes.ClassDef) -> nodes.ClassDef | None:
103
103
  node.locals["__init__"] = [init_node]
104
104
 
105
105
  root = node.root()
106
- if DEFAULT_FACTORY not in root.locals:
106
+ if DEFAULT_FACTORY in init_str and DEFAULT_FACTORY not in root.locals:
107
107
  new_assign = parse(f"{DEFAULT_FACTORY} = object()").body[0]
108
108
  new_assign.parent = root
109
109
  root.locals[DEFAULT_FACTORY] = [new_assign.targets[0]]
@@ -188,10 +188,16 @@ def _find_arguments_from_base_classes(
188
188
  if not base.is_dataclass:
189
189
  continue
190
190
  try:
191
- base_init: nodes.FunctionDef = base.locals["__init__"][0]
191
+ base_init = base.locals["__init__"][0]
192
192
  except KeyError:
193
193
  continue
194
194
 
195
+ # A base can bind "__init__" to something that is not a function, for
196
+ # example by annotating it as a field: "__init__: int". There are no
197
+ # arguments to inherit from such a base.
198
+ if not isinstance(base_init, nodes.FunctionDef):
199
+ continue
200
+
195
201
  pos_only, kw_only = base_init.args._get_arguments_data()
196
202
  for posarg, data in pos_only.items():
197
203
  # if data[1] is None:
@@ -388,9 +394,9 @@ def _generate_dataclass_init(
388
394
  prev_pos_only_store, prev_kw_only_store
389
395
  )
390
396
 
391
- # Construct the new init method paramter string
397
+ # Construct the new init method parameter string
392
398
  # First we do the positional only parameters, making sure to add the
393
- # the self parameter and the comma to allow adding keyword only parameters
399
+ # self parameter and the comma to allow adding keyword only parameters
394
400
  params_string = "" if "self" in prev_pos_only else "self, "
395
401
  params_string += prev_pos_only + ", ".join(params)
396
402
  if not params_string.endswith(", "):
@@ -0,0 +1,20 @@
1
+ # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html
2
+ # For details: https://github.com/pylint-dev/astroid/blob/main/LICENSE
3
+ # Copyright (c) https://github.com/pylint-dev/astroid/blob/main/CONTRIBUTORS.txt
4
+
5
+ from astroid import nodes
6
+ from astroid.brain.helpers import register_module_extender
7
+ from astroid.builder import AstroidBuilder
8
+ from astroid.manager import AstroidManager
9
+
10
+
11
+ def decimal_transform() -> nodes.Module:
12
+ """The _decimal module is not always available and the _pydecimal fallback can't be inferred."""
13
+ return AstroidBuilder(AstroidManager()).string_build("from _pydecimal import *")
14
+
15
+
16
+ def register(manager: AstroidManager) -> None:
17
+ try:
18
+ import _decimal # pylint: disable=unused-import,import-outside-toplevel
19
+ except ImportError:
20
+ register_module_extender(manager, "decimal", decimal_transform)
@@ -2,13 +2,14 @@
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
- """Astroid hooks for the Python 2 GObject introspection bindings.
5
+ """Astroid hooks for the GObject introspection bindings.
6
6
 
7
7
  Helps with understanding everything imported from 'gi.repository'
8
8
  """
9
9
 
10
10
  # pylint:disable=import-error,import-outside-toplevel
11
11
 
12
+ import enum
12
13
  import inspect
13
14
  import itertools
14
15
  import re
@@ -38,7 +39,6 @@ _special_methods = frozenset(
38
39
  "__delitem__",
39
40
  "__len__",
40
41
  "__bool__",
41
- "__nonzero__",
42
42
  "__next__",
43
43
  "__str__",
44
44
  "__contains__",
@@ -130,6 +130,14 @@ def _gi_build_stub(parent): # noqa: C901
130
130
  else:
131
131
  # Assume everything else is some manner of constant
132
132
  constants[name] = 0
133
+ # iterating enum.IntFlag doesn't include the zero value
134
+ if inspect.isclass(parent) and issubclass(parent, enum.IntFlag):
135
+ try:
136
+ zero_name = parent(0).name
137
+ if zero_name:
138
+ constants[zero_name] = 0
139
+ except TypeError:
140
+ pass
133
141
 
134
142
  ret = ""
135
143
 
@@ -163,7 +171,17 @@ def _gi_build_stub(parent): # noqa: C901
163
171
  if methods:
164
172
  ret += f"# {parent.__name__} methods\n\n"
165
173
  for name in sorted(methods):
166
- ret += f"def {name}(self, *args, **kwargs):\n"
174
+ static = False
175
+ try:
176
+ if not methods[name].is_method():
177
+ static = True
178
+ except AttributeError:
179
+ pass
180
+ if static:
181
+ ret += "@staticmethod\n"
182
+ ret += f"def {name}(*args, **kwargs):\n"
183
+ else:
184
+ ret += f"def {name}(self, *args, **kwargs):\n"
167
185
  ret += " pass\n"
168
186
 
169
187
  if ret:
@@ -8,6 +8,7 @@ from __future__ import annotations
8
8
 
9
9
  import functools
10
10
  import keyword
11
+ import unicodedata
11
12
  from collections.abc import Iterator
12
13
  from textwrap import dedent
13
14
  from typing import Final
@@ -16,6 +17,7 @@ from astroid import arguments, bases, nodes, util
16
17
  from astroid.builder import AstroidBuilder, _extract_single_node, extract_node
17
18
  from astroid.context import InferenceContext
18
19
  from astroid.exceptions import (
20
+ AstroidError,
19
21
  AstroidTypeError,
20
22
  AstroidValueError,
21
23
  InferenceError,
@@ -91,7 +93,11 @@ def infer_func_form(
91
93
  name, names = _find_func_form_arguments(node, context)
92
94
  try:
93
95
  attributes: list[str] = names.value.replace(",", " ").split()
94
- except AttributeError as exc:
96
+ except (AttributeError, TypeError) as exc:
97
+ # ``names`` is not a whitespace-separated string: it is either a
98
+ # container node, which has no ``value`` (AttributeError), or a
99
+ # constant of another type such as bytes (TypeError).
100
+
95
101
  # Handle attributes of NamedTuples
96
102
  if not enum:
97
103
  attributes = []
@@ -252,7 +258,12 @@ class {name}(tuple):
252
258
  class_node.locals["_replace"] = fake.body[0].locals["_replace"]
253
259
  class_node.locals["_fields"] = fake.body[0].locals["_fields"]
254
260
  for attr in attributes:
255
- class_node.locals[attr] = fake.body[0].locals[attr]
261
+ # Python normalises identifiers to NFKC, so a field named "\u00b5" (MICRO SIGN)
262
+ # is stored by the parser as "\u03bc" (GREEK SMALL LETTER MU). Looking the
263
+ # attribute up under the name as written raises KeyError on a definition
264
+ # namedtuple itself accepts, so use the name the parser actually used.
265
+ normalized = unicodedata.normalize("NFKC", attr)
266
+ class_node.locals[normalized] = fake.body[0].locals[normalized]
256
267
  # we use UseInferenceDefault, we can't be a generator so return an iterator
257
268
  return iter([class_node])
258
269
 
@@ -566,8 +577,12 @@ def infer_typing_namedtuple_class(class_node, context: InferenceContext | None =
566
577
  for body_node in class_node.body:
567
578
  if isinstance(body_node, nodes.Assign):
568
579
  for target in body_node.targets:
569
- attr = target.name
570
- generated_class_node.locals[attr] = class_node.locals[attr]
580
+ # A target is not necessarily a single name: ``cat.color = ...``
581
+ # and ``basket[0] = ...`` define no class attribute at all, while
582
+ # ``apple, banana = ...`` defines one per unpacked element.
583
+ for assign_name in target.nodes_of_class(nodes.AssignName):
584
+ attr = assign_name.name
585
+ generated_class_node.locals[attr] = class_node.locals[attr]
571
586
  elif isinstance(body_node, nodes.ClassDef):
572
587
  generated_class_node.locals[body_node.name] = [body_node]
573
588
 
@@ -654,7 +669,10 @@ def _get_namedtuple_fields(node: nodes.Call) -> str:
654
669
 
655
670
  def _is_enum_subclass(cls: nodes.ClassDef) -> bool:
656
671
  """Return whether cls is a subclass of an Enum."""
657
- return cls.is_subtype_of("enum.Enum")
672
+ try:
673
+ return cls.is_subtype_of("enum.Enum")
674
+ except AstroidError:
675
+ return False
658
676
 
659
677
 
660
678
  def register(manager: AstroidManager) -> None:
@@ -43,6 +43,8 @@ METHODS_TO_BE_INFERRED = {
43
43
  return numpy.ndarray([0, 0])""",
44
44
  "empty": """def empty(shape, dtype=float, order='C'):
45
45
  return numpy.ndarray([0, 0])""",
46
+ "fromfile": """def fromfile(file, dtype=float, count=-1, sep='', offset=0):
47
+ return numpy.ndarray([0, 0])""",
46
48
  "bincount": """def bincount(x, weights=None, minlength=0):
47
49
  return numpy.ndarray([0, 0])""",
48
50
  "busday_count": """def busday_count(
@@ -56,9 +56,11 @@ def _looks_like_pattern_or_match(node: nodes.Call) -> bool:
56
56
  Pattern = type(...)
57
57
  Match = type(...)
58
58
  ```
59
+ Older versions of regex define these in ``regex.regex``, newer versions
60
+ define them in ``regex._main``.
59
61
  """
60
62
  return (
61
- node.root().name == "regex.regex"
63
+ node.root().name in {"regex.regex", "regex._main"}
62
64
  and isinstance(node.func, nodes.Name)
63
65
  and node.func.name == "type"
64
66
  and isinstance(node.parent, nodes.Assign)