Skip to content

Commit

Permalink
Add typing exemptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ajparsons committed Aug 7, 2023
1 parent a88eba7 commit 8ea4cf7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/data_common/charting/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def json_to_chart(json_spec: str) -> alt.Chart:
del di_copy["datasets"]
del di_copy["width"]
c = Chart.from_dict(di_copy)
chart += c
chart += c # type: ignore
else:
del di["width"]
del di["config"]["view"]
chart = Chart.from_dict(di)
return chart
return chart # type: ignore


def get_chart_from_url(url: str, n: int = 0) -> alt.Chart:
Expand Down
2 changes: 1 addition & 1 deletion src/data_common/charting/sw_theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def color_scale(
use_palette = palette[: len(domain)]
if reverse:
use_palette = use_palette[::-1]
return alt.Scale(domain=domain, range=use_palette)
return alt.Scale(domain=domain, range=use_palette) # type: ignore


font = "Lato"
Expand Down
2 changes: 1 addition & 1 deletion src/data_common/charting/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ def color_scale(
use_palette = palette[: len(domain)]
if reverse:
use_palette = use_palette[::-1]
return alt.Scale(domain=domain, range=use_palette)
return alt.Scale(domain=domain, range=use_palette) # type: ignore


font = "Source Sans Pro"
Expand Down
8 changes: 1 addition & 7 deletions src/data_common/pandas/df_extensions/space.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,12 @@ def t(x):
self.label_df = label_df

def set_k(self, k: int) -> "Cluster":

new = copy.deepcopy(self)

new.k = k
return new

def get_label_name(self, n, include_short=True) -> str:

short_label = n
name = self.label_names.get(self.k, {}).get(n, short_label)
if include_short:
Expand Down Expand Up @@ -205,7 +203,6 @@ def map_from_anchor(self, anchor: pd.DataFrame | Path) -> dict[int, int]:
return mapping.to_dict()

def get_label_options(self) -> list:

return [self.get_label_name(x) for x in range(1, self.k + 1)]

def get_cluster_label_ids(self) -> pd.Series:
Expand All @@ -215,7 +212,6 @@ def get_cluster_label_ids(self) -> pd.Series:
return labels

def get_cluster_labels(self, include_short=True) -> ArrayLike:

labels = self.get_cluster_label_ids()

def f(x):
Expand All @@ -227,7 +223,6 @@ def f(x):
label_array = get_cluster_labels

def get_cluster_descs(self) -> ArrayLike:

labels = self.get_cluster_label_ids()
labels = labels.apply(lambda x: self.get_label_desc(n=x))
return np.array(labels)
Expand Down Expand Up @@ -331,7 +326,7 @@ def _get_clusters(self, k: int):
"""
fetch k means results for this cluster
"""
km = KMeans(n_clusters=k, random_state=self.default_seed, n_init=10)
km = KMeans(n_clusters=k, random_state=self.default_seed, n_init=10) # type: ignore
return km.fit(self.df)

def get_clusters(self, k: int):
Expand Down Expand Up @@ -622,7 +617,6 @@ def join_distance(df_label_dict: Dict[str, pd.DataFrame]) -> pd.DataFrame:
"""

def prepare(df, label):

return (
df.set_index(list(df.columns[:2]))
.rename(columns={"distance": label})
Expand Down

0 comments on commit 8ea4cf7

Please sign in to comment.