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

Support various number of digits after the comma in the timestamp %f … #178

Conversation

bbertincourt
Copy link
Contributor

…format

This PR adds a small modification to support various number of digits (1 to 6) after the comma to be picked up and recognized by the "%f" directive as it does with datetime.strptime.

I believe this also answers #127

Current State

from parse import parse

ok_result = parse("{:%H:%M:%S.%f}", "12:34:56.789000")
print(ok_result)

fail_result = parse("{:%H:%M:%S.%f}", "12:34:56.789")
print(fail_result)  # is None

Output[]

<Result (datetime.time(12, 34, 56, 789000),) {}>
None

Desired State

Output[]

<Result (datetime.time(12, 34, 56, 789000),) {}>
<Result (datetime.time(12, 34, 56, 789000),) {}>

@codecov-commenter
Copy link

codecov-commenter commented Jan 28, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.65%. Comparing base (8ae5d30) to head (b1d2121).
Report is 8 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #178   +/-   ##
=======================================
  Coverage   94.65%   94.65%           
=======================================
  Files           1        1           
  Lines         543      543           
  Branches      132      132           
=======================================
  Hits          514      514           
  Misses         18       18           
  Partials       11       11           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@wimglenn wimglenn merged commit 79f516d into r1chardj0n3s:master Jan 28, 2024
22 checks passed
@wimglenn
Copy link
Collaborator

This seems reasonable. Thanks for the contribution!

@bbertincourt
Copy link
Contributor Author

@wimglenn I have these weirdly formatted log exports that parse does a really good job on. Helps me really, thanks for maintaining parse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants