summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-12-31 23:25:40 -0800
committerTodd Gamblin <tgamblin@llnl.gov>2019-01-01 00:44:28 -0800
commit5425a3dad4e6f7a7dbb1708d97d50b2d273b6835 (patch)
tree16f117add91edbee12f843cecdeefe3018bb6e45 /lib
parent6f50cd52ed2bd8673d358fca8bd3d5ba62d916fb (diff)
downloadspack-5425a3dad4e6f7a7dbb1708d97d50b2d273b6835.tar.gz
spack-5425a3dad4e6f7a7dbb1708d97d50b2d273b6835.tar.bz2
spack-5425a3dad4e6f7a7dbb1708d97d50b2d273b6835.tar.xz
spack-5425a3dad4e6f7a7dbb1708d97d50b2d273b6835.zip
flake8: fix flake8 issues with invalid escapes
- in many files, regular strings were used in places where raw strings should've been used. - convert these to raw strings and get rid of new flake8 errors
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/directory_layout.py2
-rw-r--r--lib/spack/spack/graph.py2
-rw-r--r--lib/spack/spack/relocate.py2
-rw-r--r--lib/spack/spack/test/cmd/license.py6
-rw-r--r--lib/spack/spack/test/pattern.py4
-rw-r--r--lib/spack/spack/url.py146
6 files changed, 81 insertions, 81 deletions
diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py
index f152442781..f579d5664b 100644
--- a/lib/spack/spack/directory_layout.py
+++ b/lib/spack/spack/directory_layout.py
@@ -171,7 +171,7 @@ class YamlDirectoryLayout(DirectoryLayout):
"${COMPILERNAME}-${COMPILERVER}/"
"${PACKAGE}-${VERSION}-${HASH}")
if self.hash_len is not None:
- if re.search('\${HASH:\d+}', self.path_scheme):
+ if re.search(r'\${HASH:\d+}', self.path_scheme):
raise InvalidDirectoryLayoutParametersError(
"Conflicting options for installation layout hash length")
self.path_scheme = self.path_scheme.replace(
diff --git a/lib/spack/spack/graph.py b/lib/spack/spack/graph.py
index 5c8c60a3bb..8c481084ae 100644
--- a/lib/spack/spack/graph.py
+++ b/lib/spack/spack/graph.py
@@ -3,7 +3,7 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
-"""Functions for graphing DAGs of dependencies.
+r"""Functions for graphing DAGs of dependencies.
This file contains code for graphing DAGs of software packages
(i.e. Spack specs). There are two main functions you probably care
diff --git a/lib/spack/spack/relocate.py b/lib/spack/spack/relocate.py
index 8e9a48208c..a559ae6495 100644
--- a/lib/spack/spack/relocate.py
+++ b/lib/spack/spack/relocate.py
@@ -120,7 +120,7 @@ def macho_get_paths(path_name):
if match:
lhs = match.group(1).lstrip().rstrip()
rhs = match.group(2)
- match2 = re.search('(.*) \(.*\)', rhs)
+ match2 = re.search(r'(.*) \(.*\)', rhs)
if match2:
rhs = match2.group(1)
if lhs == 'cmd':
diff --git a/lib/spack/spack/test/cmd/license.py b/lib/spack/spack/test/cmd/license.py
index bc77cad096..fe02cb18a5 100644
--- a/lib/spack/spack/test/cmd/license.py
+++ b/lib/spack/spack/test/cmd/license.py
@@ -61,8 +61,8 @@ def test_verify(tmpdir):
assert str(old_lgpl_header) in out
assert str(correct_header) not in out
assert '3 improperly licensed files' in out
- assert re.search('files with no SPDX-License-Identifier:\s*1', out)
- assert re.search('files with wrong SPDX-License-Identifier:\s*1', out)
- assert re.search('files with old license header:\s*1', out)
+ assert re.search(r'files with no SPDX-License-Identifier:\s*1', out)
+ assert re.search(r'files with wrong SPDX-License-Identifier:\s*1', out)
+ assert re.search(r'files with old license header:\s*1', out)
assert license.returncode == 1
diff --git a/lib/spack/spack/test/pattern.py b/lib/spack/spack/test/pattern.py
index 1e3fbdaf0e..406915bdf0 100644
--- a/lib/spack/spack/test/pattern.py
+++ b/lib/spack/spack/test/pattern.py
@@ -15,10 +15,10 @@ def interface():
counter = 0
def add(self):
- raise NotImplemented('add not implemented')
+ raise NotImplementedError('add not implemented')
def subtract(self):
- raise NotImplemented('subtract not implemented')
+ raise NotImplementedError('subtract not implemented')
return Base
diff --git a/lib/spack/spack/url.py b/lib/spack/spack/url.py
index 5819d07e1a..387c8c957d 100644
--- a/lib/spack/spack/url.py
+++ b/lib/spack/spack/url.py
@@ -44,7 +44,7 @@ from spack.version import Version
# "path" seemed like the most generic term.
#
def find_list_url(url):
- """Finds a good list URL for the supplied URL.
+ r"""Finds a good list URL for the supplied URL.
By default, returns the dirname of the archive path.
@@ -148,81 +148,81 @@ def strip_version_suffixes(path):
suffix_regexes = [
# Download type
- '[Ii]nstall',
- 'all',
- 'code',
- 'src(_0)?',
- '[Ss]ources?',
- 'file',
- 'full',
- 'single',
- 'public',
- 'with[a-zA-Z_-]+',
- 'bin',
- 'binary',
- 'run',
- '[Uu]niversal',
- 'jar',
- 'complete',
- 'dynamic',
- 'oss',
- 'gem',
- 'tar',
- 'sh',
+ r'[Ii]nstall',
+ r'all',
+ r'code',
+ r'src(_0)?',
+ r'[Ss]ources?',
+ r'file',
+ r'full',
+ r'single',
+ r'public',
+ r'with[a-zA-Z_-]+',
+ r'bin',
+ r'binary',
+ r'run',
+ r'[Uu]niversal',
+ r'jar',
+ r'complete',
+ r'dynamic',
+ r'oss',
+ r'gem',
+ r'tar',
+ r'sh',
# Download version
- 'release',
- 'stable',
- '[Ff]inal',
- 'rel',
- 'orig',
- 'dist',
- '\+',
+ r'release',
+ r'stable',
+ r'[Ff]inal',
+ r'rel',
+ r'orig',
+ r'dist',
+ r'\+',
# License
- 'gpl',
+ r'gpl',
# Arch
# Needs to come before and after OS, appears in both orders
- 'ia32',
- 'intel',
- 'amd64',
- 'x64',
- 'x86[_-]64',
- 'x86',
- 'i[36]86',
- 'ppc64(le)?',
- 'armv?(7l|6l|64)',
+ r'ia32',
+ r'intel',
+ r'amd64',
+ r'x64',
+ r'x86[_-]64',
+ r'x86',
+ r'i[36]86',
+ r'ppc64(le)?',
+ r'armv?(7l|6l|64)',
# OS
- '[Ll]inux(_64)?',
- '[Uu]ni?x',
- '[Ss]un[Oo][Ss]',
- '[Mm]ac[Oo][Ss][Xx]?',
- '[Oo][Ss][Xx]',
- '[Dd]arwin(64)?',
- '[Aa]pple',
- '[Ww]indows',
- '[Ww]in(64|32)?',
- '[Cc]ygwin(64|32)?',
- '[Mm]ingw',
+ r'[Ll]inux(_64)?',
+ r'[Uu]ni?x',
+ r'[Ss]un[Oo][Ss]',
+ r'[Mm]ac[Oo][Ss][Xx]?',
+ r'[Oo][Ss][Xx]',
+ r'[Dd]arwin(64)?',
+ r'[Aa]pple',
+ r'[Ww]indows',
+ r'[Ww]in(64|32)?',
+ r'[Cc]ygwin(64|32)?',
+ r'[Mm]ingw',
# Arch
# Needs to come before and after OS, appears in both orders
- 'ia32',
- 'intel',
- 'amd64',
- 'x64',
- 'x86[_-]64',
- 'x86',
- 'i[36]86',
- 'ppc64(le)?',
- 'armv?(7l|6l|64)?',
+ r'ia32',
+ r'intel',
+ r'amd64',
+ r'x64',
+ r'x86[_-]64',
+ r'x86',
+ r'i[36]86',
+ r'ppc64(le)?',
+ r'armv?(7l|6l|64)?',
# PyPI
- '[._-]py[23].*\.whl',
- '[._-]cp[23].*\.whl',
- '[._-]win.*\.exe',
+ r'[._-]py[23].*\.whl',
+ r'[._-]cp[23].*\.whl',
+ r'[._-]win.*\.exe',
]
for regex in suffix_regexes:
@@ -274,22 +274,22 @@ def strip_name_suffixes(path, version):
str(version) + '.*',
# Download type
- 'install',
- 'src',
- '(open)?[Ss]ources?',
- '[._-]archive',
- '[._-]std',
+ r'install',
+ r'src',
+ r'(open)?[Ss]ources?',
+ r'[._-]archive',
+ r'[._-]std',
# Download version
- 'release',
- 'snapshot',
- 'distrib',
+ r'release',
+ r'snapshot',
+ r'distrib',
# VCS
- '0\+bzr',
+ r'0\+bzr',
# License
- 'gpl',
+ r'gpl',
]
for regex in suffix_regexes:
@@ -799,7 +799,7 @@ def wildcard_version(path):
# Replace each version with a generic capture group to find versions
# and escape everything else so it's not interpreted as a regex
- result = '(\d.*)'.join(re.escape(vp) for vp in vparts)
+ result = r'(\d.*)'.join(re.escape(vp) for vp in vparts)
return result