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

Significant Digits #55

Merged
merged 5 commits into from
May 27, 2024
Merged

Conversation

ColeDCrawford
Copy link
Contributor

Addresses #12

This handles significant digits (S) for Date, LongYear, and ExponentialYear classes.

Significant digits should work on a year in any format: "four-digit, 'Y' prefix, or exponential." These correspond to the python-edtf classes of Date, LongYear, and ExponentialYear.
- Add significant digit parsing for Date (year) and LongYear (y-prefixed)
- Standardize grammar for significant digits
- Use significant_digits rather than precision. Precision is used throughout for other functionality.
- Add estimated() public functions for the above EDTF classes
Two tests were failing:
```
FAILED edtf/parser/tests.py::test_edtf_examples[[1667, 1668, 1670..1672]-expected_tuple62] - AttributeError: 'list' object has no attribute 'expandtabs'
FAILED edtf/parser/tests.py::test_edtf_examples[{1667,1668, 1670..1672}-expected_tuple67] - AttributeError: 'list' object has no attribute 'expandtabs'
```

pyparsing.parse_string() was being passed a list by year somehow. Added year_basic for this use case (4 digit year without significant digits). If we need to support Consecutives with significant digits then this isn't a sufficient workaround.
- Adds functionality for significant digits to Date, LongYear, and ExponentialYear
- Updates the tests for significant digits
- Updates the docs for significant digits and a few other references to old syntax (lowercase e, grouping)
- ExponentialYear inherits from LongYear so only need to add it there; LongYear does not inherit from Date, so a bit of code duplication in the _fuzzy() overrides
@ColeDCrawford ColeDCrawford force-pushed the 12_exponential_year_precision branch from 2b891b0 to 5883f53 Compare May 24, 2024 20:04
@ColeDCrawford
Copy link
Contributor Author

Hmm. Same issue as the coverage branch - the comment is failing and erroring out CI.

@aweakley
Copy link
Member

This looks great, thank you very much.

@aweakley aweakley merged commit 6f19388 into ixc:v5 May 27, 2024
5 of 10 checks passed
@ColeDCrawford ColeDCrawford mentioned this pull request Jun 5, 2024
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.

2 participants