Skip to content

Commit 10a2496

Browse files
style: linting and autoformat
1 parent 8a853f5 commit 10a2496

File tree

7 files changed

+18
-29
lines changed

7 files changed

+18
-29
lines changed

src/dve/core_engine/backends/implementations/duckdb/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Implementation of duckdb backend"""
2+
23
from dve.core_engine.backends.implementations.duckdb.readers.json import DuckDBJSONReader
34
from dve.core_engine.backends.readers import register_reader
45

src/dve/core_engine/backends/implementations/spark/spark_helpers.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,7 @@
1212
from dataclasses import dataclass, is_dataclass
1313
from decimal import Decimal
1414
from functools import wraps
15-
from typing import (
16-
Any,
17-
ClassVar,
18-
Optional,
19-
TypeVar,
20-
Union,
21-
overload,
22-
)
15+
from typing import Any, ClassVar, Optional, TypeVar, Union, overload
2316

2417
from delta.exceptions import ConcurrentAppendException, DeltaConcurrentModificationException
2518
from pydantic import BaseModel

src/dve/core_engine/backends/readers/xml.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,7 @@
33

44
import re
55
from collections.abc import Collection, Iterator
6-
from typing import (
7-
IO,
8-
Any,
9-
GenericAlias, # type: ignore
10-
Optional,
11-
Union,
12-
overload
13-
)
6+
from typing import IO, Any, GenericAlias, Optional, Union, overload # type: ignore
147

158
import polars as pl
169
from lxml import etree # type: ignore

src/dve/core_engine/backends/utilities.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from dataclasses import is_dataclass
55
from datetime import date, datetime, time
66
from decimal import Decimal
7-
from typing import Any, ClassVar, Union
87
from typing import GenericAlias # type: ignore
8+
from typing import Any, ClassVar, Union
99

1010
import polars as pl # type: ignore
1111
from polars.datatypes.classes import DataTypeClass as PolarsType
@@ -40,7 +40,9 @@
4040

4141
def stringify_type(type_: Union[type, GenericAlias]) -> type:
4242
"""Stringify an individual type."""
43-
if isinstance(type_, type) and not isinstance(type_, GenericAlias): # A model, return the contents. # pylint: disable=C0301
43+
if isinstance(type_, type) and not isinstance(
44+
type_, GenericAlias
45+
): # A model, return the contents. # pylint: disable=C0301
4446
if issubclass(type_, BaseModel):
4547
return stringify_model(type_)
4648

src/dve/core_engine/message.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
import copy
44
import datetime as dt
5-
import operator
65
import json
6+
import operator
77
from collections.abc import Callable
88
from decimal import Decimal
99
from functools import reduce

src/dve/core_engine/type_hints.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
from pathlib import Path
77
from queue import Queue as ThreadQueue
88
from typing import TYPE_CHECKING, Any, List, Optional, TypeVar, Union # pylint: disable=W1901
9-
# TODO - cannot remove List from Typing. See L60 for details.
109

1110
from pyspark.sql import DataFrame
1211
from pyspark.sql.types import StructType
1312
from typing_extensions import Literal, ParamSpec, get_args
1413

14+
# TODO - cannot remove List from Typing. See L60 for details.
15+
16+
1517

1618
if TYPE_CHECKING: # pragma: no cover
1719
from dve.core_engine.message import FeedbackMessage

src/dve/metadata_parser/domain_types.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ class FormattedTime(dt.time):
408408
("", ".%f"),
409409
("%p", "%P", ""),
410410
("%z", ""),
411-
)
411+
),
412412
)
413413
) + list(
414414
# 12 hour time pattern combinations
@@ -419,7 +419,7 @@ class FormattedTime(dt.time):
419419
("", ".%f"),
420420
("%z", ""),
421421
(" %p", "%p", "%P", " %P", ""),
422-
)
422+
),
423423
)
424424
)
425425
"""A sequence of time format patterns to try if `TIME_FORMAT` is unset."""
@@ -454,9 +454,9 @@ def parse_time(cls, string: str) -> dt.time:
454454
raise ValueError("Unable to parse provided time")
455455

456456
@classmethod
457-
def validate(cls, value: Optional[Union[dt.time, dt.datetime, str]]) -> dt.time | None:
457+
def validate(cls, value: Union[dt.time, dt.datetime, str]) -> dt.time | None:
458458
"""Validate a passed time, datetime or string."""
459-
if not value:
459+
if value is None:
460460
return value
461461

462462
if isinstance(value, dt.time):
@@ -466,8 +466,8 @@ def validate(cls, value: Optional[Union[dt.time, dt.datetime, str]]) -> dt.time
466466
else:
467467
if cls.TIME_FORMAT is not None:
468468
try:
469-
new_time = dt.datetime.strptime(value, cls.TIME_FORMAT)
470-
new_time = cls.convert_to_time(new_time)
469+
new_time = dt.datetime.strptime(value, cls.TIME_FORMAT) # type: ignore
470+
new_time = cls.convert_to_time(new_time) # type: ignore
471471
except ValueError as err:
472472
raise ValueError(
473473
f"Unable to parse provided time in format {cls.TIME_FORMAT}"
@@ -478,9 +478,7 @@ def validate(cls, value: Optional[Union[dt.time, dt.datetime, str]]) -> dt.time
478478
if cls.TIMEZONE_TREATMENT == "forbid" and new_time.tzinfo:
479479
raise ValueError("Provided time has timezone, but this is forbidden for this field")
480480
if cls.TIMEZONE_TREATMENT == "require" and not new_time.tzinfo:
481-
raise ValueError(
482-
"Provided time missing timezone, but this is required for this field"
483-
)
481+
raise ValueError("Provided time missing timezone, but this is required for this field")
484482

485483
return new_time
486484

0 commit comments

Comments
 (0)