From 22c707c04f73996d21715aec2fd74fa52dce6263 Mon Sep 17 00:00:00 2001 From: JustAnotherArchivist Date: Fri, 26 Jun 2020 17:53:05 +0000 Subject: [PATCH] Add Module.name attribute --- codearchiver/core.py | 3 +++ codearchiver/modules/git.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/codearchiver/core.py b/codearchiver/core.py index f8df532..afb5fee 100644 --- a/codearchiver/core.py +++ b/codearchiver/core.py @@ -119,6 +119,9 @@ class HttpClient: class Module: '''An abstract base class for a module.''' + name: typing.Optional[str] = None + '''The name of the module. Modules without a name are ignored, and names must be unique.''' + @staticmethod def matches(inputUrl: InputURL) -> bool: '''Whether or not this module is for handling `inputUrl`.''' diff --git a/codearchiver/modules/git.py b/codearchiver/modules/git.py index 4b27b75..b50f6de 100644 --- a/codearchiver/modules/git.py +++ b/codearchiver/modules/git.py @@ -10,6 +10,8 @@ logger = logging.getLogger(__name__) class Git(codearchiver.core.Module): + name = 'git' + @staticmethod def matches(inputUrl): return inputUrl.url.endswith('.git')