Salamek / cron-descriptor

A Python library that converts cron expressions into human readable strings.
MIT License
160 stars 38 forks source link

Add a __main__.py #79

Closed eduardomezencio closed 2 months ago

eduardomezencio commented 7 months ago

We could add a main.py to this project so that you would be able to run it in the terminal like:

> python -m cron_descriptor '* * * * *'
Every minute
Salamek commented 7 months ago

PRs welcomed...

eduardomezencio commented 7 months ago

I'm working on a simple PR for this, but your code-check is not passing right now on the master branch, so I would have to commit without your pre-commit hook. Should I do that? This is the output of the code-check:

.venv ❯ ./code-check.sh 
warning: `ruff <path>` is deprecated. Use `ruff check <path>` instead.
warning: The top-level linter settings are deprecated in favour of their counterparts in the `lint` section. Please update the following options in `pyproject.toml`:
  - 'ignore' -> 'lint.ignore'
  - 'select' -> 'lint.select'
  - 'mccabe' -> 'lint.mccabe'
  - 'pylint' -> 'lint.pylint'
  - 'per-file-ignores' -> 'lint.per-file-ignores'
cron_descriptor/ExpressionDescriptor.py:42:27: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
cron_descriptor/ExpressionDescriptor.py:46:25: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
cron_descriptor/ExpressionDescriptor.py:368:14: PLR1714 Consider merging multiple comparisons: `expression in ("LW", "WL")`. Use a `set` if the elements are hashable.
cron_descriptor/ExpressionParser.py:32:18: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
cron_descriptor/ExpressionParser.py:42:20: RUF012 Mutable class attributes should be annotated with `typing.ClassVar`
tests/TestExceptions.py:34:14: PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
tests/TestExceptions.py:40:14: PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
tests/TestExceptions.py:45:14: PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
tests/TestExceptions.py:51:14: PT027 Use `pytest.raises` instead of unittest-style `assertRaises`
Found 9 errors.
No fixes available (5 hidden fixes can be enabled with the `--unsafe-fixes` option).

You can assign this issue to me, btw, if you want

Salamek commented 7 months ago

I guess so, looks like this check needs some fixes too

eduardomezencio commented 7 months ago

https://github.com/Salamek/cron-descriptor/pull/80