Skip to content

Commit e39f18c

Browse files
committed
address: PyCharm linter warnings
1 parent f854859 commit e39f18c

5 files changed

Lines changed: 11 additions & 9 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies = [
1616
"pandas>=2.0",
1717
"rich>=14.3.3",
1818
"questionary>=2.0",
19+
"prompt_toolkit>=3.0",
1920
"mcculw>=1.0.0",
2021
"pyobjc-framework-quartz>=10; sys_platform == 'darwin'",
2122
]

src/mid_det/ratings/__main__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
from mid_det import recorder, session
3030
from mid_det.ratings import core as rcore
3131
from mid_det.ratings import display as rdisplay
32-
from mid_det.ratings.wizard import run_ratings_wizard
32+
from mid_det.ratings.setup_wizard import run_ratings_wizard
3333

3434
_PACKAGE_DIR = Path(__file__).resolve().parent # src/mid_det/ratings/
3535
_PROJECT_ROOT = _PACKAGE_DIR.parent.parent.parent # project root
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def run_ratings_wizard() -> tuple[str, bool, str]:
5151
).ask()
5252
if subject_id is None:
5353
_quit()
54-
subject_id = subject_id.strip() or _SUBJECT_PLACEHOLDER
54+
subject_id: str = subject_id.strip() or _SUBJECT_PLACEHOLDER
5555

5656
show_instructions: bool | None = questionary.confirm(
5757
"Show instructions?", default=True, style=_QSTYLE

src/mid_det/recorder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ def append(self, record: TrialRecord) -> None:
274274
# MATLAB rt_vector: -2 = early press, -1 = miss/too-slow, else RT (seconds).
275275
if record.early_press:
276276
rt: float = -2
277-
elif record.rt_ms == "":
277+
elif isinstance(record.rt_ms, str): # "" sentinel = miss/too-slow
278278
rt = -1
279279
else:
280280
rt = record.rt_ms / 1000

src/mid_det/setup_wizard.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,13 @@ def prompt_legacy_name(legacy_dir: Path, filename_for: Callable[[str], str]) ->
100100

101101
# Bottom toolbar: live preview of the resolved path as NAME is typed.
102102
def _toolbar():
103-
name = get_app().current_buffer.text.strip()
104-
if not name:
103+
typed = get_app().current_buffer.text.strip()
104+
if not typed:
105105
return FormattedText(
106106
[("fg:ansired bold", " ✗ Name cannot be empty")]
107107
)
108-
target = legacy_dir / filename_for(name)
109-
return FormattedText([("fg:ansigreen bold", f" → saves as {target}")])
108+
preview = legacy_dir / filename_for(typed)
109+
return FormattedText([("fg:ansigreen bold", f" → saves as {preview}")])
110110

111111
while True:
112112
raw = ""
@@ -119,7 +119,6 @@ def _toolbar():
119119
)
120120
except (KeyboardInterrupt, EOFError):
121121
_quit()
122-
raise # unreachable; tells PyCharm this branch never continues
123122
name = raw.strip()
124123
if not name:
125124
_rcon.print("[red]Name cannot be empty.[/red]")
@@ -136,10 +135,12 @@ def _toolbar():
136135
).ask()
137136
if overwrite is None:
138137
_quit()
139-
raise # unreachable; tells PyCharm this branch never continues
140138
if overwrite:
141139
return name
142140
# else: loop and re-prompt for a different NAME
141+
# Unreachable: the loop only exits via `return` or `_quit()`. Present so the
142+
# type checker can see every path returns `str` (not `str | None`).
143+
raise AssertionError("prompt_legacy_name loop exited unexpectedly")
143144

144145

145146
# ── Custom RT field ───────────────────────────────────────────────────────────

0 commit comments

Comments
 (0)