Skip to content

Commit 407dc77

Browse files
committed
fix: resolve all flake8 PEP8 violations
- Remove extra alignment spaces in color helper definitions (E272) - Break long f-string lines in display_words() into left/right parts (E501) - Split long command hint string literal across lines (E501) - Split long error message construction into two lines (E501) https://claude.ai/code/session_01MQnNXtMmBiQvwoFoNdEQDb
1 parent 7446008 commit 407dc77

1 file changed

Lines changed: 15 additions & 6 deletions

File tree

main.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414

1515

1616
def green(s): return f"{GREEN}{s}{RESET}"
17-
def red(s): return f"{RED}{s}{RESET}"
17+
def red(s): return f"{RED}{s}{RESET}"
1818
def yellow(s): return f"{YELLOW}{s}{RESET}"
19-
def cyan(s): return f"{CYAN}{s}{RESET}"
19+
def cyan(s): return f"{CYAN}{s}{RESET}"
2020

2121

2222
# ---------------------------------------------------------------------------
@@ -102,7 +102,9 @@ def display_words(words, removed):
102102
right_word = right_col[i]
103103
right_addr = cyan(f"0x{HEX_BASE + (half + i) * HEX_STRIDE:04X}")
104104
right_display = FILLER if right_word in removed else right_word
105-
print(f" {left_addr} {left_display:<12} {right_addr} {right_display}")
105+
left_part = f" {left_addr} {left_display:<12}"
106+
right_part = f" {right_addr} {right_display}"
107+
print(left_part + right_part)
106108
else:
107109
print(f" {left_addr} {left_display}")
108110
print()
@@ -160,7 +162,11 @@ def main():
160162
while attempt > 0:
161163
attempt_color = red(str(attempt)) if attempt <= 2 else str(attempt)
162164
print(f"\n attempt num > {attempt_color}")
163-
print(yellow(" Commands: REMOVE (remove a dud) | REPLENISH (restore attempts, once)"))
165+
cmd_hint = (
166+
" Commands: REMOVE (remove a dud)"
167+
" | REPLENISH (restore attempts, once)"
168+
)
169+
print(yellow(cmd_hint))
164170

165171
try:
166172
inser = input(" > ").strip().upper()
@@ -170,7 +176,9 @@ def main():
170176

171177
# --- Special commands ---
172178
if inser == "REMOVE":
173-
candidates = [w for w in listwords if w != masterpass and w not in removed]
179+
candidates = [
180+
w for w in listwords if w != masterpass and w not in removed
181+
]
174182
if candidates:
175183
dud = random.choice(candidates)
176184
removed.add(dud)
@@ -198,7 +206,8 @@ def main():
198206
break
199207
else:
200208
hint = letinword(inser, masterpass)
201-
print(red(f" ERROR {inser}") + " -> " + yellow(f"Likeness: {hint}"))
209+
err = red(f" ERROR {inser}")
210+
print(err + " -> " + yellow(f"Likeness: {hint}"))
202211
print(f" WRONG WORD attempt num > {attempt - 1}")
203212
attempt -= 1
204213
else:

0 commit comments

Comments
 (0)