Skip to content

Commit

Permalink
docformatter
Browse files Browse the repository at this point in the history
  • Loading branch information
caneff committed Oct 20, 2023
1 parent 637d544 commit 1efde7d
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 8 additions & 12 deletions strictly_typed_pandas/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()


Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 1efde7d

Please sign in to comment.