Sfoglia il codice sorgente

Add Module.name attribute

tags/v1.0
JustAnotherArchivist 3 anni fa
parent
commit
22c707c04f
2 ha cambiato i file con 5 aggiunte e 0 eliminazioni
  1. +3
    -0
      codearchiver/core.py
  2. +2
    -0
      codearchiver/modules/git.py

+ 3
- 0
codearchiver/core.py Vedi File

@@ -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`.'''


+ 2
- 0
codearchiver/modules/git.py Vedi File

@@ -10,6 +10,8 @@ logger = logging.getLogger(__name__)


class Git(codearchiver.core.Module):
name = 'git'

@staticmethod
def matches(inputUrl):
return inputUrl.url.endswith('.git')


Caricamento…
Annulla
Salva