From 90f80e41a90c40e7e323669288d3fd61a7c18fb8 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Fri, 19 Jun 2020 23:26:16 +0000 Subject: [PATCH] Add __repr__ methods --- codearchiver/core.py | 6 ++++++ codearchiver/modules/git.py | 3 +++ 2 files changed, 9 insertions(+) diff --git a/codearchiver/core.py b/codearchiver/core.py index 7029c09..ac40c5e 100644 --- a/codearchiver/core.py +++ b/codearchiver/core.py @@ -28,6 +28,9 @@ class InputURL: self._response = HttpClient().get(self.url) return self._response.text + def __repr__(self): + return f'{type(self).__module__}.{type(self).__name__}({self._url!r})' + @dataclasses.dataclass class Result: @@ -130,6 +133,9 @@ class Module: def process(self) -> Result: '''Perform the relevant retrieval(s)''' + def __repr__(self): + return f'{type(self).__module__}.{type(self).__name__}({self._inputUrl!r})' + def get_module_class(inputUrl: InputURL) -> typing.Type['Module']: '''Get the Module class most suitable for handling `inputUrl`.''' diff --git a/codearchiver/modules/git.py b/codearchiver/modules/git.py index 54941a3..2d0ed52 100644 --- a/codearchiver/modules/git.py +++ b/codearchiver/modules/git.py @@ -50,3 +50,6 @@ class Git(codearchiver.core.Module): shutil.rmtree(directory) return codearchiver.core.Result(id = f'git-{bundle[:-7]}', files = [bundle]) + + def __repr__(self): + return f'{type(self).__module__}.{type(self).__name__}({self._inputUrl!r}, extraBranches = {self._extraBranches!r})'