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/base.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'gitlab/base.py') 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] -- cgit v1.2.1