Skip to content

Commit

Permalink
chore(flake8): remove redundant noqa statements
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed Mar 24, 2021
1 parent e2a08a5 commit 64b5e18
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 27 deletions.
1 change: 0 additions & 1 deletion examples/flight_delays.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
import pandas as pd

import popmon
Expand Down
1 change: 0 additions & 1 deletion examples/synthetic_data.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# flake8: noqa
import pandas as pd

import popmon
Expand Down
1 change: 0 additions & 1 deletion popmon/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
make_histograms,
)

# flake8: noqa
# pandas/spark dataframe decorators
from popmon import decorators

Expand Down
40 changes: 20 additions & 20 deletions popmon/analysis/apply_func.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ def apply_func(feature, selected_metrics, df, arr):

if (
"entire" in arr
and arr["entire"] is not None # noqa: W503
and arr["entire"] is not False # noqa: W503
and arr["entire"] != 0 # noqa: W503
and arr["entire"] is not None
and arr["entire"] is not False
and arr["entire"] != 0
):
obj = func(df, *args, **kwargs)
else:
Expand All @@ -302,48 +302,48 @@ def apply_func(feature, selected_metrics, df, arr):
obj = {"_".join(df.columns): obj}
elif (
isinstance(obj, (list, tuple, np.ndarray))
and isinstance(df, pd.DataFrame) # noqa: W503
and len(df.columns) == len(obj) # noqa: W503
and isinstance(df, pd.DataFrame)
and len(df.columns) == len(obj)
):
obj = {c: o for c, o in zip(df.columns, obj)}
elif (
isinstance(obj, (list, tuple, np.ndarray))
and isinstance(df, pd.Series) # noqa: W503
and len(df.index) == len(obj) # noqa: W503
and isinstance(df, pd.Series)
and len(df.index) == len(obj)
):
obj = {df.name: pd.Series(data=obj, index=df.index)}
elif (
isinstance(obj, (list, tuple, np.ndarray))
and isinstance(df, pd.DataFrame) # noqa: W503
and len(df.index) == len(obj) # noqa: W503
and isinstance(df, pd.DataFrame)
and len(df.index) == len(obj)
):
obj = {"_".join(df.columns): pd.Series(data=obj, index=df.index)}
elif (
isinstance(obj, pd.Series)
and isinstance(df, pd.Series) # noqa: W503
and len(obj) == len(df) # noqa: W503
and all(obj.index == df.index) # noqa: W503
and isinstance(df, pd.Series)
and len(obj) == len(df)
and all(obj.index == df.index)
):
obj = {df.name: obj}
elif (
isinstance(obj, pd.Series)
and isinstance(df, pd.DataFrame) # noqa: W503
and len(obj) == len(df) # noqa: W503
and all(obj.index == df.index) # noqa: W503
and isinstance(df, pd.DataFrame)
and len(obj) == len(df)
and all(obj.index == df.index)
):
obj = {"_".join(df.columns): obj}
elif (
isinstance(obj, pd.DataFrame)
and len(obj.columns) == 1 # noqa: W503
and len(obj.index) != len(df.index) # noqa: W503
and len(obj.columns) == 1
and len(obj.index) != len(df.index)
):
# e.g. output of normalized_hist_mean_cov: a dataframe with one column, actually a series
obj = obj[obj.columns[0]].to_dict()
elif (
isinstance(obj, pd.DataFrame)
and len(obj.columns) == 1 # noqa: W503
and len(obj.index) == len(df.index) # noqa: W503
and (obj.index != df.index).any() # noqa: W503
and len(obj.columns) == 1
and len(obj.index) == len(df.index)
and (obj.index != df.index).any()
):
# e.g. output of normalized_hist_mean_cov: a dataframe with one column, actually a series
obj = obj[obj.columns[0]].to_dict()
Expand Down
6 changes: 3 additions & 3 deletions popmon/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@
"chi2_pvalue": "p-value of the chi-squared statistic, comparing each time slot with {ref}",
"chi2_zscore": "Z-score of the chi-squared statistic, comparing each time slot with {ref}",
"chi2_max_residual": "The largest absolute normalized residual (|chi|) observed in all bin pairs "
+ "(one histogram in a time slot and one in {ref})", # noqa: W503
+ "(one histogram in a time slot and one in {ref})",
"chi2_spike_count": "The number of normalized residuals of all bin pairs (one histogram in a time"
+ " slot and one in {ref}) with absolute value bigger than a given threshold (default: 7).", # noqa: W503
+ " slot and one in {ref}) with absolute value bigger than a given threshold (default: 7).",
"max_prob_diff": "The largest absolute difference between all bin pairs of two normalized "
+ "histograms (one histogram in a time slot and one in {ref})", # noqa: W503
+ "histograms (one histogram in a time slot and one in {ref})",
"unknown_labels": "Are categories observed in a given time slot that are not present in {ref}?",
}

Expand Down
2 changes: 1 addition & 1 deletion tests/popmon/visualization/test_report_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,5 @@ def test_report_generator():
assert "final_report" in datastore
assert (
isinstance(datastore["final_report"], str)
and len(datastore["final_report"]) > 0 # noqa: W503
and len(datastore["final_report"]) > 0
)

0 comments on commit 64b5e18

Please sign in to comment.