commit: baf79da44e543cc0fd12f64a2c99b49b66727f39
Author: Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 9 10:44:56 2022 +0000
Commit: Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Feb 9 10:45:35 2022 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=baf79da4
*/*: reformat with latest Black 22.1.0
Black is now stable so this shouldn't be needed in future.
Signed-off-by: Sam James <sam <AT> gentoo.org>
bin/filter-bash-environment.py | 18 ++++++------
bin/xattr-helper.py | 2 +-
lib/portage/_sets/__init__.py | 2 +-
lib/portage/package/ebuild/config.py | 16 ++++------
lib/portage/tests/bin/test_filter_bash_env.py | 4 +--
lib/portage/tests/dep/testAtom.py | 34 +++++++++++++---------
lib/portage/tests/process/test_PipeLogger.py | 14 ++++-----
lib/portage/tests/process/test_PopenProcess.py | 2 +-
.../tests/process/test_PopenProcessBlockingIO.py | 2 +-
lib/portage/tests/process/test_poll.py | 2 +-
lib/portage/tests/util/file_copy/test_copyfile.py | 6 ++--
lib/portage/tests/xpak/test_decodeint.py | 2 +-
lib/portage/util/backoff.py | 2 +-
lib/portage/util/lafilefixer.py | 6 ++--
repoman/lib/repoman/copyrights.py | 6 ++--
.../modules/scan/metadata/ebuild_metadata.py | 14 ++++-----
repoman/lib/repoman/modules/vcs/cvs/changes.py | 2 +-
17 files changed, 66 insertions(+), 68 deletions(-)
diff --git a/bin/filter-bash-environment.py b/bin/filter-bash-environment.py
index f36df091e..5ec795999 100755
--- a/bin/filter-bash-environment.py
+++ b/bin/filter-bash-environment.py
@@ -6,17 +6,17 @@ import os
import re
import sys
-here_doc_re = re.compile(br".*\s<<[-]?(\w+)$")
-func_start_re = re.compile(br"^[-\w]+\s*\(\)\s*$")
-func_end_re = re.compile(br"^\}$")
+here_doc_re = re.compile(rb".*\s<<[-]?(\w+)$")
+func_start_re = re.compile(rb"^[-\w]+\s*\(\)\s*$")
+func_end_re = re.compile(rb"^\}$")
var_assign_re = re.compile(
- br'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$'
+ rb'(^|^declare\s+-\S+\s+|^declare\s+|^export\s+)([^=\s]+)=("|\')?.*$'
)
-close_quote_re = re.compile(br'(\\"|"|\')\s*$')
-readonly_re = re.compile(br"^declare\s+-(\S*)r(\S*)\s+")
+close_quote_re = re.compile(rb'(\\"|"|\')\s*$')
+readonly_re = re.compile(rb"^declare\s+-(\S*)r(\S*)\s+")
# declare without assignment
-var_declare_re = re.compile(br"^declare(\s+-\S+)?\s+([^=\s]+)\s*$")
+var_declare_re = re.compile(rb"^declare(\s+-\S+)?\s+([^=\s]+)\s*$")
def have_end_quote(quote, line):
@@ -146,8 +146,8 @@ if __name__ == "__main__":
var_pattern = os.fsencode(args[0]).split()
# Filter invalid variable names that are not supported by bash.
- var_pattern.append(br"\d.*")
- var_pattern.append(br".*\W.*")
+ var_pattern.append(rb"\d.*")
+ var_pattern.append(rb".*\W.*")
var_pattern = b"^(" + b"|".join(var_pattern) + b")$"
filter_bash_environment(re.compile(var_pattern), file_in, file_out)
diff --git a/bin/xattr-helper.py b/bin/xattr-helper.py
index b62a4de44..9d519b61c 100755
--- a/bin/xattr-helper.py
+++ b/bin/xattr-helper.py
@@ -22,7 +22,7 @@ import sys
from portage.util._xattr import xattr
-_UNQUOTE_RE = re.compile(br"\\[0-7]{3}")
+_UNQUOTE_RE = re.compile(rb"\\[0-7]{3}")
_FS_ENCODING = sys.getfilesystemencoding()
diff --git a/lib/portage/_sets/__init__.py b/lib/portage/_sets/__init__.py
index 15f942b10..4d7b2c3ec 100644
--- a/lib/portage/_sets/__init__.py
+++ b/lib/portage/_sets/__init__.py
@@ -181,7 +181,7 @@ class SetConfig:
import random
while setname in parser.sections():
- setname = "%08d" % random.randint(0, 10 ** 10)
+ setname = "%08d" % random.randint(0, 10**10)
parser.add_section(setname)
for k, v in options.items():
diff --git a/lib/portage/package/ebuild/config.py
b/lib/portage/package/ebuild/config.py
index 8fe51784e..99fd2c31e 100644
--- a/lib/portage/package/ebuild/config.py
+++ b/lib/portage/package/ebuild/config.py
@@ -3317,16 +3317,12 @@ class config:
mydict.pop("EROOT", None)
mydict.pop("ESYSROOT", None)
- if (
- phase
- not in (
- "pretend",
- "setup",
- "preinst",
- "postinst",
- )
- or not eapi_exports_replace_vars(eapi)
- ):
+ if phase not in (
+ "pretend",
+ "setup",
+ "preinst",
+ "postinst",
+ ) or not eapi_exports_replace_vars(eapi):
mydict.pop("REPLACING_VERSIONS", None)
if phase not in ("prerm", "postrm") or not
eapi_exports_replace_vars(eapi):
diff --git a/lib/portage/tests/bin/test_filter_bash_env.py
b/lib/portage/tests/bin/test_filter_bash_env.py
index 7f0bdf52f..501420560 100644
--- a/lib/portage/tests/bin/test_filter_bash_env.py
+++ b/lib/portage/tests/bin/test_filter_bash_env.py
@@ -16,7 +16,7 @@ class TestFilterBashEnv(TestCase):
test_cases = (
(
"RDEPEND BASH.* _EPATCH_ECLASS",
- br"""declare -ir BASHPID="28997"
+ rb"""declare -ir BASHPID="28997"
declare -rx A="portage-2.3.24.tar.bz2"
declare -- DESKTOP_DATABASE_DIR="/usr/share/applications"
declare PDEPEND="
@@ -53,7 +53,7 @@ use_if_iuse ()
use $1
}
""",
- br"""declare -x A="portage-2.3.24.tar.bz2"
+ rb"""declare -x A="portage-2.3.24.tar.bz2"
declare -- DESKTOP_DATABASE_DIR="/usr/share/applications"
declare PDEPEND="
!build? (
diff --git a/lib/portage/tests/dep/testAtom.py
b/lib/portage/tests/dep/testAtom.py
index 33139d83a..a6fd92dc3 100644
--- a/lib/portage/tests/dep/testAtom.py
+++ b/lib/portage/tests/dep/testAtom.py
@@ -553,22 +553,28 @@ class TestAtom(TestCase):
other_use, validator.is_valid_flag, parent_use
)
if parent_use is None:
- fail_msg = "Atom: %s, other_use: %s, iuse: %s, parent_use: %s,
got: %s, expected: %s" % (
- atom,
- " ".join(other_use),
- " ".join(iuse),
- "None",
- str(violated_atom),
- expected_violated_atom,
+ fail_msg = (
+ "Atom: %s, other_use: %s, iuse: %s, parent_use: %s, got:
%s, expected: %s"
+ % (
+ atom,
+ " ".join(other_use),
+ " ".join(iuse),
+ "None",
+ str(violated_atom),
+ expected_violated_atom,
+ )
)
else:
- fail_msg = "Atom: %s, other_use: %s, iuse: %s, parent_use: %s,
got: %s, expected: %s" % (
- atom,
- " ".join(other_use),
- " ".join(iuse),
- " ".join(parent_use),
- str(violated_atom),
- expected_violated_atom,
+ fail_msg = (
+ "Atom: %s, other_use: %s, iuse: %s, parent_use: %s, got:
%s, expected: %s"
+ % (
+ atom,
+ " ".join(other_use),
+ " ".join(iuse),
+ " ".join(parent_use),
+ str(violated_atom),
+ expected_violated_atom,
+ )
)
self.assertEqual(str(violated_atom), expected_violated_atom,
fail_msg)
diff --git a/lib/portage/tests/process/test_PipeLogger.py
b/lib/portage/tests/process/test_PipeLogger.py
index 4d9234639..eb0bf053b 100644
--- a/lib/portage/tests/process/test_PipeLogger.py
+++ b/lib/portage/tests/process/test_PipeLogger.py
@@ -59,13 +59,13 @@ class PipeLoggerTestCase(TestCase):
6,
7,
8,
- 2 ** 5,
- 2 ** 10,
- 2 ** 12,
- 2 ** 13,
- 2 ** 14,
- 2 ** 17,
- 2 ** 17 + 1,
+ 2**5,
+ 2**10,
+ 2**12,
+ 2**13,
+ 2**14,
+ 2**17,
+ 2**17 + 1,
):
test_string = x * "a"
output = loop.run_until_complete(
diff --git a/lib/portage/tests/process/test_PopenProcess.py
b/lib/portage/tests/process/test_PopenProcess.py
index 4135802cd..0ffc8d31b 100644
--- a/lib/portage/tests/process/test_PopenProcess.py
+++ b/lib/portage/tests/process/test_PopenProcess.py
@@ -86,7 +86,7 @@ class PopenPipeTestCase(TestCase):
return content.decode("ascii", "replace")
def testPopenPipe(self):
- for x in (1, 2, 5, 6, 7, 8, 2 ** 5, 2 ** 10, 2 ** 12, 2 ** 13, 2 **
14):
+ for x in (1, 2, 5, 6, 7, 8, 2**5, 2**10, 2**12, 2**13, 2**14):
test_string = x * "a"
output = self._testPipeReader(test_string)
self.assertEqual(
diff --git a/lib/portage/tests/process/test_PopenProcessBlockingIO.py
b/lib/portage/tests/process/test_PopenProcessBlockingIO.py
index 3b7208c7e..1e334560f 100644
--- a/lib/portage/tests/process/test_PopenProcessBlockingIO.py
+++ b/lib/portage/tests/process/test_PopenProcessBlockingIO.py
@@ -62,7 +62,7 @@ class PopenPipeBlockingIOTestCase(TestCase):
self.assertFalse(True, skip_reason)
return
- for x in (1, 2, 5, 6, 7, 8, 2 ** 5, 2 ** 10, 2 ** 12, 2 ** 13, 2 **
14):
+ for x in (1, 2, 5, 6, 7, 8, 2**5, 2**10, 2**12, 2**13, 2**14):
test_string = x * "a"
output = self._testPipeReader(test_string)
self.assertEqual(
diff --git a/lib/portage/tests/process/test_poll.py
b/lib/portage/tests/process/test_poll.py
index c523a8d8f..627157211 100644
--- a/lib/portage/tests/process/test_poll.py
+++ b/lib/portage/tests/process/test_poll.py
@@ -95,7 +95,7 @@ class PipeReaderTestCase(TestCase):
return consumer.getvalue().decode("ascii", "replace")
def _do_test(self, make_pipes):
- for x in (1, 2, 5, 6, 7, 8, 2 ** 5, 2 ** 10, 2 ** 12, 2 ** 13, 2 **
14):
+ for x in (1, 2, 5, 6, 7, 8, 2**5, 2**10, 2**12, 2**13, 2**14):
test_string = x * "a"
(read_end, write_end), cleanup = make_pipes()
try:
diff --git a/lib/portage/tests/util/file_copy/test_copyfile.py
b/lib/portage/tests/util/file_copy/test_copyfile.py
index d7e74f26d..68e689792 100644
--- a/lib/portage/tests/util/file_copy/test_copyfile.py
+++ b/lib/portage/tests/util/file_copy/test_copyfile.py
@@ -43,13 +43,13 @@ class CopyFileSparseTestCase(TestCase):
# sparse files.
with open(src_path, "wb") as f:
f.write(content)
- f.seek(2 ** 17, 1)
+ f.seek(2**17, 1)
f.write(content)
- f.seek(2 ** 18, 1)
+ f.seek(2**18, 1)
f.write(content)
# Test that sparse blocks are handled correctly at
# the end of the file (involves seek and truncate).
- f.seek(2 ** 17, 1)
+ f.seek(2**17, 1)
copyfile(src_path, dest_path)
diff --git a/lib/portage/tests/xpak/test_decodeint.py
b/lib/portage/tests/xpak/test_decodeint.py
index 25388d866..2d4df5f16 100644
--- a/lib/portage/tests/xpak/test_decodeint.py
+++ b/lib/portage/tests/xpak/test_decodeint.py
@@ -12,5 +12,5 @@ class testDecodeIntTestCase(TestCase):
for n in range(1000):
self.assertEqual(decodeint(encodeint(n)), n)
- for n in (2 ** 32 - 1,):
+ for n in (2**32 - 1,):
self.assertEqual(decodeint(encodeint(n)), n)
diff --git a/lib/portage/util/backoff.py b/lib/portage/util/backoff.py
index d2c78ad76..f4a9bfc33 100644
--- a/lib/portage/util/backoff.py
+++ b/lib/portage/util/backoff.py
@@ -40,7 +40,7 @@ class ExponentialBackoff:
@rtype: int
"""
try:
- return min(self._limit, self._multiplier * (self._base ** tries))
+ return min(self._limit, self._multiplier * (self._base**tries))
except OverflowError:
return self._limit
diff --git a/lib/portage/util/lafilefixer.py b/lib/portage/util/lafilefixer.py
index 59df30b4b..1fd97c242 100644
--- a/lib/portage/util/lafilefixer.py
+++ b/lib/portage/util/lafilefixer.py
@@ -40,8 +40,8 @@ inh_link_flags_re =
re.compile(b"inherited_linker_flags='(?P<value>[^']*)'$")
# replace 'X11R6/lib' and 'local/lib' with 'lib', no idea what's this about.
X11_local_sub = re.compile(b"X11R6/lib|local/lib")
# get rid of the '..'
-pkgconfig_sub1 = re.compile(br"usr/lib[^/]*/pkgconfig/\.\./\.\.")
-pkgconfig_sub2 = re.compile(br"(?P<usrlib>usr/lib[^/]*)/pkgconfig/\.\.")
+pkgconfig_sub1 = re.compile(rb"usr/lib[^/]*/pkgconfig/\.\./\.\.")
+pkgconfig_sub2 = re.compile(rb"(?P<usrlib>usr/lib[^/]*)/pkgconfig/\.\.")
# detect flags that should go into inherited_linker_flags instead of
dependency_libs
flag_re = re.compile(
@@ -135,7 +135,7 @@ def rewrite_lafile(contents):
ladir = X11_local_sub.sub(b"lib", ladir)
ladir = pkgconfig_sub1.sub(b"usr", ladir)
- ladir = pkgconfig_sub2.sub(br"\g<usrlib>", ladir)
+ ladir = pkgconfig_sub2.sub(rb"\g<usrlib>", ladir)
if ladir not in libladir:
libladir.append(ladir)
diff --git a/repoman/lib/repoman/copyrights.py
b/repoman/lib/repoman/copyrights.py
index 3a6de76f8..199f5efbf 100644
--- a/repoman/lib/repoman/copyrights.py
+++ b/repoman/lib/repoman/copyrights.py
@@ -15,10 +15,10 @@ from portage import util
_copyright_re1 = re.compile(
- br"^(# Copyright \d\d\d\d)-\d\d\d\d( Gentoo (Foundation|Authors))\b"
+ rb"^(# Copyright \d\d\d\d)-\d\d\d\d( Gentoo (Foundation|Authors))\b"
)
_copyright_re2 = re.compile(
- br"^(# Copyright )(\d\d\d\d)( Gentoo (Foundation|Authors))\b"
+ rb"^(# Copyright )(\d\d\d\d)( Gentoo (Foundation|Authors))\b"
)
@@ -58,7 +58,7 @@ def update_copyright_year(year, line):
year = _unicode_encode(year)
line = _unicode_encode(line)
- line = _copyright_re1.sub(br"\1-" + year + b" Gentoo Authors", line)
+ line = _copyright_re1.sub(rb"\1-" + year + b" Gentoo Authors", line)
line = _copyright_re2.sub(_copyright_repl(year), line)
if not is_bytes:
line = _unicode_decode(line)
diff --git a/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py
b/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py
index 4709f8336..fd0552ce7 100644
--- a/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py
+++ b/repoman/lib/repoman/modules/scan/metadata/ebuild_metadata.py
@@ -36,15 +36,11 @@ class EbuildMetadata(ScanBase):
ebuild = kwargs.get("ebuild").get()
for pos, missing_var in
enumerate(self.repo_settings.qadata.missingvars):
if not ebuild.metadata.get(missing_var):
- if (
- kwargs.get("catdir")
- in (
- "acct-group",
- "acct-user",
- "virtual",
- )
- and missing_var in ("HOMEPAGE", "LICENSE")
- ):
+ if kwargs.get("catdir") in (
+ "acct-group",
+ "acct-user",
+ "virtual",
+ ) and missing_var in ("HOMEPAGE", "LICENSE"):
continue
if ebuild.live_ebuild and missing_var == "KEYWORDS":
continue
diff --git a/repoman/lib/repoman/modules/vcs/cvs/changes.py
b/repoman/lib/repoman/modules/vcs/cvs/changes.py
index 5f898dae0..be382f291 100644
--- a/repoman/lib/repoman/modules/vcs/cvs/changes.py
+++ b/repoman/lib/repoman/modules/vcs/cvs/changes.py
@@ -61,7 +61,7 @@ class Changes(ChangesBase):
@param headers: file headers
"""
- cvs_header_re = re.compile(br"^#\s*\$Header.*\$$")
+ cvs_header_re = re.compile(rb"^#\s*\$Header.*\$$")
attic_str = b"/Attic/"
attic_replace = b"/"
for x in headers: