diff options
Diffstat (limited to 'gitlab/base.py')
-rw-r--r-- | gitlab/base.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/gitlab/base.py b/gitlab/base.py index 50f09c5..6a6e992 100644 --- a/gitlab/base.py +++ b/gitlab/base.py @@ -16,6 +16,7 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. import importlib +import pprint import textwrap from types import ModuleType from typing import Any, Dict, Iterable, NamedTuple, Optional, Tuple, Type @@ -147,6 +148,14 @@ class RESTObject(object): data.update(self._updated_attrs) return f"{type(self)} => {data}" + def pformat(self) -> str: + data = self._attrs.copy() + data.update(self._updated_attrs) + return f"{type(self)} => \n{pprint.pformat(data)}" + + def pprint(self) -> None: + print(self.pformat()) + def __repr__(self) -> str: if self._id_attr: return f"<{self.__class__.__name__} {self._id_attr}:{self.get_id()}>" |