Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 854e06e

Browse files
committed
Run black
1 parent 02e3da0 commit 854e06e

File tree

7 files changed

+14
-18
lines changed

7 files changed

+14
-18
lines changed

data_diff/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
__version__ = "0.3.0rc4"
1212

13+
1314
def connect_to_table(
1415
db_info: Union[str, dict],
1516
table_name: Union[DbPath, str],
@@ -76,7 +77,6 @@ def diff_tables(
7677
materialize_all_rows: bool = False,
7778
# Maximum number of rows to write when materializing, per thread. (joindiff only)
7879
table_write_limit: int = TABLE_WRITE_LIMIT,
79-
8080
) -> Iterator:
8181
"""Finds the diff between table1 and table2.
8282
@@ -160,7 +160,7 @@ def diff_tables(
160160
sample_exclusive_rows=sample_exclusive_rows,
161161
materialize_to_table=materialize_to_table,
162162
materialize_all_rows=materialize_all_rows,
163-
table_write_limit=table_write_limit
163+
table_write_limit=table_write_limit,
164164
)
165165
else:
166166
raise ValueError(f"Unknown algorithm: {algorithm}")

data_diff/sqeleton/databases/connect.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from .duckdb import DuckDB
2222

2323

24-
2524
@dataclass
2625
class MatchUriPath:
2726
database_cls: Type[Database]

data_diff/sqeleton/queries/ast_classes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -786,6 +786,7 @@ class CurrentTimestamp(ExprNode):
786786
def compile(self, c: Compiler) -> str:
787787
return c.dialect.current_timestamp()
788788

789+
789790
# DDL
790791

791792

data_diff/sqeleton/queries/compiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
cv_params = contextvars.ContextVar("params")
1313

14+
1415
class Root:
1516
"Nodes inheriting from Root can be used as root statements in SQL (e.g. SELECT yes, RANDOM() no)"
1617

@@ -38,6 +39,7 @@ def compile(self, elem, params=None) -> str:
3839

3940
if self.root and isinstance(elem, Compilable) and not isinstance(elem, Root):
4041
from .ast_classes import Select
42+
4143
elem = Select(columns=[elem])
4244

4345
res = self._compile(elem)

tests/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def get_git_revision_short_hash() -> str:
8787
_database_instances = {}
8888

8989

90-
def get_conn(cls: type, shared: bool =True) -> Database:
90+
def get_conn(cls: type, shared: bool = True) -> Database:
9191
if shared:
9292
if cls not in _database_instances:
9393
_database_instances[cls] = get_conn(cls, shared=False)
@@ -181,6 +181,7 @@ def _test_per_database(cls):
181181

182182
return _test_per_database
183183

184+
184185
def table_segment(database, table_path, key_columns, *args, **kw):
185186
if isinstance(key_columns, str):
186187
key_columns = (key_columns,)

tests/sqeleton/test_sql.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ def test_compile_int(self):
1818
self.assertEqual("1", self.compiler.compile(1))
1919

2020
def test_compile_table_name(self):
21-
self.assertEqual("`marine_mammals`.`walrus`", self.compiler.replace(root=False).compile(table("marine_mammals", "walrus")))
21+
self.assertEqual(
22+
"`marine_mammals`.`walrus`", self.compiler.replace(root=False).compile(table("marine_mammals", "walrus"))
23+
)
2224

2325
def test_compile_select(self):
2426
expected_sql = "SELECT name FROM `marine_mammals`.`walrus`"

tests/test_diff_tables.py

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
test_each_database: Callable = test_each_database_in_list(TEST_DATABASES)
3232

3333

34-
3534
class TestUtils(unittest.TestCase):
3635
def test_split_space(self):
3736
for i in range(0, 10):
@@ -90,24 +89,16 @@ def test_basic(self):
9089
def test_offset(self):
9190
differ = HashDiffer(bisection_factor=2, bisection_threshold=10)
9291
sec1 = self.now.shift(seconds=-3).datetime
93-
a = table_segment(
94-
self.connection, self.table_src_path, "id", "datetime", max_update=sec1, case_sensitive=False
95-
)
96-
b = table_segment(
97-
self.connection, self.table_dst_path, "id", "datetime", max_update=sec1, case_sensitive=False
98-
)
92+
a = table_segment(self.connection, self.table_src_path, "id", "datetime", max_update=sec1, case_sensitive=False)
93+
b = table_segment(self.connection, self.table_dst_path, "id", "datetime", max_update=sec1, case_sensitive=False)
9994
assert a.count() == 4, a.count()
10095
assert b.count() == 3
10196

10297
assert not list(differ.diff_tables(a, a))
10398
self.assertEqual(len(list(differ.diff_tables(a, b))), 1)
10499

105-
a = table_segment(
106-
self.connection, self.table_src_path, "id", "datetime", min_update=sec1, case_sensitive=False
107-
)
108-
b = table_segment(
109-
self.connection, self.table_dst_path, "id", "datetime", min_update=sec1, case_sensitive=False
110-
)
100+
a = table_segment(self.connection, self.table_src_path, "id", "datetime", min_update=sec1, case_sensitive=False)
101+
b = table_segment(self.connection, self.table_dst_path, "id", "datetime", min_update=sec1, case_sensitive=False)
111102
assert a.count() == 2
112103
assert b.count() == 2
113104
assert not list(differ.diff_tables(a, b))

0 commit comments

Comments
 (0)