Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
hussain-jafari committed Nov 4, 2024
1 parent d71bb7b commit b285eda
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/pseudopeople/configuration/noise_configuration.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# mypy: disable-error-code="unused-ignore"
from __future__ import annotations

from typing import Any
Expand All @@ -24,8 +23,7 @@ def __init__(self, config: LayeredConfigTree):
self._config = config

def to_dict(self) -> dict:
# TODO: remove ignore when dropping support for Python 3.9
config_dict: dict = self._config.to_dict() # type: ignore [assignment]
config_dict: dict = self._config.to_dict()
return config_dict

def get_value(
Expand Down Expand Up @@ -80,8 +78,7 @@ def get_value(
)
noise_value: int | float | LayeredConfigTree = parameter_tree.get(parameter_name)
converted_noise_value: int | float | dict = (
# not sure how to tell mypy the types in this dict
noise_value.to_dict() # type: ignore [assignment]
noise_value.to_dict()
if isinstance(noise_value, LayeredConfigTree)
else noise_value
)
Expand Down
2 changes: 1 addition & 1 deletion src/pseudopeople/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def count_number_of_tokens_per_string(s1: pd.Series, s2: pd.Series) -> pd.Series
s2 = s2.astype(str)
strings = s2.unique()
tokens_per_string = pd.Series(
list(sum(count_occurrences(s, str(token)) for token in s1) for s in strings),
[sum(count_occurrences(s, str(token)) for token in s1) for s in strings],
index=strings,
)

Expand Down
2 changes: 0 additions & 2 deletions tests/unit/test_column_noise.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,6 @@ def test_leave_blank(dataset: Dataset, fuzzy_checker: FuzzyChecker) -> None:
noised_data: pd.Series = dataset.data[column_name]
# Calculate newly missing data, ie data that didn't come in as already missing
data = data.squeeze()
# mypy can't know that squeeze() will not produce a scalar value
noised_data = noised_data.squeeze() # type: ignore [assignment]
is_not_missing = (data.notna()) & (data != "")
orig_non_missing_idx = is_not_missing[is_not_missing].index
newly_missing_idx = noised_data.index[
Expand Down

0 comments on commit b285eda

Please sign in to comment.