From 1efde7d7f5a45a91abbf0a41b40d239a1421b77f Mon Sep 17 00:00:00 2001 From: Christopher Neffshade Date: Fri, 20 Oct 2023 15:18:20 +0000 Subject: [PATCH] docformatter --- .github/workflows/build.yml | 2 ++ .pre-commit-config.yaml | 5 +++++ requirements-dev.txt | 1 + strictly_typed_pandas/dataset.py | 20 ++++++++------------ 4 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 67ca379..0aa5b21 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,6 +25,8 @@ jobs: run: isort --check . - name: Lint with black run: black --check . + - name: Lint with docformatter + run: docformatter --black -c **/*.py - name: Lint with flake8 run: flake8 - name: Lint with mypy diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index be26f8a..6ebfe8b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,6 +23,11 @@ repos: entry: isort language: system types: [python] + - id: docformatter + name: docformatter + entry: docformatter --black -i + language: system + types: [python] - id: pytest name: pytest entry: coverage run -m pytest --typeguard-packages=strictly_typed_pandas,tests diff --git a/requirements-dev.txt b/requirements-dev.txt index 5c9ce70..8ab475c 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -2,6 +2,7 @@ mypy==1.6.1 flake8==6.1.0 black[jupyter]==23.10.0 isort==5.12.0 +docformatter==1.7.5 coverage==7.3.2 pytest==7.4.2 nbconvert==7.9.2 diff --git a/strictly_typed_pandas/dataset.py b/strictly_typed_pandas/dataset.py index 5d28b5c..42ec66a 100644 --- a/strictly_typed_pandas/dataset.py +++ b/strictly_typed_pandas/dataset.py @@ -22,8 +22,9 @@ class DataSetBase(pd.DataFrame, ABC): def __init__(self, *args, **kwargs) -> None: - """ - This class is a subclass of `pd.DataFrame`, hence it is initialized with the same parameters as a `DataFrame`. + """This class is a subclass of `pd.DataFrame`, hence it is initialized with the + same parameters as a `DataFrame`. + See the Pandas `DataFrame` documentation for more information. """ super().__init__(*args, **kwargs) @@ -75,15 +76,11 @@ def _continue_initialization(self) -> None: pass # pragma: no cover def to_dataframe(self) -> pd.DataFrame: - """ - Converts the object to a pandas `DataFrame`. - """ + """Converts the object to a pandas `DataFrame`.""" return pd.DataFrame(self) def to_frame(self) -> pd.DataFrame: - """ - Synonym of to to_dataframe(): converts the object to a pandas `DataFrame`. - """ + """Synonym of to to_dataframe(): converts the object to a pandas `DataFrame`.""" return self.to_dataframe() @@ -92,8 +89,7 @@ def to_frame(self) -> pd.DataFrame: class DataSet(Generic[T], DataSetBase): - """ - `DataSet` allows for static type checking of pandas DataFrames, for example: + """`DataSet` allows for static type checking of pandas DataFrames, for example: .. code-block:: python @@ -124,8 +120,8 @@ def _continue_initialization(self) -> None: class IndexedDataSet(Generic[T, V], DataSetBase): - """ - `IndexedDataSet` allows for static type checking of indexed pandas DataFrames, for example: + """`IndexedDataSet` allows for static type checking of indexed pandas DataFrames, + for example: .. code-block:: text