Sfoglia il codice sorgente

Disallow underscores in module names

Using the preferred file naming scheme of {moduleName}_{someInputURLDerivative}_{date}*, this allows mapping files to modules without ambiguity.
tags/v1.0
JustAnotherArchivist 1 anno fa
parent
commit
2257305872
1 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. +2
    -2
      codearchiver/core.py

+ 2
- 2
codearchiver/core.py Vedi File

@@ -235,7 +235,7 @@ class ModuleMeta(type):
def __new__(cls, *args, **kwargs):
class_ = super().__new__(cls, *args, **kwargs)
if class_.name is not None:
if class_.name.strip('abcdefghijklmnopqrstuvwxyz_-') != '':
if class_.name.strip('abcdefghijklmnopqrstuvwxyz-') != '':
raise RuntimeError(f'Invalid class name: {class_.name!r}')
if class_.name in cls.__modulesByName:
raise RuntimeError(f'Class name collision: {class_.name!r} is already known')
@@ -297,7 +297,7 @@ class Module(metaclass = ModuleMeta):
'''An abstract base class for a module.'''

name: typing.Optional[str] = None
'''The name of the module. Modules without a name are ignored. Names must be unique and may only contain a-z, underscores, and hyphens.'''
'''The name of the module. Modules without a name are ignored. Names must be unique and may only contain a-z and hyphens.'''

@staticmethod
def matches(inputUrl: InputURL) -> bool:


Caricamento…
Annulla
Salva