Skip to content

Conversation

@pyup-bot
Copy link
Collaborator

This PR updates astroid from 2.3.3 to 2.11.1.

Changelog

2.11.1

=============================
Release date: 2022-03-22

* Promoted ``getattr()`` from ``astroid.scoped_nodes.FunctionDef`` to its parent
``astroid.scoped_nodes.Lambda``.

* Fixed crash on direct inference via ``nodes.FunctionDef._infer``.

Closes 817

2.11.0

=============================
Release date: 2022-03-12

* Add new (optional) ``doc_node`` attribute to ``nodes.Module``, ``nodes.ClassDef``,
and ``nodes.FunctionDef``.

* Accessing the ``doc`` attribute of ``nodes.Module``, ``nodes.ClassDef``, and
``nodes.FunctionDef`` has been deprecated in favour of the ``doc_node`` attribute.
Note: ``doc_node`` is an (optional) ``nodes.Const`` whereas ``doc`` was an (optional) ``str``.

* Passing the ``doc`` argument to the ``__init__`` of ``nodes.Module``, ``nodes.ClassDef``,
and ``nodes.FunctionDef`` has been deprecated in favour of the ``postinit`` ``doc_node`` attribute.
Note: ``doc_node`` is an (optional) ``nodes.Const`` whereas ``doc`` was an (optional) ``str``.

* Replace custom ``cachedproperty`` with ``functools.cached_property`` and deprecate it
for Python 3.8+.

Closes 1410

* Set ``end_lineno`` and ``end_col_offset`` attributes to ``None`` for all nodes
with PyPy 3.8. PyPy 3.8 assigns these attributes inconsistently which could lead
to unexpected errors. Overwriting them with ``None`` will cause a fallback
to the already supported way of PyPy 3.7.

* Add missing ``shape`` parameter to numpy ``zeros_like``, ``ones_like``,
and ``full_like`` methods.

Closes PyCQA/pylint5871

* Only pin ``wrapt`` on the major version.

2.10.0

=============================
Release date: 2022-02-27


* Fixed inference of ``self`` in binary operations in which ``self``
is part of a list or tuple.

Closes PyCQA/pylint4826

* Fixed builtin inference on `property` calls not calling the `postinit` of the new node, which
resulted in instance arguments missing on these nodes.

* Fixed a crash on ``Super.getattr`` when the attribute was previously uninferable due to a cache
limit size. This limit can be hit when the inheritance pattern of a class (and therefore of the
``__init__`` attribute) is very large.

Closes PyCQA/pylint5679

* Inlcude names of keyword-only arguments in ``astroid.scoped_nodes.Lambda.argnames``.

Closes PyCQA/pylint5771

* Fixed a crash inferring on a ``NewType`` named with an f-string.

Closes PyCQA/pylint5770

