Skip to content

Commit

Permalink
docs[python]: More docstring formatting (#4629)
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego committed Aug 31, 2022
1 parent de733cf commit 9716387
Show file tree
Hide file tree
Showing 16 changed files with 245 additions and 172 deletions.
4 changes: 2 additions & 2 deletions py-polars/.flake8
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[flake8]
max-line-length = 88
ban-relative-imports = true
docstring-convention=all
docstring-convention = all
extend-ignore =
# Satisfy black: https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
E203,
# pydocstyle: http://www.pydocstyle.org/en/stable/error_codes.html
# numpy convention with a few additional lints
D107, D203, D212, D401, D402, D415, D416,
# TODO: Remove errors below to further improve docstring linting
D1, D400, D205,
D1,
# flake8-simplify
SIM102, SIM117,

Expand Down
6 changes: 4 additions & 2 deletions py-polars/polars/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ def from_dict(
columns: Sequence[str] | None = None,
) -> DataFrame:
"""
Construct a DataFrame from a dictionary of sequences. This operation clones data,
unless you pass in a `dict[str, pl.Series]`.
Construct a DataFrame from a dictionary of sequences.
This operation clones data, unless you pass in a `dict[str, pl.Series]`.
Parameters
----------
Expand Down Expand Up @@ -318,6 +319,7 @@ def from_pandas(
) -> DataFrame | Series:
"""
Construct a Polars DataFrame or Series from a pandas DataFrame or Series.
This operation clones data.
This requires that pandas and pyarrow are installed.
Expand Down
2 changes: 1 addition & 1 deletion py-polars/polars/datatypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

def get_idx_type() -> type[DataType]:
"""
Get the datatype used for polars Indexing
Get the datatype used for polars Indexing.
This is UInt32 in regulars polars and UInt64 in polars_u64_idx
Expand Down
2 changes: 2 additions & 0 deletions py-polars/polars/internals/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
"""
Core Polars functionality.
The modules within `polars.internals` are interdependent. To prevent cyclical imports,
they all import from each other via this __init__ file using
`import polars.internals as pli`. The imports below are being shared across this module.
Expand Down
6 changes: 2 additions & 4 deletions py-polars/polars/internals/dataframe/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4801,10 +4801,7 @@ def shift(self: DF, periods: int) -> DF:

def shift_and_fill(self, periods: int, fill_value: int | str | float) -> DataFrame:
"""
Shift values by the given period and fill resulting null values.
Fill the parts that will be empty due to this operation with the result of the
`fill_value` expression.
Shift the values by a given period and fill the resulting null values.
Parameters
----------
Expand Down Expand Up @@ -5807,6 +5804,7 @@ def shrink_to_fit(self: DF, in_place: bool = False) -> DF | None:
Shrink DataFrame memory usage.
Shrinks to fit the exact capacity needed to hold the data.
"""
if in_place:
self._df.shrink_to_fit()
Expand Down

0 comments on commit 9716387

Please sign in to comment.