瀏覽代碼

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 年之前
父節點
當前提交
2257305872
共有 1 個檔案被更改,包括 2 行新增2 行删除
  1. +2
    -2
      codearchiver/core.py

+ 2
- 2
codearchiver/core.py 查看文件

@@ -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:


Loading…
取消
儲存