Skip to content

Commit

Permalink
Apply ruff rule RUF039
Browse files Browse the repository at this point in the history
RUF039 First argument to `re.match()` is not raw string
RUF039 First argument to `re.search()` is not raw string
RUF039 First argument to `re.compile()` is not raw string
  • Loading branch information
DimitriPapadopoulos committed Jan 26, 2025
1 parent 699a5cb commit 9f181fb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions util/authors.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def analyze_line(line, names, disp=False):
line = line.strip().decode('utf-8')

# Check the commit author name
m = re.match('^@@@([^@]*)@@@', line)
m = re.match(r'^@@@([^@]*)@@@', line)
if m:
name = m.group(1)
line = line[m.end():]
Expand Down Expand Up @@ -84,7 +84,7 @@ def analyze_line(line, names, disp=False):

# Sort
def name_key(fullname):
m = re.search(' [a-z ]*[A-Za-z-]+$', fullname)
m = re.search(r' [a-z ]*[A-Za-z-]+$', fullname)
if m:
forename = fullname[:m.start()].strip()
surname = fullname[m.start():].strip()
Expand Down
2 changes: 1 addition & 1 deletion util/gh_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def get_issues(getter, project, milestone):
raw_datas.append(raw_data)
if 'link' not in info:
break
m = re.search('<(.*?)>; rel="next"', info['link'])
m = re.search(r'<(.*?)>; rel="next"', info['link'])
if m:
url = m.group(1)
continue
Expand Down
4 changes: 2 additions & 2 deletions util/refguide_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ def check_rest(module, names, dots=True):
traceback.format_exc()))
continue

m = re.search("([\x00-\x09\x0b-\x1f])", text)
m = re.search(r"([\x00-\x09\x0b-\x1f])", text)
if m:
msg = ("Docstring contains a non-printable character %r! "
"Maybe forgot r\"\"\"?" % (m.group(1),))
Expand Down Expand Up @@ -429,7 +429,7 @@ def report_failure(self, out, test, example, got):
example, got)

class Checker(doctest.OutputChecker):
obj_pattern = re.compile('at 0x[0-9a-fA-F]+>')
obj_pattern = re.compile(r'at 0x[0-9a-fA-F]+>')
vanilla = doctest.OutputChecker()
rndm_markers = {'# random', '# Random', '#random', '#Random', "# may vary"}
stopwords = {'plt.', '.hist', '.show', '.ylim', '.subplot(',
Expand Down

0 comments on commit 9f181fb

Please sign in to comment.