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

Commit 1c62044

Browse files
author
Sergey Vasilyev
committed
Annotate methods with clearly no results
1 parent 001f63f commit 1c62044

File tree

11 files changed

+27
-27
lines changed

11 files changed

+27
-27
lines changed

Diff for: data_diff/__main__.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def _get_schema(pair: Tuple[Database, DbPath]) -> Dict[str, RawColumnInfo]:
7777
return db.query_table_schema(table_path)
7878

7979

80-
def diff_schemas(table1, table2, schema1, schema2, columns):
80+
def diff_schemas(table1, table2, schema1, schema2, columns) -> None:
8181
logging.info("Diffing schemas...")
8282
attrs = "name", "type", "datetime_precision", "numeric_precision", "numeric_scale"
8383
for c in columns:
@@ -281,7 +281,7 @@ def write_usage(self, prog: str, args: str = "", prefix: Optional[str] = None) -
281281
default=None,
282282
help="Override the dbt production schema configuration within dbt_project.yml",
283283
)
284-
def main(conf, run, **kw):
284+
def main(conf, run, **kw) -> None:
285285
log_handlers = _get_log_handlers(kw["dbt"])
286286
if kw["table2"] is None and kw["database2"]:
287287
# Use the "database table table" form
@@ -341,9 +341,7 @@ def main(conf, run, **kw):
341341
production_schema_flag=kw["prod_schema"],
342342
)
343343
else:
344-
return _data_diff(
345-
dbt_project_dir=project_dir_override, dbt_profiles_dir=profiles_dir_override, state=state, **kw
346-
)
344+
_data_diff(dbt_project_dir=project_dir_override, dbt_profiles_dir=profiles_dir_override, state=state, **kw)
347345
except Exception as e:
348346
logging.error(e)
349347
raise
@@ -389,7 +387,7 @@ def _data_diff(
389387
threads1=None,
390388
threads2=None,
391389
__conf__=None,
392-
):
390+
) -> None:
393391
if limit and stats:
394392
logging.error("Cannot specify a limit when using the -s/--stats switch")
395393
return

Diff for: data_diff/cloud/data_source.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def process_response(self, value: str) -> str:
4646
return value
4747

4848

49-
def _validate_temp_schema(temp_schema: str):
49+
def _validate_temp_schema(temp_schema: str) -> None:
5050
if len(temp_schema.split(".")) != 2:
5151
raise ValueError("Temporary schema should have a format <database>.<schema>")
5252

Diff for: data_diff/config.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ def _apply_config(config: Dict[str, Any], run_name: str, kw: Dict[str, Any]):
9999
_ENV_VAR_PATTERN = r"\$\{([A-Za-z0-9_]+)\}"
100100

101101

