polars-runtime-compat 1.34.0b3__cp39-abi3-win_arm64.whl → 1.34.0b4__cp39-abi3-win_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of polars-runtime-compat might be problematic. Click here for more details.
- _polars_runtime_compat/_polars_runtime_compat.pyd +0 -0
- {polars_runtime_compat-1.34.0b3.dist-info → polars_runtime_compat-1.34.0b4.dist-info}/METADATA +1 -1
- polars_runtime_compat-1.34.0b4.dist-info/RECORD +6 -0
- polars/__init__.py +0 -528
- polars/_cpu_check.py +0 -265
- polars/_dependencies.py +0 -355
- polars/_plr.py +0 -99
- polars/_plr.pyi +0 -2496
- polars/_reexport.py +0 -23
- polars/_typing.py +0 -478
- polars/_utils/__init__.py +0 -37
- polars/_utils/async_.py +0 -102
- polars/_utils/cache.py +0 -176
- polars/_utils/cloud.py +0 -40
- polars/_utils/constants.py +0 -29
- polars/_utils/construction/__init__.py +0 -46
- polars/_utils/construction/dataframe.py +0 -1397
- polars/_utils/construction/other.py +0 -72
- polars/_utils/construction/series.py +0 -560
- polars/_utils/construction/utils.py +0 -118
- polars/_utils/convert.py +0 -224
- polars/_utils/deprecation.py +0 -406
- polars/_utils/getitem.py +0 -457
- polars/_utils/logging.py +0 -11
- polars/_utils/nest_asyncio.py +0 -264
- polars/_utils/parquet.py +0 -15
- polars/_utils/parse/__init__.py +0 -12
- polars/_utils/parse/expr.py +0 -242
- polars/_utils/polars_version.py +0 -19
- polars/_utils/pycapsule.py +0 -53
- polars/_utils/scan.py +0 -27
- polars/_utils/serde.py +0 -63
- polars/_utils/slice.py +0 -215
- polars/_utils/udfs.py +0 -1251
- polars/_utils/unstable.py +0 -63
- polars/_utils/various.py +0 -782
- polars/_utils/wrap.py +0 -25
- polars/api.py +0 -370
- polars/catalog/__init__.py +0 -0
- polars/catalog/unity/__init__.py +0 -19
- polars/catalog/unity/client.py +0 -733
- polars/catalog/unity/models.py +0 -152
- polars/config.py +0 -1571
- polars/convert/__init__.py +0 -25
- polars/convert/general.py +0 -1046
- polars/convert/normalize.py +0 -261
- polars/dataframe/__init__.py +0 -5
- polars/dataframe/_html.py +0 -186
- polars/dataframe/frame.py +0 -12582
- polars/dataframe/group_by.py +0 -1067
- polars/dataframe/plotting.py +0 -257
- polars/datatype_expr/__init__.py +0 -5
- polars/datatype_expr/array.py +0 -56
- polars/datatype_expr/datatype_expr.py +0 -304
- polars/datatype_expr/list.py +0 -18
- polars/datatype_expr/struct.py +0 -69
- polars/datatypes/__init__.py +0 -122
- polars/datatypes/_parse.py +0 -195
- polars/datatypes/_utils.py +0 -48
- polars/datatypes/classes.py +0 -1213
- polars/datatypes/constants.py +0 -11
- polars/datatypes/constructor.py +0 -172
- polars/datatypes/convert.py +0 -366
- polars/datatypes/group.py +0 -130
- polars/exceptions.py +0 -230
- polars/expr/__init__.py +0 -7
- polars/expr/array.py +0 -964
- polars/expr/binary.py +0 -346
- polars/expr/categorical.py +0 -306
- polars/expr/datetime.py +0 -2620
- polars/expr/expr.py +0 -11272
- polars/expr/list.py +0 -1408
- polars/expr/meta.py +0 -444
- polars/expr/name.py +0 -321
- polars/expr/string.py +0 -3045
- polars/expr/struct.py +0 -357
- polars/expr/whenthen.py +0 -185
- polars/functions/__init__.py +0 -193
- polars/functions/aggregation/__init__.py +0 -33
- polars/functions/aggregation/horizontal.py +0 -298
- polars/functions/aggregation/vertical.py +0 -341
- polars/functions/as_datatype.py +0 -848
- polars/functions/business.py +0 -138
- polars/functions/col.py +0 -384
- polars/functions/datatype.py +0 -121
- polars/functions/eager.py +0 -524
- polars/functions/escape_regex.py +0 -29
- polars/functions/lazy.py +0 -2751
- polars/functions/len.py +0 -68
- polars/functions/lit.py +0 -210
- polars/functions/random.py +0 -22
- polars/functions/range/__init__.py +0 -19
- polars/functions/range/_utils.py +0 -15
- polars/functions/range/date_range.py +0 -303
- polars/functions/range/datetime_range.py +0 -370
- polars/functions/range/int_range.py +0 -348
- polars/functions/range/linear_space.py +0 -311
- polars/functions/range/time_range.py +0 -287
- polars/functions/repeat.py +0 -301
- polars/functions/whenthen.py +0 -353
- polars/interchange/__init__.py +0 -10
- polars/interchange/buffer.py +0 -77
- polars/interchange/column.py +0 -190
- polars/interchange/dataframe.py +0 -230
- polars/interchange/from_dataframe.py +0 -328
- polars/interchange/protocol.py +0 -303
- polars/interchange/utils.py +0 -170
- polars/io/__init__.py +0 -64
- polars/io/_utils.py +0 -317
- polars/io/avro.py +0 -49
- polars/io/clipboard.py +0 -36
- polars/io/cloud/__init__.py +0 -17
- polars/io/cloud/_utils.py +0 -80
- polars/io/cloud/credential_provider/__init__.py +0 -17
- polars/io/cloud/credential_provider/_builder.py +0 -520
- polars/io/cloud/credential_provider/_providers.py +0 -618
- polars/io/csv/__init__.py +0 -9
- polars/io/csv/_utils.py +0 -38
- polars/io/csv/batched_reader.py +0 -142
- polars/io/csv/functions.py +0 -1495
- polars/io/database/__init__.py +0 -6
- polars/io/database/_arrow_registry.py +0 -70
- polars/io/database/_cursor_proxies.py +0 -147
- polars/io/database/_executor.py +0 -578
- polars/io/database/_inference.py +0 -314
- polars/io/database/_utils.py +0 -144
- polars/io/database/functions.py +0 -516
- polars/io/delta.py +0 -499
- polars/io/iceberg/__init__.py +0 -3
- polars/io/iceberg/_utils.py +0 -697
- polars/io/iceberg/dataset.py +0 -556
- polars/io/iceberg/functions.py +0 -151
- polars/io/ipc/__init__.py +0 -8
- polars/io/ipc/functions.py +0 -514
- polars/io/json/__init__.py +0 -3
- polars/io/json/read.py +0 -101
- polars/io/ndjson.py +0 -332
- polars/io/parquet/__init__.py +0 -17
- polars/io/parquet/field_overwrites.py +0 -140
- polars/io/parquet/functions.py +0 -722
- polars/io/partition.py +0 -491
- polars/io/plugins.py +0 -187
- polars/io/pyarrow_dataset/__init__.py +0 -5
- polars/io/pyarrow_dataset/anonymous_scan.py +0 -109
- polars/io/pyarrow_dataset/functions.py +0 -79
- polars/io/scan_options/__init__.py +0 -5
- polars/io/scan_options/_options.py +0 -59
- polars/io/scan_options/cast_options.py +0 -126
- polars/io/spreadsheet/__init__.py +0 -6
- polars/io/spreadsheet/_utils.py +0 -52
- polars/io/spreadsheet/_write_utils.py +0 -647
- polars/io/spreadsheet/functions.py +0 -1323
- polars/lazyframe/__init__.py +0 -9
- polars/lazyframe/engine_config.py +0 -61
- polars/lazyframe/frame.py +0 -8564
- polars/lazyframe/group_by.py +0 -669
- polars/lazyframe/in_process.py +0 -42
- polars/lazyframe/opt_flags.py +0 -333
- polars/meta/__init__.py +0 -14
- polars/meta/build.py +0 -33
- polars/meta/index_type.py +0 -27
- polars/meta/thread_pool.py +0 -50
- polars/meta/versions.py +0 -120
- polars/ml/__init__.py +0 -0
- polars/ml/torch.py +0 -213
- polars/ml/utilities.py +0 -30
- polars/plugins.py +0 -155
- polars/py.typed +0 -0
- polars/pyproject.toml +0 -103
- polars/schema.py +0 -265
- polars/selectors.py +0 -3117
- polars/series/__init__.py +0 -5
- polars/series/array.py +0 -776
- polars/series/binary.py +0 -254
- polars/series/categorical.py +0 -246
- polars/series/datetime.py +0 -2275
- polars/series/list.py +0 -1087
- polars/series/plotting.py +0 -191
- polars/series/series.py +0 -9197
- polars/series/string.py +0 -2367
- polars/series/struct.py +0 -154
- polars/series/utils.py +0 -191
- polars/sql/__init__.py +0 -7
- polars/sql/context.py +0 -677
- polars/sql/functions.py +0 -139
- polars/string_cache.py +0 -185
- polars/testing/__init__.py +0 -13
- polars/testing/asserts/__init__.py +0 -9
- polars/testing/asserts/frame.py +0 -231
- polars/testing/asserts/series.py +0 -219
- polars/testing/asserts/utils.py +0 -12
- polars/testing/parametric/__init__.py +0 -33
- polars/testing/parametric/profiles.py +0 -107
- polars/testing/parametric/strategies/__init__.py +0 -22
- polars/testing/parametric/strategies/_utils.py +0 -14
- polars/testing/parametric/strategies/core.py +0 -615
- polars/testing/parametric/strategies/data.py +0 -452
- polars/testing/parametric/strategies/dtype.py +0 -436
- polars/testing/parametric/strategies/legacy.py +0 -169
- polars/type_aliases.py +0 -24
- polars_runtime_compat-1.34.0b3.dist-info/RECORD +0 -203
- {polars_runtime_compat-1.34.0b3.dist-info → polars_runtime_compat-1.34.0b4.dist-info}/WHEEL +0 -0
- {polars_runtime_compat-1.34.0b3.dist-info → polars_runtime_compat-1.34.0b4.dist-info}/licenses/LICENSE +0 -0
polars/_reexport.py
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"""Re-export Polars functionality to avoid cyclical imports."""
|
|
2
|
-
|
|
3
|
-
from polars.dataframe import DataFrame
|
|
4
|
-
from polars.datatype_expr import DataTypeExpr
|
|
5
|
-
from polars.datatypes import DataType, DataTypeClass
|
|
6
|
-
from polars.expr import Expr, When
|
|
7
|
-
from polars.lazyframe import LazyFrame
|
|
8
|
-
from polars.schema import Schema
|
|
9
|
-
from polars.selectors import Selector
|
|
10
|
-
from polars.series import Series
|
|
11
|
-
|
|
12
|
-
__all__ = [
|
|
13
|
-
"DataFrame",
|
|
14
|
-
"DataTypeExpr",
|
|
15
|
-
"DataType",
|
|
16
|
-
"DataTypeClass",
|
|
17
|
-
"Expr",
|
|
18
|
-
"LazyFrame",
|
|
19
|
-
"Schema",
|
|
20
|
-
"Selector",
|
|
21
|
-
"Series",
|
|
22
|
-
"When",
|
|
23
|
-
]
|
polars/_typing.py
DELETED
|
@@ -1,478 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from collections.abc import Collection, Iterable, Mapping, Sequence
|
|
4
|
-
from pathlib import Path
|
|
5
|
-
from typing import (
|
|
6
|
-
IO,
|
|
7
|
-
TYPE_CHECKING,
|
|
8
|
-
Any,
|
|
9
|
-
Callable,
|
|
10
|
-
Literal,
|
|
11
|
-
Protocol,
|
|
12
|
-
TypedDict,
|
|
13
|
-
TypeVar,
|
|
14
|
-
Union,
|
|
15
|
-
)
|
|
16
|
-
|
|
17
|
-
if TYPE_CHECKING:
|
|
18
|
-
import contextlib
|
|
19
|
-
import sys
|
|
20
|
-
from datetime import date, datetime, time, timedelta
|
|
21
|
-
from decimal import Decimal
|
|
22
|
-
|
|
23
|
-
from sqlalchemy.engine import Connection, Engine
|
|
24
|
-
from sqlalchemy.orm import Session
|
|
25
|
-
|
|
26
|
-
from polars import DataFrame, Expr, LazyFrame, Series
|
|
27
|
-
from polars._dependencies import numpy as np
|
|
28
|
-
from polars._dependencies import pandas as pd
|
|
29
|
-
from polars._dependencies import pyarrow as pa
|
|
30
|
-
from polars._dependencies import torch
|
|
31
|
-
from polars.datatypes import DataType, DataTypeClass, IntegerType, TemporalType
|
|
32
|
-
from polars.lazyframe.engine_config import GPUEngine
|
|
33
|
-
from polars.selectors import Selector
|
|
34
|
-
|
|
35
|
-
with contextlib.suppress(ImportError): # Module not available when building docs
|
|
36
|
-
from polars._plr import PyPartitioning
|
|
37
|
-
|
|
38
|
-
if sys.version_info >= (3, 10):
|
|
39
|
-
from typing import TypeAlias
|
|
40
|
-
else:
|
|
41
|
-
from typing_extensions import TypeAlias
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
class ArrowArrayExportable(Protocol):
|
|
45
|
-
"""Type protocol for Arrow C Data Interface via Arrow PyCapsule Interface."""
|
|
46
|
-
|
|
47
|
-
def __arrow_c_array__(
|
|
48
|
-
self, requested_schema: object | None = None
|
|
49
|
-
) -> tuple[object, object]: ...
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class ArrowStreamExportable(Protocol):
|
|
53
|
-
"""Type protocol for Arrow C Stream Interface via Arrow PyCapsule Interface."""
|
|
54
|
-
|
|
55
|
-
def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
class ArrowSchemaExportable(Protocol):
|
|
59
|
-
"""Type protocol for Arrow C Schema Interface via Arrow PyCapsule Interface."""
|
|
60
|
-
|
|
61
|
-
def __arrow_c_schema__(self) -> object: ...
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
# Data types
|
|
65
|
-
PolarsDataType: TypeAlias = Union["DataTypeClass", "DataType"]
|
|
66
|
-
PolarsTemporalType: TypeAlias = Union[type["TemporalType"], "TemporalType"]
|
|
67
|
-
PolarsIntegerType: TypeAlias = Union[type["IntegerType"], "IntegerType"]
|
|
68
|
-
OneOrMoreDataTypes: TypeAlias = Union[PolarsDataType, Iterable[PolarsDataType]]
|
|
69
|
-
PythonDataType: TypeAlias = Union[
|
|
70
|
-
type[int],
|
|
71
|
-
type[float],
|
|
72
|
-
type[bool],
|
|
73
|
-
type[str],
|
|
74
|
-
type["date"],
|
|
75
|
-
type["time"],
|
|
76
|
-
type["datetime"],
|
|
77
|
-
type["timedelta"],
|
|
78
|
-
type[list[Any]],
|
|
79
|
-
type[tuple[Any, ...]],
|
|
80
|
-
type[bytes],
|
|
81
|
-
type[object],
|
|
82
|
-
type["Decimal"],
|
|
83
|
-
type[None],
|
|
84
|
-
]
|
|
85
|
-
|
|
86
|
-
SchemaDefinition: TypeAlias = Union[
|
|
87
|
-
Mapping[str, Union[PolarsDataType, PythonDataType, None]],
|
|
88
|
-
Sequence[Union[str, tuple[str, Union[PolarsDataType, PythonDataType, None]]]],
|
|
89
|
-
]
|
|
90
|
-
SchemaDict: TypeAlias = Mapping[str, PolarsDataType]
|
|
91
|
-
|
|
92
|
-
NumericLiteral: TypeAlias = Union[int, float, "Decimal"]
|
|
93
|
-
TemporalLiteral: TypeAlias = Union["date", "time", "datetime", "timedelta"]
|
|
94
|
-
NonNestedLiteral: TypeAlias = Union[NumericLiteral, TemporalLiteral, str, bool, bytes]
|
|
95
|
-
# Python literal types (can convert into a `lit` expression)
|
|
96
|
-
PythonLiteral: TypeAlias = Union[NonNestedLiteral, "np.ndarray[Any, Any]", list[Any]]
|
|
97
|
-
# Inputs that can convert into a `col` expression
|
|
98
|
-
IntoExprColumn: TypeAlias = Union["Expr", "Series", str]
|
|
99
|
-
# Inputs that can convert into an expression
|
|
100
|
-
IntoExpr: TypeAlias = Union[PythonLiteral, IntoExprColumn, None]
|
|
101
|
-
|
|
102
|
-
ComparisonOperator: TypeAlias = Literal["eq", "neq", "gt", "lt", "gt_eq", "lt_eq"]
|
|
103
|
-
|
|
104
|
-
# selector type, and related collection/sequence
|
|
105
|
-
SelectorType: TypeAlias = "Selector"
|
|
106
|
-
ColumnNameOrSelector: TypeAlias = Union[str, SelectorType]
|
|
107
|
-
|
|
108
|
-
# User-facing string literal types
|
|
109
|
-
# The following all have an equivalent Rust enum with the same name
|
|
110
|
-
Ambiguous: TypeAlias = Literal["earliest", "latest", "raise", "null"]
|
|
111
|
-
AvroCompression: TypeAlias = Literal["uncompressed", "snappy", "deflate"]
|
|
112
|
-
CsvQuoteStyle: TypeAlias = Literal["necessary", "always", "non_numeric", "never"]
|
|
113
|
-
CategoricalOrdering: TypeAlias = Literal["physical", "lexical"]
|
|
114
|
-
CsvEncoding: TypeAlias = Literal["utf8", "utf8-lossy"]
|
|
115
|
-
ColumnMapping: TypeAlias = tuple[Literal["iceberg-column-mapping"], "pa.Schema"]
|
|
116
|
-
DefaultFieldValues: TypeAlias = tuple[
|
|
117
|
-
Literal["iceberg"], dict[int, Union["Series", str]]
|
|
118
|
-
]
|
|
119
|
-
DeletionFiles: TypeAlias = tuple[
|
|
120
|
-
Literal["iceberg-position-delete"], dict[int, list[str]]
|
|
121
|
-
]
|
|
122
|
-
FillNullStrategy: TypeAlias = Literal[
|
|
123
|
-
"forward", "backward", "min", "max", "mean", "zero", "one"
|
|
124
|
-
]
|
|
125
|
-
FloatFmt: TypeAlias = Literal["full", "mixed"]
|
|
126
|
-
IndexOrder: TypeAlias = Literal["c", "fortran"]
|
|
127
|
-
IpcCompression: TypeAlias = Literal["uncompressed", "lz4", "zstd"]
|
|
128
|
-
JoinValidation: TypeAlias = Literal["m:m", "m:1", "1:m", "1:1"]
|
|
129
|
-
Label: TypeAlias = Literal["left", "right", "datapoint"]
|
|
130
|
-
MaintainOrderJoin: TypeAlias = Literal[
|
|
131
|
-
"none", "left", "right", "left_right", "right_left"
|
|
132
|
-
]
|
|
133
|
-
NonExistent: TypeAlias = Literal["raise", "null"]
|
|
134
|
-
NullBehavior: TypeAlias = Literal["ignore", "drop"]
|
|
135
|
-
ParallelStrategy: TypeAlias = Literal[
|
|
136
|
-
"auto", "columns", "row_groups", "prefiltered", "none"
|
|
137
|
-
]
|
|
138
|
-
ParquetCompression: TypeAlias = Literal[
|
|
139
|
-
"lz4", "uncompressed", "snappy", "gzip", "lzo", "brotli", "zstd"
|
|
140
|
-
]
|
|
141
|
-
PivotAgg: TypeAlias = Literal[
|
|
142
|
-
"min", "max", "first", "last", "sum", "mean", "median", "len"
|
|
143
|
-
]
|
|
144
|
-
QuantileMethod: TypeAlias = Literal[
|
|
145
|
-
"nearest", "higher", "lower", "midpoint", "linear", "equiprobable"
|
|
146
|
-
]
|
|
147
|
-
RankMethod: TypeAlias = Literal["average", "min", "max", "dense", "ordinal", "random"]
|
|
148
|
-
Roll: TypeAlias = Literal["raise", "forward", "backward"]
|
|
149
|
-
RoundMode: TypeAlias = Literal["half_to_even", "half_away_from_zero"]
|
|
150
|
-
SerializationFormat: TypeAlias = Literal["binary", "json"]
|
|
151
|
-
Endianness: TypeAlias = Literal["little", "big"]
|
|
152
|
-
SizeUnit: TypeAlias = Literal[
|
|
153
|
-
"b",
|
|
154
|
-
"kb",
|
|
155
|
-
"mb",
|
|
156
|
-
"gb",
|
|
157
|
-
"tb",
|
|
158
|
-
"bytes",
|
|
159
|
-
"kilobytes",
|
|
160
|
-
"megabytes",
|
|
161
|
-
"gigabytes",
|
|
162
|
-
"terabytes",
|
|
163
|
-
]
|
|
164
|
-
StartBy: TypeAlias = Literal[
|
|
165
|
-
"window",
|
|
166
|
-
"datapoint",
|
|
167
|
-
"monday",
|
|
168
|
-
"tuesday",
|
|
169
|
-
"wednesday",
|
|
170
|
-
"thursday",
|
|
171
|
-
"friday",
|
|
172
|
-
"saturday",
|
|
173
|
-
"sunday",
|
|
174
|
-
]
|
|
175
|
-
SyncOnCloseMethod: TypeAlias = Literal["data", "all"]
|
|
176
|
-
TimeUnit: TypeAlias = Literal["ns", "us", "ms"]
|
|
177
|
-
UnicodeForm: TypeAlias = Literal["NFC", "NFKC", "NFD", "NFKD"]
|
|
178
|
-
UniqueKeepStrategy: TypeAlias = Literal["first", "last", "any", "none"]
|
|
179
|
-
UnstackDirection: TypeAlias = Literal["vertical", "horizontal"]
|
|
180
|
-
MapElementsStrategy: TypeAlias = Literal["thread_local", "threading"]
|
|
181
|
-
|
|
182
|
-
# The following have a Rust enum equivalent with a different name
|
|
183
|
-
AsofJoinStrategy: TypeAlias = Literal["backward", "forward", "nearest"] # AsofStrategy
|
|
184
|
-
ClosedInterval: TypeAlias = Literal["left", "right", "both", "none"] # ClosedWindow
|
|
185
|
-
InterpolationMethod: TypeAlias = Literal["linear", "nearest"]
|
|
186
|
-
JoinStrategy: TypeAlias = Literal[
|
|
187
|
-
"inner", "left", "right", "full", "semi", "anti", "cross", "outer"
|
|
188
|
-
] # JoinType
|
|
189
|
-
ListToStructWidthStrategy: TypeAlias = Literal["first_non_null", "max_width"]
|
|
190
|
-
|
|
191
|
-
# The following have no equivalent on the Rust side
|
|
192
|
-
ConcatMethod = Literal[
|
|
193
|
-
"vertical",
|
|
194
|
-
"vertical_relaxed",
|
|
195
|
-
"diagonal",
|
|
196
|
-
"diagonal_relaxed",
|
|
197
|
-
"horizontal",
|
|
198
|
-
"align",
|
|
199
|
-
"align_full",
|
|
200
|
-
"align_inner",
|
|
201
|
-
"align_left",
|
|
202
|
-
"align_right",
|
|
203
|
-
]
|
|
204
|
-
CorrelationMethod: TypeAlias = Literal["pearson", "spearman"]
|
|
205
|
-
DbReadEngine: TypeAlias = Literal["adbc", "connectorx"]
|
|
206
|
-
DbWriteEngine: TypeAlias = Literal["sqlalchemy", "adbc"]
|
|
207
|
-
DbWriteMode: TypeAlias = Literal["replace", "append", "fail"]
|
|
208
|
-
EpochTimeUnit = Literal["ns", "us", "ms", "s", "d"]
|
|
209
|
-
JaxExportType: TypeAlias = Literal["array", "dict"]
|
|
210
|
-
Orientation: TypeAlias = Literal["col", "row"]
|
|
211
|
-
SearchSortedSide: TypeAlias = Literal["any", "left", "right"]
|
|
212
|
-
TorchExportType: TypeAlias = Literal["tensor", "dataset", "dict"]
|
|
213
|
-
TransferEncoding: TypeAlias = Literal["hex", "base64"]
|
|
214
|
-
WindowMappingStrategy: TypeAlias = Literal["group_to_rows", "join", "explode"]
|
|
215
|
-
ExplainFormat: TypeAlias = Literal["plain", "tree"]
|
|
216
|
-
|
|
217
|
-
# type signature for allowed frame init
|
|
218
|
-
FrameInitTypes: TypeAlias = Union[
|
|
219
|
-
Mapping[str, Union[Sequence[object], Mapping[str, Sequence[object]], "Series"]],
|
|
220
|
-
Sequence[Any],
|
|
221
|
-
"np.ndarray[Any, Any]",
|
|
222
|
-
"pa.Table",
|
|
223
|
-
"pd.DataFrame",
|
|
224
|
-
"ArrowArrayExportable",
|
|
225
|
-
"ArrowStreamExportable",
|
|
226
|
-
"torch.Tensor",
|
|
227
|
-
]
|
|
228
|
-
|
|
229
|
-
# Excel IO
|
|
230
|
-
ColumnFormatDict: TypeAlias = Mapping[
|
|
231
|
-
# dict of colname(s) or selector(s) to format string or dict
|
|
232
|
-
Union[ColumnNameOrSelector, tuple[ColumnNameOrSelector, ...]],
|
|
233
|
-
Union[str, Mapping[str, str]],
|
|
234
|
-
]
|
|
235
|
-
ConditionalFormatDict: TypeAlias = Mapping[
|
|
236
|
-
# dict of colname(s) to str, dict, or sequence of str/dict
|
|
237
|
-
Union[ColumnNameOrSelector, Collection[str]],
|
|
238
|
-
Union[str, Union[Mapping[str, Any], Sequence[Union[str, Mapping[str, Any]]]]],
|
|
239
|
-
]
|
|
240
|
-
ColumnTotalsDefinition: TypeAlias = Union[
|
|
241
|
-
# dict of colname(s) to str, a collection of str, or a boolean
|
|
242
|
-
Mapping[Union[ColumnNameOrSelector, tuple[ColumnNameOrSelector]], str],
|
|
243
|
-
Sequence[str],
|
|
244
|
-
bool,
|
|
245
|
-
]
|
|
246
|
-
ColumnWidthsDefinition: TypeAlias = Union[
|
|
247
|
-
Mapping[ColumnNameOrSelector, Union[tuple[str, ...], int]], int
|
|
248
|
-
]
|
|
249
|
-
RowTotalsDefinition: TypeAlias = Union[
|
|
250
|
-
# dict of colname to str(s), a collection of str, or a boolean
|
|
251
|
-
Mapping[str, Union[str, Collection[str]]],
|
|
252
|
-
Collection[str],
|
|
253
|
-
bool,
|
|
254
|
-
]
|
|
255
|
-
|
|
256
|
-
# standard/named hypothesis profiles used for parametric testing
|
|
257
|
-
ParametricProfileNames: TypeAlias = Literal["fast", "balanced", "expensive"]
|
|
258
|
-
|
|
259
|
-
# typevars for core polars types
|
|
260
|
-
PolarsType = TypeVar("PolarsType", "DataFrame", "LazyFrame", "Series", "Expr")
|
|
261
|
-
FrameType = TypeVar("FrameType", "DataFrame", "LazyFrame")
|
|
262
|
-
BufferInfo: TypeAlias = tuple[int, int, int]
|
|
263
|
-
|
|
264
|
-
# type alias for supported spreadsheet engines
|
|
265
|
-
ExcelSpreadsheetEngine: TypeAlias = Literal["calamine", "openpyxl", "xlsx2csv"]
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
class SeriesBuffers(TypedDict):
|
|
269
|
-
"""Underlying buffers of a Series."""
|
|
270
|
-
|
|
271
|
-
values: Series
|
|
272
|
-
validity: Series | None
|
|
273
|
-
offsets: Series | None
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
# minimal protocol definitions that can reasonably represent
|
|
277
|
-
# an executable connection, cursor, or equivalent object
|
|
278
|
-
class BasicConnection(Protocol):
|
|
279
|
-
def cursor(self, *args: Any, **kwargs: Any) -> Any:
|
|
280
|
-
"""Return a cursor object."""
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
class BasicCursor(Protocol):
|
|
284
|
-
def execute(self, *args: Any, **kwargs: Any) -> Any:
|
|
285
|
-
"""Execute a query."""
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
class Cursor(BasicCursor):
|
|
289
|
-
def fetchall(self, *args: Any, **kwargs: Any) -> Any:
|
|
290
|
-
"""Fetch all results."""
|
|
291
|
-
|
|
292
|
-
def fetchmany(self, *args: Any, **kwargs: Any) -> Any:
|
|
293
|
-
"""Fetch results in batches."""
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
AlchemyConnection: TypeAlias = Union["Connection", "Engine", "Session"]
|
|
297
|
-
ConnectionOrCursor: TypeAlias = Union[
|
|
298
|
-
BasicConnection, BasicCursor, Cursor, AlchemyConnection
|
|
299
|
-
]
|
|
300
|
-
|
|
301
|
-
# Annotations for `__getitem__` methods
|
|
302
|
-
SingleIndexSelector: TypeAlias = int
|
|
303
|
-
MultiIndexSelector: TypeAlias = Union[
|
|
304
|
-
slice,
|
|
305
|
-
range,
|
|
306
|
-
Sequence[int],
|
|
307
|
-
"Series",
|
|
308
|
-
"np.ndarray[Any, Any]",
|
|
309
|
-
]
|
|
310
|
-
SingleNameSelector: TypeAlias = str
|
|
311
|
-
MultiNameSelector: TypeAlias = Union[
|
|
312
|
-
slice,
|
|
313
|
-
Sequence[str],
|
|
314
|
-
"Series",
|
|
315
|
-
"np.ndarray[Any, Any]",
|
|
316
|
-
]
|
|
317
|
-
BooleanMask: TypeAlias = Union[
|
|
318
|
-
Sequence[bool],
|
|
319
|
-
"Series",
|
|
320
|
-
"np.ndarray[Any, Any]",
|
|
321
|
-
]
|
|
322
|
-
SingleColSelector: TypeAlias = Union[SingleIndexSelector, SingleNameSelector]
|
|
323
|
-
MultiColSelector: TypeAlias = Union[MultiIndexSelector, MultiNameSelector, BooleanMask]
|
|
324
|
-
|
|
325
|
-
# LazyFrame engine selection
|
|
326
|
-
EngineType: TypeAlias = Union[
|
|
327
|
-
Literal["auto", "in-memory", "streaming", "gpu"], "GPUEngine"
|
|
328
|
-
]
|
|
329
|
-
|
|
330
|
-
PlanStage: TypeAlias = Literal["ir", "physical"]
|
|
331
|
-
|
|
332
|
-
FileSource: TypeAlias = Union[
|
|
333
|
-
str,
|
|
334
|
-
Path,
|
|
335
|
-
IO[bytes],
|
|
336
|
-
bytes,
|
|
337
|
-
list[str],
|
|
338
|
-
list[Path],
|
|
339
|
-
list[IO[bytes]],
|
|
340
|
-
list[bytes],
|
|
341
|
-
]
|
|
342
|
-
|
|
343
|
-
JSONEncoder = Union[Callable[[Any], bytes], Callable[[Any], str]]
|
|
344
|
-
|
|
345
|
-
DeprecationType: TypeAlias = Literal[
|
|
346
|
-
"function",
|
|
347
|
-
"renamed_parameter",
|
|
348
|
-
"streaming_parameter",
|
|
349
|
-
"nonkeyword_arguments",
|
|
350
|
-
"parameter_as_multi_positional",
|
|
351
|
-
]
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
class PartitioningScheme:
|
|
355
|
-
def __init__(
|
|
356
|
-
self,
|
|
357
|
-
py_partitioning: PyPartitioning,
|
|
358
|
-
) -> None:
|
|
359
|
-
self._py_partitioning = py_partitioning
|
|
360
|
-
|
|
361
|
-
@property
|
|
362
|
-
def _base_path(self) -> str | None:
|
|
363
|
-
return self._py_partitioning.base_path
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
__all__ = [
|
|
367
|
-
"Ambiguous",
|
|
368
|
-
"ArrowArrayExportable",
|
|
369
|
-
"ArrowStreamExportable",
|
|
370
|
-
"AsofJoinStrategy",
|
|
371
|
-
"AvroCompression",
|
|
372
|
-
"BooleanMask",
|
|
373
|
-
"BufferInfo",
|
|
374
|
-
"CategoricalOrdering",
|
|
375
|
-
"ClosedInterval",
|
|
376
|
-
"ColumnFormatDict",
|
|
377
|
-
"ColumnNameOrSelector",
|
|
378
|
-
"ColumnTotalsDefinition",
|
|
379
|
-
"ColumnWidthsDefinition",
|
|
380
|
-
"ComparisonOperator",
|
|
381
|
-
"ConcatMethod",
|
|
382
|
-
"ConditionalFormatDict",
|
|
383
|
-
"ConnectionOrCursor",
|
|
384
|
-
"CorrelationMethod",
|
|
385
|
-
"CsvEncoding",
|
|
386
|
-
"CsvQuoteStyle",
|
|
387
|
-
"Cursor",
|
|
388
|
-
"DbReadEngine",
|
|
389
|
-
"DbWriteEngine",
|
|
390
|
-
"DbWriteMode",
|
|
391
|
-
"DeprecationType",
|
|
392
|
-
"Endianness",
|
|
393
|
-
"EngineType",
|
|
394
|
-
"EpochTimeUnit",
|
|
395
|
-
"ExcelSpreadsheetEngine",
|
|
396
|
-
"ExplainFormat",
|
|
397
|
-
"FileSource",
|
|
398
|
-
"FillNullStrategy",
|
|
399
|
-
"FloatFmt",
|
|
400
|
-
"FrameInitTypes",
|
|
401
|
-
"FrameType",
|
|
402
|
-
"IndexOrder",
|
|
403
|
-
"InterpolationMethod",
|
|
404
|
-
"IntoExpr",
|
|
405
|
-
"IntoExprColumn",
|
|
406
|
-
"IpcCompression",
|
|
407
|
-
"JSONEncoder",
|
|
408
|
-
"JaxExportType",
|
|
409
|
-
"JoinStrategy",
|
|
410
|
-
"JoinValidation",
|
|
411
|
-
"Label",
|
|
412
|
-
"ListToStructWidthStrategy",
|
|
413
|
-
"MaintainOrderJoin",
|
|
414
|
-
"MapElementsStrategy",
|
|
415
|
-
"MultiColSelector",
|
|
416
|
-
"MultiIndexSelector",
|
|
417
|
-
"MultiNameSelector",
|
|
418
|
-
"NonExistent",
|
|
419
|
-
"NonNestedLiteral",
|
|
420
|
-
"NullBehavior",
|
|
421
|
-
"NumericLiteral",
|
|
422
|
-
"OneOrMoreDataTypes",
|
|
423
|
-
"Orientation",
|
|
424
|
-
"ParallelStrategy",
|
|
425
|
-
"ParametricProfileNames",
|
|
426
|
-
"ParquetCompression",
|
|
427
|
-
"PartitioningScheme",
|
|
428
|
-
"PivotAgg",
|
|
429
|
-
"PolarsDataType",
|
|
430
|
-
"PolarsIntegerType",
|
|
431
|
-
"PolarsTemporalType",
|
|
432
|
-
"PolarsType",
|
|
433
|
-
"PythonDataType",
|
|
434
|
-
"PythonLiteral",
|
|
435
|
-
"QuantileMethod",
|
|
436
|
-
"RankMethod",
|
|
437
|
-
"Roll",
|
|
438
|
-
"RowTotalsDefinition",
|
|
439
|
-
"SchemaDefinition",
|
|
440
|
-
"SchemaDict",
|
|
441
|
-
"SearchSortedSide",
|
|
442
|
-
"SelectorType",
|
|
443
|
-
"SerializationFormat",
|
|
444
|
-
"SeriesBuffers",
|
|
445
|
-
"SingleColSelector",
|
|
446
|
-
"SingleIndexSelector",
|
|
447
|
-
"SingleNameSelector",
|
|
448
|
-
"SizeUnit",
|
|
449
|
-
"StartBy",
|
|
450
|
-
"SyncOnCloseMethod",
|
|
451
|
-
"TemporalLiteral",
|
|
452
|
-
"TimeUnit",
|
|
453
|
-
"TorchExportType",
|
|
454
|
-
"TransferEncoding",
|
|
455
|
-
"UnicodeForm",
|
|
456
|
-
"UniqueKeepStrategy",
|
|
457
|
-
"UnstackDirection",
|
|
458
|
-
"WindowMappingStrategy",
|
|
459
|
-
]
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
class ParquetMetadataContext:
|
|
463
|
-
"""
|
|
464
|
-
The context given when writing file-level parquet metadata.
|
|
465
|
-
|
|
466
|
-
.. warning::
|
|
467
|
-
This functionality is considered **experimental**. It may be removed or
|
|
468
|
-
changed at any point without it being considered a breaking change.
|
|
469
|
-
"""
|
|
470
|
-
|
|
471
|
-
def __init__(self, *, arrow_schema: str) -> None:
|
|
472
|
-
self.arrow_schema = arrow_schema
|
|
473
|
-
|
|
474
|
-
arrow_schema: str #: The base64 encoded arrow schema that is going to be written into metadata.
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
ParquetMetadataFn: TypeAlias = Callable[[ParquetMetadataContext], dict[str, str]]
|
|
478
|
-
ParquetMetadata: TypeAlias = Union[dict[str, str], ParquetMetadataFn]
|
polars/_utils/__init__.py
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Utility functions.
|
|
3
|
-
|
|
4
|
-
Functions that are part of the public API are re-exported here.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
from polars._utils.convert import (
|
|
8
|
-
date_to_int,
|
|
9
|
-
datetime_to_int,
|
|
10
|
-
time_to_int,
|
|
11
|
-
timedelta_to_int,
|
|
12
|
-
to_py_date,
|
|
13
|
-
to_py_datetime,
|
|
14
|
-
to_py_decimal,
|
|
15
|
-
to_py_time,
|
|
16
|
-
to_py_timedelta,
|
|
17
|
-
)
|
|
18
|
-
from polars._utils.scan import _execute_from_rust
|
|
19
|
-
from polars._utils.various import NoDefault, _polars_warn, is_column, no_default
|
|
20
|
-
|
|
21
|
-
__all__ = [
|
|
22
|
-
"NoDefault",
|
|
23
|
-
"is_column",
|
|
24
|
-
"no_default",
|
|
25
|
-
# Required for Rust bindings
|
|
26
|
-
"date_to_int",
|
|
27
|
-
"datetime_to_int",
|
|
28
|
-
"time_to_int",
|
|
29
|
-
"timedelta_to_int",
|
|
30
|
-
"_execute_from_rust",
|
|
31
|
-
"_polars_warn",
|
|
32
|
-
"to_py_date",
|
|
33
|
-
"to_py_datetime",
|
|
34
|
-
"to_py_decimal",
|
|
35
|
-
"to_py_time",
|
|
36
|
-
"to_py_timedelta",
|
|
37
|
-
]
|
polars/_utils/async_.py
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
from __future__ import annotations
|
|
2
|
-
|
|
3
|
-
from collections.abc import Awaitable
|
|
4
|
-
from typing import TYPE_CHECKING, Any, Generic, TypeVar
|
|
5
|
-
|
|
6
|
-
from polars._dependencies import _GEVENT_AVAILABLE
|
|
7
|
-
from polars._utils.wrap import wrap_df
|
|
8
|
-
|
|
9
|
-
if TYPE_CHECKING:
|
|
10
|
-
from asyncio.futures import Future
|
|
11
|
-
from collections.abc import Generator
|
|
12
|
-
|
|
13
|
-
from polars._plr import PyDataFrame
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
T = TypeVar("T")
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
class _GeventDataFrameResult(Generic[T]):
|
|
20
|
-
__slots__ = ("_result", "_value", "_watcher")
|
|
21
|
-
|
|
22
|
-
def __init__(self) -> None:
|
|
23
|
-
if not _GEVENT_AVAILABLE:
|
|
24
|
-
msg = (
|
|
25
|
-
"gevent is required for using LazyFrame.collect_async(gevent=True) or"
|
|
26
|
-
"polars.collect_all_async(gevent=True)"
|
|
27
|
-
)
|
|
28
|
-
raise ImportError(msg)
|
|
29
|
-
|
|
30
|
-
from gevent.event import AsyncResult # type: ignore[import-untyped]
|
|
31
|
-
from gevent.hub import get_hub # type: ignore[import-untyped]
|
|
32
|
-
|
|
33
|
-
self._value: None | Exception | PyDataFrame | list[PyDataFrame] = None
|
|
34
|
-
self._result = AsyncResult()
|
|
35
|
-
|
|
36
|
-
self._watcher = get_hub().loop.async_()
|
|
37
|
-
self._watcher.start(self._watcher_callback)
|
|
38
|
-
|
|
39
|
-
def get(
|
|
40
|
-
self,
|
|
41
|
-
block: bool = True, # noqa: FBT001
|
|
42
|
-
timeout: float | int | None = None,
|
|
43
|
-
) -> T:
|
|
44
|
-
return self.result.get(block=block, timeout=timeout)
|
|
45
|
-
|
|
46
|
-
@property
|
|
47
|
-
def result(self) -> Any:
|
|
48
|
-
# required if we did not made any switches and just want results later
|
|
49
|
-
# with block=False and possibly without timeout
|
|
50
|
-
if self._value is not None and not self._result.ready():
|
|
51
|
-
self._watcher_callback()
|
|
52
|
-
return self._result
|
|
53
|
-
|
|
54
|
-
def _watcher_callback(self) -> None:
|
|
55
|
-
if isinstance(self._value, Exception):
|
|
56
|
-
self._result.set_exception(self._value)
|
|
57
|
-
else:
|
|
58
|
-
self._result.set(self._value)
|
|
59
|
-
self._watcher.close()
|
|
60
|
-
|
|
61
|
-
def _callback(self, obj: PyDataFrame | Exception) -> None:
|
|
62
|
-
if not isinstance(obj, Exception):
|
|
63
|
-
obj = wrap_df(obj) # type: ignore[assignment]
|
|
64
|
-
self._value = obj
|
|
65
|
-
self._watcher.send()
|
|
66
|
-
|
|
67
|
-
def _callback_all(self, obj: list[PyDataFrame] | Exception) -> None:
|
|
68
|
-
if not isinstance(obj, Exception):
|
|
69
|
-
obj = [wrap_df(pydf) for pydf in obj] # type: ignore[misc]
|
|
70
|
-
self._value = obj
|
|
71
|
-
self._watcher.send()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class _AioDataFrameResult(Awaitable[T], Generic[T]):
|
|
75
|
-
__slots__ = ("loop", "result")
|
|
76
|
-
|
|
77
|
-
def __init__(self) -> None:
|
|
78
|
-
from asyncio import get_event_loop
|
|
79
|
-
|
|
80
|
-
self.loop = get_event_loop()
|
|
81
|
-
self.result: Future[T] = self.loop.create_future()
|
|
82
|
-
|
|
83
|
-
def __await__(self) -> Generator[Any, None, T]:
|
|
84
|
-
return self.result.__await__()
|
|
85
|
-
|
|
86
|
-
def _callback(self, obj: PyDataFrame | Exception) -> None:
|
|
87
|
-
if isinstance(obj, Exception):
|
|
88
|
-
self.loop.call_soon_threadsafe(self.result.set_exception, obj)
|
|
89
|
-
else:
|
|
90
|
-
self.loop.call_soon_threadsafe(
|
|
91
|
-
self.result.set_result, # type: ignore[arg-type]
|
|
92
|
-
wrap_df(obj),
|
|
93
|
-
)
|
|
94
|
-
|
|
95
|
-
def _callback_all(self, obj: list[PyDataFrame] | Exception) -> None:
|
|
96
|
-
if isinstance(obj, Exception):
|
|
97
|
-
self.loop.call_soon_threadsafe(self.result.set_exception, obj)
|
|
98
|
-
else:
|
|
99
|
-
self.loop.call_soon_threadsafe(
|
|
100
|
-
self.result.set_result, # type: ignore[arg-type]
|
|
101
|
-
[wrap_df(pydf) for pydf in obj],
|
|
102
|
-
)
|