dataframely 1.10.0__tar.gz → 1.11.0__tar.gz
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.
- {dataframely-1.10.0 → dataframely-1.11.0}/PKG-INFO +1 -1
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/enum.py +17 -6
- {dataframely-1.10.0 → dataframely-1.11.0}/pyproject.toml +1 -1
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_enum.py +48 -1
- {dataframely-1.10.0 → dataframely-1.11.0}/.copier-answers.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.envrc +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.gitattributes +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/CODEOWNERS +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/dependabot.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/release-drafter.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/workflows/build.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/workflows/chore.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/workflows/ci.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/workflows/nightly.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.github/workflows/scorecard.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.gitignore +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.pre-commit-config.yaml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.prettierignore +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.prettierrc +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/.readthedocs.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/Cargo.lock +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/Cargo.toml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/LICENSE +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/README.md +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/SECURITY.md +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/__init__.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_base_collection.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_base_schema.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_compat.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_deprecation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_extre.pyi +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_filter.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_polars.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_rule.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_serialization.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_storage/__init__.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_storage/_base.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_storage/_exc.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_storage/constants.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_storage/delta.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_storage/parquet.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_typing.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/_validation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/collection.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/__init__.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/_base.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/_mixins.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/_registry.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/_utils.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/any.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/array.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/bool.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/categorical.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/datetime.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/decimal.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/float.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/integer.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/list.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/object.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/string.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/columns/struct.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/config.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/exc.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/failure.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/functional.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/mypy.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/py.typed +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/random.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/schema.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/testing/__init__.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/testing/const.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/testing/factory.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/testing/mask.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/testing/rules.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/testing/storage.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/dataframely/testing/typing.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docker-compose.yml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/Makefile +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.collection.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.any.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.bool.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.datetime.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.decimal.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.enum.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.float.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.integer.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.list.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.string.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.columns.struct.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.config.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.exc.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.failure.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.functional.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.mypy.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.random.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.schema.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.testing.const.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.testing.factory.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.testing.mask.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.testing.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.testing.rules.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/dataframely.testing.typing.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_api/modules.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_static/custom.css +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/_static/favicon.ico +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/conf.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/index.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/make.bat +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/sites/development.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/sites/examples/real-world.ipynb +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/sites/faq.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/sites/installation.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/sites/quickstart.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/docs/sites/versioning.rst +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/pixi.lock +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/pixi.toml +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/src/errdefs.rs +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/src/lib.rs +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/src/regex_repr.rs +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/benches/conftest.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/benches/test_collection.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/benches/test_failure.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/benches/test_schema.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_base.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_cast.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_collection_future_annotations.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_create_empty.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_filter_one_to_n.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_filter_validate.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_ignore_in_filter.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_implementation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_join.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_matches.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_optional_members.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_repr.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_sample.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_serialization.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_storage.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_validate_input.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/__init__.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_any.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_array.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_datetime.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_decimal.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_float.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_integer.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_list.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_object.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_string.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/column_types/test_struct.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/__init__.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_alias.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_check.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_default_dtypes.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_matches.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_metadata.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_polars_schema.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_pyarrow.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_rules.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_sample.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_sql_schema.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_str.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/columns/test_utils.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/core_validation/__init__.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/core_validation/test_column_validation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/core_validation/test_dtype_validation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/core_validation/test_rule_evaluation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/failure_info/test_storage.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/functional/test_concat.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/functional/test_relationships.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_base.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_cast.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_create_empty.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_create_empty_if_none.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_filter.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_inheritance.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_matches.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_read_write_parquet.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_repr.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_rule_implementation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_sample.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_serialization.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_storage.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/schema/test_validate.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/storage/test_delta.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_compat.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_config.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_deprecation.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_exc.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_extre.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_factory.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_random.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_serialization.py +0 -0
- {dataframely-1.10.0 → dataframely-1.11.0}/tests/test_typing.py +0 -0
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
from __future__ import annotations
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
import enum
|
|
7
|
+
from collections.abc import Iterable
|
|
8
|
+
from inspect import isclass
|
|
7
9
|
from typing import Any
|
|
8
10
|
|
|
9
11
|
import polars as pl
|
|
@@ -22,7 +24,7 @@ class Enum(Column):
|
|
|
22
24
|
|
|
23
25
|
def __init__(
|
|
24
26
|
self,
|
|
25
|
-
categories:
|
|
27
|
+
categories: pl.Series | Iterable[str] | type[enum.Enum],
|
|
26
28
|
*,
|
|
27
29
|
nullable: bool | None = None,
|
|
28
30
|
primary_key: bool = False,
|
|
@@ -32,7 +34,8 @@ class Enum(Column):
|
|
|
32
34
|
):
|
|
33
35
|
"""
|
|
34
36
|
Args:
|
|
35
|
-
categories: The
|
|
37
|
+
categories: The set of valid categories for the enum, or an existing Python
|
|
38
|
+
string-valued enum.
|
|
36
39
|
nullable: Whether this column may contain null values.
|
|
37
40
|
Explicitly set `nullable=True` if you want your column to be nullable.
|
|
38
41
|
In a future release, `nullable=False` will be the default if `nullable`
|
|
@@ -63,7 +66,13 @@ class Enum(Column):
|
|
|
63
66
|
alias=alias,
|
|
64
67
|
metadata=metadata,
|
|
65
68
|
)
|
|
66
|
-
|
|
69
|
+
if isclass(categories) and issubclass(categories, enum.Enum):
|
|
70
|
+
categories = pl.Series(
|
|
71
|
+
values=[getattr(v, "value", v) for v in categories.__members__.values()]
|
|
72
|
+
)
|
|
73
|
+
elif not isinstance(categories, pl.Series):
|
|
74
|
+
categories = pl.Series(values=categories)
|
|
75
|
+
self.categories = categories
|
|
67
76
|
|
|
68
77
|
@property
|
|
69
78
|
def dtype(self) -> pl.DataType:
|
|
@@ -72,7 +81,7 @@ class Enum(Column):
|
|
|
72
81
|
def validate_dtype(self, dtype: PolarsDataType) -> bool:
|
|
73
82
|
if not isinstance(dtype, pl.Enum):
|
|
74
83
|
return False
|
|
75
|
-
return self.categories
|
|
84
|
+
return self.categories.equals(dtype.categories)
|
|
76
85
|
|
|
77
86
|
def sqlalchemy_dtype(self, dialect: sa.Dialect) -> sa_TypeEngine:
|
|
78
87
|
category_lengths = [len(c) for c in self.categories]
|
|
@@ -92,5 +101,7 @@ class Enum(Column):
|
|
|
92
101
|
|
|
93
102
|
def _sample_unchecked(self, generator: Generator, n: int) -> pl.Series:
|
|
94
103
|
return generator.sample_choice(
|
|
95
|
-
n,
|
|
104
|
+
n,
|
|
105
|
+
choices=self.categories.to_list(),
|
|
106
|
+
null_probability=self._null_probability,
|
|
96
107
|
).cast(self.dtype)
|
|
@@ -25,7 +25,7 @@ description = "A declarative, polars-native data frame validation library"
|
|
|
25
25
|
name = "dataframely"
|
|
26
26
|
readme = "README.md"
|
|
27
27
|
requires-python = ">=3.10"
|
|
28
|
-
version = "1.
|
|
28
|
+
version = "1.11.0"
|
|
29
29
|
|
|
30
30
|
[project.optional-dependencies]
|
|
31
31
|
deltalake = ["deltalake"]
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Copyright (c) QuantCo 2025-2025
|
|
2
2
|
# SPDX-License-Identifier: BSD-3-Clause
|
|
3
|
-
|
|
3
|
+
import enum
|
|
4
|
+
from collections.abc import Iterable
|
|
5
|
+
from enum import Enum
|
|
4
6
|
from typing import Any
|
|
5
7
|
|
|
6
8
|
import polars as pl
|
|
@@ -61,3 +63,48 @@ def test_different_sequences(type1: type, type2: type) -> None:
|
|
|
61
63
|
S = create_schema("test", {"x": dy.Enum(type1(allowed))})
|
|
62
64
|
df = pl.DataFrame({"x": pl.Series(["a", "b"], dtype=pl.Enum(type2(allowed)))})
|
|
63
65
|
S.validate(df)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def test_enum_of_enum_136() -> None:
|
|
69
|
+
class Categories(str, Enum):
|
|
70
|
+
a = "a"
|
|
71
|
+
b = "b"
|
|
72
|
+
|
|
73
|
+
assert pl.Enum(Categories) == dy.Enum(Categories).dtype
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def test_enum_of_series() -> None:
|
|
77
|
+
categories = pl.Series(["a", "b"])
|
|
78
|
+
assert pl.Enum(categories) == dy.Enum(categories).dtype
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def test_enum_of_iterable() -> None:
|
|
82
|
+
categories = (x for x in ["a", "b"])
|
|
83
|
+
assert pl.Enum(["a", "b"]) == dy.Enum(categories).dtype
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
@pytest.mark.parametrize(
|
|
87
|
+
"categories1",
|
|
88
|
+
[
|
|
89
|
+
["a", "b"],
|
|
90
|
+
("a", "b"),
|
|
91
|
+
pl.Series(["a", "b"]),
|
|
92
|
+
Enum("Categories", {"a": "a", "b": "b"}),
|
|
93
|
+
],
|
|
94
|
+
)
|
|
95
|
+
@pytest.mark.parametrize(
|
|
96
|
+
"categories2",
|
|
97
|
+
[
|
|
98
|
+
["a", "b"],
|
|
99
|
+
("a", "b"),
|
|
100
|
+
pl.Series(["a", "b"]),
|
|
101
|
+
Enum("Categories", {"a": "a", "b": "b"}),
|
|
102
|
+
],
|
|
103
|
+
)
|
|
104
|
+
def test_sequences_and_enums(
|
|
105
|
+
categories1: pl.Series | Iterable[str] | type[enum.Enum],
|
|
106
|
+
categories2: pl.Series | Iterable[str] | type[enum.Enum],
|
|
107
|
+
) -> None:
|
|
108
|
+
S = create_schema("test", {"x": dy.Enum(categories1)})
|
|
109
|
+
df = pl.DataFrame({"x": pl.Series(["a", "b"], dtype=pl.Enum(categories2))})
|
|
110
|
+
S.validate(df)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dataframely-1.10.0 → dataframely-1.11.0}/tests/collection/test_collection_future_annotations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|