Skip to content
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

refactor: remove arrow from CA-BC parser #6185

Conversation

Barissa-Imran
Copy link
Contributor

Issue

Refs: #6135

Description

Upgrade the parser to use datetime which is a python buit-in. Parser functionality has not changed.

  • rename datetime variable to parsed_datetime

Preview

Double check

  • I have tested my parser changes locally with poetry run test_parser "zone_key"
  • I have run pnpx prettier --write . and poetry run format to format my changes.

Upgrade the parser to use `datetime`. Parser functionality has not changed.

- add `24` hour handling (midnight next day)
Upgrade the parser to use `datetime` which is a python buit-in. Parser functionality has not changed.
- rename `datetime` variable to `parsed_datetime`
@VIKTORVAV99 VIKTORVAV99 self-requested a review November 28, 2023 15:07
@Barissa-Imran Barissa-Imran mentioned this pull request Nov 29, 2023
95 tasks
@VIKTORVAV99
Copy link
Member

Seems like this also contains the changes from the CA-AB pr it would be great if you could remove those changes from this PR, then I'll give it a proper review but I don't think there is any problems with the CA-BC changes at first glance.

Comment on lines +86 to +92
except ValueError:
# Handle special case where hour is `24`
row[0] = row[0].replace(" 24", " 00")
date_time = datetime.strptime(row[0], "%m/%d/%Y %H").replace(
tzinfo=TIMEZONE
)
date_time += timedelta(days=1)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there be a test to confirm that the 24 value is present and did cause the ValueError?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes actually, but lemme refactor the whole code block so that we don't need the exception

@github-actions github-actions bot added the python Pull requests that update Python code label Dec 22, 2023
@VIKTORVAV99 VIKTORVAV99 closed this Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
parser python Pull requests that update Python code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants