diff --git a/bin/euscan_patch_metadata b/bin/euscan_patch_metadata index 746fd2e..449b253 100755 --- a/bin/euscan_patch_metadata +++ b/bin/euscan_patch_metadata @@ -119,11 +119,11 @@ def get_deb_url(name): content = opened.read() for link in BeautifulSoup(content, parseOnlyThese=SoupStrainer("a")): - if re.match("[^\s]+\.debian\.tar\.(?:gz|bz2)", link.text): + if re.match(r"[^\s]+\.debian\.tar\.(?:gz|bz2)", link.text): deb_url = link["href"] deb_type = "source" break - if re.match("[^\s]+\.diff\.gz", link.text): + if re.match(r"[^\s]+\.diff\.gz", link.text): deb_url = link["href"] deb_type = "diff" break @@ -157,7 +157,7 @@ def patch_metadata(package, watch_data, diff=False): for watch_line in watch_data.split("\n"): # there can be multiple lines watch_line = " ".join(watch_line.split()) # remove extra spaces and \n - version_parse = re.match("version=(\d+?)", watch_line) + version_parse = re.match(r"version=(\d+?)", watch_line) if version_parse: version = version_parse.group(1) continue diff --git a/src/euscan/__init__.py b/src/euscan/__init__.py index ab046a2..fff04d8 100644 --- a/src/euscan/__init__.py +++ b/src/euscan/__init__.py @@ -74,13 +74,13 @@ BRUTEFORCE_BLACKLIST_URLS = [ ROBOTS_TXT_BLACKLIST_DOMAINS = [ "(.*)sourceforge(.*)", "(.*)github.com", - "(.*)qt\.nokia\.com(.*)", - "(.*)chromium\.org(.*)", - "(.*)nodejs\.org(.*)", - "(.*)download\.mono-project\.com(.*)", - "(.*)fedorahosted\.org(.*)", - "(.*)download\.tuxfamily\.org(.*)", - "(.*)festvox\.org(.*)", + r"(.*)qt\.nokia\.com(.*)", + r"(.*)chromium\.org(.*)", + r"(.*)nodejs\.org(.*)", + r"(.*)download\.mono-project\.com(.*)", + r"(.*)fedorahosted\.org(.*)", + r"(.*)download\.tuxfamily\.org(.*)", + r"(.*)festvox\.org(.*)", ] from euscan.out import EuscanOutput # noqa: E402 diff --git a/src/euscan/handlers/generic.py b/src/euscan/handlers/generic.py index 62304ec..69220ad 100644 --- a/src/euscan/handlers/generic.py +++ b/src/euscan/handlers/generic.py @@ -122,7 +122,7 @@ def scan_directory_recursive(cp, ver, rev, url, steps, orig_url, options): results = [] - if re.search(b"<\s*a\s+[^>]*href", data, re.I): + if re.search(rb"<\s*a\s+[^>]*href", data, re.I): results.extend(scan_html(data, url, pattern)) elif url.startswith("ftp://"): results.extend(scan_ftp(data, url, pattern)) diff --git a/src/euscan/handlers/php.py b/src/euscan/handlers/php.py index e661490..b4c9438 100644 --- a/src/euscan/handlers/php.py +++ b/src/euscan/handlers/php.py @@ -20,7 +20,7 @@ def can_handle(pkg, url=None): def guess_package_and_channel(cp, url): - match = re.search("http://(.*)\.php\.net/get/(.*)-(.*).tgz", url) + match = re.search(r"http://(.*)\.php\.net/get/(.*)-(.*).tgz", url) if match: host = match.group(1) diff --git a/src/euscan/handlers/pypi.py b/src/euscan/handlers/pypi.py index aa09027..5e3465c 100644 --- a/src/euscan/handlers/pypi.py +++ b/src/euscan/handlers/pypi.py @@ -19,7 +19,7 @@ def can_handle(pkg, url=None): def guess_package(cp, url): - match = re.search("mirror://pypi/\w+/(.*)/.*", url) + match = re.search(r"mirror://pypi/\w+/(.*)/.*", url) if match: return match.group(1) diff --git a/src/euscan/handlers/url.py b/src/euscan/handlers/url.py index 8662510..a856534 100644 --- a/src/euscan/handlers/url.py +++ b/src/euscan/handlers/url.py @@ -24,7 +24,7 @@ def can_handle(*args): def handle_directory_patterns(base, file_pattern): - """ + r""" Directory pattern matching e.g.: base: ftp://ftp.nessus.org/pub/nessus/nessus-([\d\.]+)/src/ file_pattern: nessus-core-([\d\.]+)\.tar\.gz diff --git a/src/euscan/helpers.py b/src/euscan/helpers.py index 605479d..03a68c1 100644 --- a/src/euscan/helpers.py +++ b/src/euscan/helpers.py @@ -383,9 +383,9 @@ def regex_from_template(template): regexp = re.escape(template) # Unescape specific stuff - regexp = regexp.replace("\$\{", "${") - regexp = regexp.replace("\}", "}") - regexp = regexp.replace("}\.$", "}.$") + regexp = regexp.replace(r"\$\{", "${") + regexp = regexp.replace(r"\}", "}") + regexp = regexp.replace(r"}\.$", "}.$") # Replace ${\d+} # regexp = regexp.replace('${0}', r'([\d]+?)') diff --git a/src/euscan/out.py b/src/euscan/out.py index 43dad06..f28cb94 100644 --- a/src/euscan/out.py +++ b/src/euscan/out.py @@ -74,7 +74,7 @@ def progress_bar(): def clean_colors(string): if isinstance(string, str): - string = re.sub("\033\[[0-9;]+m", "", string) + string = re.sub(r"\033\[[0-9;]+m", "", string) string = re.sub(r"\\u001b\[[0-9;]+m", "", string) string = re.sub(r"\x1b\[[0-9;]+m", "", string) return string diff --git a/src/euscan/version.py b/src/euscan/version.py index 0b8290a..84d6a71 100644 --- a/src/euscan/version.py +++ b/src/euscan/version.py @@ -22,7 +22,7 @@ def get_version_type(version): if "9999" in version or "99999999" in version: return "live" - for token in re.findall("[\._-]([a-zA-Z]+)", version): + for token in re.findall(r"[\._-]([a-zA-Z]+)", version): if token in gentoo_types: types.append(token) if types: