Skip to content
Closed
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
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ repos:
(?x)^(
.*\.txt|
.*\.ipynb|
.*\.html
.*\.html|
docs/source/_build/.*
)$

# Format docstrings
Expand Down
8 changes: 2 additions & 6 deletions acro/acro.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,7 @@ def __init__(self, config: str = "default", suppress: bool = False) -> None:
# set globals for survival analysis
acro_tables.SURVIVAL_THRESHOLD = self.config["survival_safe_threshold"]

def finalise(
self, path: str = "outputs", ext: str = "json", interactive: bool = False
) -> Records | None:
def finalise(self, path: str = "outputs", ext="json") -> Records | None:
"""Create a results file for checking.

Parameters
Expand All @@ -89,8 +87,6 @@ def finalise(
Name of a folder to save outputs.
ext : str
Extension of the results file. Valid extensions: {json, xlsx}.
interactive : bool
Whether to prompt the user to request exceptions for failing outputs.

Returns
-------
Expand All @@ -105,7 +101,7 @@ def finalise(
path,
)
return None
self.results.finalise(path, ext, interactive)
self.results.finalise(path, ext)
config_filename: str = os.path.normpath(f"{path}/config.json")
try:
with open(config_filename, "w", newline="", encoding="utf-8") as file:
Expand Down
17 changes: 3 additions & 14 deletions acro/acro_tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ def crosstab( # pylint: disable=too-many-arguments,too-many-locals
)

# record output

self.results.add(
status=status,
output_type="table",
Expand All @@ -226,11 +225,6 @@ def crosstab( # pylint: disable=too-many-arguments,too-many-locals
output=[table],
comments=comments,
)
if self.suppress:
justadded = f"output_{self.results.output_id - 1}"
self.results.add_exception(
justadded, "Suppression automatically applied where needed"
)
return table

def pivot_table( # pylint: disable=too-many-arguments,too-many-locals
Expand Down Expand Up @@ -404,11 +398,6 @@ def pivot_table( # pylint: disable=too-many-arguments,too-many-locals
output=[table],
comments=comments,
)
if self.suppress:
justadded = f"output_{self.results.output_id - 1}"
self.results.add_exception(
justadded, "Suppression automatically applied where needed"
)
return table

def surv_func( # pylint: disable=too-many-arguments,too-many-locals
Expand Down Expand Up @@ -1378,7 +1367,7 @@ def create_dataframe(index, columns) -> DataFrame:
index_df = pd.concat(index, axis=1)
elif isinstance(index, pd.Series):
index_df = pd.DataFrame({index.name: index})
except (ValueError, TypeError):
except ValueError:
index_df = empty_dataframe

columns_df = empty_dataframe
Expand All @@ -1387,12 +1376,12 @@ def create_dataframe(index, columns) -> DataFrame:
columns_df = pd.concat(columns, axis=1)
elif isinstance(columns, pd.Series):
columns_df = pd.DataFrame({columns.name: columns})
except (ValueError, TypeError):
except ValueError:
columns_df = empty_dataframe

try:
data = pd.concat([index_df, columns_df], axis=1)
except (ValueError, TypeError):
except ValueError:
data = empty_dataframe

return data
Expand Down
7 changes: 2 additions & 5 deletions acro/record.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ def validate_outputs(self) -> None:
)
record.exception = input("")

def finalise(self, path: str, ext: str, interactive: bool = False) -> None:
def finalise(self, path: str, ext: str) -> None:
"""Create a results file for checking.

Parameters
Expand All @@ -439,12 +439,9 @@ def finalise(self, path: str, ext: str, interactive: bool = False) -> None:
Name of a folder to save outputs.
ext : str
Extension of the results file. Valid extensions: {json, xlsx}.
interactive : Bool
Whether to prompt the user to request exceptions for failing outputs.
"""
logger.debug("finalise()")
if interactive:
self.validate_outputs()
self.validate_outputs()
if ext == "json":
self.finalise_json(path)
elif ext == "xlsx":
Expand Down
4 changes: 4 additions & 0 deletions docs/source/_build/.buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file records the configuration used when building these files. When it is not found, a full rebuild will be done.
config: c6e75f07f2d08ab9c68144b63a96bffd
tags: 645f666f9bcd5a90fca523b33c5a78b7
Binary file added docs/source/_build/.doctrees/acro.doctree
Binary file not shown.
Binary file added docs/source/_build/.doctrees/acro_r.doctree
Binary file not shown.
Binary file added docs/source/_build/.doctrees/api.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docs/source/_build/.doctrees/environment.pickle
Binary file not shown.
Binary file added docs/source/_build/.doctrees/examples.doctree
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docs/source/_build/.doctrees/faq.doctree
Binary file not shown.
Binary file added docs/source/_build/.doctrees/index.doctree
Binary file not shown.
Binary file added docs/source/_build/.doctrees/installation.doctree
Binary file not shown.
Binary file added docs/source/_build/.doctrees/introduction.doctree
Binary file not shown.
Loading