| 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>
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
numpy is imported without alias whereas it is ok when numpy is imported with an alias. It should be investigated but is probably beyond the scope of this work.
|
| | |
|
| |
|
|
|
|
|
| |
* 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>
|
| | |
|
| | |
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
|
| |
array and not [array, Uninferable] because it could lead to false negatives."
This reverts commit 4fc45c581523e4883937e1b7a5314e434e8f3125.
|
| |
|
|
|
|
| |
context.path"
This reverts commit be78cd4a531aeb66f2c2292fb717f8c5db6e2a47.
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
This is possible with python 3.6
|
| | |
|
| | |
|
| | |
|
| |
|
|
| |
unused-import due to the fact that six.with_metaclass is not consumed. Adds a unittest to check that bases attribute holds a call node and that ancestors attributes returns the correct class hierarchy.
|
| | |
|