Skip to content
Snippets Groups Projects

Fix #11: local variable 'time_points' referenced before assignment

Merged Fix #11: local variable 'time_points' referenced before assignment
1 file
+ 8
9
Compare changes
  • Side-by-side
  • Inline
+ 8
9
@@ -113,9 +113,7 @@ def validate(iofile: File, strict_validate: bool = True) -> (bool, str):
@@ -113,9 +113,7 @@ def validate(iofile: File, strict_validate: bool = True) -> (bool, str):
if a in sampling:
if a in sampling:
assert_validate_type(sampling[a], a_type, a, f"sampling {s_name}")
assert_validate_type(sampling[a], a_type, a, f"sampling {s_name}")
if "frequency_hz" in sampling.attrs:
if "monotonic_time_points_us" in sampling:
pass
elif "monotonic_time_points_us" in sampling:
time_points = sampling["monotonic_time_points_us"]
time_points = sampling["monotonic_time_points_us"]
# 1 dimensional array
# 1 dimensional array
assert_validate(
assert_validate(
@@ -138,12 +136,13 @@ def validate(iofile: File, strict_validate: bool = True) -> (bool, str):
@@ -138,12 +136,13 @@ def validate(iofile: File, strict_validate: bool = True) -> (bool, str):
"Dimensionality of calendar_time_points should be 1",
"Dimensionality of calendar_time_points should be 1",
f"sampling {s_name}",
f"sampling {s_name}",
)
)
assert_validate(
if "monotonic_time_points_us" in sampling:
calendar_points.shape[0] == time_points.shape[0],
assert_validate(
"The length of calendar points (%d) does not match the length of monotonic points (%d)"
calendar_points.shape[0] == time_points.shape[0],
% (calendar_points.shape[0], time_points.shape[0]),
"The length of calendar points (%d) does not match the length of monotonic points (%d)"
f"sampling {s_name}",
% (calendar_points.shape[0], time_points.shape[0]),
)
f"sampling {s_name}",
 
)
# validate iso8601, this validates the dtype implicitly
# validate iso8601, this validates the dtype implicitly
for c in calendar_points.asstr(encoding="utf-8"):
for c in calendar_points.asstr(encoding="utf-8"):
Loading