Skip to content

Commit 618e5b3

Browse files
committed
replace use of deprecated typing._UnionGenericAlias
1 parent 95dc959 commit 618e5b3

21 files changed

+92
-78
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ dev = [ # tooling like uv will install this automatically when syncing the envir
305305

306306
[tool.pytest.ini_options]
307307
minversion = "6.0"
308-
addopts = "-ra --numprocesses 4 --dist loadfile --verbose"
308+
addopts = "-ra -p no:xdist --verbose"
309309
testpaths = ["tests"]
310310
filterwarnings = [
311311
"error",

scripts/cache_data.json

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -622,7 +622,8 @@
622622
"full_path": "typing",
623623
"name": "typing",
624624
"children": [
625-
"typing._UnionGenericAlias"
625+
"typing.Union",
626+
"typing.get_origin"
626627
]
627628
},
628629
"typing._UnionGenericAlias": {
@@ -793,5 +794,17 @@
793794
"full_path": "pyarrow.decimal128",
794795
"name": "decimal128",
795796
"children": []
797+
},
798+
"typing.get_origin": {
799+
"type": "attribute",
800+
"full_path": "typing.get_origin",
801+
"name": "get_origin",
802+
"children": []
803+
},
804+
"typing.Union": {
805+
"type": "attribute",
806+
"full_path": "typing.Union",
807+
"name": "Union",
808+
"children": []
796809
}
797810
}

