Skip to content

Commit 1ae1397

Browse files
committed
stubfix?
1 parent dd4f1b3 commit 1ae1397

File tree

9 files changed

+2988
-189
lines changed

9 files changed

+2988
-189
lines changed

duckdb/_duckdb/__init__.pyi

Lines changed: 2781 additions & 0 deletions
Large diffs are not rendered by default.

duckdb/_duckdb/functional.pyi

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
"""
2+
This module contains classes and methods related to functions and udf
3+
"""
4+
5+
from __future__ import annotations
6+
import typing
7+
8+
__all__: list[str] = ["ARROW", "DEFAULT", "FunctionNullHandling", "NATIVE", "PythonUDFType", "SPECIAL"]
9+
10+
class FunctionNullHandling:
11+
"""
12+
Members:
13+
14+
DEFAULT
15+
16+
SPECIAL
17+
"""
18+
19+
DEFAULT: typing.ClassVar[FunctionNullHandling] # value = <FunctionNullHandling.DEFAULT: 0>
20+
SPECIAL: typing.ClassVar[FunctionNullHandling] # value = <FunctionNullHandling.SPECIAL: 1>
21+
__members__: typing.ClassVar[
22+
dict[str, FunctionNullHandling]
23+
] # value = {'DEFAULT': <FunctionNullHandling.DEFAULT: 0>, 'SPECIAL': <FunctionNullHandling.SPECIAL: 1>}
24+
def __eq__(self, other: typing.Any) -> bool: ...
25+
def __getstate__(self) -> int: ...
26+
def __hash__(self) -> int: ...
27+
def __index__(self) -> int: ...
28+
def __init__(self, value: typing.SupportsInt) -> None: ...
29+
def __int__(self) -> int: ...
30+
def __ne__(self, other: typing.Any) -> bool: ...
31+
def __repr__(self) -> str: ...
32+
def __setstate__(self, state: typing.SupportsInt) -> None: ...
33+
def __str__(self) -> str: ...
34+
@property
35+
def name(self) -> str: ...
36+
@property
37+
def value(self) -> int: ...
38+
39+
class PythonUDFType:
40+
"""
41+
Members:
42+
43+
NATIVE
44+
45+
ARROW
46+
"""
47+
48+
ARROW: typing.ClassVar[PythonUDFType] # value = <PythonUDFType.ARROW: 1>
49+
NATIVE: typing.ClassVar[PythonUDFType] # value = <PythonUDFType.NATIVE: 0>
50+
__members__: typing.ClassVar[
51+
dict[str, PythonUDFType]
52+
] # value = {'NATIVE': <PythonUDFType.NATIVE: 0>, 'ARROW': <PythonUDFType.ARROW: 1>}
53+
def __eq__(self, other: typing.Any) -> bool: ...
54+
def __getstate__(self) -> int: ...
55+
def __hash__(self) -> int: ...
56+
def __index__(self) -> int: ...
57+
def __init__(self, value: typing.SupportsInt) -> None: ...
58+
def __int__(self) -> int: ...
59+
def __ne__(self, other: typing.Any) -> bool: ...
60+
def __repr__(self) -> str: ...
61+
def __setstate__(self, state: typing.SupportsInt) -> None: ...
62+
def __str__(self) -> str: ...
63+
@property
64+
def name(self) -> str: ...
65+
@property
66+
def value(self) -> int: ...
67+
68+
ARROW: PythonUDFType # value = <PythonUDFType.ARROW: 1>
69+
DEFAULT: FunctionNullHandling # value = <FunctionNullHandling.DEFAULT: 0>
70+
NATIVE: PythonUDFType # value = <PythonUDFType.NATIVE: 0>
71+
SPECIAL: FunctionNullHandling # value = <FunctionNullHandling.SPECIAL: 1>

