diff options
| author | hippo91 <guillaume.peillex@gmail.com> | 2021-01-24 14:42:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-24 14:42:25 +0100 |
| commit | 5f67396894c79c4661e357ec8bb03aa134a51109 (patch) | |
| tree | 644d05660afc183cbdfd199b30baf474932b0df7 /astroid/brain | |
| parent | abf9d0e4e63d1098436602804548d07a0909ece1 (diff) | |
| download | astroid-git-5f67396894c79c4661e357ec8bb03aa134a51109.tar.gz | |
Julien palard mdk/class getitem (#885)
* 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>
Diffstat (limited to 'astroid/brain')
| -rw-r--r-- | astroid/brain/brain_collections.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/astroid/brain/brain_collections.py b/astroid/brain/brain_collections.py index 6594e0c7..229969c5 100644 --- a/astroid/brain/brain_collections.py +++ b/astroid/brain/brain_collections.py @@ -4,6 +4,7 @@ # Copyright (c) 2017 Derek Gustafson <degustaf@gmail.com> # Copyright (c) 2018 Ioana Tagirta <ioana.tagirta@gmail.com> # Copyright (c) 2019 Hugo van Kemenade <hugovk@users.noreply.github.com> +# Copyright (c) 2021 Julien Palard <julien@palard.fr> # Licensed under the LGPL: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html # For details: https://github.com/PyCQA/astroid/blob/master/COPYING.LESSER @@ -12,6 +13,9 @@ import sys import astroid +PY39 = sys.version_info >= (3, 9) + + def _collections_transform(): return astroid.parse( """ @@ -61,6 +65,10 @@ def _deque_mock(): def __mul__(self, other): pass def __imul__(self, other): pass def __rmul__(self, other): pass""" + if PY39: + base_deque_class += """ + @classmethod + def __class_getitem__(self, item): pass""" return base_deque_class |
