Fix invalid backslash characters
* https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior Signed-off-by: Alfred Wingate <parona@protonmail.com>
This commit is contained in:
parent
d48699e5fd
commit
c0be0e0b67
@ -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
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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]+?)')
|
||||
|
@ -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
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user