Skip to content

Commit a3ea809

Browse files
committed
Ruff D: Docstring fixes
1 parent e81189f commit a3ea809

11 files changed

Lines changed: 31 additions & 31 deletions

File tree

duckdb/experimental/spark/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class ContributionsAcceptedError(NotImplementedError):
22
"""This method is not planned to be implemented, if you would like to implement this method
33
or show your interest in this method to other members of the community,
4-
feel free to open up a PR or a Discussion over on https://github.com/duckdb/duckdb
4+
feel free to open up a PR or a Discussion over on https://github.com/duckdb/duckdb.
55
"""
66

77
def __init__(self, message=None) -> None:

duckdb/experimental/spark/sql/column.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def _unary_op(
2929
name: str,
3030
doc: str = "unary operator",
3131
) -> Callable[["Column"], "Column"]:
32-
"""Create a method for given unary operator"""
32+
"""Create a method for given unary operator."""
3333

3434
def _(self: "Column") -> "Column":
3535
# Call the function identified by 'name' on the internal Expression object
@@ -44,7 +44,7 @@ def _bin_op(
4444
name: str,
4545
doc: str = "binary operator",
4646
) -> Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral", "DateTimeLiteral"]], "Column"]:
47-
"""Create a method for given binary operator"""
47+
"""Create a method for given binary operator."""
4848

