v2.0.0
Rewritten to hopefully achieve a cleaner code base and better user experience.
Breaking
- Only officially supporting
Python 3.8and above. TimeLength.total_secondswas moved toTimeLength.result.seconds.TimeLength.parsed_valuewas moved toTimeLength.result.invalidandTimeLength.result.valid.TimeLength.passed_valuewas renamed toTimeLength.content.- Scales, such as
TimeLength.Second, were moved to theTimeLength.Locale.
Features
TimeLength.result.successto determine the parsing outcome based onTimeLength.strict. See theREADMEfor more information.- Numerals (
half a day), (twelve hours), etc, are supported. - The same
TimeLengthobject can be reused by accessingTimeLength.contentandTimeLength.parse(). - Parsers are now in their own files found in
timelength/parsersand are loaded dynamically by theLocalethat uses them.Locales determine which parser to use based on the config file they are passed, which are found intimelength/locales. - The 2 default supported
Locales areEnglishandSpanish. CustomLocales are possible by using theCustomLocaleobject and a custom config file. See theREADMEfor more information.
Improvements
- Errors will no longer be thrown during parsing even if
TimeLength.strictisTrue. If "invalid" (as determined by the relevant parser) inputs are found, it will be up to the user to determine how to proceed. Errors are still thrown if the config is invalid, or if a conversion method is used for a disabledScale. - Using
ruffto format code everywhere except for the test files.