Skip to content

Commit

Permalink
black: list / dict / tuple formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpurkhiser committed Oct 30, 2024
1 parent 7bc3d62 commit f5af7a1
Showing 1 changed file with 65 additions and 23 deletions.
88 changes: 65 additions & 23 deletions src/croniter/croniter.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,29 @@ def is_32bit():


EPOCH = datetime.datetime.fromtimestamp(0)
M_ALPHAS = {"jan": 1, "feb": 2, "mar": 3, "apr": 4, "may": 5, "jun": 6,
"jul": 7, "aug": 8, "sep": 9, "oct": 10, "nov": 11, "dec": 12}
DOW_ALPHAS = {"sun": 0, "mon": 1, "tue": 2, "wed": 3, "thu": 4, "fri": 5, "sat": 6}
M_ALPHAS = {
"jan": 1,
"feb": 2,
"mar": 3,
"apr": 4,
"may": 5,
"jun": 6,
"jul": 7,
"aug": 8,
"sep": 9,
"oct": 10,
"nov": 11,
"dec": 12,
}
DOW_ALPHAS = {
"sun": 0,
"mon": 1,
"tue": 2,
"wed": 3,
"thu": 4,
"fri": 5,
"sat": 6,
}

step_search_re = re.compile(r"^([^-]+)-([^-/]+)(/(\d+))?$")
only_int_re = re.compile(r"^\d+$")
Expand All @@ -100,9 +120,30 @@ def is_32bit():
DOW_FIELD = 4
SECOND_FIELD = 5
YEAR_FIELD = 6
UNIX_FIELDS = (MINUTE_FIELD, HOUR_FIELD, DAY_FIELD, MONTH_FIELD, DOW_FIELD)
SECOND_FIELDS = (MINUTE_FIELD, HOUR_FIELD, DAY_FIELD, MONTH_FIELD, DOW_FIELD, SECOND_FIELD)
YEAR_FIELDS = (MINUTE_FIELD, HOUR_FIELD, DAY_FIELD, MONTH_FIELD, DOW_FIELD, SECOND_FIELD, YEAR_FIELD)
UNIX_FIELDS = (
MINUTE_FIELD,
HOUR_FIELD,
DAY_FIELD,
MONTH_FIELD,
DOW_FIELD,
)
SECOND_FIELDS = (
MINUTE_FIELD,
HOUR_FIELD,
DAY_FIELD,
MONTH_FIELD,
DOW_FIELD,
SECOND_FIELD,
)
YEAR_FIELDS = (
MINUTE_FIELD,
HOUR_FIELD,
DAY_FIELD,
MONTH_FIELD,
DOW_FIELD,
SECOND_FIELD,
YEAR_FIELD,
)
CRON_FIELDS = {
"unix": UNIX_FIELDS,
"second": SECOND_FIELDS,
Expand Down Expand Up @@ -185,11 +226,9 @@ class croniter(object):
(1, 12),
(0, 6),
(0, 59),
(1970, 2099)
)
DAYS = (
31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
(1970, 2099),
)
DAYS = (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31)

ALPHACONV = (
{}, # 0: min
Expand All @@ -202,7 +241,7 @@ class croniter(object):
# 5: second
{},
# 6: year
{}
{},
)

LOWMAP = (
Expand All @@ -212,7 +251,7 @@ class croniter(object):
{0: 1},
{7: 0},
{},
{}
{},
)

LEN_MEANS_ALL = (
Expand Down Expand Up @@ -661,14 +700,15 @@ def proc_second(d):
d += relativedelta(second=0)
return False, d

procs = [proc_year,
proc_month,
proc_day_of_month,
(proc_day_of_week_nth if nth_weekday_of_month
else proc_day_of_week),
proc_hour,
proc_minute,
proc_second]
procs = [
proc_year,
proc_month,
proc_day_of_month,
(proc_day_of_week_nth if nth_weekday_of_month else proc_day_of_week),
proc_hour,
proc_minute,
proc_second,
]

while abs(year - current_year) <= self._max_years_between_matches:
next = False
Expand Down Expand Up @@ -1278,6 +1318,8 @@ def expand(self, efl, idx, expr, hash_id=None, match="", **kw):
)


EXPANDERS = OrderedDict([
("hash", HashExpander),
])
EXPANDERS = OrderedDict(
[
("hash", HashExpander),
]
)

0 comments on commit f5af7a1

Please sign in to comment.