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

Commit dcca028

Browse files
authored
Merge pull request #752 from datafold/minor-type-annotations
Correct a few misleading type annotations
2 parents 3bc08e2 + 4d0e273 commit dcca028

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

data_diff/databases/base.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,9 @@ def _process_table_schema(
996996
# Return a dict of form {name: type} after normalization
997997
return col_dict
998998

999-
def _refine_coltypes(self, table_path: DbPath, col_dict: Dict[str, ColType], where: str = None, sample_size=64):
999+
def _refine_coltypes(
1000+
self, table_path: DbPath, col_dict: Dict[str, ColType], where: Optional[str] = None, sample_size=64
1001+
):
10001002
"""Refine the types in the column dict, by querying the database for a sample of their values
10011003
10021004
'where' restricts the rows to be sampled.

data_diff/diff_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ def _diff_tables_wrapper(self, table1: TableSegment, table2: TableSegment, info_
244244
if error:
245245
raise error
246246

247-
def _validate_and_adjust_columns(self, table1: TableSegment, table2: TableSegment) -> DiffResult:
247+
def _validate_and_adjust_columns(self, table1: TableSegment, table2: TableSegment) -> None:
248248
pass
249249

250250
def _diff_tables_root(self, table1: TableSegment, table2: TableSegment, info_tree: InfoTree) -> DiffResult:

data_diff/hashdiff_tables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def __attrs_post_init__(self):
8282
if self.bisection_factor < 2:
8383
raise ValueError("Must have at least two segments per iteration (i.e. bisection_factor >= 2)")
8484

85-
def _validate_and_adjust_columns(self, table1, table2, *, strict: bool = True):
85+
def _validate_and_adjust_columns(self, table1: TableSegment, table2: TableSegment, *, strict: bool = True) -> None:
8686
for c1, c2 in safezip(table1.relevant_columns, table2.relevant_columns):
8787
if c1 not in table1._schema:
8888
raise ValueError(f"Column '{c1}' not found in schema for table {table1}")

tests/test_utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ def test_remove_passwords_in_dict(self):
2727
assert d["info"]["password"] == "%%"
2828

2929
# Test replacing a motherduck token in nested dictionary
30-
d = {'database1': {'driver': 'duckdb', 'filepath':'md:datafold_demo?motherduck_token=awieojfaowiejacijobhiwaef'}}
30+
d = {
31+
"database1": {"driver": "duckdb", "filepath": "md:datafold_demo?motherduck_token=awieojfaowiejacijobhiwaef"}
32+
}
3133
remove_passwords_in_dict(d, "%%")
3234
assert d["database1"]["filepath"] == "md:datafold_demo?motherduck_token=%%"
3335

@@ -54,7 +56,9 @@ def test__main__remove_passwords_in_dict(self):
5456
assert d["info"]["password"] == "**********"
5557

5658
# Test replacing a motherduck token in nested dictionary
57-
d = {'database1': {'driver': 'duckdb', 'filepath':'md:datafold_demo?motherduck_token=awieojfaowiejacijobhiwaef'}}
59+
d = {
60+
"database1": {"driver": "duckdb", "filepath": "md:datafold_demo?motherduck_token=awieojfaowiejacijobhiwaef"}
61+
}
5862
_remove_passwords_in_dict(d)
5963
assert d["database1"]["filepath"] == "md:datafold_demo?motherduck_token=**********"
6064

0 commit comments

Comments
 (0)