4949
def _(
5050
self: "Column",
@@ -62,7 +62,7 @@ def _bin_func(
6262
name: str,
6363
doc: str = "binary function",
6464
) -> Callable[["Column", Union["Column", "LiteralType", "DecimalLiteral", "DateTimeLiteral"]], "Column"]:
65-
"""Create a function expression for the given binary function"""
65+
"""Create a function expression for the given binary function."""
6666

6767
def _(
6868
self: "Column",
@@ -245,14 +245,14 @@ def __eq__( # type: ignore[override]
245245
self,
246246
other: Union["Column", "LiteralType", "DecimalLiteral", "DateTimeLiteral"],
247247
) -> "Column":
248-
"""Binary function"""
248+
"""Binary function."""
249249
return Column(self.expr == (_get_expr(other)))
250250

251251
def __ne__( # type: ignore[override]
252252
self,
253253
other: object,
254254
) -> "Column":
255-
"""Binary function"""
255+
"""Binary function."""
256256
return Column(self.expr != (_get_expr(other)))
257257

258258
__lt__ = _bin_op("__lt__")

duckdb/experimental/spark/sql/dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ def limit(self, num: int) -> "DataFrame":
845845
return DataFrame(rel, self.session)
846846

847847
def __contains__(self, item: str) -> bool:
848-
"""Check if the :class:`DataFrame` contains a column by the name of `item`"""
848+
"""Check if the :class:`DataFrame` contains a column by the name of `item`."""
849849
return item in self.relation
850850

851851
@property

duckdb/experimental/spark/sql/functions.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ def _to_column_expr(col: ColumnOrName) -> Expression:
164164

165165

166166
def regexp_replace(str: "ColumnOrName", pattern: str, replacement: str) -> Column:
167-
r"""Replace all substrings of the specified string value that match regexp with rep.
167+
"""Replace all substrings of the specified string value that match regexp with rep.
168168
169169
.. versionadded:: 1.5.0
170170
@@ -1487,7 +1487,7 @@ def approx_count_distinct(col: "ColumnOrName", rsd: Optional[float] = None) -> C
14871487

14881488

14891489
def approxCountDistinct(col: "ColumnOrName", rsd: Optional[float] = None) -> Column:
1490-
""".. versionadded:: 1.3.0
1490+
""".. versionadded:: 1.3.0.
14911491
14921492
.. versionchanged:: 3.4.0
14931493
Supports Spark Connect.
@@ -2059,7 +2059,7 @@ def cbrt(col: "ColumnOrName") -> Column:
20592059

20602060
def char(col: "ColumnOrName") -> Column:
20612061
"""Returns the ASCII character having the binary equivalent to `col`. If col is larger than 256 the
2062-
result is equivalent to char(col % 256)
2062+
result is equivalent to char(col % 256).
20632063
20642064
.. versionadded:: 3.5.0
20652065
@@ -2373,7 +2373,7 @@ def rand(seed: Optional[int] = None) -> Column:
23732373

23742374

23752375
def regexp(str: "ColumnOrName", regexp: "ColumnOrName") -> Column:
2376-
r"""Returns true if `str` matches the Java regex `regexp`, or false otherwise.
2376+
"""Returns true if `str` matches the Java regex `regexp`, or false otherwise.
23772377
23782378
.. versionadded:: 3.5.0
23792379
@@ -2425,7 +2425,7 @@ def regexp(str: "ColumnOrName", regexp: "ColumnOrName") -> Column:
24252425

24262426

24272427
def regexp_count(str: "ColumnOrName", regexp: "ColumnOrName") -> Column:
2428-
r"""Returns a count of the number of times that the Java regex pattern `regexp` is matched
2428+
"""Returns a count of the number of times that the Java regex pattern `regexp` is matched
24292429
in the string `str`.
24302430
24312431
.. versionadded:: 3.5.0
@@ -2456,7 +2456,7 @@ def regexp_count(str: "ColumnOrName", regexp: "ColumnOrName") -> Column:
24562456

24572457

24582458
def regexp_extract(str: "ColumnOrName", pattern: str, idx: int) -> Column:
2459-
r"""Extract a specific group matched by the Java regex `regexp`, from the specified string column.
2459+
"""Extract a specific group matched by the Java regex `regexp`, from the specified string column.
24602460
If the regex did not match, or the specified group did not match, an empty string is returned.
24612461
24622462
.. versionadded:: 1.5.0
@@ -2496,7 +2496,7 @@ def regexp_extract(str: "ColumnOrName", pattern: str, idx: int) -> Column:
24962496

24972497

24982498
def regexp_extract_all(str: "ColumnOrName", regexp: "ColumnOrName", idx: Optional[Union[int, Column]] = None) -> Column:
2499-
r"""Extract all strings in the `str` that match the Java regex `regexp`
2499+
"""Extract all strings in the `str` that match the Java regex `regexp`
25002500
and corresponding to the regex group index.
25012501
25022502
.. versionadded:: 3.5.0
@@ -2535,7 +2535,7 @@ def regexp_extract_all(str: "ColumnOrName", regexp: "ColumnOrName", idx: Optiona
25352535

25362536

25372537
def regexp_like(str: "ColumnOrName", regexp: "ColumnOrName") -> Column:
2538-
r"""Returns true if `str` matches the Java regex `regexp`, or false otherwise.
2538+
"""Returns true if `str` matches the Java regex `regexp`, or false otherwise.
25392539
25402540
.. versionadded:: 3.5.0
25412541
@@ -2587,7 +2587,7 @@ def regexp_like(str: "ColumnOrName", regexp: "ColumnOrName") -> Column:
25872587

25882588

25892589
def regexp_substr(str: "ColumnOrName", regexp: "ColumnOrName") -> Column:
2590-
r"""Returns the substring that matches the Java regex `regexp` within the string `str`.
2590+
"""Returns the substring that matches the Java regex `regexp` within the string `str`.
25912591
If the regular expression is not found, the result is null.
25922592
25932593
.. versionadded:: 3.5.0
@@ -3996,7 +3996,7 @@ def month(col: "ColumnOrName") -> Column:
39963996

39973997
def dayofweek(col: "ColumnOrName") -> Column:
39983998
"""Extract the day of the week of a given date/timestamp as integer.
3999-
Ranges from 1 for a Sunday through to 7 for a Saturday
3999+
Ranges from 1 for a Sunday through to 7 for a Saturday.
40004000
40014001
.. versionadded:: 2.3.0
40024002
@@ -4187,7 +4187,7 @@ def second(col: "ColumnOrName") -> Column:
41874187
def weekofyear(col: "ColumnOrName") -> Column:
41884188
"""Extract the week number of a given date as integer.
41894189
A week is considered to start on a Monday and week 1 is the first week with more than 3 days,
4190-
as defined by ISO 8601
4190+
as defined by ISO 8601.
41914191
41924192
.. versionadded:: 1.5.0
41934193
@@ -4609,7 +4609,7 @@ def atan(col: "ColumnOrName") -> Column:
46094609

46104610

46114611
def atan2(col1: Union["ColumnOrName", float], col2: Union["ColumnOrName", float]) -> Column:
4612-
""".. versionadded:: 1.4.0
4612+
""".. versionadded:: 1.4.0.
46134613
46144614
.. versionchanged:: 3.4.0
46154615
Supports Spark Connect.
@@ -5577,7 +5577,7 @@ def var_samp(col: "ColumnOrName") -> Column:
55775577

55785578

55795579
def variance(col: "ColumnOrName") -> Column:
5580-
"""Aggregate function: alias for var_samp
5580+
"""Aggregate function: alias for var_samp.
55815581
55825582
.. versionadded:: 1.6.0
55835583
@@ -6242,7 +6242,7 @@ def instr(str: "ColumnOrName", substr: str) -> Column:
62426242

62436243

62446244
def expr(str: str) -> Column:
6245-
"""Parses the expression string into the column that it represents
6245+
"""Parses the expression string into the column that it represents.
62466246
62476247
.. versionadded:: 1.5.0
62486248

duckdb/experimental/spark/sql/types.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def fromInternal(self, obj: Any) -> Any:
113113
# This singleton pattern does not work with pickle, you will get
114114
# another object after pickle and unpickle
115115
class DataTypeSingleton(type):
116-
"""Metaclass for DataType"""
116+
"""Metaclass for DataType."""
117117

118118
_instances: ClassVar[dict[type["DataTypeSingleton"], "DataTypeSingleton"]] = {}
119119

@@ -855,7 +855,7 @@ def add(
855855
return self
856856

857857
def __iter__(self) -> Iterator[StructField]:
858-
"""Iterate the fields"""
858+
"""Iterate the fields."""
859859
return iter(self.fields)
860860

861861
def __len__(self) -> int:
@@ -1147,7 +1147,7 @@ def __new__(cls, *args: Optional[str], **kwargs: Optional[Any]) -> "Row":
11471147
return tuple.__new__(cls, args)
11481148

11491149
def asDict(self, recursive: bool = False) -> dict[str, Any]:
1150-
"""Return as a dict
1150+
"""Return as a dict.
11511151
11521152
Parameters
11531153
----------
@@ -1200,7 +1200,7 @@ def __contains__(self, item: Any) -> bool:
12001200

12011201
# let object acts like class
12021202
def __call__(self, *args: Any) -> "Row":
1203-
"""Create new Row object"""
1203+
"""Create new Row object."""
12041204
if len(args) > len(self):
12051205
raise ValueError(
12061206
"Can not create Row with fields %s, expected %d values but got %s" % (self, len(self), args)

duckdb/udf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
def vectorized(func):
2-
"""Decorate a function with annotated function parameters, so DuckDB can infer that the function should be provided with pyarrow arrays and should expect pyarrow array(s) as output"""
2+
"""Decorate a function with annotated function parameters, so DuckDB can infer that the function should be provided with pyarrow arrays and should expect pyarrow array(s) as output."""
33
import types
44
from inspect import signature
55

sqllogic/conftest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def pytest_collection_modifyitems(session: pytest.Session, config: pytest.Config
271271

272272

273273
def pytest_runtest_setup(item: pytest.Item):
274-
"""Show the test index after the test name"""
274+
"""Show the test index after the test name."""
275275

276276
def get_from_tuple_list(tuples, key):
277277
for t in tuples:

tests/fast/spark/test_spark_dataframe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def test_df_columns(self, spark):
339339
assert "OtherInfo" in updatedDF.columns
340340

341341
def test_array_and_map_type(self, spark):
342-
"""Array & Map"""
342+
"""Array & Map."""
343343
arrayStructureSchema = StructType(
344344
[
345345
StructField(

tests/fast/test_json_logging.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77

88
def _parse_json_func(error_prefix: str):
9-
"""Helper to check that the error message is indeed parsable json"""
9+
"""Helper to check that the error message is indeed parsable json."""
1010

1111
def parse_func(exception):
1212
msg = exception.args[0]

tests/fast/test_pypi_cleanup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
"""Unit tests for pypi_cleanup.py
2+
"""Unit tests for pypi_cleanup.py.
33
44
Run with: python -m pytest test_pypi_cleanup.py -v
55
"""

0 commit comments

Comments
 (0)