Skip to content

Commit 6c54375

Browse files
authored
Merge pull request #117 from evanpurkhiser/black-fns
black: Long function defnition arg lists
2 parents 73a2b9e + 66fccd2 commit 6c54375

File tree

1 file changed

+60
-15
lines changed

1 file changed

+60
-15
lines changed

src/croniter/croniter.py

+60-15
Original file line numberDiff line numberDiff line change
@@ -224,10 +224,19 @@ class croniter(object):
224224
130
225225
)
226226

227-
def __init__(self, expr_format, start_time=None, ret_type=float,
228-
day_or=True, max_years_between_matches=None, is_prev=False,
229-
hash_id=None, implement_cron_bug=False, second_at_beginning=None,
230-
expand_from_start_time=False):
227+
def __init__(
228+
self,
229+
expr_format,
230+
start_time=None,
231+
ret_type=float,
232+
day_or=True,
233+
max_years_between_matches=None,
234+
is_prev=False,
235+
hash_id=None,
236+
implement_cron_bug=False,
237+
second_at_beginning=None,
238+
expand_from_start_time=False,
239+
):
231240
self._ret_type = ret_type
232241
self._day_or = day_or
233242
self._implement_cron_bug = implement_cron_bug
@@ -337,7 +346,13 @@ def _timedelta_to_seconds(td):
337346
"""
338347
return timedelta_to_seconds(td)
339348

340-
def _get_next(self, ret_type=None, start_time=None, is_prev=None, update_current=None):
349+
def _get_next(
350+
self,
351+
ret_type=None,
352+
start_time=None,
353+
is_prev=None,
354+
update_current=None,
355+
):
341356
if update_current is None:
342357
update_current = True
343358
self.set_current(start_time, force=True)
@@ -800,7 +815,13 @@ def value_alias(cls, val, field_index, len_expressions=UNIX_CRON_LEN):
800815
return val
801816

802817
@classmethod
803-
def _expand(cls, expr_format, hash_id=None, second_at_beginning=False, from_timestamp=None):
818+
def _expand(
819+
cls,
820+
expr_format,
821+
hash_id=None,
822+
second_at_beginning=False,
823+
from_timestamp=None,
824+
):
804825
# Split the expression in components, and normalize L -> l, MON -> mon,
805826
# etc. Keep expr_format untouched so we can use it in the exception
806827
# messages.
@@ -1019,7 +1040,13 @@ def _expand(cls, expr_format, hash_id=None, second_at_beginning=False, from_time
10191040
return expanded, nth_weekday_of_month
10201041

10211042
@classmethod
1022-
def expand(cls, expr_format, hash_id=None, second_at_beginning=False, from_timestamp=None):
1043+
def expand(
1044+
cls,
1045+
expr_format,
1046+
hash_id=None,
1047+
second_at_beginning=False,
1048+
from_timestamp=None,
1049+
):
10231050
"""
10241051
Expand a cron expression format into a noramlized format of
10251052
list[list[int | 'l' | '*']]. The first list representing each element
@@ -1088,8 +1115,13 @@ def _get_low_from_current_date_number(cls, field_index, step, from_timestamp):
10881115
raise ValueError("Can't get current date number for index larger than 4")
10891116

10901117
@classmethod
1091-
def is_valid(cls, expression, hash_id=None, encoding="UTF-8",
1092-
second_at_beginning=False):
1118+
def is_valid(
1119+
cls,
1120+
expression,
1121+
hash_id=None,
1122+
encoding="UTF-8",
1123+
second_at_beginning=False,
1124+
):
10931125
if hash_id:
10941126
if not isinstance(hash_id, (bytes, str)):
10951127
raise TypeError("hash_id must be bytes or UTF-8 string")
@@ -1108,8 +1140,14 @@ def match(cls, cron_expression, testdate, day_or=True, second_at_beginning=False
11081140
return cls.match_range(cron_expression, testdate, testdate, day_or, second_at_beginning)
11091141

11101142
@classmethod
1111-
def match_range(cls, cron_expression, from_datetime, to_datetime,
1112-
day_or=True, second_at_beginning=False):
1143+
def match_range(
1144+
cls,
1145+
cron_expression,
1146+
from_datetime,
1147+
to_datetime,
1148+
day_or=True,
1149+
second_at_beginning=False,
1150+
):
11131151
cron = cls(cron_expression, to_datetime, ret_type=datetime.datetime,
11141152
day_or=day_or, second_at_beginning=second_at_beginning)
11151153
tdp = cron.get_current(datetime.datetime)
@@ -1125,10 +1163,17 @@ def match_range(cls, cron_expression, from_datetime, to_datetime,
11251163
return (max(tdp, tdt) - min(tdp, tdt)).total_seconds() < duration_in_second
11261164

11271165

1128-
def croniter_range(start, stop, expr_format, ret_type=None, day_or=True, exclude_ends=False,
1129-
_croniter=None,
1130-
second_at_beginning=False,
1131-
expand_from_start_time=False):
1166+
def croniter_range(
1167+
start,
1168+
stop,
1169+
expr_format,
1170+
ret_type=None,
1171+
day_or=True,
1172+
exclude_ends=False,
1173+
_croniter=None,
1174+
second_at_beginning=False,
1175+
expand_from_start_time=False,
1176+
):
11321177
"""
11331178
Generator that provides all times from start to stop matching the given cron expression.
11341179
If the cron expression matches either 'start' and/or 'stop', those times will be returned as

0 commit comments

Comments
 (0)