Metadata-Version: 2.4
Name: regdurations
Version: 1.0.8
Summary: Parse user-provided duration strings using regular expressions
Author: CrisMystik
License-Expression: BSL-1.0
Project-URL: Homepage, https://github.com/CrisMystik/RegDurations
Project-URL: Issues, https://github.com/CrisMystik/RegDurations/issues
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Classifier: Typing :: Typed
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 5 - Production/Stable
Classifier: Natural Language :: English
Classifier: Natural Language :: Italian
Classifier: Natural Language :: French
Classifier: Natural Language :: Spanish
Classifier: Natural Language :: German
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE_1_0.txt
Provides-Extra: find-relativedelta
Requires-Dist: python-dateutil; extra == "find-relativedelta"
Provides-Extra: relativedelta
Requires-Dist: python-dateutil; extra == "relativedelta"
Provides-Extra: dateutil
Requires-Dist: python-dateutil; extra == "dateutil"
Dynamic: license-file

# RegDurations

This library allows to simply parse durations written in a string, in multiple supported languages.

## Install
Run:
```
pip install regdurations
```

## Usage
``` python
from regdurations import DurationParser

duration_parser = DurationParser()
# optionally specify a list of supported languages:
duration_parser = DurationParser(allowed_languages=['it', 'en'])

duration_parser.find_relativedelta('3 weeks 10y 4 anni 5 minuti')
>>> (relativedelta(years=+14, days=+21, minutes=+5), 0, 27)  # result, starting index, ending index
# or, if dateutil is not installed:
duration_parser.find_dict('4s 23gg 78 settimane')
>>> ({'seconds': 4, 'minutes': 0, 'hours': 0, 'days': 23, 'weeks': 78, 'months': 0, 'years': 0}, 0, 20)
```

## Supported Languages
* `EN`, `IT`, `FR`, `DE`, `ES`
* Contributions for new languages are accepted

## Credits and contact
* Thanks to [CalledLuca](https://github.com/CalledLuca) for the idea and the `FR`, `DE`, `ES` languages!
* For any question you can try to **contact** me on [Telegram](https://t.me/CrisMystik).

## License
This project is licensed under the **Boost Software License**. Please take a look.
