Skip to content

Commit

Permalink
fix: fix ruff and mypy version and do formatting (#2240)
Browse files Browse the repository at this point in the history
# Description
As requested by @ion-elgreco in #2229 , we should fix the formatter
versions

# Related Issue(s)
<!---
For example:

- closes #106
--->

# Documentation

<!---
Share links to useful documentation
--->
  • Loading branch information
aersam authored Mar 4, 2024
1 parent 3d13238 commit 15538b9
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
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
1 change: 1 addition & 0 deletions python/tests/pyspark_integration/test_write_to_pyspark.py
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

0 comments on commit 15538b9

Please sign in to comment.