fix some tokens
This commit is contained in:
parent
9523ad480f
commit
5a2ba4a60b
@ -27,13 +27,13 @@ r_time_in_epoch_ms_now = re.compile('(?:milliseconds since epoch)', flags=re.IGN
|
|||||||
r_time_in_epoch_ms2 = re.compile('(.*)?\s*(?:in|to)\s*(?:ms|milliseconds|miliseconds)', flags=re.IGNORECASE)
|
r_time_in_epoch_ms2 = re.compile('(.*)?\s*(?:in|to)\s*(?:ms|milliseconds|miliseconds)', flags=re.IGNORECASE)
|
||||||
r_time_in_epoch_ms3 = re.compile('(?:ms|milliseconds|miliseconds)?\s*since\s*(.*)', flags=re.IGNORECASE)
|
r_time_in_epoch_ms3 = re.compile('(?:ms|milliseconds|miliseconds)?\s*since\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_time_in = re.compile('(?:time)?\s*in\s*(.*)', flags=re.IGNORECASE)
|
r_time_in = re.compile('(?:time)?\s*in\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_time_since = re.compile('(?:time|year|month|week|day|hour|minute|second)?(?:s)?\s*since\s*(.*)', flags=re.IGNORECASE)
|
r_time_since = re.compile('(?:time|year|month|week|day|hour|minute|second)?(?:s)?\s*(?:since|ago)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_time_until = re.compile('(?:time|year|month|week|day|hour|minute|second)?(?:s)?\s*until\s*(.*)', flags=re.IGNORECASE)
|
r_time_until = re.compile('(?:time|year|month|week|day|hour|minute|second)?(?:s)?\s*(?:until|to)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_time_between = re.compile('(?:time|year|month|week|day|hour|minute|second)?(?:s)?\s*between\s*(.*)\s*and\s*(.*)', flags=re.IGNORECASE)
|
r_time_between = re.compile('(?:time|year|month|week|day|hour|minute|second)?(?:s)?\s*between\s*(.*)\s*and\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_tz_between = re.compile('(?:time difference|tz diff|time diff|time zone difference|timezone difference|timezone diff|time zone diff)?(?:s)?\s*between\s*(.*)\s*and\s*(.*)', flags=re.IGNORECASE)
|
r_tz_between = re.compile('(?:time difference|tz diff|time diff|time zone difference|timezone difference|timezone diff|time zone diff)?(?:s)?\s*between\s*(.*)\s*and\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_time_plus = re.compile('(.*)\s*(?:plus|\+|after|from)\s*(.*)', flags=re.IGNORECASE)
|
r_time_plus = re.compile('(.*)\s*(?:plus|\+|after|from)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_time_minus = re.compile('(.*)\s*(?:minus|\-)\s*(.*)', flags=re.IGNORECASE)
|
r_time_minus = re.compile('(.*)\s*(?:minus|\-)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_time_before = re.compile('(.*)\s*(?:before|\-)\s*(.*)', flags=re.IGNORECASE)
|
r_time_before = re.compile('(.*)\s*(?:before)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_weekday_pre = re.compile('(?:day of week|weekday|week day|what day is|what day of week is)\s*(.*)', flags=re.IGNORECASE)
|
r_weekday_pre = re.compile('(?:day of week|weekday|week day|what day is|what day of week is)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_weekday_post = re.compile('(.*)\s*(?:day of week|weekday|week day|what day|what day of week)', flags=re.IGNORECASE)
|
r_weekday_post = re.compile('(.*)\s*(?:day of week|weekday|week day|what day|what day of week)', flags=re.IGNORECASE)
|
||||||
r_workdays_since = re.compile('(?:workdays|work days)\s*since\s*(.*)', flags=re.IGNORECASE)
|
r_workdays_since = re.compile('(?:workdays|work days)\s*since\s*(.*)', flags=re.IGNORECASE)
|
||||||
@ -46,8 +46,8 @@ r_timezone_translation = re.compile('(.*)?\s(?:in|to)\s(.*)', flags=re.IGNORECAS
|
|||||||
r_timezone_translation_in_to = re.compile('(.*)(?:in)\s(.*)\s(?:to)\s(.*)', flags=re.IGNORECASE)
|
r_timezone_translation_in_to = re.compile('(.*)(?:in)\s(.*)\s(?:to)\s(.*)', flags=re.IGNORECASE)
|
||||||
r_hour_minute_timezone = re.compile('((?:[0[0-9]|1[0-9]|2[0-3]):[0-5][0-9])?\s(.*)', flags=re.IGNORECASE)
|
r_hour_minute_timezone = re.compile('((?:[0[0-9]|1[0-9]|2[0-3]):[0-5][0-9])?\s(.*)', flags=re.IGNORECASE)
|
||||||
r_timezone = re.compile('(.*)\s(?:timezone|timezones|tz)', flags=re.IGNORECASE)
|
r_timezone = re.compile('(.*)\s(?:timezone|timezones|tz)', flags=re.IGNORECASE)
|
||||||
r_calendar_year = re.compile('(?:cal year|calendar year)?\s*(.*)', flags=re.IGNORECASE)
|
r_calendar_year = re.compile('(?:cal year|calendar year)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_calendar_month = re.compile('(?:calendar|cal|month|cal month|calendar month)?\s*(.*)', flags=re.IGNORECASE)
|
r_calendar_month = re.compile('(?:calendar|cal|month|cal month|calendar month)\s*(.*)', flags=re.IGNORECASE)
|
||||||
r_timezone_2 = re.compile('(?:timezone in|timezones in|tz in|timezone|timezones|tz)\s(.*)?', flags=re.IGNORECASE)
|
r_timezone_2 = re.compile('(?:timezone in|timezones in|tz in|timezone|timezones|tz)\s(.*)?', flags=re.IGNORECASE)
|
||||||
|
|
||||||
|
|
||||||
@ -180,6 +180,10 @@ def handler_time_plus(dt_s: str, td: str):
|
|||||||
return dt + td
|
return dt + td
|
||||||
|
|
||||||
|
|
||||||
|
def handler_time_plus_rev(td: str, dt_s: str, ):
|
||||||
|
return handler_time_plus(dt_s, td)
|
||||||
|
|
||||||
|
|
||||||
def handler_time_minus(dt_s: str, td: str):
|
def handler_time_minus(dt_s: str, td: str):
|
||||||
dt = dateparser_parse_dt(dt_s)
|
dt = dateparser_parse_dt(dt_s)
|
||||||
td = get_timedelta(td, direction='past')
|
td = get_timedelta(td, direction='past')
|
||||||
@ -234,6 +238,7 @@ regex_handlers = [
|
|||||||
(r_time_between, handler_time_diff, QUERY_TYPE_TD, h_default_td),
|
(r_time_between, handler_time_diff, QUERY_TYPE_TD, h_default_td),
|
||||||
(r_tz_between, handler_tz_diff, QUERY_TYPE_TD, h_default_td),
|
(r_tz_between, handler_tz_diff, QUERY_TYPE_TD, h_default_td),
|
||||||
(r_time_plus, handler_time_plus, QUERY_TYPE_DT, h_default_dt),
|
(r_time_plus, handler_time_plus, QUERY_TYPE_DT, h_default_dt),
|
||||||
|
(r_time_plus, handler_time_plus_rev, QUERY_TYPE_DT, h_default_dt),
|
||||||
(r_time_minus, handler_time_minus, QUERY_TYPE_DT, h_default_dt),
|
(r_time_minus, handler_time_minus, QUERY_TYPE_DT, h_default_dt),
|
||||||
(r_time_before, handler_time_before, QUERY_TYPE_DT, h_default_dt),
|
(r_time_before, handler_time_before, QUERY_TYPE_DT, h_default_dt),
|
||||||
(r_weekday_pre, handler_generic_parser, QUERY_TYPE_DT, h_day_of_week),
|
(r_weekday_pre, handler_generic_parser, QUERY_TYPE_DT, h_day_of_week),
|
||||||
|
Loading…
Reference in New Issue
Block a user