-
Notifications
You must be signed in to change notification settings - Fork 680
[ENH] clean-up refactor of TimeSeriesDataSet
#1746
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, this clean-up looks good to me 😊
A one point that we should consider:
- I think we can start handling exceptions using
if
conditions instead ofassert
asif
is optimized for runtime, and for some cases for example if a user is running a python program using optimizer flags(python -O
orpython -OO
) theassert
conditions are skipped.
def divide(a, b):
if b == 0:
raise ValueError("Denominator cannot be zero.")
return a / b
print(divide(1, 0) # ValueError: Cannot divide by zero when we do python -O script.py
When we use assert
def divide(a, b):
assert b != 0, "Denominator cannot be zero."
return a / b
print(divide(2/0)) # ZeroDivisionError: division by zero with python -O
For the second case, the exception we wanted to handle was skipped and we got an unexpected exception which can affect the exceptions handling in general for the case of our codebase.
thanks for review, @fnhirwa - merging so we avoid issues with the linting PR, I will address the assert/raise issue later. |
This PR carries out a clean-up refactor of
TimeSeriesDataSet
. No changes are made to the logic.This is in preparation for major work items impacting the logic, e.g., removal of the
pandas
coupling (see #1685), or a 2.0 rework (see #1736).In general, a clean state would make these easier.
Work carried out: