Skip to content

Commit a062e37

Browse files
committed
Ruff linter fixes
1 parent 5146c6f commit a062e37

File tree

296 files changed

+2148
-2426
lines changed

Some content is hidden

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

296 files changed

+2148
-2426
lines changed

adbc_driver_duckdb/dbapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
"""
19-
DBAPI 2.0-compatible facade for the ADBC DuckDB driver.
18+
"""DBAPI 2.0-compatible facade for the ADBC DuckDB driver.
2019
"""
2120

2221
import typing
2322

2423
import adbc_driver_manager
2524
import adbc_driver_manager.dbapi
25+
2626
import adbc_driver_duckdb
2727

2828
__all__ = [

duckdb/__init__.py

Lines changed: 115 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Modules
2+
from importlib.metadata import version
3+
4+
from _duckdb import __version__ as duckdb_version
5+
26
import duckdb.functional as functional
37
import duckdb.typing as typing
4-
from _duckdb import __version__ as duckdb_version
5-
from importlib.metadata import version
68

79
# duckdb.__version__ returns the version of the distribution package, i.e. the pypi version
810
__version__ = version("duckdb")
@@ -19,25 +21,25 @@ def version():
1921

2022
# Classes
2123
from _duckdb import (
22-
DuckDBPyRelation,
24+
CaseExpression,
25+
CoalesceOperator,
26+
ColumnExpression,
27+
ConstantExpression,
28+
CSVLineTerminator,
29+
DefaultExpression,
2330
DuckDBPyConnection,
24-
Statement,
25-
ExplainType,
26-
StatementType,
31+
DuckDBPyRelation,
2732
ExpectedResultType,
28-
CSVLineTerminator,
29-
PythonExceptionHandling,
30-
RenderMode,
33+
ExplainType,
3134
Expression,
32-
ConstantExpression,
33-
ColumnExpression,
34-
DefaultExpression,
35-
CoalesceOperator,
36-
LambdaExpression,
37-
StarExpression,
3835
FunctionExpression,
39-
CaseExpression,
36+
LambdaExpression,
37+
PythonExceptionHandling,
38+
RenderMode,
4039
SQLExpression,
40+
StarExpression,
41+
Statement,
42+
StatementType,
4143
)
4244

4345
_exported_symbols.extend(
@@ -61,91 +63,85 @@ def version():
6163

6264
# These are overloaded twice, we define them inside of C++ so pybind can deal with it
6365
_exported_symbols.extend(["df", "arrow"])
64-
from _duckdb import df, arrow
65-
6666
# NOTE: this section is generated by tools/pythonpkg/scripts/generate_connection_wrapper_methods.py.
6767
# Do not edit this section manually, your changes will be overwritten!
68-
6968
# START OF CONNECTION WRAPPER
70-
7169
from _duckdb import (
72-
cursor,
73-
register_filesystem,
74-
unregister_filesystem,
75-
list_filesystems,
76-
filesystem_is_registered,
77-
create_function,
78-
remove_function,
79-
sqltype,
80-
dtype,
81-
type,
70+
aggregate,
71+
alias,
72+
append,
8273
array_type,
83-
list_type,
84-
union_type,
85-
string_type,
86-
enum_type,
74+
arrow,
75+
begin,
76+
checkpoint,
77+
close,
78+
commit,
79+
create_function,
80+
cursor,
8781
decimal_type,
88-
struct_type,
89-
row_type,
90-
map_type,
82+
description,
83+
df,
84+
distinct,
85+
dtype,
9186
duplicate,
87+
enum_type,
9288
execute,
9389
executemany,
94-
close,
95-
interrupt,
96-
query_progress,
97-
fetchone,
98-
fetchmany,
99-
fetchall,
100-
fetchnumpy,
101-
fetchdf,
90+
extract_statements,
91+
fetch_arrow_table,
10292
fetch_df,
103-
df,
10493
fetch_df_chunk,
105-
pl,
106-
fetch_arrow_table,
107-
arrow,
10894
fetch_record_batch,
109-
torch,
110-
tf,
111-
begin,
112-
commit,
113-
rollback,
114-
checkpoint,
115-
append,
116-
register,
117-
unregister,
118-
table,
119-
view,
120-
values,
121-
table_function,
122-
read_json,
123-
extract_statements,
124-
sql,
125-
query,
126-
from_query,
127-
read_csv,
95+
fetchall,
96+
fetchdf,
97+
fetchmany,
98+
fetchnumpy,
99+
fetchone,
100+
filesystem_is_registered,
101+
filter,
102+
from_arrow,
128103
from_csv_auto,
129104
from_df,
130-
from_arrow,
131-
from_parquet,
132-
read_parquet,
133105
from_parquet,
134-
read_parquet,
106+
from_query,
135107
get_table_names,
136108
install_extension,
137-
load_extension,
138-
project,
139-
distinct,
140-
write_csv,
141-
aggregate,
142-
alias,
143-
filter,
109+
interrupt,
144110
limit,
111+
list_filesystems,
112+
list_type,
113+
load_extension,
114+
map_type,
145115
order,
116+
pl,
117+
project,
118+
query,
146119
query_df,
147-
description,
120+
query_progress,
121+
read_csv,
122+
read_json,
123+
read_parquet,
124+
register,
125+
register_filesystem,
126+
remove_function,
127+
rollback,
128+
row_type,
148129
rowcount,
130+
sql,
131+
sqltype,
132+
string_type,
133+
struct_type,
134+
table,
135+
table_function,
136+
tf,
137+
torch,
138+
type,
139+
union_type,
140+
unregister,
141+
unregister_filesystem,
142+
values,
143+
view,
144+
write_csv,
149145
)
150146

151147
_exported_symbols.extend(
@@ -233,17 +229,17 @@ def version():
233229
# END OF CONNECTION WRAPPER
234230

235231
# Enums
236-
from _duckdb import ANALYZE, DEFAULT, RETURN_NULL, STANDARD, COLUMNS, ROWS
232+
from _duckdb import ANALYZE, COLUMNS, DEFAULT, RETURN_NULL, ROWS, STANDARD
237233

238234
_exported_symbols.extend(["ANALYZE", "DEFAULT", "RETURN_NULL", "STANDARD"])
239235

240236

241237
# read-only properties
242238
from _duckdb import (
243-
__standard_vector_size__,
239+
__formatted_python_version__,
244240
__interactive__,
245241
__jupyter__,
246-
__formatted_python_version__,
242+
__standard_vector_size__,
247243
apilevel,
248244
comment,
249245
identifier,
@@ -294,35 +290,35 @@ def version():
294290

295291
# Exceptions
296292
from _duckdb import (
297-
Error,
298-
DataError,
293+
BinderException,
294+
CatalogException,
295+
ConnectionException,
296+
ConstraintException,
299297
ConversionException,
300-
OutOfRangeException,
301-
TypeMismatchException,
298+
DataError,
299+
Error,
302300
FatalException,
301+
HTTPException,
303302
IntegrityError,
304-
ConstraintException,
305303
InternalError,
306304
InternalException,
307305
InterruptException,
308-
NotSupportedError,
306+
InvalidInputException,
307+
InvalidTypeException,
308+
IOException,
309309
NotImplementedException,
310+
NotSupportedError,
310311
OperationalError,
311-
ConnectionException,
312-
IOException,
313-
HTTPException,
314312
OutOfMemoryException,
315-
SerializationException,
316-
TransactionException,
313+
OutOfRangeException,
314+
ParserException,
317315
PermissionException,
318316
ProgrammingError,
319-
BinderException,
320-
CatalogException,
321-
InvalidInputException,
322-
InvalidTypeException,
323-
ParserException,
324-
SyntaxException,
325317
SequenceException,
318+
SerializationException,
319+
SyntaxException,
320+
TransactionException,
321+
TypeMismatchException,
326322
Warning,
327323
)
328324

@@ -363,34 +359,34 @@ def version():
363359

364360
# Value
365361
from duckdb.value.constant import (
366-
Value,
367-
NullValue,
368-
BooleanValue,
369-
UnsignedBinaryValue,
370-
UnsignedShortValue,
371-
UnsignedIntegerValue,
372-
UnsignedLongValue,
373362
BinaryValue,
374-
ShortValue,
375-
IntegerValue,
376-
LongValue,
377-
HugeIntegerValue,
378-
FloatValue,
379-
DoubleValue,
380-
DecimalValue,
381-
StringValue,
382-
UUIDValue,
383363
BitValue,
384364
BlobValue,
365+
BooleanValue,
385366
DateValue,
367+
DecimalValue,
368+
DoubleValue,
369+
FloatValue,
370+
HugeIntegerValue,
371+
IntegerValue,
386372
IntervalValue,
387-
TimestampValue,
388-
TimestampSecondValue,
373+
LongValue,
374+
NullValue,
375+
ShortValue,
376+
StringValue,
389377
TimestampMilisecondValue,
390378
TimestampNanosecondValue,
379+
TimestampSecondValue,
391380
TimestampTimeZoneValue,
392-
TimeValue,
381+
TimestampValue,
393382
TimeTimeZoneValue,
383+
TimeValue,
384+
UnsignedBinaryValue,
385+
UnsignedIntegerValue,
386+
UnsignedLongValue,
387+
UnsignedShortValue,
388+
UUIDValue,
389+
Value,
394390
)
395391

396392
_exported_symbols.extend(
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
from .sql import SparkSession, DataFrame
1+
from ._globals import _NoValue
22
from .conf import SparkConf
33
from .context import SparkContext
4-
from ._globals import _NoValue
54
from .exception import ContributionsAcceptedError
5+
from .sql import DataFrame, SparkSession
66

7-
__all__ = ["SparkSession", "DataFrame", "SparkConf", "SparkContext", "ContributionsAcceptedError"]
7+
__all__ = ["ContributionsAcceptedError", "DataFrame", "SparkConf", "SparkContext", "SparkSession"]

duckdb/experimental/spark/_globals.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
"""
19-
Module defining global singleton classes.
18+
"""Module defining global singleton classes.
2019
2120
This module raises a RuntimeError if an attempt to reload it is made. In that
2221
way the identities of the classes defined here are fixed and will remain so

duckdb/experimental/spark/_typing.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@
1616
# specific language governing permissions and limitations
1717
# under the License.
1818

19-
from typing import Callable, Iterable, Sized, TypeVar, Union
20-
from typing_extensions import Literal, Protocol
19+
from collections.abc import Iterable, Sized
20+
from typing import Callable, TypeVar, Union
2121

22-
from numpy import int32, int64, float32, float64, ndarray
22+
from numpy import float32, float64, int32, int64, ndarray
23+
from typing_extensions import Literal, Protocol
2324

2425
F = TypeVar("F", bound=Callable)
2526
T_co = TypeVar("T_co", covariant=True)

duckdb/experimental/spark/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from typing import Optional, List, Tuple
1+
from typing import Optional
2+
23
from duckdb.experimental.spark.exception import ContributionsAcceptedError
34

45

0 commit comments

Comments
 (0)