Skip to content

Commit f4787d3

Browse files
authored
docs(python) remove now unnecessary returns statements (#3170)
* feat * fixup# * typing, docs
1 parent 053390d commit f4787d3

File tree

14 files changed

+4
-266
lines changed

14 files changed

+4
-266
lines changed

docstring_template.mustache

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,3 @@ Arguments:
1010
{{var}}: {{descriptionPlaceholder}}
1111
{{/kwargs}}
1212
{{/parametersExist}}
13-
{{#returnsExist}}
14-
15-
Returns:
16-
{{#returns}}
17-
{{descriptionPlaceholder}}
18-
{{/returns}}
19-
{{/returnsExist}}
20-
{{#yieldsExist}}
21-
22-
Yields:
23-
{{#yields}}
24-
{{descriptionPlaceholder}}
25-
{{/yields}}
26-
{{/yieldsExist}}

narwhals/_duckdb/utils.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,6 @@ def concat_str(*exprs: Expression, separator: str = "") -> Expression:
5959
exprs: Native columns.
6060
separator: String that will be used to separate the values of each column.
6161
62-
Returns:
63-
A new native expression.
6462
6563
[concat]: https://duckdb.org/docs/stable/sql/functions/char.html#concatstring-
6664
[concat_ws]: https://duckdb.org/docs/stable/sql/functions/char.html#concat_wsseparator-string-

narwhals/_exceptions.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
def find_stacklevel() -> int:
77
"""Find the first place in the stack that is not inside narwhals.
88
9-
Returns:
10-
Stacklevel.
11-
129
Taken from:
1310
https://github.com/pandas-dev/pandas/blob/ab89c53f48df67709a533b6a95ce3d911871a0a8/pandas/util/_exceptions.py#L30-L51
1411
"""

narwhals/_polars/series.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -652,12 +652,12 @@ def to_polars(self) -> pl.Series:
652652
def first(self) -> PythonLiteral:
653653
if self._backend_version < (1, 10): # pragma: no cover
654654
return self.native.item(0) if len(self) else None
655-
return self.native.first()
655+
return self.native.first() # type: ignore[return-value]
656656

657657
def last(self) -> PythonLiteral:
658658
if self._backend_version < (1, 10): # pragma: no cover
659659
return self.native.item(-1) if len(self) else None
660-
return self.native.last()
660+
return self.native.last() # type: ignore[return-value]
661661

662662
@property
663663
def dt(self) -> PolarsSeriesDateTimeNamespace:

narwhals/_utils.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -695,9 +695,6 @@ def parse_version(version: str | ModuleType | _SupportsVersion) -> tuple[int, ..
695695
696696
Arguments:
697697
version: Version string, or object with one, to parse.
698-
699-
Returns:
700-
Parsed version number.
701698
"""
702699
# lifted from Polars
703700
# [marco]: Take care of DuckDB pre-releases which end with e.g. `-dev4108`
@@ -779,9 +776,6 @@ def maybe_align_index(
779776
lhs: Dataframe or Series.
780777
rhs: Dataframe or Series to align with.
781778
782-
Returns:
783-
Same type as input.
784-
785779
Notes:
786780
This is only really intended for backwards-compatibility purposes,
787781
for example if your library already aligns indices for users.
@@ -871,9 +865,6 @@ def maybe_get_index(obj: DataFrame[Any] | LazyFrame[Any] | Series[Any]) -> Any |
871865
Arguments:
872866
obj: Dataframe or Series.
873867
874-
Returns:
875-
Same type as input.
876-
877868
Notes:
878869
This is only really intended for backwards-compatibility purposes,
879870
for example if your library already aligns indices for users.
@@ -918,9 +909,6 @@ def maybe_set_index(
918909
`ValueError` is raised.
919910
index: series or list of series to set as index.
920911
921-
Returns:
922-
Same type as input.
923-
924912
Raises:
925913
ValueError: If one of the following conditions happens
926914
@@ -996,9 +984,6 @@ def maybe_reset_index(obj: FrameOrSeriesT) -> FrameOrSeriesT:
996984
Arguments:
997985
obj: Dataframe or Series.
998986
999-
Returns:
1000-
Same type as input.
1001-
1002987
Notes:
1003988
This is only really intended for backwards-compatibility purposes,
1004989
for example if your library already resets the index for users.
@@ -1106,9 +1091,6 @@ def maybe_convert_dtypes(
11061091
*args: Additional arguments which gets passed through.
11071092
**kwargs: Additional arguments which gets passed through.
11081093
1109-
Returns:
1110-
Same type as input.
1111-
11121094
Notes:
11131095
For non-pandas-like inputs, this is a no-op.
11141096
Also, `args` and `kwargs` just get passed down to the underlying library as-is.
@@ -1146,9 +1128,6 @@ def scale_bytes(sz: int, unit: SizeUnit) -> int | float:
11461128
Arguments:
11471129
sz: original size in bytes
11481130
unit: size unit to convert into
1149-
1150-
Returns:
1151-
Integer or float.
11521131
"""
11531132
if unit in {"b", "bytes"}:
11541133
return sz
@@ -1182,9 +1161,6 @@ def is_ordered_categorical(series: Series[Any]) -> bool:
11821161
Arguments:
11831162
series: Input Series.
11841163
1185-
Returns:
1186-
Whether the Series is an ordered categorical.
1187-
11881164
Examples:
11891165
>>> import narwhals as nw
11901166
>>> import pandas as pd
@@ -1677,9 +1653,6 @@ def _into_arrow_table(data: IntoArrowTable, context: _LimitedContext, /) -> pa.T
16771653
Arguments:
16781654
data: Object which implements `__arrow_c_stream__`.
16791655
context: Initialized compliant object.
1680-
1681-
Returns:
1682-
A PyArrow Table.
16831656
"""
16841657
if find_spec("pyarrow"):
16851658
ns = context._version.namespace.from_backend("pyarrow").compliant

narwhals/dataframe.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1842,9 +1842,6 @@ def top_k(
18421842
reverse: Consider the k smallest elements of the by column(s) (instead of the k largest).
18431843
This can be specified per column by passing a sequence of booleans.
18441844
1845-
Returns:
1846-
The dataframe with the `k` largest rows.
1847-
18481845
Examples:
18491846
>>> import pandas as pd
18501847
>>> import narwhals as nw
@@ -3088,9 +3085,6 @@ def top_k(
30883085
reverse: Consider the k smallest elements of the by column(s) (instead of the k largest).
30893086
This can be specified per column by passing a sequence of booleans.
30903087
3091-
Returns:
3092-
The LazyFrame with the `k` largest rows.
3093-
30943088
Examples:
30953089
>>> import duckdb
30963090
>>> import narwhals as nw

narwhals/dependencies.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -480,9 +480,6 @@ def is_into_series(native_series: Any | IntoSeriesT) -> TypeIs[IntoSeriesT]:
480480
Arguments:
481481
native_series: The object to check.
482482
483-
Returns:
484-
`True` if `native_series` can be converted to a Narwhals Series, `False` otherwise.
485-
486483
Examples:
487484
>>> import pandas as pd
488485
>>> import polars as pl
@@ -517,9 +514,6 @@ def is_into_dataframe(native_dataframe: Any | IntoDataFrameT) -> TypeIs[IntoData
517514
Arguments:
518515
native_dataframe: The object to check.
519516
520-
Returns:
521-
`True` if `native_dataframe` can be converted to a Narwhals DataFrame, `False` otherwise.
522-
523517
Examples:
524518
>>> import pandas as pd
525519
>>> import polars as pl

narwhals/expr_list.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,6 @@ def get(self, index: int) -> ExprT:
111111
112112
Negative indices are not accepted.
113113
114-
Returns:
115-
A new expression.
116-
117114
Examples:
118115
>>> import polars as pl
119116
>>> import narwhals as nw

0 commit comments

Comments
 (0)