summaryrefslogtreecommitdiff
path: root/gitlab/v4/cli.py
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-03-07 09:16:45 -0800
committerJohn L. Villalovos <john@sodarock.com>2021-03-07 09:30:22 -0800
commit924f83eb4b5e160bd231efc38e2eea0231fa311f (patch)
tree2d66f0ad7b2accd1b584aafd55c22aaf595d660e /gitlab/v4/cli.py
parent48fc907403b630f069dfd63fada73f96a8c6e983 (diff)
downloadgitlab-924f83eb4b5e160bd231efc38e2eea0231fa311f.tar.gz
chore: make _types always present in RESTManager
We now create _types = {} in RESTManager class. By making _types always present in RESTManager it makes the code simpler. We no longer have to do: types = getattr(self, "_types", {}) And the type checker now understands the type.
Diffstat (limited to 'gitlab/v4/cli.py')
-rw-r--r--gitlab/v4/cli.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/gitlab/v4/cli.py b/gitlab/v4/cli.py
index 6172f93..a768999 100644
--- a/gitlab/v4/cli.py
+++ b/gitlab/v4/cli.py
@@ -42,9 +42,8 @@ class GitlabCLI(object):
self.mgr_cls._path = self.mgr_cls._path % self.args
self.mgr = self.mgr_cls(gl)
- types = getattr(self.mgr_cls, "_types", {})
- if types:
- for attr_name, type_cls in types.items():
+ if self.mgr_cls._types:
+ for attr_name, type_cls in self.mgr_cls._types.items():
if attr_name in self.args.keys():
obj = type_cls()
obj.set_from_cli(self.args[attr_name])