diff options
| author | Nejc Habjan <hab.nejc@gmail.com> | 2021-05-01 22:47:24 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-05-01 22:47:24 +0200 |
| commit | 562fbbd83c0fabdf9f45d199a2bdd8f61595c4b0 (patch) | |
| tree | 913060f063953c18dbab825838602b7831f31f54 /gitlab/base.py | |
| parent | b563cdc1a6cd585647fc53722081dceb6f7b4466 (diff) | |
| parent | 6aef2dadf715e601ae9c302be0ad9958345a97f2 (diff) | |
| download | gitlab-562fbbd83c0fabdf9f45d199a2bdd8f61595c4b0.tar.gz | |
Merge pull request #1409 from JohnVillalovos/jlvillal/untyped_defs
chore: mypy: Disallow untyped definitions
Diffstat (limited to 'gitlab/base.py')
| -rw-r--r-- | gitlab/base.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/gitlab/base.py b/gitlab/base.py index 7121cb0..c81c6d9 100644 --- a/gitlab/base.py +++ b/gitlab/base.py @@ -17,7 +17,7 @@ import importlib from types import ModuleType -from typing import Any, Dict, NamedTuple, Optional, Tuple, Type +from typing import Any, Dict, Iterable, NamedTuple, Optional, Tuple, Type from .client import Gitlab, GitlabList from gitlab import types as g_types @@ -133,8 +133,8 @@ class RESTObject(object): return self.get_id() != other.get_id() return super(RESTObject, self) != other - def __dir__(self): - return super(RESTObject, self).__dir__() | self.attributes.keys() + def __dir__(self) -> Iterable[str]: + return set(self.attributes).union(super(RESTObject, self).__dir__()) def __hash__(self) -> int: if not self.get_id(): @@ -155,7 +155,7 @@ class RESTObject(object): self.__dict__["_updated_attrs"] = {} self.__dict__["_attrs"] = new_attrs - def get_id(self): + def get_id(self) -> Any: """Returns the id of the resource.""" if self._id_attr is None or not hasattr(self, self._id_attr): return None @@ -207,10 +207,10 @@ class RESTObjectList(object): def __len__(self) -> int: return len(self._list) - def __next__(self): + def __next__(self) -> RESTObject: return self.next() - def next(self): + def next(self) -> RESTObject: data = self._list.next() return self._obj_cls(self.manager, data) |
