fix: space in words
Python Lint CI / ruff (push) Has been cancelled
Python Lint CI / ruff-format-check (push) Has been cancelled
Python Lint CI / ty (push) Has been cancelled

This commit is contained in:
2026-06-15 14:31:21 +02:00
parent 4df2bab348
commit d1deaad03f
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ class FactoryError(Exception):
class Factory:
__slots__ = ["__found", "__tld_list", "__word_list", "logger", "__words"]
__slots__ = ["__found", "__tld_list", "__word_list", "__words", "logger"]
def __init__(self, tld_list: TLDList, word_list: WordList, words: int) -> None:
self.logger: logging.Logger = logging.getLogger(self.__class__.__name__)
@@ -71,7 +71,7 @@ class Factory:
tld_escaped = tld.replace(".", "")
if word.endswith(tld_escaped) and len(word) > len(tld_escaped):
domain = word[: -len(tld_escaped)] + "." + tld
if domain not in self.__found:
if "-." not in domain and domain not in self.__found:
self.__found.add(domain)
return domain
return None
+4 -1
View File
@@ -22,7 +22,10 @@ class WordList:
self.logger.info("[%s] Loaded %d words", self.__name, len(self.words))
def __escape_word(self, word: str) -> str:
return unidecode.unidecode(word.strip()).lower()
word = unidecode.unidecode(word.strip()).lower()
if " " in word:
return ""
return word
def close(self) -> None:
pass