From 226207a916a7477f404c60d3c0f1168c26f31259 Mon Sep 17 00:00:00 2001 From: Nicolas ROCHE Date: Sat, 5 Dec 2020 21:28:28 +0100 Subject: [PATCH] templatetags: add 'r' prefix to regex strings (#48919) --- combo_plugin_gnm/templatetags/gnm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/combo_plugin_gnm/templatetags/gnm.py b/combo_plugin_gnm/templatetags/gnm.py index 57a64c2..3365b7d 100644 --- a/combo_plugin_gnm/templatetags/gnm.py +++ b/combo_plugin_gnm/templatetags/gnm.py @@ -180,7 +180,7 @@ def get_slots_from_mdr_format(data, today): if not hours: continue try: - parts = re.match('(\d?\d)h(\d\d)-(\d?\d)h(\d\d)', hours).groups() + parts = re.match(r'(\d?\d)h(\d\d)-(\d?\d)h(\d\d)', hours).groups() except AttributeError: continue # add to slots the opening hours in chronological order beginning from today @@ -207,13 +207,13 @@ def parse_opening_hours_data(mairie_data): for openinghours in mairie_data.get('openinghours', []): # format is comma-separated days and/or intervals, or only one day try: - groups = re.match('(\w\w(?:(?:,|\-)?\w\w)*) (\d\d?):(\d\d?)-(\d\d?):(\d\d?)', openinghours).groups() + groups = re.match(r'(\w\w(?:(?:,|\-)?\w\w)*) (\d\d?):(\d\d?)-(\d\d?):(\d\d?)', openinghours).groups() except AttributeError: # invalid input data continue for day in groups[0].split(','): if '-' in day: # interval - parts = re.match('(\w\w)-(\w\w)', day).groups() + groups[1:] + parts = re.match(r'(\w\w)-(\w\w)', day).groups() + groups[1:] time_table = dict(zip(('start_day', 'end_day', 'start_hour', 'start_minute', 'end_hour', 'end_minute'), parts)) days_list = EN_ABBREV_WEEKDAYS_LIST[ EN_ABBREV_WEEKDAYS_LIST.index(time_table['start_day'].lower()):