From 924f83eb4b5e160bd231efc38e2eea0231fa311f Mon Sep 17 00:00:00 2001 From: "John L. Villalovos" Date: Sun, 7 Mar 2021 09:16:45 -0800 Subject: 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. --- gitlab/v4/cli.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'gitlab/v4/cli.py') 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]) -- cgit v1.2.1