summaryrefslogtreecommitdiff
path: root/astroid/brain/brain_collections.py
Commit message (Collapse)AuthorAgeFilesLines
* Bump astroid to 2.6.4, update changelogv2.6.4fix-4623-generator-raised-stop-iterationPierre Sassoulas2021-07-191-1/+1
|
* Bump astroid to 2.6.3, update changelogv2.6.3Pierre Sassoulas2021-07-191-0/+1
|
* Fix copyright links (#1084)Marc Mueller2021-07-011-1/+1
| | | | * Fix link in license header * Fix link to cpython
* Rename non obvious PY3X constant to PY3X_PLUSPierre Sassoulas2021-06-211-4/+4
| | | | See https://github.com/PyCQA/astroid/pull/1069\#issuecomment-865206120
* Simplification because AstroidManager is a singleton/borgPierre Sassoulas2021-06-191-3/+3
|
* Create a file for the global manager defined in astroid.__init__.pyPierre Sassoulas2021-06-191-1/+1
|
* Import directly from modules in astroid.brain.*Pierre Sassoulas2021-06-191-8/+11
|
* Move 'register_module_extender' in astroid.brain where it's usedPierre Sassoulas2021-06-191-1/+2
|
* Rename astroid.constants to astroid.constPierre Sassoulas2021-06-191-1/+1
| | | | See https://github.com/PyCQA/astroid/pull/1045\#discussion_r654572722
* Create a astroid.constants.py to avoid circular importsPierre Sassoulas2021-06-171-3/+1
| | | | And add PY3X type constants in it.
* Add an isort configuration in setup.cfg and apply itPierre Sassoulas2021-04-191-1/+0
| | | | Except on astroid/__init__.py because of circular imports
* Fix issue #891Pierre Sassoulas2021-04-101-1/+1
| | | | Remove outdated COPYING and rename COPYING.LESSER
* Bug pylint 4206 (#921)hippo912021-04-061-1/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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>
* Upgrade copyrite noticePierre Sassoulas2021-02-281-0/+1
|
* Remove the # coding, since PEP3120 the default is UTF8Pierre Sassoulas2021-02-211-1/+0
|
* Update copyright noticehippo912021-02-151-1/+1
|
* Julien palard mdk/class getitem (#885)hippo912021-01-241-0/+8
| | | | | | | | | | | | | | | * 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>
* New copyright noticeshippo912020-12-271-1/+1
|
* Add missing copyright annotations for the past releasesClaudiu Popa2020-04-271-0/+1
|
* Remove redundant compatibility code (#693)Hugo van Kemenade2019-09-101-9/+1
|
* Initial formatting of astroidClaudiu Popa2018-10-021-11/+15
|
* Update the copyright noticesastroid-2.0Claudiu Popa2018-07-151-1/+5
|
* Adapt a couple of deque's brain methodsClaudiu Popa2018-07-101-6/+6
| | | | Close PyCQA/pylint#2267
* deque.rotate has a default paramter. Close PyCQA/pylint#2013Claudiu Popa2018-04-121-1/+1
|
* Add move_to_end to OrderedDict collections brainIoana Tagirta2018-02-111-5/+13
|
* Improve understanding of collections.deque (#441)Łukasz Rogalski2017-07-081-5/+28
| | | Closes PyCQA/pylint#1476
* Add getitem to defaultdict brain. (#387)Derek Gustafson2017-01-251-0/+1
|
* Add a __reversed__ method to the OrderedDict stubŁukasz Rogalski2016-12-311-1/+2
|
* Improve inference of OrderedDict (#381)Łukasz Rogalski2016-12-301-0/+2
|
* Even more granular copyrights (thanks to copyrite)Claudiu Popa2016-07-221-2/+2
|
* Keep a consistent copyright notice across the board.Claudiu Popa2016-07-191-0/+2
|
* Split brain_stdlib into multiple modules and finally kill it.Claudiu Popa2016-05-311-0/+37