Rewritten to hopefully achieve a cleaner code base and better user experience.
Breaking
- Only officially supporting `Python 3.8` and above.
- `TimeLength.total_seconds` was moved to `TimeLength.result.seconds`.
- `TimeLength.parsed_value` was moved to `TimeLength.result.invalid` and `TimeLength.result.valid`.
- `TimeLength.passed_value` was renamed to `TimeLength.content`.
- Scales, such as `TimeLength.Second`, were moved to the `TimeLength.Locale`.
Features
- `TimeLength.result.success` to determine the parsing outcome based on `TimeLength.strict`. See the `README` for more information.
- Numerals (`half a day`), (`twelve hours`), etc, are supported.
- The same `TimeLength` object can be reused by accessing `TimeLength.content` and `TimeLength.parse()`.
- Parsers are now in their own files found in `timelength/parsers` and are loaded dynamically by the `Locale` that uses them. `Locale`s determine which parser to use based on the config file they are passed, which are found in `timelength/locales`.
- The 2 default supported `Locale`s are `English` and `Spanish`. Custom `Locale`s are possible by using the `CustomLocale` object and a custom config file. See the `README` for more information.
Improvements
- Errors will no longer be thrown during parsing even if `TimeLength.strict` is `True`. 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 disabled `Scale`.
- Using `ruff` to format code everywhere except for the test files.