Skip to content

Commit cebb932

Browse files
committed
Ruff E501: fixed and noqa'd too long lines
1 parent e92718d commit cebb932

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+207
-132
lines changed

duckdb/experimental/spark/context.py

Lines changed: 27 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def version(self) -> str: # noqa: D102
5858
def __repr__(self) -> str: # noqa: D105
5959
raise ContributionsAcceptedError
6060

61-
# def accumulator(self, value: ~T, accum_param: Optional[ForwardRef('AccumulatorParam[T]')] = None) -> 'Accumulator[T]':
61+
# def accumulator(self, value: ~T, accum_param: Optional[ForwardRef('AccumulatorParam[T]')] = None
62+
# ) -> 'Accumulator[T]':
6263
# pass
6364

6465
def addArchive(self, path: str) -> None: # noqa: D102
@@ -70,7 +71,8 @@ def addFile(self, path: str, recursive: bool = False) -> None: # noqa: D102
7071
def addPyFile(self, path: str) -> None: # noqa: D102
7172
raise ContributionsAcceptedError
7273

73-
# def binaryFiles(self, path: str, minPartitions: Optional[int] = None) -> duckdb.experimental.spark.rdd.RDD[typing.Tuple[str, bytes]]:
74+
# def binaryFiles(self, path: str, minPartitions: Optional[int] = None
75+
# ) -> duckdb.experimental.spark.rdd.RDD[typing.Tuple[str, bytes]]:
7476
# pass
7577

7678
# def binaryRecords(self, path: str, recordLength: int) -> duckdb.experimental.spark.rdd.RDD[bytes]:
@@ -100,16 +102,24 @@ def getConf(self) -> SparkConf: # noqa: D102
100102
def getLocalProperty(self, key: str) -> Optional[str]: # noqa: D102
101103
raise ContributionsAcceptedError
102104

103-
# def hadoopFile(self, path: str, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
105+
# def hadoopFile(self, path: str, inputFormatClass: str, keyClass: str, valueClass: str,
106+
# keyConverter: Optional[str] = None, valueConverter: Optional[str] = None,
107+
# conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
104108
# pass
105109

106-
# def hadoopRDD(self, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
110+
# def hadoopRDD(self, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None,
111+
# valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0
112+
# ) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
107113
# pass
108114

109-
# def newAPIHadoopFile(self, path: str, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
115+
# def newAPIHadoopFile(self, path: str, inputFormatClass: str, keyClass: str, valueClass: str,
116+
# keyConverter: Optional[str] = None, valueConverter: Optional[str] = None,
117+
# conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
110118
# pass
111119

112-
# def newAPIHadoopRDD(self, inputFormatClass: str, keyClass: str, valueClass: str, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
120+
# def newAPIHadoopRDD(self, inputFormatClass: str, keyClass: str, valueClass: str,
121+
# keyConverter: Optional[str] = None, valueConverter: Optional[str] = None,
122+
# conf: Optional[Dict[str, str]] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
113123
# pass
114124

115125
# def parallelize(self, c: Iterable[~T], numSlices: Optional[int] = None) -> pyspark.rdd.RDD[~T]:
@@ -118,13 +128,17 @@ def getLocalProperty(self, key: str) -> Optional[str]: # noqa: D102
118128
# def pickleFile(self, name: str, minPartitions: Optional[int] = None) -> pyspark.rdd.RDD[typing.Any]:
119129
# pass
120130

121-
# def range(self, start: int, end: Optional[int] = None, step: int = 1, numSlices: Optional[int] = None) -> pyspark.rdd.RDD[int]:
131+
# def range(self, start: int, end: Optional[int] = None, step: int = 1, numSlices: Optional[int] = None
132+
# ) -> pyspark.rdd.RDD[int]:
122133
# pass
123134

124-
# def runJob(self, rdd: pyspark.rdd.RDD[~T], partitionFunc: Callable[[Iterable[~T]], Iterable[~U]], partitions: Optional[Sequence[int]] = None, allowLocal: bool = False) -> List[~U]:
135+
# def runJob(self, rdd: pyspark.rdd.RDD[~T], partitionFunc: Callable[[Iterable[~T]], Iterable[~U]],
136+
# partitions: Optional[Sequence[int]] = None, allowLocal: bool = False) -> List[~U]:
125137
# pass
126138

