From 8e8b87d69824584bacd9670c142f588d70aa1000 Mon Sep 17 00:00:00 2001 From: lennybronner Date: Tue, 15 Oct 2024 18:45:04 -0400 Subject: [PATCH] linter --- src/elexmodel/client.py | 8 ++++++-- src/elexmodel/handlers/data/CombinedData.py | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/elexmodel/client.py b/src/elexmodel/client.py index bc194655..5912c94f 100644 --- a/src/elexmodel/client.py +++ b/src/elexmodel/client.py @@ -1,6 +1,6 @@ import logging -from collections import defaultdict import pprint +from collections import defaultdict import numpy as np import pandas as pd @@ -352,7 +352,11 @@ def get_estimates( There are {n_nonreporting_units} nonreporting units.""" ) if len(non_modeled_units) > 0: - non_modeled_units = non_modeled_units.groupby("unit_category")[["postal_code", "geographic_unit_fips"]].apply(lambda x: list(x.itertuples(index=False, name=None))).to_dict() + non_modeled_units = ( + non_modeled_units.groupby("unit_category")[["postal_code", "geographic_unit_fips"]] + .apply(lambda x: list(x.itertuples(index=False, name=None))) + .to_dict() + ) non_modeled_units_pprint = pprint.pformat(non_modeled_units) LOG.info(f"non-modeled units:\n{non_modeled_units_pprint}") diff --git a/src/elexmodel/handlers/data/CombinedData.py b/src/elexmodel/handlers/data/CombinedData.py index 8b930234..f28bc17d 100644 --- a/src/elexmodel/handlers/data/CombinedData.py +++ b/src/elexmodel/handlers/data/CombinedData.py @@ -227,8 +227,10 @@ def _get_non_modeled_units( ].copy() units_with_strange_margin_change["unit_category"] = "non-modeled: strange margin change" non_modeled_units_list.append(units_with_strange_margin_change) - - non_modeled_units = pd.concat(non_modeled_units_list).reset_index(drop=True).drop_duplicates(subset='geographic_unit_fips') + + non_modeled_units = ( + pd.concat(non_modeled_units_list).reset_index(drop=True).drop_duplicates(subset="geographic_unit_fips") + ) return non_modeled_units def write_data(self, election_id, office):