diff options
author | Lowell Alleman <lowell87@gmail.com> | 2021-03-24 11:30:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-24 11:30:43 -0400 |
commit | 390f38e643d79545197979b565592fb254a8f1d5 (patch) | |
tree | 4a17feebc34280cc2e794d06fcfb5dc1421854a3 | |
parent | d0ed29433a4a8b2685bc6428055476dddc082730 (diff) | |
parent | 617566698cdcf3be7eafefa144c98a5294a43060 (diff) | |
download | croniter-390f38e643d79545197979b565592fb254a8f1d5.tar.gz |
Merge branch 'master' into feat-ext-lib-reduction
-rw-r--r-- | docs/CHANGES.rst | 11 | ||||
-rw-r--r-- | requirements/base.txt | 1 | ||||
-rw-r--r-- | setup.py | 2 | ||||
-rw-r--r-- | src/croniter/croniter.py | 20 |
4 files changed, 28 insertions, 6 deletions
diff --git a/docs/CHANGES.rst b/docs/CHANGES.rst index 34dec96..3147664 100644 --- a/docs/CHANGES.rst +++ b/docs/CHANGES.rst @@ -1,8 +1,8 @@ Changelog ============== -1.0.9 (unreleased) ------------------- +1.0.10 (unreleased) +------------------- - Remove external library ``natsort``. Sorting of cron expression components now handled with ``sorted()`` with a custom ``key`` function. @@ -10,6 +10,13 @@ Changelog +1.0.9 (2021-03-23) +------------------ + +- Remove futures dependency + [kiorky] + + 1.0.8 (2021-03-06) ------------------ diff --git a/requirements/base.txt b/requirements/base.txt index 7ff05fa..14d6dd6 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,3 +1,2 @@ python_dateutil -future -e . @@ -23,7 +23,7 @@ long_description = "\n\n".join( setup( name='croniter', - version='1.0.9.dev0', + version='1.0.10.dev0', py_modules=['croniter', ], description=( 'croniter provides iteration for datetime ' diff --git a/src/croniter/croniter.py b/src/croniter/croniter.py index 3d1001b..8295858 100644 --- a/src/croniter/croniter.py +++ b/src/croniter/croniter.py @@ -6,12 +6,12 @@ from __future__ import absolute_import, print_function, division import math import re import sys +import inspect from time import time import datetime from dateutil.relativedelta import relativedelta from dateutil.tz import tzutc import calendar -from future.utils import raise_from step_search_re = re.compile(r'^([^-]+)-([^-/]+)(/(\d+))?$') @@ -20,6 +20,18 @@ star_or_int_re = re.compile(r'^(\d+|\*)$') VALID_LEN_EXPRESSION = [5, 6] +def _get_caller_globals_and_locals(): + """ + Returns the globals and locals of the calling frame. + + Is there an alternative to frame hacking here? + """ + caller_frame = inspect.stack()[2] + myglobals = caller_frame[0].f_globals + mylocals = caller_frame[0].f_locals + return myglobals, mylocals + + class CroniterError(ValueError): """ General top-level Croniter base exception """ pass @@ -661,7 +673,11 @@ class croniter(object): error_type, error_instance, traceback = sys.exc_info() if isinstance(exc, CroniterError): raise - raise_from(CroniterBadCronError, exc) + if int(sys.version[0]) >= 3: + globs, locs = _get_caller_globals_and_locals() + exec("raise CroniterBadCronError from exc", globs, locs) + else: + raise CroniterBadCronError("{0}".format(exc)) @classmethod def is_valid(cls, expression): |