| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Except on astroid/__init__.py because of circular imports
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
Remove outdated COPYING and rename COPYING.LESSER
|
|
|
|
|
|
|
| |
``__class_getitem__`` (#931)
* Modify infernce tip for typing.Generic and typing.Annotated with __class_getitem__
* Fix issue with slots caching
* Clean typing.Generic from mro
|
|
|
|
|
|
| |
* Better handling of generic aliases
* Use qname for tests mro
* Add inference for re.Pattern and re.Match
* Add comments
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Takes into account the fact that inferring subscript when the node is a class may use the __class_getitem__ method of the current class instead of looking for __getitem__ in the metaclass.
* OrderedDict in the collections module inherit from dict which is C coded and thus have no metaclass but starting from python3.9 it supports subscripting thanks to the __class_getitem__ method.
* check_metaclass becomes a static class method because we need it in the class scope.
The brain_typing module does not add a ABCMeta_typing class thus there is no need to test it. Moreover it doesn't add neither a __getitem__ to the metaclass
* The brain_typing module does not add anymore _typing suffixed classes in the mro
* The OrderedDict class inherits from C coded dict class and thus doesn't have a metaclass.
* When trying to inherit from typing.Pattern the REPL says : TypeError: type 're.Pattern' is not an acceptable base type
* The REPL says that Derived as ABCMeta for metaclass and the mro is Derived => Iterator => Iterable => object
* Adds comments
* Starting with Python39 some collections of the collections.abc module support subscripting thanks to __class_getitem__ method. However the wat it is implemented is not straigthforward and instead of complexifying the way __class_getitem__ is handled inside the getitem method of the ClassDef class, we prefer to hack a bit.
* Thanks to __class_getitem__ method there is no need to hack the metaclass
* SImplifies the inference system for typing objects before python3.9. Before python3.9 the objects of the typing module that are alias of the same objects in the collections.abc module have subscripting possibility thanks to the _GenericAlias metaclass. To mock the subscripting capability we add __class_getitem__ method on those objects.
* check_metaclass_is_abc become global to be shared among different classes
* Create a test class dedicated to the Collections brain
* Rewrites and adds test
* Corrects syntax error
* Deque, defaultdict and OrderedDict are part of the _collections module which is a pure C lib. While letting those class mocks inside collections module is fair for astroid it leds to pylint acceptance tests fail.
* Formatting according to black
* Adds two entries
* Extends the filter to determine what is subscriptable to include OrderedDict
* Formatting according to black
* Takes into account the fact that inferring subscript when the node is a class may use the __class_getitem__ method of the current class instead of looking for __getitem__ in the metaclass.
* OrderedDict in the collections module inherit from dict which is C coded and thus have no metaclass but starting from python3.9 it supports subscripting thanks to the __class_getitem__ method.
* check_metaclass becomes a static class method because we need it in the class scope.
The brain_typing module does not add a ABCMeta_typing class thus there is no need to test it. Moreover it doesn't add neither a __getitem__ to the metaclass
* The brain_typing module does not add anymore _typing suffixed classes in the mro
* The OrderedDict class inherits from C coded dict class and thus doesn't have a metaclass.
* When trying to inherit from typing.Pattern the REPL says : TypeError: type 're.Pattern' is not an acceptable base type
* The REPL says that Derived as ABCMeta for metaclass and the mro is Derived => Iterator => Iterable => object
* Adds comments
* Starting with Python39 some collections of the collections.abc module support subscripting thanks to __class_getitem__ method. However the wat it is implemented is not straigthforward and instead of complexifying the way __class_getitem__ is handled inside the getitem method of the ClassDef class, we prefer to hack a bit.
* Thanks to __class_getitem__ method there is no need to hack the metaclass
* SImplifies the inference system for typing objects before python3.9. Before python3.9 the objects of the typing module that are alias of the same objects in the collections.abc module have subscripting possibility thanks to the _GenericAlias metaclass. To mock the subscripting capability we add __class_getitem__ method on those objects.
* check_metaclass_is_abc become global to be shared among different classes
* Create a test class dedicated to the Collections brain
* Rewrites and adds test
* Corrects syntax error
* Deque, defaultdict and OrderedDict are part of the _collections module which is a pure C lib. While letting those class mocks inside collections module is fair for astroid it leds to pylint acceptance tests fail.
* Formatting according to black
* Adds two entries
* Extends the filter to determine what is subscriptable to include OrderedDict
* Formatting according to black
* Takes into account AWhetter remarks
* Deactivates access to __class_getitem__ method
* OrderedDict appears in typing module with python3.7.2
* _alias function in the typing module appears with python3.7
* Formatting according to black
* _alias function is used also for builtins type and not only for collections.abc ones
* Adds tests for both builtins type that are subscriptable and typing builtin alias type that are also subscriptable
* No need to handle builtin types in this brain. It is better suited inside brain_bulitin_inference
* Adds brain to handle builtin types that are subscriptable starting with python39
* Formatting according to black
* Uses partial function instead of closure in order pylint acceptance to be ok
* Handling the __class_getitem__ method associated to EmptyNode for builtin types is made directly inside the getitem method
* infer_typing_alias has to be an inference_tip to avoid interferences between typing module and others (collections or builtin)
* Formatting
* Removes useless code
* Adds comment
* Takes into account cdce8p remarks
* Formatting
* Style changes
Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
|
| |
|
|
|
|
|
|
|
| |
* Adds inference support for all typing types that are defined through _alias function
* Instead of creating a new class (by the mean of TYPING_TYPE_TEMPLATE) infer the origin class : i.e MutableSet = _alias(collections.MutableSet ...) origin is the class in collections module. Needs to add __getitem method on its metaclass so that is support indexing (MutableSet[T]).
* Enable _alias mocking and testing only if python version is at least 3.7
Co-authored-by: hippo91 <guillaume.peillex@gmail.com>
|
| |
|
|
|
| |
Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
|
| |
|
| |
|
| |
|
|
|
|
| |
This is possible with python 3.6
|
| |
|
| |
|
| |
|
| |
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* Add missing __class_getitem__ to deque.
* The __class_getitem__ method is added only for python versions above 3.9
* Adds two tests that ensure that __class_getitem__ method is not present for python versions prior to 3.9 but present for python versions above 3.9
* Reorganizes
* Adds an entry
* Add Julien Palard in copyright
Co-authored-by: Julien Palard <julien@palard.fr>
|
| |\
| | |
| | | |
Bug pylint 4001
|
| | | |
|
| | | |
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This is necessary for pylint to detect that `subprocess.Popen` is
subscriptable, starting from Python 3.9 (see PyCQA/pylint#4034).
$ python3.9
>>> import subprocess
>>> subprocess.Popen.__class_getitem__
<bound method GenericAlias of <class 'subprocess.Popen'>>
|
| |
| |
| |
| | |
We are now guaranteed to be running on 3.6+
|
| | |
|
|/ |
|
| |
|
|
|
|
| |
Close #835
|
| |
|
|
|
|
|
|
|
| |
(#804)
This also makes debugging a lot simpler reducing the complexity of the
function stack.
|
|
|
| |
Fixes PyCQA/pylint#3599
|
|
|
|
| |
Close PyCQA/pylint#3549
|
| |
|
|
|
|
|
| |
Rather than failing the inference altogether, we can infer the default
int value for subclasses of ints.
|
|
|
|
| |
Closes PyCQA/pylint#3365
|
|
|
|
| |
Close PyCQA/pylint#3296
|
|
|