Skip to content

Commit 06daf6a

Browse files
committed
Changed regex strings to raw strings.
- Legacy-Id: 16312
1 parent 218f6d8 commit 06daf6a

5 files changed

Lines changed: 10 additions & 10 deletions

File tree

ietf/doc/expire.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def clean_up_draft_files():
168168
cut_off = datetime.date.today()
169169

170170
pattern = os.path.join(settings.INTERNET_DRAFT_PATH, "draft-*.*")
171-
filename_re = re.compile('^(.*)-(\d\d)$')
171+
filename_re = re.compile(r'^(.*)-(\d\d)$')
172172

173173
def splitext(fn):
174174
"""

ietf/doc/views_status_change.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ def clean_helper(form, formtype):
395395
for k in sorted(form.data.keys()):
396396
v = form.data[k]
397397
if k.startswith('new_relation_row'):
398-
if re.match('\d{1,4}',v):
398+
if re.match(r'\d{1,4}',v):
399399
v = 'rfc'+v
400400
rfc_fields[k[17:]]=v
401401
elif k.startswith('statchg_relation_row'):
@@ -412,7 +412,7 @@ def clean_helper(form, formtype):
412412
errors=[]
413413
for key in new_relations:
414414

415-
if not re.match('(?i)rfc\d{1,4}',key):
415+
if not re.match(r'(?i)rfc\d{1,4}',key):
416416
errors.append(key+" is not a valid RFC - please use the form RFCn\n")
417417
elif not DocAlias.objects.filter(name=key):
418418
errors.append(key+" does not exist\n")

ietf/group/views.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def fill_in_wg_drafts(group):
201201

202202

203203
def check_group_email_aliases():
204-
pattern = re.compile('expand-(.*?)(-\w+)@.*? +(.*)$')
204+
pattern = re.compile(r'expand-(.*?)(-\w+)@.*? +(.*)$')
205205
tot_count = 0
206206
good_count = 0
207207
with open(settings.GROUP_VIRTUAL_PATH,"r") as virtual_file:
@@ -414,7 +414,7 @@ def concluded_groups(request):
414414
sections['Review teams'] = Group.objects.filter(type='review', state="conclude").select_related("state", "charter").order_by("parent__name","acronym")
415415
sections['Teams'] = Group.objects.filter(type='team', state="conclude").select_related("state", "charter").order_by("parent__name","acronym")
416416

417-
for name, groups in list(sections.items()):
417+
for name, groups in sections.items():
418418

419419
# add start/conclusion date
420420
d = dict((g.pk, g) for g in groups)
@@ -625,9 +625,9 @@ def group_about_status_edit(request, acronym, group_type=None):
625625

626626
def get_group_email_aliases(acronym, group_type):
627627
if acronym:
628-
pattern = re.compile('expand-(%s)(-\w+)@.*? +(.*)$'%acronym)
628+
pattern = re.compile(r'expand-(%s)(-\w+)@.*? +(.*)$'%acronym)
629629
else:
630-
pattern = re.compile('expand-(.*?)(-\w+)@.*? +(.*)$')
630+
pattern = re.compile(r'expand-(.*?)(-\w+)@.*? +(.*)$')
631631

632632
aliases = []
633633
with open(settings.GROUP_VIRTUAL_PATH,"r") as virtual_file:
@@ -976,7 +976,7 @@ def diff(attr, name):
976976
group.groupurl_set.all().delete()
977977
# Add new ones
978978
for u in new_urls:
979-
m = re.search('(?P<url>[\w\d:#@%/;$()~_?\+-=\\\.&]+)( \((?P<name>.+)\))?', u)
979+
m = re.search(r'(?P<url>[\w\d:#@%/;$()~_?\+-=\\\.&]+)( \((?P<name>.+)\))?', u)
980980
if m:
981981
if m.group('name'):
982982
url = GroupURL(url=m.group('url'), name=m.group('name'), group=group)

ietf/meeting/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def convert_draft_to_pdf(doc_name):
238238
for line in infile:
239239
line = re.sub("\r","",line)
240240
line = re.sub("[ \t]+$","",line)
241-
if re.search("\[?[Pp]age [0-9ivx]+\]?[ \t]*$",line):
241+
if re.search(r"\[?[Pp]age [0-9ivx]+\]?[ \t]*$",line):
242242
pageend=1
243243
tempfile.write(line)
244244
continue

ietf/utils/textupload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def get_cleaned_text_file_content(uploaded_file):
3434
if not filetype.startswith("text"):
3535
raise ValidationError("Uploaded file does not appear to be a text file.")
3636

37-
match = re.search("charset=([\w-]+)", filetype)
37+
match = re.search(r"charset=([\w-]+)", filetype)
3838
if not match:
3939
raise ValidationError("File has unknown encoding.")
4040

0 commit comments

Comments
 (0)