Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dataframely/_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ class Dialect: # type: ignore # noqa: N801

try:
import pyarrow as pa
except ImportError:
pa = _DummyModule("pyarrow")
except ImportError: # pragma: no cover
pa = _DummyModule("pyarrow") # type: ignore

# -------------------------------------- PYDANTIC ------------------------------------ #

Expand Down
1 change: 0 additions & 1 deletion dataframely/_storage/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ def read_failure_info(
self, **kwargs: Any
) -> tuple[pl.DataFrame, SerializedRules, SerializedSchema]:
"""Read the failure info from the storage backend."""

lf, rule_metadata, schema_metadata = self.scan_failure_info(**kwargs)
return (
lf.collect(),
Expand Down
1 change: 0 additions & 1 deletion dataframely/columns/_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ def __init__(
names, the specified alias is the only valid name.
metadata: A dictionary of metadata to attach to the column.
"""

if nullable and primary_key:
raise ValueError("Nullable primary key columns are not supported.")

Expand Down
5 changes: 2 additions & 3 deletions dataframely/random.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ class Generator:
specifying a lower (inclusive) and an upper (exclusive) bound for the type to be
sampled.

These methods can be used to sample higher-level types. To this end, users may
also directly access the underlying `numpy_generator` to reuse the generator's
seeding.
These methods can be used to sample higher-level types. To this end, users may also
directly access the underlying `numpy_generator` to reuse the generator's seeding.
"""

def __init__(self, seed: int | None = None) -> None:
Expand Down
10,483 changes: 5,344 additions & 5,139 deletions pixi.lock

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions tests/collection/test_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ def test_annotation_union_with_data_frame() -> None:

def test_annotation_union_too_many_arg_failure() -> None:
"""Unions should have a maximum of two types in them."""

with pytest.raises(AnnotationImplementationError):
create_collection_raw(
"test",
Expand All @@ -68,7 +67,6 @@ def test_annotation_union_too_many_arg_failure() -> None:

def test_annotation_union_conflicting_types_failure() -> None:
"""Unions should contain a maximum of one non-None type."""

with pytest.raises(AnnotationImplementationError):
create_collection_raw(
"test",
Expand Down
29 changes: 15 additions & 14 deletions tests/collection/test_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,18 @@ def member_a_member_b_one_to_one(self) -> pl.LazyFrame:
reason="query plan repr changed in polars 1.39",
)
def test_repr_collection() -> None:
assert repr(MyCollection) == textwrap.dedent("""\
[Collection "CollectionMeta"]
Members:
- "member_a": MySchema(optional=False, ignored_in_filters=False, inline_for_sampling=False)
- "member_b": MySchema(optional=False, ignored_in_filters=False, inline_for_sampling=False)
Filters:
- "member_a_member_b_one_to_one":
INNER JOIN:
LEFT PLAN ON: [col("a")]
DF ["a"]; PROJECT */1 COLUMNS
RIGHT PLAN ON: [col("a")]
DF ["a"]; PROJECT */1 COLUMNS
END INNER JOIN
""")
expected = """\
[Collection "CollectionMeta"]
Members:
- "member_a": MySchema(optional=False, ignored_in_filters=False, inline_for_sampling=False)
- "member_b": MySchema(optional=False, ignored_in_filters=False, inline_for_sampling=False)
Filters:
- "member_a_member_b_one_to_one":
INNER JOIN:
LEFT PLAN ON: [col("a")]
DF ["a"]; PROJECT */1 COLUMNS
RIGHT PLAN ON: [col("a")]
DF ["a"]; PROJECT */1 COLUMNS
END INNER JOIN
"""
assert repr(MyCollection) == textwrap.dedent(expected)
52 changes: 28 additions & 24 deletions tests/schema/test_repr.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,24 @@ def test_repr_no_rules() -> None:
class SchemaNoRules(dy.Schema):
a = dy.Integer(nullable=True)

assert repr(SchemaNoRules) == textwrap.dedent("""\
[Schema "SchemaNoRules"]
Columns:
- "a": Integer(nullable=True)
""")
expected = """\
[Schema "SchemaNoRules"]
Columns:
- "a": Integer(nullable=True)
"""
assert repr(SchemaNoRules) == textwrap.dedent(expected)


def test_repr_only_column_rules() -> None:
class SchemaColumnRules(dy.Schema):
a = dy.Integer(min=10, nullable=True)

assert repr(SchemaColumnRules) == textwrap.dedent("""\
[Schema "SchemaColumnRules"]
Columns:
- "a": Integer(nullable=True, min=10)
""")
expected = """\
[Schema "SchemaColumnRules"]
Columns:
- "a": Integer(nullable=True, min=10)
"""
assert repr(SchemaColumnRules) == textwrap.dedent(expected)


class SchemaWithRules(dy.Schema):
Expand All @@ -43,23 +45,25 @@ def my_group_rule(cls) -> pl.Expr:


def test_repr_with_rules() -> None:
assert repr(SchemaWithRules) == textwrap.dedent("""\
[Schema "SchemaWithRules"]
Columns:
- "a": Integer(min=10)
- "b2": String(primary_key=True, regex='^[A-Z]{3}$')
Rules:
- "my_rule": [(col("a")) < (dyn int: 100)]
- "my_group_rule": [(col("a").sum()) > (dyn int: 50)] grouped by ['a']
""")
expected = """\
[Schema "SchemaWithRules"]
Columns:
- "a": Integer(min=10)
- "b2": String(primary_key=True, regex='^[A-Z]{3}$')
Rules:
- "my_rule": [(col("a")) < (dyn int: 100)]
- "my_group_rule": [(col("a").sum()) > (dyn int: 50)] grouped by ['a']
"""
assert repr(SchemaWithRules) == textwrap.dedent(expected)


def test_repr_enum() -> None:
class SchemaNoRules(dy.Schema):
a = dy.Enum(["a"], nullable=True)

assert repr(SchemaNoRules) == textwrap.dedent("""\
[Schema "SchemaNoRules"]
Columns:
- "a": Enum(categories=['a'], nullable=True)
""")
expected = """\
[Schema "SchemaNoRules"]
Columns:
- "a": Enum(categories=['a'], nullable=True)
"""
assert repr(SchemaNoRules) == textwrap.dedent(expected)
Loading