scripts/generate_import_cache_cpp.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ def to_string(self):
151151
152152
//! Note: This class is generated using scripts.
153153
//! If you need to add a new object to the cache you must:
154-
//! 1. adjust tools/pythonpkg/scripts/imports.py
155-
//! 2. run python3 tools/pythonpkg/scripts/generate_import_cache_json.py
156-
//! 3. run python3 tools/pythonpkg/scripts/generate_import_cache_cpp.py
157-
//! 4. run make format-main (the generator doesn't respect the formatting rules ;))
154+
//! 1. adjust scripts/imports.py
155+
//! 2. run python scripts/generate_import_cache_json.py
156+
//! 3. run python scripts/generate_import_cache_cpp.py
157+
//! 4. run pre-commit to fix formatting errors
158158
159159
namespace duckdb {{
160160
{self.get_classes()}
@@ -230,7 +230,7 @@ def get_root_modules(files: list[ModuleFile]):
230230

231231

232232
def get_module_file_path_includes(files: list[ModuleFile]):
233-
template = '#include "duckdb_python/import_cache/modules/{}'
233+
template = '#include "duckdb_python/import_cache/modules/{}"'
234234
return "\n".join(template.format(f.file_name) for f in files)
235235

236236

scripts/imports.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@
128128

129129
import typing
130130

131-
typing._UnionGenericAlias
131+
typing.Union
132+
typing.get_origin
132133

133134
import uuid
134135

src/duckdb_py/include/duckdb_python/import_cache/modules/collections_module.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
//! Note: This class is generated using scripts.
1515
//! If you need to add a new object to the cache you must:
16-
//! 1. adjust tools/pythonpkg/scripts/imports.py
17-
//! 2. run python3 tools/pythonpkg/scripts/generate_import_cache_json.py
18-
//! 3. run python3 tools/pythonpkg/scripts/generate_import_cache_cpp.py
19-
//! 4. run make format-main (the generator doesn't respect the formatting rules ;))
16+
//! 1. adjust scripts/imports.py
17+
//! 2. run python scripts/generate_import_cache_json.py
18+
//! 3. run python scripts/generate_import_cache_cpp.py
19+
//! 4. run pre-commit to fix formatting errors
2020

2121
namespace duckdb {
2222

src/duckdb_py/include/duckdb_python/import_cache/modules/datetime_module.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
//! Note: This class is generated using scripts.
1515
//! If you need to add a new object to the cache you must:
16-
//! 1. adjust tools/pythonpkg/scripts/imports.py
17-
//! 2. run python3 tools/pythonpkg/scripts/generate_import_cache_json.py
18-
//! 3. run python3 tools/pythonpkg/scripts/generate_import_cache_cpp.py
19-
//! 4. run make format-main (the generator doesn't respect the formatting rules ;))
16+
//! 1. adjust scripts/imports.py
17+
//! 2. run python scripts/generate_import_cache_json.py
18+
//! 3. run python scripts/generate_import_cache_cpp.py
19+
//! 4. run pre-commit to fix formatting errors
2020

2121
namespace duckdb {
2222

src/duckdb_py/include/duckdb_python/import_cache/modules/decimal_module.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
//! Note: This class is generated using scripts.
1515
//! If you need to add a new object to the cache you must:
16-
//! 1. adjust tools/pythonpkg/scripts/imports.py
17-
//! 2. run python3 tools/pythonpkg/scripts/generate_import_cache_json.py
18-
//! 3. run python3 tools/pythonpkg/scripts/generate_import_cache_cpp.py
19-
//! 4. run make format-main (the generator doesn't respect the formatting rules ;))
16+
//! 1. adjust scripts/imports.py
17+
//! 2. run python scripts/generate_import_cache_json.py
18+
//! 3. run python scripts/generate_import_cache_cpp.py
19+
//! 4. run pre-commit to fix formatting errors
2020

2121
namespace duckdb {
2222

src/duckdb_py/include/duckdb_python/import_cache/modules/duckdb_module.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
//! Note: This class is generated using scripts.
1515
//! If you need to add a new object to the cache you must:
16-
//! 1. adjust tools/pythonpkg/scripts/imports.py
17-
//! 2. run python3 tools/pythonpkg/scripts/generate_import_cache_json.py
18-
//! 3. run python3 tools/pythonpkg/scripts/generate_import_cache_cpp.py
19-
//! 4. run make format-main (the generator doesn't respect the formatting rules ;))
16+
//! 1. adjust scripts/imports.py
17+
//! 2. run python scripts/generate_import_cache_json.py
18+
//! 3. run python scripts/generate_import_cache_cpp.py
19+
//! 4. run pre-commit to fix formatting errors
2020

2121
namespace duckdb {
2222

src/duckdb_py/include/duckdb_python/import_cache/modules/ipython_module.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
//! Note: This class is generated using scripts.
1515
//! If you need to add a new object to the cache you must:
16-
//! 1. adjust tools/pythonpkg/scripts/imports.py
17-
//! 2. run python3 tools/pythonpkg/scripts/generate_import_cache_json.py
18-
//! 3. run python3 tools/pythonpkg/scripts/generate_import_cache_cpp.py
19-
//! 4. run make format-main (the generator doesn't respect the formatting rules ;))
16+
//! 1. adjust scripts/imports.py
17+
//! 2. run python scripts/generate_import_cache_json.py
18+
//! 3. run python scripts/generate_import_cache_cpp.py
19+
//! 4. run pre-commit to fix formatting errors
2020

2121
namespace duckdb {
2222

src/duckdb_py/include/duckdb_python/import_cache/modules/ipywidgets_module.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313

1414
//! Note: This class is generated using scripts.
1515
//! If you need to add a new object to the cache you must:
16-
//! 1. adjust tools/pythonpkg/scripts/imports.py
17-
//! 2. run python3 tools/pythonpkg/scripts/generate_import_cache_json.py
18-
//! 3. run python3 tools/pythonpkg/scripts/generate_import_cache_cpp.py
19-
//! 4. run make format-main (the generator doesn't respect the formatting rules ;))
16+
//! 1. adjust scripts/imports.py
17+
//! 2. run python scripts/generate_import_cache_json.py
18+
//! 3. run python scripts/generate_import_cache_cpp.py
19+
//! 4. run pre-commit to fix formatting errors
2020

2121
namespace duckdb {
2222

0 commit comments

Comments
 (0)