Timelength

Latest version: v2.0.2

Safety actively analyzes 626691 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

2.0.2

- Updated outdated docstring example.
- Various github-relevant-but-not-package-relevant changes.

2.0.1

- Added a few missing tests to both the `English` and `Spanish` test files that got lost during translation.
- Modified parsing slightly to account for unconventional inputs.

2.0.0

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.

1.1.8

The last (probably) version of the `v1.x` series before a complete rewrite which aims to have better code and more features.

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.