diff --git a/acro/acro_regression.py b/acro/acro_regression.py index 3abfec0..e37a997 100644 --- a/acro/acro_regression.py +++ b/acro/acro_regression.py @@ -27,7 +27,7 @@ def __init__(self, config) -> None: self.config = config self.results: Records = Records() - def ols( # pylint: disable=too-many-locals + def ols( self, endog, exog=None, missing="none", hasconst=None, **kwargs ) -> RegressionResultsWrapper: """Fits Ordinary Least Squares Regression. @@ -76,7 +76,7 @@ def ols( # pylint: disable=too-many-locals ) return results - def olsr( # pylint: disable=too-many-locals,keyword-arg-before-vararg + def olsr( # pylint: disable=keyword-arg-before-vararg self, formula, data, subset=None, drop_cols=None, *args, **kwargs ) -> RegressionResultsWrapper: """Fits Ordinary Least Squares Regression from a formula and dataframe. @@ -141,7 +141,7 @@ def olsr( # pylint: disable=too-many-locals,keyword-arg-before-vararg ) return results - def logit( # pylint: disable=too-many-arguments,too-many-locals + def logit( self, endog, exog, @@ -190,7 +190,7 @@ def logit( # pylint: disable=too-many-arguments,too-many-locals ) return results - def logitr( # pylint: disable=too-many-locals,keyword-arg-before-vararg + def logitr( # pylint: disable=keyword-arg-before-vararg self, formula, data, subset=None, drop_cols=None, *args, **kwargs ) -> RegressionResultsWrapper: """Fits Logit model from a formula and dataframe. @@ -255,7 +255,7 @@ def logitr( # pylint: disable=too-many-locals,keyword-arg-before-vararg ) return results - def probit( # pylint: disable=too-many-arguments,too-many-locals + def probit( self, endog, exog, @@ -304,7 +304,7 @@ def probit( # pylint: disable=too-many-arguments,too-many-locals ) return results - def probitr( # pylint: disable=too-many-locals,keyword-arg-before-vararg + def probitr( # pylint: disable=keyword-arg-before-vararg self, formula, data, subset=None, drop_cols=None, *args, **kwargs ) -> RegressionResultsWrapper: """Fits Probit model from a formula and dataframe. diff --git a/acro/acro_stata_parser.py b/acro/acro_stata_parser.py index 4712267..1b7a8e7 100644 --- a/acro/acro_stata_parser.py +++ b/acro/acro_stata_parser.py @@ -186,7 +186,7 @@ def parse_table_details( return details -def parse_and_run( # pylint: disable=too-many-arguments,too-many-locals +def parse_and_run( # pylint: disable=too-many-arguments mydata: pd.DataFrame, command: str, varlist_as_str: str, @@ -438,7 +438,7 @@ def creates_datasets(data, details): return set_of_data, msg -def run_table_command( # pylint: disable=too-many-arguments,too-many-locals +def run_table_command( # pylint: disable=too-many-locals data: pd.DataFrame, varlist: list, weights: str, diff --git a/acro/acro_tables.py b/acro/acro_tables.py index 37204e4..cac4a91 100644 --- a/acro/acro_tables.py +++ b/acro/acro_tables.py @@ -299,7 +299,7 @@ def pivot_table( # pylint: disable=too-many-arguments,too-many-locals n_agg: int = 1 if not isinstance(aggfunc, list) else len(aggfunc) # requested table - table: DataFrame = pd.pivot_table( # pylint: disable=too-many-function-args + table: DataFrame = pd.pivot_table( data, values, index, @@ -445,7 +445,7 @@ def surv_func( # pylint: disable=too-many-arguments,too-many-locals """ logger.debug("surv_func()") command: str = utils.get_command("surv_func()", stack()) - survival_func: DataFrame = sm.SurvfuncRight( # pylint: disable=too-many-function-args + survival_func: DataFrame = sm.SurvfuncRight( time, status, entry, @@ -488,7 +488,7 @@ def surv_func( # pylint: disable=too-many-arguments,too-many-locals return (plot, filename) return None - def survival_table( # pylint: disable=too-many-arguments,too-many-locals + def survival_table( # pylint: disable=too-many-arguments self, survival_table, safe_table, status, sdc, command, summary, outcome ): """Create the survival table according to the status of suppressing.""" @@ -506,7 +506,7 @@ def survival_table( # pylint: disable=too-many-arguments,too-many-locals ) return survival_table - def survival_plot( # pylint: disable=too-many-arguments,too-many-locals + def survival_plot( # pylint: disable=too-many-arguments self, survival_table, survival_func, filename, status, sdc, command, summary ): """Create the survival plot according to the status of suppressing.""" @@ -644,7 +644,7 @@ def hist( # pylint: disable=too-many-arguments,too-many-locals ) return None - freq, _ = np.histogram( # pylint: disable=too-many-function-args + freq, _ = np.histogram( data[column], bins, range=(data[column].min(), data[column].max()) ) @@ -1557,7 +1557,7 @@ def crosstab_with_totals( # pylint: disable=too-many-arguments,too-many-locals return table -def manual_crossstab_with_totals( # pylint: disable=too-many-arguments,too-many-locals +def manual_crossstab_with_totals( # pylint: disable=too-many-arguments table, aggfunc, index, diff --git a/acro/record.py b/acro/record.py index b6732e2..967eb5d 100644 --- a/acro/record.py +++ b/acro/record.py @@ -58,7 +58,7 @@ def load_output(path: str, output: list[str]) -> list[str] | list[DataFrame]: return loaded -class Record: # pylint: disable=too-many-instance-attributes,too-few-public-methods +class Record: # pylint: disable=too-many-instance-attributes """Stores data related to a single output record. Attributes diff --git a/pyproject.toml b/pyproject.toml index 67e659c..a026de4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,12 +16,16 @@ lint.select = [ "D", # pydocstyle # "DTZ", # flake8-datetimez # "E", # pycodestyle +# "EM", # flake8-errmsg # "ERA", # eradicate "F", # Pyflakes "I", # isort + "ICN", # flake8-import-conventions "N", # pep8-naming # "PD", # pandas-vet # "PGH", # pygrep-hooks + "PIE", # flake8-pie +# "PL", # Pylint "PLC", # Pylint "PLE", # Pylint # "PLR", # Pylint @@ -29,11 +33,14 @@ lint.select = [ # "PT", # flake8-pytest-style "Q", # flake8-quotes # "RET", # flake8-return + "RUF100", # Ruff-specific # "S", # flake8-bandit # "SIM", # flake8-simplify # "T20", # flake8-print "TID", # flake8-tidy-imports + "UP", # pyupgrade "W", # pycodestyle + "YTT", # flake8-2020 ] exclude = [ @@ -54,3 +61,22 @@ convention = "numpy" [tool.ruff.format] docstring-code-format = true docstring-code-line-length = 20 + +[tool.pylint] +master.py-version = "3.9" +reports.output-format = "colorized" + +[tool.pylint.messages_control] +enable = [ + "useless-suppression", +] + +[tool.mypy] +python_version = "3.9" +#exclude = "docs/source/conf.py" +#strict = false +#warn_unreachable = true +#ignore_missing_imports = true +#follow_imports = false +#disallow_untyped_defs = false +#disallow_untyped_calls = false