Skip to content

Commit 0f25964

Browse files
committed
fix E741 ambiguous variable name where logical
1 parent 50696cb commit 0f25964

3 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/xulbux/console.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,10 @@ def log(
440440
)
441441
prompt_lst: list[str] = [
442442
item for lst in
443-
(String.split_count(l, cls.w - (title_len + len(tab) + 2 * len(mx))) for l in str(clean_prompt).splitlines())
443+
(
444+
String.split_count(line, cls.w - (title_len + len(tab) + 2 * len(mx))) \
445+
for line in str(clean_prompt).splitlines()
446+
)
444447
for item in ([""] if lst == [] else (lst if isinstance(lst, list) else [lst]))
445448
]
446449
prompt = f"\n{mx}{' ' * title_len}{mx}{tab}".join(

src/xulbux/env_path.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,10 @@ def _persistent(cls, path: str, remove: bool = False) -> None:
7676
path = _os.path.normpath(path)
7777

7878
if remove:
79-
current_paths = [p for p in current_paths if _os.path.normpath(p) != _os.path.normpath(path)]
79+
current_paths = [
80+
path for path in current_paths \
81+
if _os.path.normpath(path) != _os.path.normpath(path)
82+
]
8083
else:
8184
current_paths.append(path)
8285

@@ -97,16 +100,16 @@ def _persistent(cls, path: str, remove: bool = False) -> None:
97100
else "~/.zshrc"
98101
)
99102

100-
with open(shell_rc_file, "r+") as f:
101-
content = f.read()
102-
f.seek(0)
103+
with open(shell_rc_file, "r+") as file:
104+
content = file.read()
105+
file.seek(0)
103106

104107
if remove:
105-
new_content = [l for l in content.splitlines() if not l.endswith(f':{path}"')]
106-
f.write("\n".join(new_content))
108+
new_content = [line for line in content.splitlines() if not line.endswith(f':{path}"')]
109+
file.write("\n".join(new_content))
107110
else:
108-
f.write(f'{content.rstrip()}\n# Added by XulbuX\nexport PATH="{new_path}"\n')
111+
file.write(f'{content.rstrip()}\n# Added by XulbuX\nexport PATH="{new_path}"\n')
109112

110-
f.truncate()
113+
file.truncate()
111114

112115
_os.system(f"source {shell_rc_file}")

src/xulbux/regex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ def hexa_str(cls, allow_alpha: bool = True) -> str:
214214
@classmethod
215215
def _clean(cls, pattern: str) -> str:
216216
"""Internal method to make a multiline-string regex pattern into a single-line pattern."""
217-
return "".join(l.strip() for l in pattern.splitlines()).strip()
217+
return "".join(line.strip() for line in pattern.splitlines()).strip()
218218

219219

220220
@mypyc_attr(native_class=False)

0 commit comments

Comments
 (0)