Skip to content

Commit 4435f79

Browse files
refactor: ensure dve working on python 3.10
1 parent fc13439 commit 4435f79

3 files changed

Lines changed: 15 additions & 6 deletions

File tree

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ packages = [
99
]
1010
classifiers = [
1111
"Programming Language :: Python :: 3",
12-
"Programming Language :: Python :: 3.7",
12+
"Programming Language :: Python :: 3.10",
13+
"Programming Language :: Python :: 3.11",
1314
"Operating System :: OS Independent",
1415
"Topic :: Software Development :: Libraries",
1516
"Typing :: Typed",
1617
]
1718

1819
[tool.poetry.dependencies]
19-
python = ">=3.11,<3.12"
20+
python = ">=3.10,<3.12"
2021
boto3 = "1.34.162"
2122
botocore = "1.34.162"
2223
delta-spark = "2.4.0"

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,14 @@
33

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

815
import polars as pl
916
from lxml import etree # type: ignore
@@ -55,7 +62,7 @@ def create_template_row(schema: type[BaseModel]) -> dict[str, Any]:
5562
template_row[field_name] = None
5663
continue
5764

58-
if isinstance(field_type, type):
65+
if isinstance(field_type, type) and not isinstance(field_type, GenericAlias):
5966
if issubclass(field_type, BaseModel):
6067
template_row[field_name] = create_template_row(field_type)
6168
continue

src/dve/core_engine/backends/utilities.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from datetime import date, datetime
66
from decimal import Decimal
77
from typing import Any, ClassVar, Union
8+
from typing import GenericAlias # type: ignore
89

910
import polars as pl # type: ignore
1011
from polars.datatypes.classes import DataTypeClass as PolarsType
@@ -36,9 +37,9 @@
3637
"""A mapping of Python types to the equivalent Polars types."""
3738

3839

39-
def stringify_type(type_: type) -> type:
40+
def stringify_type(type_: Union[type, GenericAlias]) -> type:
4041
"""Stringify an individual type."""
41-
if isinstance(type_, type): # A model, return the contents.
42+
if isinstance(type_, type) and not isinstance(type_, GenericAlias): # A model, return the contents. # pylint: disable=C0301
4243
if issubclass(type_, BaseModel):
4344
return stringify_model(type_)
4445

0 commit comments

Comments
 (0)