* Add support for [attrs v21.3.0](https://github.com/python-attrs/attrs/releases/tag/21.3.0) which
added a new `attrs` module alongside the existing `attr`.

Closes 1330

* Use the ``end_lineno`` attribute for the ``NodeNG.tolineno`` property
when it is available.

Closes 1350

* Add ``is_dataclass`` attribute to ``ClassDef`` nodes.

* Use ``sysconfig`` instead of ``distutils`` to determine the location of
python stdlib files and packages.

Related pull requests: 1322, 1323, 1324
Closes 1282
Ref 1103

* Fixed crash with recursion error for inference of class attributes that referenced
the class itself.

Closes PyCQA/pylint5408

* Fixed crash when trying to infer ``items()`` on the ``__dict__``
attribute of an imported module.

Closes 1085

* Add optional ``NodeNG.position`` attribute.
Used for block nodes to highlight position of keyword(s) and name
in cases where the AST doesn't provide good enough positional information.
E.g. ``nodes.ClassDef``, ``nodes.FunctionDef``.

* Fix ``ClassDef.fromlineno``. For Python < 3.8 the ``lineno`` attribute includes decorators.
``fromlineno`` should return the line of the ``class`` statement itself.

* Performance improvements. Only run expensive decorator functions when
non-default Deprecation warnings are enabled, eg. during a Pytest run.

Closes 1383

2.9.3

============================
Release date: 2022-01-09

* Fixed regression where packages without a ``__init__.py`` file were
not recognized or imported correctly.

Closes 1327

2.9.2

============================
Release date: 2022-01-04

* Fixed regression in ``astroid.scoped_nodes`` where ``_is_metaclass``
was not accessible anymore.

Closes 1325

2.9.1

============================
Release date: 2021-12-31

* ``NodeNG.frame()`` and ``NodeNG.statement()`` will start raising ``ParentMissingError``
instead of ``AttributeError`` in astroid 3.0. This behaviour can already be triggered
by passing ``future=True`` to a ``frame()`` or ``statement()`` call.

* Prefer the module loader get_source() method in AstroidBuilder's
module_build() when possible to avoid assumptions about source
code being available on a filesystem.  Otherwise the source cannot
be found and application behavior changes when running within an
embedded hermetic interpreter environment (pyoxidizer, etc.).

* Require Python 3.6.2 to use astroid.

* Removed custom ``distutils`` handling for resolving paths to submodules.

Ref 1321

* Restore custom ``distutils`` handling for resolving paths to submodules.

Closes PyCQA/pylint5645

* Fix ``deque.insert()`` signature in ``collections`` brain.

Closes 1260

* Fix ``Module`` nodes not having a ``col_offset``, ``end_lineno``, and ``end_col_offset``
attributes.

* Fix typing and update explanation for ``Arguments.args`` being ``None``.

* Fix crash if a variable named ``type`` is accessed with an index operator (``[]``)
in a generator expression.

Closes PyCQA/pylint5461

* Enable inference of dataclass import from marshmallow_dataclass.
This allows the dataclasses brain to recognize dataclasses annotated by marshmallow_dataclass.

* Resolve symlinks in the import path
Fixes inference error when the import path includes symlinks (e.g. Python
installed on macOS via Homebrew).

Closes 823
Closes PyCQA/pylint3499
Closes PyCQA/pylint4302
Closes PyCQA/pylint4798
Closes PyCQA/pylint5081

2.9.0

============================
Release date: 2021-11-21

* Add ``end_lineno`` and ``end_col_offset`` attributes to astroid nodes.

* Always treat ``__class_getitem__`` as a classmethod.

* Add missing ``as_string`` visitor method for ``Unknown`` node.

Closes 1264

2.8.6

============================
Release date: 2021-11-21

* Fix crash on inference of subclasses created from ``Class().__subclasses__``

Closes PyCQA/pylint4982

* Fix bug with Python 3.7.0 / 3.7.1 and ``typing.NoReturn``.

Closes 1239

2.8.5

============================
Release date: 2021-11-12

* Use more permissive versions for the ``typed-ast`` dependency (<2.0 instead of <1.5)

Closes 1237

* Fix crash on inference of ``__len__``.

Closes PyCQA/pylint5244

* Added missing ``kind`` (for ``Const``) and ``conversion`` (for ``FormattedValue``) fields to repr.

* Fix crash with assignment expressions, nested if expressions and filtering of statements

Closes PyCQA/pylint5178

* Fix incorrect filtering of assignment expressions statements

2.8.4

============================
Release date: 2021-10-25

* Fix the ``scope()`` and ``frame()`` methods of ``NamedExpr`` nodes.
When these nodes occur in ``Arguments``, ``Keyword``  or ``Comprehension`` nodes these
methods now correctly point to the outer-scope of the ``FunctionDef``,
``ClassDef``, or ``Comprehension``.

* Fix the ``set_local`` function for ``NamedExpr`` nodes.
When these nodes occur in ``Arguments``, ``Keyword``, or ``Comprehension`` nodes these
nodes are now correctly added to the locals of the ``FunctionDef``,
``ClassDef``, or ``Comprehension``.

2.8.3

============================
Release date: 2021-10-17

* Add support for wrapt 1.13

* Fixes handling of nested partial functions

Closes PyCQA/pylint2462
Closes 1208

* Fix regression with the import resolver

Closes PyCQA/pylint5131

* Fix crash with invalid dataclass field call

Closes PyCQA/pylint5153

2.8.2

============================
Release date: 2021-10-07

Same content than 2.8.2-dev0 / 2.8.1, released in order to fix a
mistake when creating the tag.

2.8.1

============================
Release date: 2021-10-06

* Adds support of type hints inside numpy's brains.

Closes PyCQA/pylint4326

* Enable inference of dataclass import from pydantic.dataclasses.
This allows the dataclasses brain to recognize pydantic dataclasses.

Closes PyCQA/pylint4899

* Fix regression on ClassDef inference

Closes PyCQA/pylint5030
Closes PyCQA/pylint5036

* Fix regression on Compare node inference

Closes PyCQA/pylint5048

* Extended attrs brain to support the provisional APIs

* Astroid does not trigger it's own deprecation warning anymore.

* Improve brain for ``typing.Callable`` and ``typing.Type``.

* Fix bug with importing namespace packages with relative imports

Closes PyCQA/pylint5059

* The ``is_typing_guard`` and ``is_sys_guard`` functions are deprecated and will
be removed in 3.0.0. They are complex meta-inference functions that are better
suited for pylint. Import them from ``pylint.checkers.utils`` instead
(requires pylint ``2.12``).

* Suppress the conditional between applied brains and dynamic import authorized
modules. (Revert the "The transforms related to a module are applied only if this
module has not been explicitly authorized to be imported" of version 2.7.3)

* Adds a brain to infer the ``numpy.ma.masked_where`` function.

Closes PyCQA/pylint3342

2.8.0

============================
Release date: 2021-09-14

* Add additional deprecation warnings in preparation for astroid 3.0

* Require attributes for some node classes with ``__init__`` call.

 * ``name`` (``str``) for ``Name``, ``AssignName``, ``DelName``
 * ``attrname`` (``str``) for ``Attribute``, ``AssignAttr``, ``DelAttr``
 * ``op`` (``str``) for ``AugAssign``, ``BinOp``, ``BoolOp``, ``UnaryOp``
 * ``names`` (``list[tuple[str, str | None]]``) for ``Import``

* Support pyz imports

Closes PyCQA/pylint3887

* Add ``node_ancestors`` method to ``NodeNG`` for obtaining the ancestors of nodes.

* It's now possible to infer the value of comparison nodes

Closes 846

* Fixed bug in inference of dataclass field calls.

Closes PyCQA/pylint4963

2.7.3

============================
Release date: 2021-08-30

* The transforms related to a module are applied only if this module has not been explicitly authorized to be imported
(i.e is not in AstroidManager.extension_package_whitelist). Solves the following issues if numpy is authorized to be imported
through the `extension-pkg-allow-list` option.

Closes PyCQA/pylint3342
Closes PyCQA/pylint4326

* Fixed bug in attribute inference from inside method calls.

 Closes PyCQA/pylint400

* Fixed bug in inference for superclass instance methods called
from the class rather than an instance.

 Closes 1008
 Closes PyCQA/pylint4377

* Fixed bug in inference of chained attributes where a subclass
had an attribute that was an instance of its superclass.

 Closes PyCQA/pylint4220

* Adds a brain for the ctypes module.

Closes PyCQA/pylint4896

* When processing dataclass attributes, exclude the same type hints from abc.collections
as from typing.

Closes PyCQA/pylint4895

* Apply dataclass inference to pydantic's dataclasses.

Closes PyCQA/pylint4899

2.7.2

============================
Release date: 2021-08-20

* ``BaseContainer`` is now public, and will replace ``_BaseContainer`` completely in astroid 3.0.
* The call cache used by inference functions produced by ``inference_tip``
can now be cleared via ``clear_inference_tip_cache``.

* ``astroid.const.BUILTINS`` and ``astroid.bases.BUILTINS`` are not used internally anymore
and will be removed in astroid 3.0. Simply replace this by the string 'builtins' for better
performances and clarity.

* Add inference for dataclass initializer method.

 Closes PyCQA/pylint3201

2.7.1

============================
Release date: 2021-08-16

* When processing dataclass attributes, only do typing inference on collection types.
Support for instantiating other typing types is left for the future, if desired.

Closes 1129

* Fixed LookupMixIn missing from ``astroid.node_classes``.

2.7.0

============================
Release date: 2021-08-15

* Import from ``astroid.node_classes`` and ``astroid.scoped_nodes`` has been deprecated in favor of
``astroid.nodes``. Only the imports from ``astroid.nodes`` will work in astroid 3.0.0.

* Add support for arbitrary Enum subclass hierarchies

Closes PyCQA/pylint533
Closes PyCQA/pylint2224
Closes PyCQA/pylint2626

* Add inference tips for dataclass attributes, including dataclasses.field calls.
Also add support for InitVar.

Closes PyCQA/pylint2600
Closes PyCQA/pylint2698
Closes PyCQA/pylint3405
Closes PyCQA/pylint3794

* Adds a brain that deals with dynamic import of `IsolatedAsyncioTestCase` class of the `unittest` module.

Closes PyCQA/pylint4060

2.6.6

============================
Release date: 2021-08-03

* Added support to infer return type of ``typing.cast()``

* Fix variable lookup handling of exclusive statements

Closes PyCQA/pylint3711

* Fix variable lookup handling of function parameters

Closes PyCQA/astroid180

* Fix variable lookup's handling of except clause variables

* Fix handling of classes with duplicated bases with the same name

Closes PyCQA/astroid1088

2.6.5

============================
Release date: 2021-07-21

* Fix a crash when there would be a 'TypeError object does not support
item assignment' in the code we parse.

Closes PyCQA/pylint4439

* Fix a crash when a AttributeInferenceError was raised when
failing to find the real name in infer_import_from.

Closes PyCQA/pylint4692

2.6.4

============================
Release date: 2021-07-19

* Fix a crash when a StopIteration was raised when inferring
a faulty function in a context manager.

Closes PyCQA/pylint4723

2.6.3

============================
Release date: 2021-07-19

* Added ``If.is_sys_guard`` and ``If.is_typing_guard`` helper methods

* Fix a bad inference type for yield values inside of a derived class.

Closes PyCQA/astroid1090

* Fix a crash when the node is a 'Module' in the brain builtin inference

Closes PyCQA/pylint4671

* Fix issues when inferring match variables

Closes PyCQA/pylint4685

* Fix lookup for nested non-function scopes

* Fix issue that ``TypedDict`` instance wasn't callable.

Closes PyCQA/pylint4715

* Add dependency on setuptools and a guard to prevent related exceptions.

2.6.2

============================
Release date: 2021-06-30

* Fix a crash when the inference of the length of a node failed

Closes PyCQA/pylint4633

* Fix unhandled StopIteration during inference, following the implementation
of PEP479 in python 3.7+

Closes PyCQA/pylint4631
Closes 1080

2.6.1

============================
Release date: 2021-06-29

* Fix issue with ``TypedDict`` for Python 3.9+

Closes PyCQA/pylint4610

2.6.0

============================
Release date: 2021-06-22

* Appveyor and travis are no longer used in the continuous integration

* ``setuptools_scm`` has been removed and replaced by ``tbump`` in order to not
have hidden runtime dependencies to setuptools

* ``NodeNg``, the base node class, is now accessible from ``astroid`` or
``astroid.nodes`` as it can be used for typing.

* Update enum brain to improve inference of .name and .value dynamic class
attributes

Closes PyCQA/pylint1932
Closes PyCQA/pylint2062
Closes PyCQA/pylint2306

* Removed ``Repr``, ``Exec``, and ``Print`` nodes as the ``ast`` nodes
they represented have been removed with the change to Python 3

* Deprecate ``Ellipsis`` node. It will be removed with the next minor release.
Checkers that already support Python 3.8+ work without issues. It's only
necessary to remove all references to the ``astroid.Ellipsis`` node.
This changes will make development of checkers easier as the resulting tree for Ellipsis
will no longer depend on the python version. **Background**: With Python 3.8 the
``ast.Ellipsis`` node, along with ``ast.Str``, ``ast.Bytes``, ``ast.Num``,
and ``ast.NamedConstant`` were merged into ``ast.Constant``.

* Deprecated ``Index`` and ``ExtSlice`` nodes. They will be removed with the
next minor release. Both are now part of the ``Subscript`` node.
Checkers that already support Python 3.9+ work without issues.
It's only necessary to remove all references to the ``astroid.Index`` and
``astroid.ExtSlice`` nodes. This change will make development of checkers
easier as the resulting tree for ``ast.Subscript`` nodes will no longer
depend on the python version. **Background**: With Python 3.9 ``ast.Index``
and ``ast.ExtSlice`` were merged into the ``ast.Subscript`` node.

* Updated all Match nodes to be internally consistent.

* Add ``Pattern`` base class.

2.5.8

============================
Release date: 2021-06-07

* Improve support for Pattern Matching

* Add lineno and col_offset for ``Keyword`` nodes and Python 3.9+

* Add global inference cache to speed up inference of long statement blocks

* Add a limit to the total number of nodes inferred indirectly as a result
of inferring some node

2.5.7

============================
Release date: 2021-05-09

* Fix six.with_metaclass transformation so it doesn't break user defined transformations.

* Fix detection of relative imports.
Closes 930
Closes PyCQA/pylint4186

* Fix inference of instance attributes defined in base classes

Closes 932

* Update `infer_named_tuple` brain to reject namedtuple definitions
that would raise ValueError

Closes 920

* Do not set instance attributes on builtin object()

Closes 945
Closes PyCQA/pylint4232
Closes PyCQA/pylint4221
Closes PyCQA/pylint3970
Closes PyCQA/pylint3595

* Fix some spurious cycles detected in ``context.path`` leading to more cases
that can now be inferred

Closes 926

* Add ``kind`` field to ``Const`` nodes, matching the structure of the built-in ast Const.
The kind field is "u" if the literal is a u-prefixed string, and ``None`` otherwise.

Closes 898

* Fix property inference in class contexts for properties defined on the metaclass

Closes 940

* Update enum brain to fix definition of __members__ for subclass-defined Enums

Closes PyCQA/pylint3535
Closes PyCQA/pylint4358

* Update random brain to fix a crash with inference of some sequence elements

Closes 922

* Fix inference of attributes defined in a base class that is an inner class

Closes 904

* Allow inferring a return value of None for non-abstract empty functions and
functions with no return statements (implicitly returning None)

Closes 485

* scm_setuptools has been added to the packaging.

* Astroid's tags are now the standard form ``vX.Y.Z`` and not ``astroid-X.Y.Z`` anymore.

* Add initial support for Pattern Matching in Python 3.10

2.5.6

============================
Release date: 2021-04-25

* Fix retro-compatibility issues with old version of pylint
Closes PyCQA/pylint4402

2.5.5

============================
Release date: 2021-04-24

* Fixes the discord link in the project urls of the package.
Closes PyCQA/pylint4393

2.5.4

============================
Release date: 2021-04-24

* The packaging is now done via setuptools exclusively. ``doc``, ``tests``, and ``Changelog`` are
not packaged anymore - reducing the size of the package greatly.

* Debian packaging is now  (officially) done in https://salsa.debian.org/python-team/packages/astroid.

* ``__pkginfo__`` now  only contain ``__version__`` (also accessible with ``astroid.__version__``),
other meta-information are still accessible with ``import importlib;metadata.metadata('astroid')``.

* Added inference tip for ``typing.Tuple`` alias

* Fix crash when evaluating ``typing.NamedTuple``

Closes PyCQA/pylint4383

* COPYING was removed in favor of COPYING.LESSER and the latter was renamed to LICENSE to make more apparent
that the code is licensed under LGPLv2 or later.

* Moved from appveyor and travis to Github Actions for continuous integration.

2.5.3

============================
Release date: 2021-04-10

* Takes into account the fact that subscript inferring for a ClassDef may involve __class_getitem__ method

* Reworks the ``collections`` and ``typing`` brain so that pylint`s acceptance tests are fine.

Closes PyCQA/pylint4206

* Use ``inference_tip`` for ``typing.TypedDict`` brain.

* Fix mro for classes that inherit from typing.Generic

* Add inference tip for typing.Generic and typing.Annotated with ``__class_getitem__``

Closes PyCQA/pylint2822

2.5.2

============================
Release date: 2021-03-28

* Detects `import numpy` as a valid `numpy` import.

Closes PyCQA/pylint3974

* Iterate over ``Keywords`` when using ``ClassDef.get_children``

Closes PyCQA/pylint3202

2.5.1

============================
Release date: 2021-02-28

* The ``context.path`` is reverted to a set because otherwise it leads to false positives
for non `numpy` functions.

Closes 895 899

* Don't transform dataclass ClassVars

* Improve typing.TypedDict inference

* Fix the `Duplicates found in MROs` false positive.

Closes 905
Closes PyCQA/pylint2717
Closes PyCQA/pylint3247
Closes PyCQA/pylint4093
Closes PyCQA/pylint4131
Closes PyCQA/pylint4145

2.5

============================
Release date: 2021-02-15

* Adds `attr_fset` in the `PropertyModel` class.

Fixes PyCQA/pylint3480

* Remove support for Python 3.5.
* Remove the runtime dependency on ``six``. The ``six`` brain remains in
astroid.

Fixes PyCQA/astroid863

* Enrich the ``brain_collection`` module so that ``__class_getitem__`` method is added to `deque` for
``python`` version above 3.9.

* The ``context.path`` is now a ``dict`` and the ``context.push`` method
returns ``True`` if the node has been visited a certain amount of times.

Close 669

* Adds a brain for type object so that it is possible to write `type[int]` in annotation.

Fixes PyCQA/pylint4001

* Add ``__class_getitem__`` method to ``subprocess.Popen`` brain under Python 3.9 so that it is seen as subscriptable by pylint.

Fixes PyCQA/pylint4034


* Adds `degrees`, `radians`, which are `numpy ufunc` functions, in the `numpy` brain. Adds `random` function in the `numpy.random` brain.

Fixes PyCQA/pylint3856

* Fix deprecated importlib methods

Closes 703

* Fix a crash in inference caused by `Uninferable` container elements

Close 866

* Add `python 3.9` support.

* The flat attribute of ``numpy.ndarray`` is now inferred as an ``numpy.ndarray`` itself.
It should be a ``numpy.flatiter`` instance, but this class is not yet available in the numpy brain.

Fixes PyCQA/pylint3640

* Fix a bug for dunder methods inference of function objects

Fixes 819

* Fixes a bug in the signature of the ``ndarray.__or__`` method,
in the ``brain_numpy_ndarray.py`` module.

Fixes 815

* Fixes a to-list cast bug in ``starred_assigned_stmts`` method, in the
``protocols.py`` module.

* Added a brain for ``hypothesis.strategies.composite``

* The transpose of a ``numpy.ndarray`` is also a ``numpy.ndarray``

Fixes PyCQA/pylint3387

* Added a brain for ``sqlalchemy.orm.session``

* Separate string and bytes classes patching

Fixes PyCQA/pylint3599

* Prevent recursion error for self referential length calls

Close 777

* Added missing methods to the brain for ``mechanize``, to fix pylint false positives

Close 793

* Added more supported parameters to ``subprocess.check_output``

* Fix recursion errors with pandas

Fixes PyCQA/pylint2843
Fixes PyCQA/pylint2811

* Added exception inference for `UnicodeDecodeError`

Close PyCQA/pylint3639

* `FunctionDef.is_generator` properly handles `yield` nodes in `If` tests

Close PyCQA/pylint3583

* Fixed exception-chaining error messages.

* Fix failure to infer base class type with multiple inheritance and qualified names

Fixes 843

* Fix interpretation of ``six.with_metaclass`` class definitions.

Fixes 713

* Reduce memory usage of astroid's module cache.

* Remove dependency on `imp`.

Close 594
Close 681

* Do not crash when encountering starred assignments in enums.

Close 835

* Fix a crash in functools.partial inference when the arguments cannot be determined

Close PyCQA/pylint3776

* Fix a crash caused by a lookup of a monkey-patched method

Close PyCQA/pylint3686

* ``is_generator`` correctly considers `Yield` nodes in `AugAssign` nodes

This fixes a false positive with the `assignment-from-no-return` pylint check.

Close PyCQA/pylint3904

* Corrected the parent of function type comment nodes.

These nodes used to be parented to their original ast.FunctionDef parent
but are now correctly parented to their astroid.FunctionDef parent.

Close PyCQA/astroid851

2.4.2

============================
Release date: 2020-06-08

* `FunctionDef.is_generator` properly handles `yield` nodes in `While` tests

Close PyCQA/pylint3519

* Properly construct the arguments of inferred property descriptors

Close PyCQA/pylint3648

2.4.1

============================
Release date: 2020-05-05

* Handle the case where the raw builder fails to retrieve the ``__all__`` attribute

Close 772

* Restructure the AST parsing heuristic to always pick the same module

Close PyCQA/pylint3540
Close 773

* Changed setup.py to work with [distlib](https://pypi.org/project/distlib)

Close 779

* Do not crash with SyntaxError when parsing namedtuples with invalid label

Close PyCQA/pylint3549

* Protect against ``infer_call_result`` failing with `InferenceError` in `Super.getattr()`

Close PyCQA/pylint3529

2.4.0

============================
Release date: 2020-04-27

* Expose a ast_from_string method in AstroidManager, which will accept
source code as a string and return the corresponding astroid object

Closes PyCQA/astroid725

* ``BoundMethod.implicit_parameters`` returns a proper value for ``__new__``

Close PyCQA/pylint2335

* Allow slots added dynamically to a class to still be inferred

Close PyCQA/pylint2334

* Allow `FunctionDef.getattr` to look into both instance attrs and special attributes

Close PyCQA/pylint1078

* Infer qualified ``classmethod`` as a classmethod.

Close PyCQA/pylint3417

* Prevent a recursion error to happen when inferring the declared metaclass of a class

Close 749

* Raise ``AttributeInferenceError`` when ``getattr()`` receives an empty name

Close PyCQA/pylint2991

* Prevent a recursion error for self reference variables and `type()` calls.

Close 199

* Do not infer the first argument of a staticmethod in a metaclass as the class itself

Close PyCQA/pylint3032

* ``NodeNG.bool_value()`` gained an optional ``context`` parameter

We need to pass an inference context downstream when inferring the boolean
value of a node in order to prevent recursion errors and double inference.

This fix prevents a recursion error with dask library.

Close PyCQA/pylint2985

* Pass a context argument to ``astroid.Arguments`` to prevent recursion errors

Close PyCQA/pylint3414

* Better inference of class and static methods decorated with custom methods

Close PyCQA/pylint3209

* Reverse the order of decorators for `infer_subscript`

`path_wrapper` needs to come first, followed by `raise_if_nothing_inferred`,
otherwise we won't handle `StopIteration` correctly.

Close 762

* Prevent a recursion error when inferring self-referential variables without definition

Close PyCQA/pylint1285

* Numpy `datetime64.astype` return value is inferred as a `ndarray`.

Close PyCQA/pylint3332

* Skip non ``Assign`` and ``AnnAssign`` nodes from enum reinterpretation

Closes PyCQA/pylint3365

* Numpy ``ndarray`` attributes ``imag`` and ``real`` are now inferred as ``ndarray``.

Close PyCQA/pylint3322

* Added a call to ``register_transform`` for all functions of the ``brain_numpy_core_multiarray``
module in case the current node is an instance of ``astroid.Name``

Close 666

* Use the parent of the node when inferring aug assign nodes instead of the statement

Close PyCQA/pylint2911
Close PyCQA/pylint3214

* Added some functions to the ``brain_numpy_core_umath`` module

Close PyCQA/pylint3319

* Added some functions of the ``numpy.core.multiarray`` module

Close PyCQA/pylint3208

* All the ``numpy ufunc`` functions derived now from a common class that
implements the specific ``reduce``, ``accumulate``, ``reduceat``,
``outer`` and ``at`` methods.

Close PyCQA/pylint2885

* ``nodes.Const.itered`` returns a list of ``Const`` nodes, not strings

Close PyCQA/pylint3306

* The ``shape`` attribute of a ``numpy ndarray`` is now a ``ndarray``

Close PyCQA/pylint3139

* Don't ignore special methods when inspecting gi classes

Close 728

* Added transform for ``scipy.gaussian``

* Add support for inferring properties.

* Added a brain for ``responses``

* Allow inferring positional only arguments.

* Retry parsing a module that has invalid type comments

It is possible for a module to use comments that might be interpreted
as type comments by the `ast` library. We do not want to completely crash on those
invalid type comments.

Close 708

* Scope the inference to the current bound node when inferring instances of classes

When inferring instances of classes from arguments, such as ``self``
in a bound method, we could use as a hint the context's ``boundnode``,
which indicates the instance from which the inference originated.
As an example, a subclass that uses a parent's method which returns
``self``, will override the ``self`` to point to it instead of pointing
to the parent class.

Close PyCQA/pylint3157

* Add support for inferring exception instances in all contexts

We were able to infer exception instances as ``ExceptionInstance``
only for a handful of cases, but not all. ``ExceptionInstance`` has
support for better inference of `.args` and other exception related
attributes that normal instances do not have.
This additional support should remove certain false positives related
to ``.args`` and other exception attributes in ``pylint``.

Close PyCQA/pylint2333

* Add more supported parameters to ``subprocess.check_output``

Close 722

* Infer args unpacking of ``self``

Certain stdlib modules use ``*args`` to encapsulate
the ``self`` parameter, which results in uninferable
instances given we rely on the presence of the ``self``
argument to figure out the instance where we should be
setting attributes.

Close PyCQA/pylint3216

* Clean up setup.py

Make pytest-runner a requirement only if running tests, similar to what was
done with McCabe.

Clean up the setup.py file, resolving a handful of minor warnings with it.

* Handle StopIteration error in infer_int.

Close PyCQA/pylint3274

* Can access per argument type comments for positional only and keyword only arguments.

The comments are accessed through through the new
``Arguments.type_comment_posonlyargs`` and
``Arguments.type_comment_kwonlyargs`` attributes respectively.

* Relax upper bound on `wrapt`

Close 755

* Properly analyze CFFI compiled extensions.
Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants