-
Notifications
You must be signed in to change notification settings - Fork 4
[MAINT] switch to ruff #261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -74,7 +74,7 @@ def __attrs_post_init__(self) -> None: | |
| self.bids_filter = get_bids_filter_config() | ||
|
|
||
| self.output_dir = self.output_dir / "bidsmreye" | ||
| if not self.output_dir: | ||
| if not self.output_dir.exists(): | ||
| self.output_dir.mkdir(parents=True, exist_ok=True) | ||
|
|
||
| database_path = self.input_dir / "pybids_db" | ||
|
|
@@ -136,7 +136,7 @@ def check_argument(self, attribute: str, layout_in: BIDSLayout) -> Config: | |
| self.listify(attribute) | ||
|
|
||
| # convert all run values to integers | ||
| if attribute in {"run"}: | ||
| if attribute == "run": | ||
| for i, j in enumerate(value): | ||
| value[i] = int(j) | ||
| tmp = [int(j) for j in getattr(self, attribute)] | ||
|
|
@@ -155,7 +155,7 @@ def check_argument(self, attribute: str, layout_in: BIDSLayout) -> Config: | |
| # run and space can be empty if their entity are not used | ||
| # we will figure out the values for run | ||
| # in subject / task wise manner later on | ||
| if attribute not in ["run"]: | ||
| if attribute != "run": | ||
| setattr(self, attribute, value) | ||
|
|
||
| if attribute not in ["run", "space"] and not getattr(self, attribute): | ||
|
|
@@ -236,7 +236,7 @@ def get_config(config_file: Path | None = None, default: str = "") -> dict[str, | |
| my_path = Path(__file__).absolute().parent / "config" | ||
| config_file = my_path / default | ||
|
|
||
| if config_file is None or not Path(config_file).exists(): | ||
| if not Path(config_file).exists(): | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (bug_risk): Calling get_config with default="" now attempts to open a directory as a file. With this change, when To keep the clearer failure mode, consider either restoring the |
||
| raise FileNotFoundError(f"Config file {config_file} not found") | ||
|
|
||
| with open(config_file) as ff: | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion (bug_risk): Using --unsafe-fixes in ruff-check may introduce semantic changes during pre-commit runs.
Since these transformations can alter runtime behaviour and are applied automatically on developer machines, they may introduce subtle bugs. Consider removing
--unsafe-fixesfrom the pre-commit hook and instead running them only in an explicit context (e.g. a dedicated script or CI job), while keeping pre-commit limited to safer auto-fixes.