102-
def _resolve_env(config: Dict[str, Any]):
102+
def _resolve_env(config: Dict[str, Any]) -> None:
103103
"""
104104
Resolve environment variables referenced as ${ENV_VAR_NAME}.
105105
Missing environment variables are replaced with an empty string.

Diff for: data_diff/databases/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class ThreadLocalInterpreter:
188188
compiler: Compiler
189189
gen: Generator
190190

191-
def apply_queries(self, callback: Callable[[str], Any]):
191+
def apply_queries(self, callback: Callable[[str], Any]) -> None:
192192
q: Expr = next(self.gen)
193193
while True:
194194
sql = self.compiler.database.dialect.compile(self.compiler, q)

Diff for: data_diff/dbt_parser.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def try_get_dbt_runner():
5050

5151
# ProfileRenderer.render_data() fails without instantiating global flag MACRO_DEBUGGING in dbt-core 1.5
5252
# hacky but seems to be a bug on dbt's end
53-
def try_set_dbt_flags():
53+
def try_set_dbt_flags() -> None:
5454
try:
5555
from dbt.flags import set_flags
5656

Diff for: data_diff/info_tree.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@ class SegmentInfo:
1818
rowcounts: Dict[int, int] = attrs.field(factory=dict)
1919
max_rows: Optional[int] = None
2020

21-
def set_diff(self, diff: List[Union[Tuple[Any, ...], List[Any]]], schema: Optional[Tuple[Tuple[str, type]]] = None):
21+
def set_diff(
22+
self, diff: List[Union[Tuple[Any, ...], List[Any]]], schema: Optional[Tuple[Tuple[str, type]]] = None
23+
) -> None:
2224
self.diff_schema = schema
2325
self.diff = diff
2426
self.diff_count = len(diff)
2527
self.is_diff = self.diff_count > 0
2628

27-
def update_from_children(self, child_infos):
29+
def update_from_children(self, child_infos) -> None:
2830
child_infos = list(child_infos)
2931
assert child_infos
3032

@@ -53,7 +55,7 @@ def add_node(self, table1: TableSegment, table2: TableSegment, max_rows: Optiona
5355
self.children.append(node)
5456
return node
5557

56-
def aggregate_info(self):
58+
def aggregate_info(self) -> None:
5759
if self.children:
5860
for c in self.children:
5961
c.aggregate_info()

Diff for: data_diff/queries/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def coalesce(*exprs) -> Func:
151151
return Func("COALESCE", exprs)
152152

153153

154-
def insert_rows_in_batches(db, tbl: TablePath, rows, *, columns=None, batch_size=1024 * 8):
154+
def insert_rows_in_batches(db, tbl: TablePath, rows, *, columns=None, batch_size=1024 * 8) -> None:
155155
assert batch_size > 0
156156
rows = list(rows)
157157

Diff for: data_diff/query_utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def _drop_table(name: DbPath):
2323
yield commit
2424

2525

26-
def drop_table(db, tbl):
26+
def drop_table(db, tbl) -> None:
2727
if isinstance(db, Oracle):
2828
db.query(_drop_table_oracle(tbl))
2929
else:
@@ -51,6 +51,6 @@ def _append_to_table(path: DbPath, expr: Expr):
5151
yield commit
5252

5353

54-
def append_to_table(db, path, expr):
54+
def append_to_table(db, path, expr) -> None:
5555
f = _append_to_table_oracle if isinstance(db, Oracle) else _append_to_table
5656
db.query(f(path, expr))

Diff for: data_diff/thread_utils.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class AutoPriorityQueue(PriorityQueue):
1919

2020
_counter = itertools.count().__next__
2121

22-
def put(self, item: Optional[_WorkItem], block=True, timeout=None):
22+
def put(self, item: Optional[_WorkItem], block=True, timeout=None) -> None:
2323
priority = item.kwargs.pop("priority") if item is not None else 0
2424
super().put((-priority, self._counter(), item), block, timeout)
2525

@@ -66,7 +66,7 @@ def __init__(self, max_workers: Optional[int] = None, yield_list: bool = False)
6666
self._exception = None
6767
self.yield_list = yield_list
6868

69-
def _worker(self, fn, *args, **kwargs):
69+
def _worker(self, fn, *args, **kwargs) -> None:
7070
try:
7171
res = fn(*args, **kwargs)
7272
if res is not None:
@@ -77,7 +77,7 @@ def _worker(self, fn, *args, **kwargs):
7777
except Exception as e:
7878
self._exception = e
7979

80-
def submit(self, fn: Callable, *args, priority: int = 0, **kwargs):
80+
def submit(self, fn: Callable, *args, priority: int = 0, **kwargs) -> None:
8181
self._futures.append(self._pool.submit(self._worker, fn, *args, priority=priority, **kwargs))
8282

8383
def __iter__(self) -> Iterator[Any]:

Diff for: data_diff/tracking.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def bool_notify_about_extension() -> bool:
8080
entrypoint_name = "Python API"
8181

8282

83-
def disable_tracking():
83+
def disable_tracking() -> None:
8484
global g_tracking_enabled
8585
g_tracking_enabled = False
8686

@@ -89,7 +89,7 @@ def is_tracking_enabled():
8989
return g_tracking_enabled
9090

9191

92-
def set_entrypoint_name(s):
92+
def set_entrypoint_name(s) -> None:
9393
global entrypoint_name
9494
entrypoint_name = s
9595

@@ -99,17 +99,17 @@ def set_entrypoint_name(s):
9999
dbt_project_id = None
100100

101101

102-
def set_dbt_user_id(s):
102+
def set_dbt_user_id(s) -> None:
103103
global dbt_user_id
104104
dbt_user_id = s
105105

106106

107-
def set_dbt_version(s):
107+
def set_dbt_version(s) -> None:
108108
global dbt_version
109109
dbt_version = s
110110

111111

112-
def set_dbt_project_id(s):
112+
def set_dbt_project_id(s) -> None:
113113
global dbt_project_id
114114
dbt_project_id = s
115115

@@ -201,7 +201,7 @@ def create_email_signup_event_json(email: str) -> Dict[str, Any]:
201201
}
202202

203203

204-
def send_event_json(event_json):
204+
def send_event_json(event_json) -> None:
205205
if not g_tracking_enabled:
206206
raise RuntimeError("Won't send; tracking is disabled!")
207207

Diff for: data_diff/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,13 @@ def __iter__(self) -> Iterator[V]:
9393
def __len__(self) -> int:
9494
return len(self._dict)
9595

96-
def __setitem__(self, key: str, value):
96+
def __setitem__(self, key: str, value) -> None:
9797
k = key.lower()
9898
if k in self._dict:
9999
key = self._dict[k][0]
100100
self._dict[k] = key, value
101101

102-
def __delitem__(self, key: str):
102+
def __delitem__(self, key: str) -> None:
103103
del self._dict[key.lower()]
104104

105105
def get_key(self, key: str) -> str:

0 commit comments

Comments
 (0)