rename extractor classes starting with a digit

This commit is contained in:
Mike Fährmann
2019-11-02 20:42:09 +01:00
parent b3b9da6d74
commit 2a3bd4e3c7
4 changed files with 10 additions and 24 deletions

View File

@@ -157,22 +157,12 @@ class TestExtractor(unittest.TestCase):
def capitalize(c):
if "-" in c:
return string.capwords(c.replace("-", " ")).replace(" ", "")
if "." in c:
c = c.replace(".", "")
return c.capitalize()
mapping = {
"2chan" : "futaba",
"3dbooru": "threedeebooru",
"4plebs" : "fourplebs",
"oauth" : None,
}
for extr in extractor.extractors():
category = mapping.get(extr.category, extr.category)
if category:
if extr.category not in ("", "oauth"):
expected = "{}{}Extractor".format(
capitalize(category),
capitalize(extr.category),
capitalize(extr.subcategory),
)
if expected[0].isdigit():