Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#245)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/codespell-project/codespell: v2.3.0 → v2.4.0](codespell-project/codespell@v2.3.0...v2.4.0)
- [github.com/astral-sh/ruff-pre-commit: v0.8.1 → v0.9.3](astral-sh/ruff-pre-commit@v0.8.1...v0.9.3)
- [github.com/pre-commit/mirrors-mypy: v1.13.0 → v1.14.1](pre-commit/mirrors-mypy@v1.13.0...v1.14.1)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
pre-commit-ci[bot] authored Jan 29, 2025
1 parent 9d27274 commit f7df079
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 29 deletions.
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:

# Check for spelling
- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.0
hooks:
- id: codespell
args: ["-L", "tre"]
Expand All @@ -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.3
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

0 comments on commit f7df079

Please sign in to comment.