summaryrefslogtreecommitdiff
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* remove futurefutureMathieu Le Marec - Pasquet2021-03-231-2/+18
|
* Update _expand to lowercase each component of the expressionPēteris Caune2021-03-062-5/+15
| | | | | This is in relation to #157. With this change, croniter accepts and correctly handles "* * 10-L * *"
* Merge remote-tracking branch 'cuu508/reject_empty_step'Mathieu Le Marec - Pasquet2021-03-022-3/+8
|\
| * Fix _expand to reject expressions with an empty stepPēteris Caune2021-02-262-3/+8
| | | | | | | | | | | | | | | | | | | | Example: 0-10/ * * * * Removed search_re, as it is identical to step_search_re. Tightened step_search_re: the "/{step}" component is optional, but if it *is* present, {step} must consist of one or more digits.
* | Fix _expand to reject int literals with underscoresPēteris Caune2021-03-022-3/+3
| |
* | Remove a debug statement to make flake8 happyPēteris Caune2021-02-261-1/+0
|/
* Fix combination of star and invalid expression bugsMathieu Le Marec - Pasquet2021-02-012-6/+27
|
* Security fix: fix overflow when using cron rangesMathieu Le Marec - Pasquet2021-01-292-1/+12
|
* Fix #155: raise CroniterBadCronError when error syntaxMathieu Le Marec - Pasquet2021-01-292-1/+17
|
* spellingMathieu Le Marec - Pasquet2021-01-291-1/+1
|
* Fix match when datetime has microsecondsMathieu Le Marec - Pasquet2021-01-192-1/+8
| | | | fixes #151
* fix travisdont-install-testsMathieu Le Marec - Pasquet2020-11-021-3/+6
|
* Review last changes and ensuite iterator can go up and downwardsMathieu Le Marec - Pasquet2020-10-112-51/+60
|
* Merge remote-tracking branch 'kintyre/issue145'Mathieu Le Marec - Pasquet2020-10-112-17/+104
|\
| * Cleanup exception class usage for consistencyLowell Alleman2020-09-301-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | - Updated the use of CroniterBadDateError to *only* apply during date finding operations (next/prev), and all parsing errors can now be caught using CroniterBadCronError. Specifically, this means that: + expand() only raise CroniterBadCronError + _calc() only raises CroniterBadDateError (as before) + _alphaconv() only raises CroniterNotAlphaError (as before) + The CroniterNotAlphaError exception is now a child of CroniterBadCronError, thus allowing all parsing error to be caught with a single parent class. - Added one-line definitions to all the CroniterError exception classes for future readers of the code.
| * Avoid custom cron exception when gap specified during iterationLowell Alleman2020-09-302-6/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Updated the all_next() and all_prev() generator interfaces to avoid CroniterBadDateError exceptions when the 'max_years_between_matches' parameter is provided. The rational of this change is as follows: If the caller has explicitly provided the maximum time frame between consecutive matching dates, then if no additional matching date occurs within the specified number of years provided, then the caller would prefer to simply stop iteration, rather than deal with an additional exception type. In other words, if the contract between the croniter library and caller have explicitly agreed to a max range (year gap), then there's no need for an exception because croniter has explicitly done what was asked. However, in the case where a default range (1y) is used, then the library should notify the caller of the inability of finding the next time. This keeps existing behavior backwards compatible while still offering an improved experience for users of the library. NOTE: Both get_next() and get_prev() remain unchanged, because there a Python iterable interface isn't expected. - Add unit tests for the above changes.
| * Support sparse cron events with new parameterLowell Alleman2020-09-302-12/+21
| | | | | | | | | | | | | | | | | | | | | | | | - Add a new 'max_years_between_match' argument to croniter() constructor that enables support for iterating over time ranges with very large gaps between matches. This is helpful for matching quarterly events, where a pattern doesn't match every year. The default for this parameter is 1 year to align with the previous behavior. - Updated the croniter_range() function to automatically set the new argument based on the duration represented by the provided 'start' and 'end' values. This ensure that callers of croniter_range() never have to worry with CronBadDateError exceptions.
| * New unit tests illustrating issueLowell Alleman2020-09-301-0/+20
| |
* | Handle L in rangesMathieu Le Marec - Pasquet2020-10-102-7/+51
|/ | | | This fixes #142.
* Merge pull request #30 from Kintyre/feat-cronrangekiorky2020-06-193-1/+142
|\ | | | | Feat croniter_range(start, stop, cron)
| * Python 2.7 fixLowell Alleman2020-06-181-1/+2
| |
| * Another unit test (passes as-is)Lowell Alleman2020-06-171-0/+14
| | | | | | | | | | - Added another unit DST unit test. Core croniter handles this correctly, likely an issue elsewhere in my code. Adding this for reference.
| * Remove croniter_range() timezone safety checkLowell Alleman2020-06-172-20/+8
| | | | | | | | | | | | | | | | | | | | - Removed the timezone check for the croniter_range() check, it seemed like a good idea, but became more trouble that it's worth. The behavior is well defined. The timezone from 'start' is used and the one from 'stop' is only used for terminating the generator, it's up to the user to select timezones combinations that make sense. - Replaced unitest. New unit test ensures that croniter_range() works across DST boundaries.
| * Simplify datetime type checkLowell Alleman2020-06-171-1/+2
| | | | | | | | | | | | | | - Switched to use `issubclass()` for datetime check instead of issubclass, as supporting custom classes derived from datetime isn't really supported anywhere else so the previous code was awkward and unnecessary. - Tentatively mark first release as 0.3.34.
| * croniter_range: Tweak internalsLowell Alleman2020-06-172-29/+28
| | | | | | | | | | | | - Revamp some internal implementation details of the croniter_range() function. - Ran flake8 for some cleanup & confirmed with tox - Fixed coverage of croniter_range(): 100%
| * croniter_range: Allow different ret_type/input typesLowell Alleman2020-06-172-29/+40
| | | | | | | | | | | | | | - Allow the ret_type to differ from the provided start/stop type. This is closer to the behavior of the croniter() class. The one difference is that if you don't specify 'ret_type' it will autodetect the input type and return the same type, which is nice, since that's likely the typical use case.
| * Add croniter_range(start,end,cron_expr) functionLowell Alleman2020-06-173-1/+128
| | | | | | | | | | | | | | | | | | - Created new helper function `croniter_range()` that allows forward or reverse time range iteration based on a given cron expression. Initial implementation handles `ret_type` in a way that's a bit different than the croniter class. - Added several test cases to a new test class to keep croniter and croniter_range cases cleanly separated. - Updated README to include example use of croniter_range().
* | Add cron expression optimizationsLowell Alleman2020-06-181-0/+13
| | | | | | | | | | | | | | | | | | | | | | - Optimized for duplicate entries in a cron expression. For example if min contains '1,5-8,8,5' this can be reduced from [1,5,5,6,7,8,8] to simply [1,5,6,7,8]. - Replaced full ranges with a wildcard. So if mins contain '0-59', this can be swapped with "*". Detecting a "full" entry is possible because of existing bounds checking, min value substitution, duplicate removal (new), and max value identification (LEN_MEANS_ALL). So a poorly written hour expression like '1-20,0,15-23' can also be reduced to simply "*".
* | Tests with redundant/inefficient cron expressionsLowell Alleman2020-06-181-0/+26
|/ | | | | | | | Add new unittest cases with real-world examples of poorly written cron expressions created by end-users (who aren't cron experts). Specific optimizations opportunities include: - Range reduction: Minutes of 0-59 can be replaced with "*". - Removal of duplicate values: Hours of 4,1-4,5,4 can be simplified to 1-5
* Merge pull request #29 from Kintyre/feat-dateutil-unittestskiorky2020-06-151-0/+8
|\ | | | | Add dateutil unittests & docs
| * Make dateutil tz support more officialLowell Alleman2020-06-101-0/+8
| | | | | | | | | | | | - Add a dateutil.tz unittest to ensure that tz implementation gets tested. - Updated README to note an example with the python_dateutil module. - Updated the pytz DST example too, giving users a full example to borrow from.
* | Merge pull request #28 from Kintyre/fix-dst-unittestkiorky2020-06-151-1/+1
|\ \ | | | | | | Minor DST unittest tweak
| * | Minor unit test fixLowell Alleman2020-06-091-1/+1
| |/ | | | | | | Fixed assertion against wrong variable (typo)
* | feat: Support for day-or in matchdevs田口信元2020-06-082-2/+32
|/
* Fix sorting on py3Mathieu Le Marec - Pasquet2020-05-271-1/+2
| | | | This fixes #127
* Fix styleMathieu Le Marec - Pasquet2020-05-271-11/+12
|
* Add more DST testsMathieu Le Marec - Pasquet2020-05-271-1/+55
|
* Test for #127Mathieu Le Marec - Pasquet2020-05-271-0/+5
| | | | This fixes #127
* Add datetime/crontab match method.Mathieu Le Marec - Pasquet2020-05-272-0/+23
| | | | Implement and fixes #54.
* Document more second repeats.Mathieu Le Marec - Pasquet2020-05-272-8/+29
| | | | This fixes taichino/croniter#122
* Changed lag_hours comparison to absolute to manage dst boundary when getting ↵Sokkka2020-05-182-2/+23
| | | | previous
* Fix get_next() when start_time less then 1s before next instantAlex Hill2020-01-022-19/+38
|
* Handle -Sun notationMathieu Le Marec - Pasquet2019-03-262-3/+73
| | | | This fixes #119.
* Handle invalid ranges correctlyMathieu Le Marec - Pasquet2019-03-262-1/+8
| | | | This fixes #114
* (fix#107): microsecond thresholdMathieu Le Marec - Pasquet2018-06-202-0/+23
|
* fix `get_next` while perserving the fix of `get_prev` in 7661c2aaaAvikam Agur2018-05-222-1/+18
|
* Don't count previous minute if now is dynamicIgor Khrol2018-03-052-1/+8
| | | | If the code is triggered from 5-asterisk based cron `get_prev` based on `datetime.now()` is expected to return current cron iteration and not previous execution.
* Fix sao paulo timezone test.Kevin Rose2017-11-061-4/+4
|
* remove outdated commentKevin Rose2017-11-061-1/+0
|
* correctly handle DST changesKevin Rose2017-11-061-11/+6
|