Skip to content
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

[pre-commit.ci] pre-commit autoupdate #245

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ repos:

# Ruff, the Python auto-correcting linter/formatter written in Rust
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.9.1
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format

# Check types with mypy
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.13.0
rev: v1.14.1
hooks:
- id: mypy
args: ["--ignore-missing-imports", "--follow-imports", "skip", "--check-untyped-defs"]
Expand Down
12 changes: 4 additions & 8 deletions acro/acro_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -964,13 +964,9 @@ def get_aggfunc(aggfunc: str | None) -> str | Callable | None:
func = None
if aggfunc is not None:
if not isinstance(aggfunc, str): # pragma: no cover
raise ValueError(
f"aggfunc {aggfunc} must be:" f"{', '.join(AGGFUNC.keys())}"
)
raise ValueError(f"aggfunc {aggfunc} must be:{', '.join(AGGFUNC.keys())}")
if aggfunc not in AGGFUNC: # pragma: no cover
raise ValueError(
f"aggfunc {aggfunc} must be: " f"{', '.join(AGGFUNC.keys())}"
)
raise ValueError(f"aggfunc {aggfunc} must be: {', '.join(AGGFUNC.keys())}")
func = AGGFUNC[aggfunc]
logger.debug("aggfunc: %s", func)
return func
Expand Down Expand Up @@ -1312,7 +1308,7 @@ def get_queries(masks, aggfunc) -> list[str]:
(
f"({index_level_names} == {row_label})"
if isinstance(row_label, (int, float))
else (f"({index_level_names}" f'== "{row_label}")')
else (f'({index_level_names}== "{row_label}")')
)
]
)
Expand All @@ -1333,7 +1329,7 @@ def get_queries(masks, aggfunc) -> list[str]:
(
f"({column_level_names} == {col_label})"
if isinstance(col_label, (int, float))
else (f"({column_level_names}" f'== "{col_label}")')
else (f'({column_level_names}== "{col_label}")')
)
]
)
Expand Down
4 changes: 1 addition & 3 deletions notebooks/test-nursery.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,7 @@
# Mean() in this case
# Then how Max and Min are not allowed by the code

print(
"\nIllustration of crosstab using an aggregation function " "- mean in this case."
)
print("\nIllustration of crosstab using an aggregation function - mean in this case.")
safe_table = acro.crosstab(df.recommend, df.parents, values=df.children, aggfunc="mean")
print("\nand this is the researchers output")
print(safe_table)
Expand Down
12 changes: 6 additions & 6 deletions test/test_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@ def test_surv_func(acro):
_ = acro.surv_func(data.futime, data.death, output="table")
output = acro.results.get_index(0)
correct_summary: str = "fail; threshold: 3864 cells suppressed; "
assert (
output.summary == correct_summary
), f"\n{output.summary}\n should be \n{correct_summary}\n"
assert output.summary == correct_summary, (
f"\n{output.summary}\n should be \n{correct_summary}\n"
)

filename = os.path.normpath("acro_artifacts/kaplan-meier_0.png")
_ = acro.surv_func(data.futime, data.death, output="plot")
Expand Down Expand Up @@ -876,9 +876,9 @@ def test_crosstab_multiple_aggregate_function(data, acro):
" p-ratio: 4 cells may need suppressing; "
"nk-rule: 2 cells may need suppressing; "
)
assert (
output.summary == correct_summary
), f"\n{output.summary}\n should be \n{correct_summary}\n"
assert output.summary == correct_summary, (
f"\n{output.summary}\n should be \n{correct_summary}\n"
)
print(f"{output.output[0]['mean']['R/G'].sum()}")
correctval = 97383496.0
errmsg = f"{output.output[0]['mean']['R/G'].sum()} should be {correctval}"
Expand Down
12 changes: 6 additions & 6 deletions test/test_stata17_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ def test_stata_acro_init():
options="",
stata_version="17",
)
assert (
ret == "acro analysis session created\n"
), f"wrong string for acro init: {ret}\n"
assert ret == "acro analysis session created\n", (
f"wrong string for acro init: {ret}\n"
)
errmsg = f"wrong type for stata_acro:{type(stata_config.stata_acro)}"
assert isinstance(stata_config.stata_acro, ACRO), errmsg

Expand Down Expand Up @@ -808,9 +808,9 @@ def test_table_stata17_2(data):
options="nototals",
stata_version="17",
)
assert (
ret.split() == ret_1.split() == correct.split()
), f"got\n{ret}\n expected\n{correct}"
assert ret.split() == ret_1.split() == correct.split(), (
f"got\n{ret}\n expected\n{correct}"
)


def test_table_stata17_3(data):
Expand Down
6 changes: 3 additions & 3 deletions test/test_stata_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,9 +217,9 @@ def test_stata_acro_init():
options="",
stata_version="16",
)
assert (
ret == "acro analysis session created\n"
), f"wrong string for acro init: {ret}\n"
assert ret == "acro analysis session created\n", (
f"wrong string for acro init: {ret}\n"
)
errmsg = f"wrong type for stata_acro:{type(stata_config.stata_acro)}"
assert isinstance(stata_config.stata_acro, ACRO), errmsg

Expand Down