diff options
author | John L. Villalovos <john@sodarock.com> | 2021-03-07 09:16:45 -0800 |
---|---|---|
committer | John L. Villalovos <john@sodarock.com> | 2021-03-07 09:30:22 -0800 |
commit | 924f83eb4b5e160bd231efc38e2eea0231fa311f (patch) | |
tree | 2d66f0ad7b2accd1b584aafd55c22aaf595d660e /gitlab/base.py | |
parent | 48fc907403b630f069dfd63fada73f96a8c6e983 (diff) | |
download | gitlab-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/base.py')
-rw-r--r-- | gitlab/base.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/gitlab/base.py b/gitlab/base.py index ed551ff..b9960ad 100644 --- a/gitlab/base.py +++ b/gitlab/base.py @@ -20,6 +20,7 @@ from types import ModuleType from typing import Any, Dict, Optional, Type from .client import Gitlab, GitlabList +from gitlab import types as g_types __all__ = [ "RESTObject", @@ -260,6 +261,7 @@ class RESTManager(object): _path: Optional[str] = None _obj_cls: Optional[Type[RESTObject]] = None _from_parent_attrs: Dict[str, Any] = {} + _types: Dict[str, Type[g_types.GitlabAttribute]] = {} _computed_path: Optional[str] _parent: Optional[RESTObject] |