summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-11-21 22:35:34 -0800
committerJohn L. Villalovos <john@sodarock.com>2021-11-21 22:37:56 -0800
commit9a451a892d37e0857af5c82c31a96d68ac161738 (patch)
tree08d71ff5cda53216684436e5055b12fb0d4396e7
parent2cd15ac44d8a45fa2d0dcab80cc933e3871db7f8 (diff)
downloadgitlab-9a451a892d37e0857af5c82c31a96d68ac161738.tar.gz
chore: fix issue with adding type-hints to 'manager' attribute
When attempting to add type-hints to the the 'manager' attribute into a RESTObject derived class it would break things. This was because our auto-manager creation code would automatically add the specified annotated manager to the 'manager' attribute. This breaks things. Now check in our auto-manager creation if our attribute is called 'manager'. If so we ignore it.
-rw-r--r--gitlab/base.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/gitlab/base.py b/gitlab/base.py
index db2e149..5e5f57b 100644
--- a/gitlab/base.py
+++ b/gitlab/base.py
@@ -150,6 +150,10 @@ class RESTObject(object):
# annotations. If an attribute is annotated as being a *Manager type
# then we create the manager and assign it to the attribute.
for attr, annotation in sorted(self.__annotations__.items()):
+ # We ignore creating a manager for the 'manager' attribute as that
+ # is done in the self.__init__() method
+ if attr in ("manager",):
+ continue
if not isinstance(annotation, (type, str)):
continue
if isinstance(annotation, type):