| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Closes https://github.com/PyCQA/pylint/issues/4671
|
| | |
|
| |
|
|
| |
* Fix link in license header
* Fix link to cpython
|
| | |
|
| |
|
|
|
|
|
|
|
| |
``next`` (#1081)
* Catch the StopIteration that result from PEP-479
StopIteration exceptions raised directly or indirectly in coroutines
and generators are transformed into RuntimeError exceptions for python
3.7+.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
See https://github.com/PyCQA/astroid/pull/1069\#issuecomment-865206120
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
See https://github.com/PyCQA/astroid/pull/1045\#discussion_r654572722
|
| | |
|
| |
|
|
| |
And add PY3X type constants in it.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add DynamicClassAttribute to list of properties
DynamicClassAttribute is a descriptor defined in Python's Lib/types.py
which changes the behaviour of an attribute depending on if it is looked
up on the class or on an instance.
* Add fake "name" property to enum.Enum subclasses
Ref PyCQA/pylint#1932. Ref PyCQA/pylint#2062. The enum.Enum class itself
defines two @DynamicClassAttribute data-descriptors "name" and "value"
which behave differently when looked up on an instance or on the class.
When dealing with inference of an arbitrary instance of the enum class,
e.g. in a method defined in the class body like:
class SomeEnum(enum.Enum):
def method(self):
self.name # <- here
we should assume that "self.name" is the string name of some enum
member, unless the enum itself defines a "name" member.
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
| | |
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Fix uncaught AstroidSyntaxErrors in namedtuple brain
Ref #920. This adds a test suite and updates the infer_named_tuple brain with
some additional behaviours expected by `collections.namedtuple`, specifically
about rejecting invalid type and field names. Some of these cases inferred as
namedtuples/`ClassDef` when they would have raised `ValueError` and some of
these raise unhandled `AstroidSyntaxError`s due to attempts to parse class
fakes with type names that would have raised `ValueError`. For example:
from collections import namedtuple
Tuple = namedtuple('X', 'abc abc')
# Traceback (most recent call last):
# ...
# ValueError: Encountered duplicate field name: 'abc'
import astroid
node = astroid.extract_node("""
from collections import namedtuple
Tuple = namedtuple('X', 'abc abc')
Tuple
""")
next(node.infer())
# <ClassDef.X l.3 at 0x...>
from collections import namedtuple
Tuple = namedtuple('123', 'abc')
# Traceback (most recent call last):
# ...
# ValueError: Type names and field names must be valid identifiers: '123'
import astroid
node = astroid.extract_node("""
from collections import namedtuple
Tuple = namedtuple('123', 'abc')
Tuple
""")
next(node.infer())
# Traceback (most recent call last):
# ...
# KeyError: (<function infer_named_tuple at 0x...>, <Call l.3 at 0x...>)
#
# During handling of the above exception, another exception occurred:
#
# Traceback (most recent call last):
# ...
# File "<unknown>", line 2
# class 123(tuple):
# ^
# SyntaxError: invalid syntax
#
# The above exception was the direct cause of the following exception:
#
# Traceback (most recent call last):
# ...
# astroid.exceptions.AstroidSyntaxError: Parsing Python code failed:
# invalid syntax (<unknown>, line 2)
|
| |
|
|
|
| |
transformations (#975)
* Fix six.with_metaclass transformation so it doesn't break user defined transformations
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
* Add test of crash on random.sample inference
Ref #922
* Fix crash in brain for random.sample
Fixes #922. A combination of changes in 79d5a3a7 and 77e205dc meant that
the node cloning helper could be given an EvaluatedObject, which doesn't
present the same __init__ signature as NodeNG.
* Update changelog
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Add tests of failing property inference
Ref #940
* Fix inference of properties in a class context
Ref #940. If we are accessing an attribute and it is found on
type(A).__dict__ *and* it is a data descriptor, then we resolve that
descriptor. For the case of inferring a property which is accessed as a
class attribute, this equates to the property being defined on the
metaclass (which may be anywhere in the class hierarchy).
* Fix inference of Enum.__members__ property for subclasses
Ref PyCQA/pylint#3535. Ref PyCQA/pylint#4358. This updates the
namedtuple/enum brain to add a dictionary for __members__
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/asottile/pyupgrade: v2.13.0 → v2.15.0](https://github.com/asottile/pyupgrade/compare/v2.13.0...v2.15.0)
- https://github.com/ambv/black → https://github.com/psf/black
- [github.com/psf/black: 20.8b1 → 21.5b1](https://github.com/psf/black/compare/20.8b1...21.5b1)
- [github.com/pre-commit/mirrors-prettier: v2.2.1 → v2.3.0](https://github.com/pre-commit/mirrors-prettier/compare/v2.2.1...v2.3.0)
- https://gitlab.com/pycqa/flake8 → https://github.com/PyCQA/flake8
- [github.com/PyCQA/flake8: 3.9.0 → 3.9.2](https://github.com/PyCQA/flake8/compare/3.9.0...3.9.2)
* Update requirements file
* Black changes
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Ref PyCQA/pylint#4083. Ref PyCQA/pylint#4387. When used in a
nodes.Subscript, an existing inference_tip was set for Name nodes
matching called type. However, when this name was redefined this led to
false-positive typecheck errors in pylint such as invalid-sequence-index
due to the argument being inferred as builtins.type and inference_tip
preventing any further inference.
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
Except on astroid/__init__.py because of circular imports
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|