Merged
Conversation
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
2b891b0 to
5883f53
Compare
Contributor
Author
|
Hmm. Same issue as the coverage branch - the comment is failing and erroring out CI. |
Member
|
This looks great, thank you very much. |
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #12
This handles significant digits (
S) forDate,LongYear, andExponentialYearclasses.