Skip to content

Commit

Permalink
mypy fixes round 2
Browse files Browse the repository at this point in the history
  • Loading branch information
BuzzCutNorman committed Jul 25, 2023
1 parent 62c2c32 commit 541a46d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions singer_sdk/helpers/_perftimer.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,32 @@ def __init__(
"""The max size a bulk insert can be"""

@property
def sink_max_size(self):
def sink_max_size(self) -> int:
"""The current MAX_SIZE_DEFAULT."""
return self._sink_max_size

Check warning on line 67 in singer_sdk/helpers/_perftimer.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_perftimer.py#L67

Added line #L67 was not covered by tests

@property
def max_perf_counter(self):
def max_perf_counter(self) -> float:
"""How many seconds can pass before a insert."""
return self._max_perf_counter

Check warning on line 72 in singer_sdk/helpers/_perftimer.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_perftimer.py#L72

Added line #L72 was not covered by tests

@property
def perf_diff_allowed_min(self):
def perf_diff_allowed_min(self) -> float:
"""The mininum negative variance allowed, 1/3 worse than wanted."""
return -1.0 * (self.max_perf_counter * 0.33)

Check warning on line 77 in singer_sdk/helpers/_perftimer.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_perftimer.py#L77

Added line #L77 was not covered by tests

@property
def perf_diff_allowed_max(self):
def perf_diff_allowed_max(self) -> float:
"""The maximum postive variace allowed, # 3/4 better than wanted."""
return self.max_perf_counter * 0.75

Check warning on line 82 in singer_sdk/helpers/_perftimer.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_perftimer.py#L82

Added line #L82 was not covered by tests

@property
def perf_diff(self) -> float:
"""Difference between wanted elapsed time and actual elpased time."""
diff = 0

Check warning on line 87 in singer_sdk/helpers/_perftimer.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_perftimer.py#L87

Added line #L87 was not covered by tests
if self._lap_time:
return self.max_perf_counter - self.lap_time
return float(0)
diff = self.max_perf_counter - self.lap_time
return float(diff)

Check warning on line 90 in singer_sdk/helpers/_perftimer.py

View check run for this annotation

Codecov / codecov/patch

singer_sdk/helpers/_perftimer.py#L89-L90

Added lines #L89 - L90 were not covered by tests

def counter_based_max_size(self) -> int: # noqa: C901
"""Caclulate performance based batch size."""
Expand Down

0 comments on commit 541a46d

Please sign in to comment.