127-
# def sequenceFile(self, path: str, keyClass: Optional[str] = None, valueClass: Optional[str] = None, keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, minSplits: Optional[int] = None, batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
139+
# def sequenceFile(self, path: str, keyClass: Optional[str] = None, valueClass: Optional[str] = None,
140+
# keyConverter: Optional[str] = None, valueConverter: Optional[str] = None, minSplits: Optional[int] = None,
141+
# batchSize: int = 0) -> pyspark.rdd.RDD[typing.Tuple[~T, ~U]]:
128142
# pass
129143

130144
def setCheckpointDir(self, dirName: str) -> None: # noqa: D102
@@ -151,13 +165,15 @@ def sparkUser(self) -> str: # noqa: D102
151165
# def statusTracker(self) -> duckdb.experimental.spark.status.StatusTracker:
152166
# raise ContributionsAcceptedError
153167

154-
# def textFile(self, name: str, minPartitions: Optional[int] = None, use_unicode: bool = True) -> pyspark.rdd.RDD[str]:
168+
# def textFile(self, name: str, minPartitions: Optional[int] = None, use_unicode: bool = True
169+
# ) -> pyspark.rdd.RDD[str]:
155170
# pass
156171

157172
# def union(self, rdds: List[pyspark.rdd.RDD[~T]]) -> pyspark.rdd.RDD[~T]:
158173
# pass
159174

160-
# def wholeTextFiles(self, path: str, minPartitions: Optional[int] = None, use_unicode: bool = True) -> pyspark.rdd.RDD[typing.Tuple[str, str]]:
175+
# def wholeTextFiles(self, path: str, minPartitions: Optional[int] = None, use_unicode: bool = True
176+
# ) -> pyspark.rdd.RDD[typing.Tuple[str, str]]:
161177
# pass
162178

163179

duckdb/experimental/spark/errors/error_classes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# # noqa: D100
1+
# ruff: noqa: D100, E501
22
# Licensed to the Apache Software Foundation (ASF) under one or more
33
# contributor license agreements. See the NOTICE file distributed with
44
# this work for additional information regarding copyright ownership.

duckdb/experimental/spark/sql/functions.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4879,7 +4879,9 @@ def octet_length(col: "ColumnOrName") -> Column:
48794879

48804880

48814881
def hex(col: "ColumnOrName") -> Column:
4882-
"""Computes hex value of the given column, which could be :class:`~pyspark.sql.types.StringType`, :class:`~pyspark.sql.types.BinaryType`, :class:`~pyspark.sql.types.IntegerType` or :class:`~pyspark.sql.types.LongType`.
4882+
"""Computes hex value of the given column, which could be :class:`~pyspark.sql.types.StringType`,
4883+
:class:`~pyspark.sql.types.BinaryType`, :class:`~pyspark.sql.types.IntegerType` or
4884+
:class:`~pyspark.sql.types.LongType`.
48834885
48844886
.. versionadded:: 1.5.0
48854887
@@ -4905,7 +4907,8 @@ def hex(col: "ColumnOrName") -> Column:
49054907

49064908

49074909
def unhex(col: "ColumnOrName") -> Column:
4908-
"""Inverse of hex. Interprets each pair of characters as a hexadecimal number and converts to the byte representation of number. column and returns it as a binary column.
4910+
"""Inverse of hex. Interprets each pair of characters as a hexadecimal number and converts to the byte
4911+
representation of number. column and returns it as a binary column.
49094912
49104913
.. versionadded:: 1.5.0
49114914

duckdb/experimental/spark/sql/session.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
# In spark:
2323
# SparkSession holds a SparkContext
2424
# SparkContext gets created from SparkConf
25-
# At this level the check is made to determine whether the instance already exists and just needs to be retrieved or it needs to be created
25+
# At this level the check is made to determine whether the instance already exists and just needs
26+
# to be retrieved or it needs to be created.
2627

2728
# For us this is done inside of `duckdb.connect`, based on the passed in path + configuration
2829
# SparkContext can be compared to our Connection class, and SparkConf to our ClientContext class

