You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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 <[email protected]>
0 commit comments