Skip to content

Commit c03fe7a

Browse files
committed
ruff formaiting
1 parent d54c3d7 commit c03fe7a

13 files changed

Lines changed: 19 additions & 15 deletions

iglu_python/utils.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,10 @@ def CGMS2DayByDay(
232232
interp_data = interp_data.reshape(n_days, n_points_per_day)
233233

234234
# Get actual dates
235+
if IGLU_R_COMPATIBLE:
236+
# convert start_time into naive datetime
237+
start_time = start_time.tz_localize(None)
238+
235239
actual_dates = [start_time + pd.Timedelta(days=i) for i in range(n_days)]
236240

237241
return interp_data, actual_dates, dt0

notebooks/episode_calculation_evaluation.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@
8888
"source": [
8989
"@iglu_py.bridge.df_conversion\n",
9090
"def my_episode_calculation(data: pd.DataFrame, **kwargs):\n",
91-
" results = bridge.iglu_r.episode_calculation(data, **kwargs)\n",
91+
" results = iglu_py.bridge.iglu_r.episode_calculation(data, **kwargs)\n",
9292
"\n",
9393
" if isinstance(results, pd.DataFrame):\n",
9494
" return results\n",

tests/test_CGMS2DayByDay.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def test_CGMS2DayByDay_iglu_r_compatible(scenario):
4747
expected_results = scenario["results"]
4848
expected_interp_data = np.array(expected_results["gd2d"], dtype=np.float64)
4949
expected_interp_data = np.where(
50-
expected_interp_data == None, np.nan, expected_interp_data
50+
expected_interp_data is None, np.nan, expected_interp_data
5151
)
5252
expected_interp_data = expected_interp_data.astype(np.float64)
5353
expected_actual_dates = [pd.Timestamp(d) for d in expected_results["actual_dates"]]

tests/test_conga.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def test_conga_empty():
109109
"""Test CONGA with empty data"""
110110
empty_data = pd.DataFrame(columns=["id", "time", "gl"])
111111
with pytest.raises(ValueError):
112-
result = iglu.conga(empty_data)
112+
iglu.conga(empty_data)
113113

114114

115115
def test_conga_constant_glucose():

tests/test_ea1c.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def test_ea1c_empty():
118118
"""Test eA1C with empty data"""
119119
empty_data = pd.DataFrame(columns=["id", "time", "gl"])
120120
with pytest.raises(ValueError):
121-
result = iglu.ea1c(empty_data)
121+
iglu.ea1c(empty_data)
122122

123123

124124
def test_ea1c_constant_glucose():

tests/test_episode_calculation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def test_episode_calculation_iglu_r_compatible(scenario):
3333
expected_results = scenario["results"]
3434
if "data" in expected_results:
3535
# this is extended expected result, with two separate dataframes
36-
assert kwargs["return_data"] == True
36+
assert kwargs["return_data"]
3737
expected_episodes_df = pd.DataFrame(expected_results['episodes']).reset_index(drop=True)
3838
expected_data_df = pd.DataFrame(expected_results['data']).reset_index(drop=True)
3939
else :
@@ -46,15 +46,15 @@ def test_episode_calculation_iglu_r_compatible(scenario):
4646
if "time" in df.columns:
4747
df["time"] = pd.to_datetime(df["time"])
4848

49-
if "return_data" in kwargs and kwargs["return_data"] == True :
49+
if "return_data" in kwargs and kwargs["return_data"]:
5050
result_episodes_df, result_data_df = iglu.episode_calculation(df, **kwargs)
5151
else:
5252
result_episodes_df = iglu.episode_calculation(df, **kwargs)
5353

5454
assert result_episodes_df is not None
5555

5656
# Compare DataFrames with precision to 0.001 for numeric columns
57-
if "return_data" in kwargs and kwargs["return_data"] == True :
57+
if "return_data" in kwargs and kwargs["return_data"] :
5858
flag_columns = ['lv1_hypo', 'lv2_hypo', 'lv1_hyper', 'lv2_hyper', 'ext_hypo', 'lv1_hypo_excl', 'lv1_hyper_excl']
5959
for col in flag_columns:
6060
result_data_df[col] = result_data_df[col].astype(bool)
@@ -207,7 +207,7 @@ def test_episode_calculation_empty():
207207
"""Test episode calculation with empty data"""
208208
empty_data = pd.DataFrame(columns=["id", "time", "gl"])
209209
with pytest.raises(ValueError):
210-
result = iglu.episode_calculation(empty_data)
210+
iglu.episode_calculation(empty_data)
211211

212212

213213
def test_episode_calculation_constant_glucose():

tests/test_grade_hypo.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_grade_hypo_empty():
113113
"""Test GRADE hypoglycemia with empty data"""
114114
empty_data = pd.DataFrame(columns=["id", "time", "gl"])
115115
with pytest.raises(ValueError):
116-
result = iglu.grade_hypo(empty_data)
116+
iglu.grade_hypo(empty_data)
117117

118118

119119
def test_grade_hypo_constant_glucose():

tests/test_gri.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def test_gri_empty():
113113
"""Test GRI with empty data"""
114114
empty_data = pd.DataFrame(columns=["id", "time", "gl"])
115115
with pytest.raises(ValueError):
116-
result = iglu.gri(empty_data)
116+
iglu.gri(empty_data)
117117

118118

119119
def test_gri_constant_glucose():

tests/test_j_index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def test_j_index_empty_data():
120120
# Empty DataFrame
121121
data = pd.DataFrame(columns=["id", "time", "gl"])
122122
with pytest.raises(ValueError):
123-
result = iglu.j_index(data)
123+
iglu.j_index(data)
124124

125125

126126
def test_j_index_missing_values():

tests/test_median_glu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def test_median_glu_empty():
110110
"""Test median_glu with empty data"""
111111
empty_data = pd.DataFrame(columns=["id", "time", "gl"])
112112
with pytest.raises(ValueError):
113-
result = iglu.median_glu(empty_data)
113+
iglu.median_glu(empty_data)
114114

115115

116116
def test_median_glu_constant_glucose():

0 commit comments

Comments
 (0)