From a44461a93b4085146f1c0c2cbc41a0635e6d3801 Mon Sep 17 00:00:00 2001 From: Auric Vente Date: Sun, 21 Jul 2024 00:35:01 -0600 Subject: [PATCH] Mods --- cromulant/ants.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cromulant/ants.py b/cromulant/ants.py index 1ec7fdf..7d79ad5 100644 --- a/cromulant/ants.py +++ b/cromulant/ants.py @@ -243,17 +243,16 @@ class Ants: def split(ant: Ant) -> list[str]: return re.split(r"[ -]", ant.name) + def remove(words: list[str], ignore: list[str]) -> list[str]: + return [word for word in words if word.lower() not in ignore] + def fill(words: list[str]) -> list[str]: + words = remove(words, ["of", "de"]) + if len(words) < 2: words.extend(Utils.random_word(2 - len(words))) - words = [ - word if word.lower() != "of" else Utils.random_word()[0] - for word in words - ] - - words = [Utils.capitalize(word) for word in words] - return [word.lower() if word == "de" else word for word in words] + return [Utils.capitalize(word) for word in words] ant_1 = Ants.random_ant()