Skip to content

Commit

Permalink
fix: Add idx to passed arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
grandmaster-ethereal committed Jan 26, 2022
1 parent b33c6a9 commit 33781f0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions hourglass/utilities/rule_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def compute_datetime(rule, present: datetime, unit=None, special_value=None):
return present


def get_dt_singular(token, tokens, rules, present):
def get_dt_singular(idx, token, tokens, rules, present):
value = tokens[idx - 1]
try:
tag_head = tokens[: idx - 1]
Expand All @@ -150,7 +150,7 @@ def get_dt_singular(token, tokens, rules, present):
return datetime_object


def get_dt_plural(token, tokens, rules, present):
def get_dt_plural(idx, token, tokens, rules, present):
value = tokens[idx - 1]
try:
tag_head = tokens[: idx - 1]
Expand Down Expand Up @@ -182,8 +182,8 @@ def get_datetime_object(tag: str, present: datetime, rules: Dict) -> List:
tokens = tokenize(tag)
for idx, token in enumerate(tokens):
if token in UNITS_SINGULAR:
datetime_object = get_dt_singular(token, tokens, rules, present)
datetime_object = get_dt_singular(idx, token, tokens, rules, present)
return {"entity": tag, "parsed_value": datetime_object}
elif token in UNITS_PLURAL:
datetime_object = get_dt_plural(token, tokens, rules, present)
datetime_object = get_dt_plural(idx, token, tokens, rules, present)
return {"entity": tag, "parsed_value": datetime_object}

0 comments on commit 33781f0

Please sign in to comment.