Skip to content

Commit c9d414f

Browse files
scopDNF Bot
authored andcommitted
Python 3.6 invalid escape sequence deprecation fixes
Closes: rpm-software-management#737 Approved by: ignatenkobrain
1 parent 2579781 commit c9d414f

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

dnf/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def _trans_error_summary(self, errstring):
730730
"""
731731
summary = ''
732732
# do disk space report first
733-
p = re.compile('needs (\d+)MB on the (\S+) filesystem')
733+
p = re.compile(r'needs (\d+)MB on the (\S+) filesystem')
734734
disk = {}
735735
for m in p.finditer(errstring):
736736
if m.group(2) not in disk:

dnf/cli/commands/repoquery.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ def grow_tree(self, level, pkg):
413413
for reqirepkg in pkg.requires:
414414
requires.append(str(reqirepkg))
415415
reqstr = "[" + str(len(requires)) + ": " + ", ".join(requires) + "]"
416-
print(spacing + "\_ " + str(pkg) + " " + reqstr)
416+
print(spacing + r"\_ " + str(pkg) + " " + reqstr)
417417

418418
def tree_seed(self, query, aquery, opts, level=-1, usedpkgs=None):
419419
for pkg in sorted(set(query.run()), key=lambda p: p.name):

dnf/yum/misc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def re_glob(s):
5454
""" Tests if a string is a shell wildcard. """
5555
global _re_compiled_glob_match
5656
if _re_compiled_glob_match is None:
57-
_re_compiled_glob_match = re.compile('[*?]|\[.+\]').search
57+
_re_compiled_glob_match = re.compile(r'[*?]|\[.+\]').search
5858
return _re_compiled_glob_match(s)
5959

6060
_re_compiled_full_match = None
@@ -63,7 +63,7 @@ def re_full_search_needed(s):
6363
global _re_compiled_full_match
6464
if _re_compiled_full_match is None:
6565
# A glob, or a "." or "-" separator, followed by something (the ".")
66-
one = re.compile('.*([-.*?]|\[.+\]).').match
66+
one = re.compile(r'.*([-.*?]|\[.+\]).').match
6767
# Any epoch, for envra
6868
two = re.compile('[0-9]+:').match
6969
_re_compiled_full_match = (one, two)
@@ -484,16 +484,16 @@ def repo_gen_decompress(filename, generated_name, cached=False):
484484
return decompress(filename, dest=dest, check_timestamps=True, fn_only=cached)
485485

486486
def read_in_items_from_dot_dir(thisglob, line_as_list=True):
487-
""" Takes a glob of a dir (like /etc/foo.d/\*.foo) returns a list of all the
488-
lines in all the files matching that glob, ignores comments and blank
487+
""" Takes a glob of a dir (like /etc/foo.d/\\*.foo) returns a list of all
488+
the lines in all the files matching that glob, ignores comments and blank
489489
lines, optional paramater 'line_as_list tells whether to treat each line
490490
as a space or comma-separated list, defaults to True.
491491
"""
492492
results = []
493493
for fname in glob.glob(thisglob):
494494
with open(fname) as f:
495495
for line in f:
496-
if re.match('\s*(#|$)', line):
496+
if re.match(r'\s*(#|$)', line):
497497
continue
498498
line = line.rstrip() # no more trailing \n's
499499
line = line.lstrip() # be nice

scripts/sanitize_po_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def sanitize_po_file(po_file):
2828
msgstr_without_indents = entry.msgstr.strip()
2929
entry.msgstr = entry.msgid.replace(
3030
msgid_without_indents, msgstr_without_indents)
31-
if re.match("^\s+$", entry.msgstr):
31+
if re.match(r"^\s+$", entry.msgstr):
3232
entry.msgstr = ""
3333

3434
if entry.msgid_plural:
@@ -38,7 +38,7 @@ def sanitize_po_file(po_file):
3838
entry.msgstr_plural[i] = entry.msgid_plural.replace(
3939
msgid_plural_without_indents,
4040
msgstr_plural_without_indents)
41-
if re.match("^\s+$", entry.msgstr_plural[i]):
41+
if re.match(r"^\s+$", entry.msgstr_plural[i]):
4242
entry.msgstr_plural[i] = ""
4343
po.save()
4444

0 commit comments

Comments
 (0)