This commit is contained in:
Iliyan Angelov
2025-09-19 11:58:53 +03:00
parent 306b20e24a
commit 6b247e5b9f
11423 changed files with 1500615 additions and 778 deletions

View File

@@ -0,0 +1,204 @@
Metadata-Version: 2.4
Name: cron_descriptor
Version: 2.0.6
Summary: A Python library that converts cron expressions into human readable strings.
Author-email: Adam Schubert <adam.schubert@sg1-game.net>
License-Expression: MIT
Project-URL: Homepage, https://github.com/Salamek/cron-descriptor
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: typing_extensions
Provides-Extra: dev
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Requires-Dist: polib; extra == "dev"
Provides-Extra: test
Requires-Dist: pytest; extra == "test"
Dynamic: license-file
# Cron Descriptor
[![Python tests](https://github.com/Salamek/cron-descriptor/actions/workflows/python-test.yml/badge.svg)](https://github.com/Salamek/cron-descriptor/actions/workflows/python-test.yml)
[![Donate](https://img.shields.io/badge/Donate-PayPal-green.svg)](https://www.paypal.me/salamek)
A Python library that converts cron expressions into human readable strings. Ported to Python from https://github.com/bradyholt/cron-expression-descriptor.
**Author**: Adam Schubert (https://www.salamek.cz)
**Original Author & Credit**: Brady Holt (http://www.geekytidbits.com)
**License**: [MIT](http://opensource.org/licenses/MIT)
## Features
* Supports all cron expression special characters including * / , - ? L W, #
* Supports 5, 6 (w/ seconds or year), or 7 (w/ seconds and year) part cron expressions
* Provides casing options (Sentence, Title, Lower, etc.)
* Localization with support for ~31 languages
* Supports Python 3.9 - 3.13
## Installation
Using PIP
```bash
pip install cron-descriptor
```
## Usage example
### Simple
```python
from cron_descriptor import get_description, ExpressionDescriptor
print(get_description("* 2 3 * *"))
#OR
print(str(ExpressionDescriptor("* 2 3 * *")))
```
### Advanced
```python
# Consult Options.py/CasingTypeEnum.py/DescriptionTypeEnum.py for more info
from cron_descriptor import Options, CasingTypeEnum, DescriptionTypeEnum, ExpressionDescriptor
descriptor = ExpressionDescriptor(
expression = "*/10 * * * *",
casing_type = CasingTypeEnum.Sentence,
use_24hour_time_format = True
)
# GetDescription uses DescriptionTypeEnum.FULL by default:
print(descriptor.get_description())
print(f"{descriptor = }")
# Or passing Options class as second argument:
options = Options()
options.casing_type = CasingTypeEnum.Sentence
options.use_24hour_time_format = True
descriptor = ExpressionDescriptor("*/10 * * * *", options)
print(descriptor.get_description(DescriptionTypeEnum.FULL))
```
## Languages Available
| Language | Locale Code | Contributor |
|---------------------|-------------|---------------------------------------------------------|
| English | en | [Brady Holt](https://github.com/bradyholt) |
| Chinese Simplified | zh_CN | [Star Peng](https://github.com/starpeng) |
| Chinese Traditional | zh_TW | [Ricky Chiang](https://github.com/metavige) |
| Czech | cs_CZ | [Adam Schubert](https://github.com/salamek) |
| Danish | da_DK | [Rasmus Melchior Jacobsen](https://github.com/rmja) |
| Dutch | nl_NL | [TotalMace](https://github.com/TotalMace) |
| Finnish | fi_FI | [Mikael Rosenberg](https://github.com/MR77FI) |
| French | fr_FR | [Arnaud TAMAILLON](https://github.com/Greybird) |
| German | de_DE | [Michael Schuler](https://github.com/mschuler) |
| Hebrew | he_IL | [Ariel Deil](https://github.com/arieldeil) |
| Hungarian | hu_HU | [Varga Miklós](https://github.com/Micky2149) |
| Italian | it_IT | [rinaldihno](https://github.com/rinaldihno) |
| Japanese | ja_JP | [Tho Nguyen](https://github.com/tho-asterist) |
| Korean | ko_KR | [KyuJoo Han](https://github.com/hanqyu) |
| Norwegian | nb_NO | [Siarhei Khalipski](https://github.com/KhalipskiSiarhei)|
| Persian | fa_IR | [A. Bahrami](https://github.com/alirezakoo) |
| Polish | pl_PL | [foka](https://github.com/foka) |
| Portuguese | pt_PT | [Renato Lima](https://github.com/natenho) |
| Portuguese (Brazil) | pt_BR | [Renato Lima](https://github.com/natenho) |
| Romanian | ro_RO | [Illegitimis](https://github.com/illegitimis) |
| Russian | ru_RU | [LbISS](https://github.com/LbISS) |
| Slovenian | sl_SI | [Jani Bevk](https://github.com/jenzy) |
| Spanish | es_ES | [Ivan Santos](https://github.com/ivansg) |
| Spanish (Mexico) | es_MX | [Ion Mincu](https://github.com/ionmincu) |
| Swedish | sv_SE | [Åke Engelbrektson](https://github.com/eson57) |
| Vietnamese | vi_VN | [Nguyen Duc Son](https://github.com/ali33) |
| Turkish | tr_TR | [Mustafa SADEDİL](https://github.com/sadedil) |
| Tamil | ta_IN | [Sankar Hari](https://github.com/sankarhari) |
| Ukrainian | uk_UA | [Taras](https://github.com/tbudurovych) |
| Greek | el_GR | [hardra1n](https://github.com/Hardra1n) |
| Kazakh | kk_KZ | [hardra1n](https://github.com/Hardra1n) |
<!-- SOON
## Demo
## Download
-->
## Original Source
- .NET - [https://github.com/bradyholt/cron-expression-descriptor](https://github.com/bradyholt/cron-expression-descriptor)
## Ports
- Java - [https://github.com/RedHogs/cron-parser](https://github.com/RedHogs/cron-parser)
- Ruby - [https://github.com/alpinweis/cronex](https://github.com/alpinweis/cronex)
- Golang - [https://github.com/jsuar/go-cron-descriptor](https://github.com/jsuar/go-cron-descriptor)
## Running Unit Tests
```bash
python setup.py test
```
## Translating
cron-descriptor is using [Gettext](https://www.gnu.org/software/gettext/) for translations.
> To create new translation or edit existing one, i suggest using [Poedit](https://poedit.net/).
You can copy/rename and translate any file from `locale` directory:
```bash
cp ./cron_descriptor/locale/de_DE.po ./cron_descriptor/locale/YOUR_LOCALE_CODE.po
poedit ./cron_descriptor/locale/YOUR_LOCALE_CODE.po
```
or you can generate new untranslated *.po file from sources by running in `cron_descriptor` directory:
```bash
cd cron_descriptor
xgettext *.py -o locale/YOUR_LOCALE_CODE.po
```
Generating *.mo file from *.po file. In root directory run command:
```bash
msgfmt -o cron_descriptor/locale/YOUR_LOCALE_CODE.mo cron_descriptor/locale/YOUR_LOCALE_CODE.po
```
## Developing
All suggestions and PR's are welcomed
Just clone this repository and register pre-commit hook by running:
```bash
ln -s ../../code-check.sh .git/hooks/pre-commit
```
Then install dev requirements:
```bash
pip install .[dev,test]
```

View File

@@ -0,0 +1,63 @@
cron_descriptor-2.0.6.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
cron_descriptor-2.0.6.dist-info/METADATA,sha256=PELB8PyrVaQp_xyQeQuo6M6cTK82VzAGj-PKC244cV8,8076
cron_descriptor-2.0.6.dist-info/RECORD,,
cron_descriptor-2.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
cron_descriptor-2.0.6.dist-info/licenses/LICENSE,sha256=MHde0rcKp8I0Rz9ayZ8LVm3_p9qmAlNPO8Dm1eBzUWY,1080
cron_descriptor-2.0.6.dist-info/top_level.txt,sha256=jDWE1nkr6QcBpI8lWv9pv1UQt-m5jRHA7R7C8IIK24E,22
cron_descriptor/CasingTypeEnum.py,sha256=m3Pnas1fLq5eCLe4PRa7vD5QtySVoLd3HVhgvgc5ysg,1306
cron_descriptor/DescriptionTypeEnum.py,sha256=fI-GOeZenDzu3G0HrTTi8pxj-MAAVd5TV8Ee11rHq6M,1364
cron_descriptor/Exception.py,sha256=CF7_wYFvhko1gwYnh0qAjucvN-9ftBndvMLMG9-SK20,1931
cron_descriptor/ExpressionDescriptor.py,sha256=MbbBBmqYZN7Zw1p9MSxjFMOADayaCkLFwC5nytJEmls,26555
cron_descriptor/ExpressionParser.py,sha256=2P0BSmHbMCoFLhAP4JmO6Ljgb8GRkYcVvtASpaotqAk,9329
cron_descriptor/ExpressionValidator.py,sha256=csUKt-Fukcp3GWdYxy_OCJENvxhEOLPkhtWpDDRXQbg,28456
cron_descriptor/GetText.py,sha256=WbKOXLppzMbRbEf-POvGvfUQSurulxlvY8_Pjkqk5ig,2583
cron_descriptor/Options.py,sha256=OUfcK3XropS1YH8y63qWAxbmBtjUJNFYCII39bhOAPY,3392
cron_descriptor/StringBuilder.py,sha256=ZcpTeHDaqm6YdrpI5c7sSote62QBIO0s5aIaFnK9-ig,1674
cron_descriptor/__init__.py,sha256=EJ5l5QGTv-CjOizH_9q-Nm4H3_Cb8w9MrMkrw8Vyl10,1758
cron_descriptor/__main__.py,sha256=6P3CObL22TkQjIoapXHUNCz6aD7mTigFKYJ95oe-fTc,934
cron_descriptor/__pycache__/CasingTypeEnum.cpython-312.pyc,,
cron_descriptor/__pycache__/DescriptionTypeEnum.cpython-312.pyc,,
cron_descriptor/__pycache__/Exception.cpython-312.pyc,,
cron_descriptor/__pycache__/ExpressionDescriptor.cpython-312.pyc,,
cron_descriptor/__pycache__/ExpressionParser.cpython-312.pyc,,
cron_descriptor/__pycache__/ExpressionValidator.cpython-312.pyc,,
cron_descriptor/__pycache__/GetText.cpython-312.pyc,,
cron_descriptor/__pycache__/Options.cpython-312.pyc,,
cron_descriptor/__pycache__/StringBuilder.cpython-312.pyc,,
cron_descriptor/__pycache__/__init__.cpython-312.pyc,,
cron_descriptor/__pycache__/__main__.cpython-312.pyc,,
cron_descriptor/locale/cs_CZ.mo,sha256=HFn-hPlwH7up0JFZlx73uxcIwcC1_Oup9AtfNEgKwpw,2908
cron_descriptor/locale/da_DK.mo,sha256=NyiK4vk7cygVWXqriC_hao5M3BtVq6hmL1kmHmDXup4,2936
cron_descriptor/locale/de_DE.mo,sha256=W2slbsm1REzws0CV3xbC6ODceHlVaWlx1hxdX3UoJiI,2701
cron_descriptor/locale/el_GR.mo,sha256=8osDnP-Py70bPeVxuqWcjq993j4q2ihULryN6SMKkcY,3661
cron_descriptor/locale/en_US.mo,sha256=2YjJVmyRbeS4XDXxqWtGfTYE1npt70O9_9qpjrw2wvU,3719
cron_descriptor/locale/es_ES.mo,sha256=5izpra85BJ2r5m17xIdpQcUhglr67Ybi3AXBDsEFT7c,3079
cron_descriptor/locale/es_MX.mo,sha256=3lviVMIfNq__C_CjFkaaInbKeUik4Bhz_9j1e01Y1Q8,3065
cron_descriptor/locale/fa_IR.mo,sha256=TBrP0NWx-D24ow07eH5XwYdT6eNmFPHRBXMuRUENILw,3203
cron_descriptor/locale/fi_FI.mo,sha256=KIIAivJ6c36uOyNr5Jn2DYNnsBIpe_rQVLc2Ow47Nns,2952
cron_descriptor/locale/fr_FR.mo,sha256=bc9CtN95r4eWoWPbEL5aeCs8btOSsY_k93-_WQi-CHs,2841
cron_descriptor/locale/he_IL.mo,sha256=RdcAq5mFFtdA9gjuJMMnyQzUs2Gjn3QlstGR4HvFtP0,3175
cron_descriptor/locale/hu_HU.mo,sha256=iJn8CA9cMP0g0LJixz__ochsVGo0aL_wLZuZVgweolU,2989
cron_descriptor/locale/it_IT.mo,sha256=U2V1furElvFYUOMvk3z1Y9Nhoj3Sm44yBLwhKDG8mW4,2783
cron_descriptor/locale/ja_JP.mo,sha256=3d12CIF7DUZol9RI_kTChgCyYql9jhrfqHzaVTUu6UA,3039
cron_descriptor/locale/kk_KZ.mo,sha256=I5BXBwywBE2rjcvyzfOGkGBLrRBXg4boJi_9t_FrOSk,3422
cron_descriptor/locale/ko_KR.mo,sha256=GwM8iPUiX3JdXyspAWhf2y5ssZ9ItBtvZPCU3ajoqaI,2859
cron_descriptor/locale/nb_NO.mo,sha256=cHUSP3b7f5_9A9eqFTkWrw1iv4Fq_fAhKanycBDD4A8,2758
cron_descriptor/locale/nl_NL.mo,sha256=HIUqoexSnXvGgoD2xfhyya9s7wE687xDF0SJaYid6kg,2933
cron_descriptor/locale/pl_PL.mo,sha256=UeR6Ta9p_8S3AHGLO2xtw7POFVXHolcaz7TKkg8NNzU,2850
cron_descriptor/locale/pt_PT.mo,sha256=IviamDPJcZ8au6xFbTzEjcZ50epF31r2AtRtqOkixPU,2730
cron_descriptor/locale/ro_RO.mo,sha256=9yRTHrEl564dAzDSoyPWiif5yZ1aq7o5PNMhIcvWQOo,3011
cron_descriptor/locale/ru_RU.mo,sha256=fQalylhWtZbR4TPtJwYYC4pI9QQptUjoMEv8H5idlI0,3116
cron_descriptor/locale/sk_SK.mo,sha256=4EkWzSMu-k1dTpRAp1Cdg-lTxWZLccsui9ta9zcwgFI,2887
cron_descriptor/locale/sl_SI.mo,sha256=tlh8LvTDuOkEg7dBGJ9LdSo1eOEM2LDpi84ltqNPPpU,2812
cron_descriptor/locale/sv_SE.mo,sha256=-us02k2vwt7TORHErAT2BO_GxOWTBPpUrEFzAKgeaAg,3177
cron_descriptor/locale/ta_IN.mo,sha256=w1aTDjXf3Zailw4sTqvREkbNiy4Ft3JatkFEYuND-sc,4681
cron_descriptor/locale/tr_TR.mo,sha256=PcjdmP3BAS7NHWRFrNtWblZdMCyEWp96GQs9MPcDKq0,2760
cron_descriptor/locale/uk_UA.mo,sha256=TyvyL5PBVwaHg9FFd7zzrf0AkmPwJb7GbRjNZDWSXSY,3051
cron_descriptor/locale/vi_VN.mo,sha256=DH2qdG5J67aJy8eqjZkdE7A-pyjR1ofhDYWGaVFfUM4,3123
cron_descriptor/locale/zh_CN.mo,sha256=mVmxzQD-YAIlM21a_w0A1Ub7G5NoJyCus2PPpGCdT0w,2675
cron_descriptor/locale/zh_TW.mo,sha256=N4YcCzgaMfS3_NaTu_Rr66lrRHWgJjH43vC0D88ZPKs,2874
tools/__pycache__/compilepos.cpython-312.pyc,,
tools/__pycache__/resx2po.cpython-312.pyc,,
tools/compilepos.py,sha256=E7tFC0M9oD1eW4KjH6wkSMjpe7gLHlGZ8sCJ3fXf5vA,334
tools/resx2po.py,sha256=x3qMSJ5F9M3z9-aUzT7bvtSFFk4sVO3Tyir8kP2fBRs,4949

View File

@@ -0,0 +1,5 @@
Wheel-Version: 1.0
Generator: setuptools (80.9.0)
Root-Is-Purelib: true
Tag: py3-none-any

View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Adam Schubert
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,2 @@
cron_descriptor
tools