Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix ruff and mypy version and do formatting #2240

Merged
merged 1 commit into from
Mar 4, 2024
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: 3 additions & 1 deletion docs/src/python/check_constraints.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@ def add_constraint():

def add_data():
# --8<-- [start:add_data]
from deltalake import write_deltalake
from deltalake import write_deltalake, DeltaTable
import pandas as pd

dt = DeltaTable("../rust/tests/data/simple_table")

df = pd.DataFrame({"id": [-1]})
write_deltalake(dt, df, mode="append", engine="rust")
# _internal.DeltaProtocolError: Invariant violations: ["Check or Invariant (id > 0) violated by value in row: [-1]"]
Expand Down
6 changes: 3 additions & 3 deletions python/deltalake/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -1277,9 +1277,9 @@ def __init__(
self.not_matched_insert_updates: Optional[List[Dict[str, str]]] = None
self.not_matched_insert_predicate: Optional[List[Optional[str]]] = None
self.not_matched_by_source_update_updates: Optional[List[Dict[str, str]]] = None
self.not_matched_by_source_update_predicate: Optional[
List[Optional[str]]
] = None
self.not_matched_by_source_update_predicate: Optional[List[Optional[str]]] = (
None
)
self.not_matched_by_source_delete_predicate: Optional[List[str]] = None
self.not_matched_by_source_delete_all: Optional[bool] = None

Expand Down
21 changes: 9 additions & 12 deletions python/deltalake/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ def write_deltalake(
large_dtypes: bool = ...,
engine: Literal["pyarrow"] = ...,
custom_metadata: Optional[Dict[str, str]] = ...,
) -> None:
...
) -> None: ...


@overload
Expand All @@ -128,8 +127,7 @@ def write_deltalake(
engine: Literal["rust"],
writer_properties: WriterProperties = ...,
custom_metadata: Optional[Dict[str, str]] = ...,
) -> None:
...
) -> None: ...


@overload
Expand Down Expand Up @@ -157,8 +155,7 @@ def write_deltalake(
engine: Literal["rust"],
writer_properties: WriterProperties = ...,
custom_metadata: Optional[Dict[str, str]] = ...,
) -> None:
...
) -> None: ...


def write_deltalake(
Expand Down Expand Up @@ -421,12 +418,12 @@ def check_data_is_aligned_with_partition_filtering(
) -> None:
if table is None:
return
existed_partitions: FrozenSet[
FrozenSet[Tuple[str, Optional[str]]]
] = table._table.get_active_partitions()
allowed_partitions: FrozenSet[
FrozenSet[Tuple[str, Optional[str]]]
] = table._table.get_active_partitions(partition_filters)
existed_partitions: FrozenSet[FrozenSet[Tuple[str, Optional[str]]]] = (
table._table.get_active_partitions()
)
allowed_partitions: FrozenSet[FrozenSet[Tuple[str, Optional[str]]]] = (
table._table.get_active_partitions(partition_filters)
)
partition_values = pa.RecordBatch.from_arrays(
[
batch.column(column_name)
Expand Down
6 changes: 3 additions & 3 deletions python/docs/source/_ext/edit_on_github.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ def html_page_context(app, pagename, templatename, context, doctree):
context["display_github"] = True
context["github_user"] = app.config.edit_on_github_project.split("/")[0]
context["github_repo"] = app.config.edit_on_github_project.split("/")[1]
context[
"github_version"
] = f"{app.config.edit_on_github_branch}/{app.config.page_source_prefix}/"
context["github_version"] = (
f"{app.config.edit_on_github_branch}/{app.config.page_source_prefix}/"
)


def setup(app):
Expand Down
4 changes: 2 additions & 2 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ pandas = [
"pandas"
]
devel = [
"mypy",
"ruff>=0.1.5",
"mypy~=1.8.0",
"ruff~=0.3.0",
"packaging>=20",
"pytest",
"pytest-mock",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Tests that deltalake(delta-rs) can write to tables written by PySpark."""

import pathlib

import pyarrow as pa
Expand Down
1 change: 1 addition & 0 deletions python/tests/pyspark_integration/test_writer_readable.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Test that pyspark can read tables written by deltalake(delta-rs)."""

import pathlib

import pyarrow as pa
Expand Down
Loading