duckdb/experimental/spark/sql/types.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# This code is based on code from Apache Spark under the license found in the LICENSE file located in the 'spark' folder. # noqa: D100
1+
# This code is based on code from Apache Spark under the license found in the LICENSE # noqa: D100
2+
# file located in the 'spark' folder.
23

34
import calendar
45
import datetime
@@ -456,8 +457,8 @@ def simpleString(self) -> str: # noqa: D102
456457
class HugeIntegerType(IntegralType):
457458
"""Huge integer data type, i.e. a signed 128-bit integer.
458459
459-
If the values are beyond the range of [-170141183460469231731687303715884105728, 170141183460469231731687303715884105727],
460-
please use :class:`DecimalType`.
460+
If the values are beyond the range of [-170141183460469231731687303715884105728,
461+
170141183460469231731687303715884105727], please use :class:`DecimalType`.
461462
"""
462463

463464
def __init__(self) -> None: # noqa: D107

duckdb/query_graph/__main__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ def main() -> None: # noqa: D103
327327
exit(1)
328328
parser = argparse.ArgumentParser(
329329
prog="Query Graph Generator",
330-
description="Given a json profile output, generate a html file showing the query graph and timings of operators",
330+
description="""Given a json profile output, generate a html file showing the query graph and
331+
timings of operators""",
331332
)
332333
parser.add_argument("profile_input", help="profile input in json")
333334
parser.add_argument("--out", required=False, default=False)

duckdb/udf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33

44
def vectorized(func: Callable) -> Callable:
5-
"""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."""
5+
"""Decorate a function with annotated function parameters, so DuckDB can infer that the function should be
6+
provided with pyarrow arrays and should expect pyarrow array(s) as output.
7+
"""
68
import types
79
from inspect import signature
810

tests/extensions/test_httpfs.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ def test_s3fs(self, require):
3939
def test_httpfs(self, require, pandas):
4040
connection = require("httpfs")
4141
try:
42-
connection.execute(
43-
"SELECT id, first_name, last_name FROM PARQUET_SCAN('https://raw.githubusercontent.com/duckdb/duckdb/main/data/parquet-testing/userdata1.parquet') LIMIT 3;"
44-
)
42+
connection.execute("""
43+
SELECT id, first_name, last_name FROM PARQUET_SCAN(
44+
'https://raw.githubusercontent.com/duckdb/duckdb/main/data/parquet-testing/userdata1.parquet'
45+
) LIMIT 3;
46+
""")
4547
except RuntimeError as e:
4648
# Test will ignore result if it fails due to networking issues while running the test.
4749
if str(e).startswith("HTTP HEAD error") or str(e).startswith("Unable to connect"):

tests/fast/api/test_duckdb_connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def test_execute(self):
122122

123123
def test_executemany(self):
124124
# executemany does not keep an open result set
125-
# TODO: shouldn't we also have a version that executes a query multiple times with different parameters, returning all of the results?
125+
# TODO: shouldn't we also have a version that executes a query multiple times with different parameters,
126+
# returning all of the results?
126127
duckdb.execute("create table tbl (i integer, j varchar)")
127128
duckdb.executemany("insert into tbl VALUES (?, ?)", [(5, "test"), (2, "duck"), (42, "quack")])
128129
res = duckdb.table("tbl").fetchall()

tests/fast/api/test_duckdb_query.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def test_named_param_not_exhaustive(self):
111111

112112
with pytest.raises(
113113
duckdb.InvalidInputException,
114-
match="Invalid Input Error: Values were not provided for the following prepared statement parameters: name3",
114+
match="Invalid Input Error: Values were not provided for the following prepared statement parameters: name3", # noqa: E501
115115
):
116116
con.execute("select $name1, $name2, $name3", {"name1": 5, "name2": 3})
117117

@@ -184,7 +184,7 @@ def test_conversion_from_tuple(self):
184184
# we throw an error
185185
with pytest.raises(
186186
duckdb.InvalidInputException,
187-
match="Tried to create a STRUCT value from a tuple containing 3 elements, but the STRUCT consists of 2 children",
187+
match="Tried to create a STRUCT value from a tuple containing 3 elements, but the STRUCT consists of 2 children", # noqa: E501
188188
):
189189
result = con.execute("select $1", [Value(("a", 21, True), {"a": str, "b": int})]).fetchall()
190190

0 commit comments

Comments
 (0)