duckdb/_duckdb/typing.pyi

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
"""
2+
This module contains classes and methods related to typing
3+
"""
4+
5+
from __future__ import annotations
6+
import duckdb
7+
import typing
8+
9+
__all__: list[str] = [
10+
"BIGINT",
11+
"BIT",
12+
"BLOB",
13+
"BOOLEAN",
14+
"DATE",
15+
"DOUBLE",
16+
"DuckDBPyType",
17+
"FLOAT",
18+
"HUGEINT",
19+
"INTEGER",
20+
"INTERVAL",
21+
"SMALLINT",
22+
"SQLNULL",
23+
"TIME",
24+
"TIMESTAMP",
25+
"TIMESTAMP_MS",
26+
"TIMESTAMP_NS",
27+
"TIMESTAMP_S",
28+
"TIMESTAMP_TZ",
29+
"TIME_TZ",
30+
"TINYINT",
31+
"UBIGINT",
32+
"UHUGEINT",
33+
"UINTEGER",
34+
"USMALLINT",
35+
"UTINYINT",
36+
"UUID",
37+
"VARCHAR",
38+
]
39+
40+
class DuckDBPyType:
41+
@typing.overload
42+
def __eq__(self, other: DuckDBPyType) -> bool:
43+
"""
44+
Compare two types for equality
45+
"""
46+
@typing.overload
47+
def __eq__(self, other: str) -> bool:
48+
"""
49+
Compare two types for equality
50+
"""
51+
def __getattr__(self, name: str) -> DuckDBPyType:
52+
"""
53+
Get the child type by 'name'
54+
"""
55+
def __getitem__(self, name: str) -> DuckDBPyType:
56+
"""
57+
Get the child type by 'name'
58+
"""
59+
def __hash__(self) -> int: ...
60+
@typing.overload
61+
def __init__(self, type_str: str, connection: typing.Optional[duckdb.DuckDBPyConnection] = None) -> None:
62+
"""
63+
Construct a DuckDBPyType from a type name and optional connection.
64+
"""
65+
66+
@typing.overload
67+
def __init__(self, obj: object) -> None:
68+
"""
69+
Construct a DuckDBPyType from a Python type (types.*) or object.
70+
"""
71+
def __repr__(self) -> str:
72+
"""
73+
Stringified representation of the type object
74+
"""
75+
@property
76+
def children(self) -> list: ...
77+
@property
78+
def id(self) -> str: ...
79+
80+
BIGINT: DuckDBPyType # value = BIGINT
81+
BIT: DuckDBPyType # value = BIT
82+
BLOB: DuckDBPyType # value = BLOB
83+
BOOLEAN: DuckDBPyType # value = BOOLEAN
84+
DATE: DuckDBPyType # value = DATE
85+
DOUBLE: DuckDBPyType # value = DOUBLE
86+
FLOAT: DuckDBPyType # value = FLOAT
87+
HUGEINT: DuckDBPyType # value = HUGEINT
88+
INTEGER: DuckDBPyType # value = INTEGER
89+
INTERVAL: DuckDBPyType # value = INTERVAL
90+
SMALLINT: DuckDBPyType # value = SMALLINT
91+
SQLNULL: DuckDBPyType # value = "NULL"
92+
TIME: DuckDBPyType # value = TIME
93+
TIMESTAMP: DuckDBPyType # value = TIMESTAMP
94+
TIMESTAMP_MS: DuckDBPyType # value = TIMESTAMP_MS
95+
TIMESTAMP_NS: DuckDBPyType # value = TIMESTAMP_NS
96+
TIMESTAMP_S: DuckDBPyType # value = TIMESTAMP_S
97+
TIMESTAMP_TZ: DuckDBPyType # value = TIMESTAMP WITH TIME ZONE
98+
TIME_TZ: DuckDBPyType # value = TIME WITH TIME ZONE
99+
TINYINT: DuckDBPyType # value = TINYINT
100+
UBIGINT: DuckDBPyType # value = UBIGINT
101+
UHUGEINT: DuckDBPyType # value = UHUGEINT
102+
UINTEGER: DuckDBPyType # value = UINTEGER
103+
USMALLINT: DuckDBPyType # value = USMALLINT
104+
UTINYINT: DuckDBPyType # value = UTINYINT
105+
UUID: DuckDBPyType # value = UUID
106+
VARCHAR: DuckDBPyType # value = VARCHAR

duckdb/functional/__init__.pyi

Lines changed: 0 additions & 31 deletions
This file was deleted.
File renamed without changes.

duckdb/typing/__init__.pyi

Lines changed: 0 additions & 38 deletions
This file was deleted.

duckdb/value/constant/__init__.pyi

Lines changed: 0 additions & 114 deletions
This file was deleted.

pyproject.toml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,27 @@ dev = [ # tooling like uv will install this automatically when syncing the envir
297297
# - pytest
298298
######################################################################################################
299299

300+
[tool.mypy]
301+
packages = ["duckdb"]
302+
strict = true
303+
warn_unreachable = true
304+
pretty = true
305+
python_version = "3.9"
306+
exclude = [
307+
"duckdb/experimental/",
308+
"duckdb/functional/",
309+
"duckdb/query_graph/",
310+
"duckdb/typing/",
311+
"duckdb/value/",
312+
]
313+
314+
[[tool.mypy.overrides]]
315+
module = [
316+
# "some_untyped_dependency.*",
317+
# "another_untyped_lib"
318+
]
319+
ignore_missing_imports = true
320+
300321
[tool.pytest.ini_options]
301322
minversion = "6.0"
302323
addopts = "-ra -q"

0 commit comments

Comments
 (0)