Skip to content

Commit fdbc30f

Browse files
committed
ruff checks
1 parent 6dbfe0b commit fdbc30f

11 files changed

Lines changed: 20 additions & 22 deletions

File tree

examples/ogdc_leakage_case/compare_leakage.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
run: python compare_leakage.py
66
"""
77

8-
import sys, os
8+
import sys
9+
import os
910
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
1011

1112
import pandas as pd
12-
import numpy as np
1313
from sklearn.ensemble import RandomForestClassifier, GradientBoostingClassifier
1414
from sklearn.metrics import accuracy_score, roc_auc_score
1515

examples/sensor-example/sensor_example.ipynb

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@
209209
},
210210
{
211211
"cell_type": "code",
212-
"execution_count": 7,
212+
"execution_count": null,
213213
"id": "67c5aea4",
214214
"metadata": {
215215
"execution": {
@@ -232,9 +232,10 @@
232232
}
233233
],
234234
"source": [
235-
"ax = clean.plot(title=\"Clean synthetic sensor stream (no faults)\")\n",
235+
"ax = clean.plot(title=\"Clean synthetic sensor stream\")\n",
236236
"ax.set_ylabel(\"reading\")\n",
237-
"plt.tight_layout(); plt.show()"
237+
"plt.tight_layout()\n",
238+
"plt.show()"
238239
]
239240
},
240241
{
@@ -317,7 +318,7 @@
317318
},
318319
{
319320
"cell_type": "code",
320-
"execution_count": 9,
321+
"execution_count": null,
321322
"id": "b5afeb69",
322323
"metadata": {
323324
"execution": {
@@ -345,15 +346,18 @@
345346
"a1.plot(df.index, df[\"temperature\"], color=\"tab:red\")\n",
346347
"a1.axvspan(df.index[stuck_start], df.index[stuck_start + 5], color=\"orange\", alpha=0.3,\n",
347348
" label=\"stuck sensor (ANO001)\")\n",
348-
"a1.set_ylabel(\"temperature\"); a1.legend(loc=\"upper right\")\n",
349+
"a1.set_ylabel(\"temperature\")\n",
350+
"a1.legend(loc=\"upper right\")\n",
349351
"\n",
350352
"a2.plot(df.index, df[\"humidity\"], color=\"tab:blue\")\n",
351353
"a2.axvspan(df.index[gap_start], df.index[gap_start + 5], color=\"purple\", alpha=0.25,\n",
352354
" label=\"outage gap (PRF002)\")\n",
353-
"a2.set_ylabel(\"humidity\"); a2.legend(loc=\"upper right\")\n",
355+
"a2.set_ylabel(\"humidity\")\n",
356+
"a2.legend(loc=\"upper right\")\n",
354357
"\n",
355358
"fig.suptitle(\"Faulted sensor stream: frozen segment + outage gap\")\n",
356-
"plt.tight_layout(); plt.show()"
359+
"plt.tight_layout()\n",
360+
"plt.show()"
357361
]
358362
},
359363
{

tests/test_contextual.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import pytest
22
import pandas as pd
3-
import numpy as np
43
from tsauditor.anomaly.contextual import audit_contextual_anomalies
5-
from tsauditor.report.summary import Issue, WARNING
4+
from tsauditor.report.summary import WARNING
65

76
def test_clean_df_no_anomalies(clean_financial_df):
87
"""Case 1 — Clean df -> no issues on continuous market data columns."""

tests/test_missing.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import pytest
21
import pandas as pd
32
import numpy as np
43
from tsauditor.profiler.missing import audit_missing
5-
from tsauditor.report.summary import Issue, WARNING
4+
from tsauditor.report.summary import WARNING
65

76
def test_clean_df_no_missing_values(clean_financial_df):
87
# Case 1 — Clean df with no missing values -> no issues.

tests/test_point.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import pandas as pd
33
import numpy as np
44
from tsauditor.anomaly.point import audit_point_anomalies
5-
from tsauditor.report.summary import WARNING
65

76
@pytest.fixture
87
def base_date_index():

tests/test_profiler.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import pytest
22
import pandas as pd
3-
import numpy as np
43
from tsauditor.profiler.frequency import audit_frequency
5-
from tsauditor.report.summary import Issue, CRITICAL, WARNING
4+
from tsauditor.report.summary import CRITICAL, WARNING
65

76
def test_clean_financial_df_no_issues(clean_financial_df):
87
# Case 1 — Clean daily financial df -> no issues returned.

tests/test_remediation.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import pytest
21

32
from tsauditor.report.summary import Issue, GuardReport, CRITICAL, WARNING, INFO
43

tests/test_scaffold.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
import pytest
1212

1313
import tsauditor as tsa
14-
from tsauditor.report.summary import GuardReport, Issue, CRITICAL, WARNING, INFO
14+
from tsauditor.report.summary import GuardReport, Issue, CRITICAL, WARNING
1515
from tsauditor.utils.validation import validate_dataframe, infer_frequency
1616

1717

tests/test_stationarity.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
import pandas as pd
33
import numpy as np
44
from tsauditor.profiler.stationarity import audit_stationarity
5-
from tsauditor.report.summary import INFO
65

76
@pytest.fixture
87
def base_date_index():

tsauditor/anomaly/point.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import pandas as pd
2-
import numpy as np
32
from tsauditor.report.summary import Issue, WARNING
43

54
def audit_point_anomalies(
@@ -36,7 +35,8 @@ def audit_point_anomalies(
3635

3736
# 3. Z-score Method
3837
mean, std = series.mean(), series.std()
39-
if std == 0: continue
38+
if std == 0:
39+
continue
4040
z_scores = (series - mean) / std
4141
z_mask = abs(z_scores) > z_thresh
4242

0 commit comments

Comments
 (0)