commit: 3d55e159c473075c7b2f87c92293b0df6fa57563 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sun Jan 28 22:01:58 2024 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sun Jan 28 23:09:26 2024 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=3d55e159
*/*: rerun black w/ 24.1.0 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/_emerge/AsynchronousTask.py | 6 +-- lib/_emerge/EbuildMetadataPhase.py | 11 ++--- lib/_emerge/MergeListItem.py | 1 - lib/_emerge/PipeReader.py | 1 - lib/_emerge/SpawnProcess.py | 1 - lib/_emerge/depgraph.py | 59 ++++++++++++++----------- lib/_emerge/resolver/slot_collision.py | 12 ++--- lib/portage/_emirrordist/DeletionIterator.py | 8 ++-- lib/portage/_emirrordist/FetchIterator.py | 8 ++-- lib/portage/_sets/libs.py | 1 - lib/portage/dbapi/porttree.py | 1 - lib/portage/dbapi/vartree.py | 28 +++++++----- lib/portage/dep/__init__.py | 1 - lib/portage/package/ebuild/config.py | 38 ++++++++-------- lib/portage/package/ebuild/doebuild.py | 16 ++++--- lib/portage/proxy/objectproxy.py | 1 - lib/portage/tests/ebuild/test_fetch.py | 10 ++--- lib/portage/tests/process/test_AsyncFunction.py | 8 ++-- lib/portage/util/_async/PipeLogger.py | 1 - lib/portage/util/_async/TaskScheduler.py | 1 - lib/portage/util/_dyn_libs/LinkageMapELF.py | 3 -- lib/portage/util/file_copy/__init__.py | 7 +-- lib/portage/util/futures/_sync_decorator.py | 8 ++-- 23 files changed, 119 insertions(+), 112 deletions(-) diff --git a/lib/_emerge/AsynchronousTask.py b/lib/_emerge/AsynchronousTask.py index 4290eede36..4049ba5eb6 100644 --- a/lib/_emerge/AsynchronousTask.py +++ b/lib/_emerge/AsynchronousTask.py @@ -46,9 +46,9 @@ class AsynchronousTask(SlotObject): ) self.addExitListener(exit_listener) waiter.add_done_callback( - lambda waiter: self.removeExitListener(exit_listener) - if waiter.cancelled() - else None + lambda waiter: ( + self.removeExitListener(exit_listener) if waiter.cancelled() else None + ) ) if self.returncode is not None: # If the returncode is not None, it means the exit event has already diff --git a/lib/_emerge/EbuildMetadataPhase.py b/lib/_emerge/EbuildMetadataPhase.py index fd695e0253..8905a058fc 100644 --- a/lib/_emerge/EbuildMetadataPhase.py +++ b/lib/_emerge/EbuildMetadataPhase.py @@ -19,7 +19,6 @@ import fcntl class EbuildMetadataPhase(SubProcess): - """ Asynchronous interface for the ebuild "depend" phase which is used to extract metadata from the ebuild. @@ -200,12 +199,10 @@ class EbuildMetadataPhase(SubProcess): # entries for unsupported EAPIs. if self.eapi_supported: if metadata.get("INHERITED", False): - metadata[ - "_eclasses_" - ] = self.portdb.repositories.get_repo_for_location( - self.repo_path - ).eclass_db.get_eclass_data( - metadata["INHERITED"].split() + metadata["_eclasses_"] = ( + self.portdb.repositories.get_repo_for_location( + self.repo_path + ).eclass_db.get_eclass_data(metadata["INHERITED"].split()) ) else: metadata["_eclasses_"] = {} diff --git a/lib/_emerge/MergeListItem.py b/lib/_emerge/MergeListItem.py index efe485c2e0..ae894704a4 100644 --- a/lib/_emerge/MergeListItem.py +++ b/lib/_emerge/MergeListItem.py @@ -13,7 +13,6 @@ from _emerge.PackageUninstall import PackageUninstall class MergeListItem(CompositeTask): - """ TODO: For parallel scheduling, everything here needs asynchronous execution support (start, poll, and wait methods). diff --git a/lib/_emerge/PipeReader.py b/lib/_emerge/PipeReader.py index 026346e0bb..76ab7f1882 100644 --- a/lib/_emerge/PipeReader.py +++ b/lib/_emerge/PipeReader.py @@ -8,7 +8,6 @@ from _emerge.AbstractPollTask import AbstractPollTask class PipeReader(AbstractPollTask): - """ Reads output from one or more files and saves it in memory, for retrieval via the getvalue() method. This is driven by diff --git a/lib/_emerge/SpawnProcess.py b/lib/_emerge/SpawnProcess.py index 72fa72c613..40740df9aa 100644 --- a/lib/_emerge/SpawnProcess.py +++ b/lib/_emerge/SpawnProcess.py @@ -16,7 +16,6 @@ from portage.util.futures import asyncio class SpawnProcess(SubProcess): - """ Constructor keyword args are passed into portage.process.spawn(). The required "args" keyword argument will be passed as the first diff --git a/lib/_emerge/depgraph.py b/lib/_emerge/depgraph.py index 1cbbbaf815..1674fa289e 100644 --- a/lib/_emerge/depgraph.py +++ b/lib/_emerge/depgraph.py @@ -408,7 +408,6 @@ class _use_changes(tuple): class _dynamic_depgraph_config: - """ ``dynamic_depgraph_config`` is an object that is used to collect settings and important data structures that are used in calculating Portage dependencies. Each depgraph created by the depgraph.py code gets its own @@ -3798,11 +3797,15 @@ class depgraph: + ( optional_msg.format("parent and child") if parent in removed and pkg in removed - else optional_msg.format("parent") - if parent in removed - else optional_msg.format("child") - if pkg in removed - else "" + else ( + optional_msg.format("parent") + if parent in removed + else ( + optional_msg.format("child") + if pkg in removed + else "" + ) + ) ) ) priorities = [] @@ -3820,11 +3823,15 @@ class depgraph: + ( optional_msg.format("parent and child") if pkg in removed and child in removed - else optional_msg.format("parent") - if pkg in removed - else optional_msg.format("child") - if child in removed - else "" + else ( + optional_msg.format("parent") + if pkg in removed + else ( + optional_msg.format("child") + if child in removed + else "" + ) + ) ) ) priorities = [] @@ -5830,9 +5837,9 @@ class depgraph: self._select_atoms_parent = parent mytrees["parent"] = parent mytrees["atom_graph"] = atom_graph - mytrees[ - "circular_dependency" - ] = self._dynamic_config._circular_dependency + mytrees["circular_dependency"] = ( + self._dynamic_config._circular_dependency + ) if priority is not None: mytrees["priority"] = priority @@ -10546,24 +10553,24 @@ class depgraph: filename = "package.accept_keywords" else: filename = "package.keywords" - file_to_write_to[ - (abs_user_config, "package.keywords") - ] = find_config_file(abs_user_config, filename) + file_to_write_to[(abs_user_config, "package.keywords")] = ( + find_config_file(abs_user_config, filename) + ) if root in p_mask_change_msg: - file_to_write_to[ - (abs_user_config, "package.unmask") - ] = find_config_file(abs_user_config, "package.unmask") + file_to_write_to[(abs_user_config, "package.unmask")] = ( + find_config_file(abs_user_config, "package.unmask") + ) if root in use_changes_msg: - file_to_write_to[ - (abs_user_config, "package.use") - ] = find_config_file(abs_user_config, "package.use") + file_to_write_to[(abs_user_config, "package.use")] = ( + find_config_file(abs_user_config, "package.use") + ) if root in license_msg: - file_to_write_to[ - (abs_user_config, "package.license") - ] = find_config_file(abs_user_config, "package.license") + file_to_write_to[(abs_user_config, "package.license")] = ( + find_config_file(abs_user_config, "package.license") + ) for (abs_user_config, f), path in file_to_write_to.items(): if path is None: diff --git a/lib/_emerge/resolver/slot_collision.py b/lib/_emerge/resolver/slot_collision.py index 7e579f3944..d4f7018ea9 100644 --- a/lib/_emerge/resolver/slot_collision.py +++ b/lib/_emerge/resolver/slot_collision.py @@ -446,17 +446,17 @@ class slot_conflict_handler: modified_use=self.depgraph._pkg_use_enabled(ppkg), ): selected_for_display.add((ppkg, atom)) - need_rebuild[ - ppkg - ] = "matched by --useoldpkg-atoms argument" + need_rebuild[ppkg] = ( + "matched by --useoldpkg-atoms argument" + ) elif usepkgonly: # This case is tricky, so keep quiet in order to avoid false-positives. pass elif not self.depgraph._equiv_ebuild_visible(ppkg): selected_for_display.add((ppkg, atom)) - need_rebuild[ - ppkg - ] = "ebuild is masked or unavailable" + need_rebuild[ppkg] = ( + "ebuild is masked or unavailable" + ) for ppkg, atom, other_pkg in parents: selected_for_display.add((ppkg, atom)) diff --git a/lib/portage/_emirrordist/DeletionIterator.py b/lib/portage/_emirrordist/DeletionIterator.py index 4494b7b242..bed40e9352 100644 --- a/lib/portage/_emirrordist/DeletionIterator.py +++ b/lib/portage/_emirrordist/DeletionIterator.py @@ -27,9 +27,11 @@ class DeletionIterator: distfiles_set = set() distfiles_set.update( ( - filename - if isinstance(filename, DistfileName) - else DistfileName(filename) + ( + filename + if isinstance(filename, DistfileName) + else DistfileName(filename) + ) for filename in itertools.chain.from_iterable( layout.get_filenames(distdir) for layout in self._config.layouts ) diff --git a/lib/portage/_emirrordist/FetchIterator.py b/lib/portage/_emirrordist/FetchIterator.py index 54a058bb53..eaf3e53596 100644 --- a/lib/portage/_emirrordist/FetchIterator.py +++ b/lib/portage/_emirrordist/FetchIterator.py @@ -292,9 +292,11 @@ def _async_fetch_tasks(config, hash_filter, repo_config, digests_future, cpv, lo ) gather_result.add_done_callback(aux_get_done) result.add_done_callback( - lambda result: gather_result.cancel() - if result.cancelled() and not gather_result.done() - else None + lambda result: ( + gather_result.cancel() + if result.cancelled() and not gather_result.done() + else None + ) ) return result diff --git a/lib/portage/_sets/libs.py b/lib/portage/_sets/libs.py index 9636b9d2c8..8608442352 100644 --- a/lib/portage/_sets/libs.py +++ b/lib/portage/_sets/libs.py @@ -33,7 +33,6 @@ class LibraryConsumerSet(PackageSet): class LibraryFileConsumerSet(LibraryConsumerSet): - """ Note: This does not detect libtool archive (*.la) files that consume the specified files (revdep-rebuild is able to detect them). diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py index eabf2d0a2a..61d431f917 100644 --- a/lib/portage/dbapi/porttree.py +++ b/lib/portage/dbapi/porttree.py @@ -106,7 +106,6 @@ class _dummy_list(list): class _better_cache: - """ The purpose of better_cache is to locate catpkgs in repositories using ``os.listdir()`` as much as possible, which is less expensive IO-wise than exhaustively doing a stat on each repo for a particular catpkg. better_cache stores a diff --git a/lib/portage/dbapi/vartree.py b/lib/portage/dbapi/vartree.py index a00c731c57..c6b45ba422 100644 --- a/lib/portage/dbapi/vartree.py +++ b/lib/portage/dbapi/vartree.py @@ -2164,9 +2164,11 @@ class dblink: # The tarfile module will write pax headers holding the # xattrs only if PAX_FORMAT is specified here. with tarfile.open( - fileobj=output_file - if hasattr(output_file, "write") - else open(output_file.fileno(), mode="wb", closefd=False), + fileobj=( + output_file + if hasattr(output_file, "write") + else open(output_file.fileno(), mode="wb", closefd=False) + ), mode="w|", format=tarfile.PAX_FORMAT if xattrs else tarfile.DEFAULT_FORMAT, ) as tar: @@ -5293,12 +5295,14 @@ class dblink: # to TextIOWrapper with python2. contents_tmp_path = os.path.join(self.dbtmpdir, "CONTENTS") outfile = atomic_ofstream( - contents_tmp_path - if portage.utf8_mode - else _unicode_encode( - contents_tmp_path, - encoding=_encodings["fs"], - errors="strict", + ( + contents_tmp_path + if portage.utf8_mode + else _unicode_encode( + contents_tmp_path, + encoding=_encodings["fs"], + errors="strict", + ) ), mode="w", encoding=_encodings["repo.content"], @@ -6546,9 +6550,9 @@ def tar_contents(contents, root, tar, protect=None, onProgress=None, xattrs=Fals # Compatible with GNU tar, which saves the xattrs # under the SCHILY.xattr namespace. for k in xattr.list(path_bytes): - tarinfo.pax_headers[ - "SCHILY.xattr." + _unicode_decode(k) - ] = _unicode_decode(xattr.get(path_bytes, _unicode_encode(k))) + tarinfo.pax_headers["SCHILY.xattr." + _unicode_decode(k)] = ( + _unicode_decode(xattr.get(path_bytes, _unicode_encode(k))) + ) with open(path_bytes, "rb") as f: tar.addfile(tarinfo, f) diff --git a/lib/portage/dep/__init__.py b/lib/portage/dep/__init__.py index 04f857c999..a4a5bf26bd 100644 --- a/lib/portage/dep/__init__.py +++ b/lib/portage/dep/__init__.py @@ -1440,7 +1440,6 @@ class _use_dep: class Atom(str): - """ For compatibility with existing atom string manipulation code, this class emulates most of the str methods that are useful with atoms. diff --git a/lib/portage/package/ebuild/config.py b/lib/portage/package/ebuild/config.py index 1c455eeacb..d7b0ca5676 100644 --- a/lib/portage/package/ebuild/config.py +++ b/lib/portage/package/ebuild/config.py @@ -866,10 +866,10 @@ class config: # Initialize all USE related variables we track ourselves. self.usemask = self._use_manager.getUseMask() self.useforce = self._use_manager.getUseForce() - self.configdict["conf"][ - "USE" - ] = self._use_manager.extract_global_USE_changes( - self.configdict["conf"].get("USE", "") + self.configdict["conf"]["USE"] = ( + self._use_manager.extract_global_USE_changes( + self.configdict["conf"].get("USE", "") + ) ) # Read license_groups and optionally license_groups and package.license from user config @@ -879,10 +879,10 @@ class config: user_config=local_config, ) # Extract '*/*' entries from package.license - self.configdict["conf"][ - "ACCEPT_LICENSE" - ] = self._license_manager.extract_global_changes( - self.configdict["conf"].get("ACCEPT_LICENSE", "") + self.configdict["conf"]["ACCEPT_LICENSE"] = ( + self._license_manager.extract_global_changes( + self.configdict["conf"].get("ACCEPT_LICENSE", "") + ) ) # profile.bashrc @@ -1068,9 +1068,9 @@ class config: # reasonable defaults; this is important as without USE_ORDER, # USE will always be "" (nothing set)! if "USE_ORDER" not in self: - self[ - "USE_ORDER" - ] = "env:pkg:conf:defaults:pkginternal:features:repo:env.d" + self["USE_ORDER"] = ( + "env:pkg:conf:defaults:pkginternal:features:repo:env.d" + ) self.backup_changes("USE_ORDER") if "CBUILD" not in self and "CHOST" in self: @@ -1689,14 +1689,14 @@ class config: if use is None: use = frozenset(settings["PORTAGE_USE"].split()) - values[ - "ACCEPT_LICENSE" - ] = settings._license_manager.get_prunned_accept_license( - settings.mycpv, - use, - settings.get("LICENSE", ""), - settings.get("SLOT"), - settings.get("PORTAGE_REPO_NAME"), + values["ACCEPT_LICENSE"] = ( + settings._license_manager.get_prunned_accept_license( + settings.mycpv, + use, + settings.get("LICENSE", ""), + settings.get("SLOT"), + settings.get("PORTAGE_REPO_NAME"), + ) ) values["PORTAGE_PROPERTIES"] = self._flatten("PROPERTIES", use, settings) values["PORTAGE_RESTRICT"] = self._flatten("RESTRICT", use, settings) diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py index b10bbaf30d..ed604415da 100644 --- a/lib/portage/package/ebuild/doebuild.py +++ b/lib/portage/package/ebuild/doebuild.py @@ -591,9 +591,9 @@ def doebuild_environment( if nproc: mysettings["MAKEOPTS"] = "-j%d" % (nproc) if "GNUMAKEFLAGS" not in mysettings and "MAKEFLAGS" not in mysettings: - mysettings[ - "GNUMAKEFLAGS" - ] = f"--load-average {nproc} --output-sync=line" + mysettings["GNUMAKEFLAGS"] = ( + f"--load-average {nproc} --output-sync=line" + ) if not eapi_exports_KV(eapi): # Discard KV for EAPIs that don't support it. Cached KV is restored @@ -2773,10 +2773,12 @@ def _post_src_install_uid_fix(mysettings, out): # a normal write might fail due to file permission # settings on some operating systems such as HP-UX write_atomic( - fpath - if portage.utf8_mode - else _unicode_encode( - fpath, encoding=_encodings["merge"], errors="strict" + ( + fpath + if portage.utf8_mode + else _unicode_encode( + fpath, encoding=_encodings["merge"], errors="strict" + ) ), new_contents, mode="wb", diff --git a/lib/portage/proxy/objectproxy.py b/lib/portage/proxy/objectproxy.py index 7cdc6f68d6..f36464e197 100644 --- a/lib/portage/proxy/objectproxy.py +++ b/lib/portage/proxy/objectproxy.py @@ -6,7 +6,6 @@ __all__ = ["ObjectProxy"] class ObjectProxy: - """ Object that acts as a proxy to another object, forwarding attribute accesses and method calls. This can be useful diff --git a/lib/portage/tests/ebuild/test_fetch.py b/lib/portage/tests/ebuild/test_fetch.py index bc8c052746..4812eb4306 100644 --- a/lib/portage/tests/ebuild/test_fetch.py +++ b/lib/portage/tests/ebuild/test_fetch.py @@ -246,11 +246,11 @@ class EbuildFetchTestCase(TestCase): """ % orig_fetchcommand.replace("${FILE}", "${FILE}.__download__") ) - settings[ - "FETCHCOMMAND" - ] = '"{}" "{}" "${{URI}}" "${{DISTDIR}}" "${{FILE}}"'.format( - BASH_BINARY, - temp_fetchcommand, + settings["FETCHCOMMAND"] = ( + '"{}" "{}" "${{URI}}" "${{DISTDIR}}" "${{FILE}}"'.format( + BASH_BINARY, + temp_fetchcommand, + ) ) settings.features.add("skiprocheck") settings.features.remove("distlocks") diff --git a/lib/portage/tests/process/test_AsyncFunction.py b/lib/portage/tests/process/test_AsyncFunction.py index 1faf8f49f7..a056f268bd 100644 --- a/lib/portage/tests/process/test_AsyncFunction.py +++ b/lib/portage/tests/process/test_AsyncFunction.py @@ -36,9 +36,11 @@ class AsyncFunctionTestCase(TestCase): scheduler=loop, target=self._read_from_stdin, args=( - pw.fileno() - if multiprocessing.get_start_method() == "fork" - else None, + ( + pw.fileno() + if multiprocessing.get_start_method() == "fork" + else None + ), ), ) reader.start() diff --git a/lib/portage/util/_async/PipeLogger.py b/lib/portage/util/_async/PipeLogger.py index e5cabaa621..5f3c832275 100644 --- a/lib/portage/util/_async/PipeLogger.py +++ b/lib/portage/util/_async/PipeLogger.py @@ -14,7 +14,6 @@ from _emerge.AbstractPollTask import AbstractPollTask class PipeLogger(AbstractPollTask): - """ This can be used for logging output of a child process, optionally outputting to log_file_path and/or stdout_fd. It can diff --git a/lib/portage/util/_async/TaskScheduler.py b/lib/portage/util/_async/TaskScheduler.py index 09920111e4..ec97a84ac6 100644 --- a/lib/portage/util/_async/TaskScheduler.py +++ b/lib/portage/util/_async/TaskScheduler.py @@ -5,7 +5,6 @@ from .AsyncScheduler import AsyncScheduler class TaskScheduler(AsyncScheduler): - """ A simple way to handle scheduling of AbstractPollTask instances. Simply pass a task iterator into the constructor and call start(). Use the diff --git a/lib/portage/util/_dyn_libs/LinkageMapELF.py b/lib/portage/util/_dyn_libs/LinkageMapELF.py index 76feadcac1..67ed16ccbc 100644 --- a/lib/portage/util/_dyn_libs/LinkageMapELF.py +++ b/lib/portage/util/_dyn_libs/LinkageMapELF.py @@ -52,7 +52,6 @@ _approx_multilib_categories = { class LinkageMapELF: - """Models dynamic linker dependencies.""" _needed_aux_key = "NEEDED.ELF.2" @@ -107,7 +106,6 @@ class LinkageMapELF: return key class _ObjectKey: - """Helper class used as _obj_properties keys for objects.""" __slots__ = ("_key",) @@ -515,7 +513,6 @@ class LinkageMapELF: os = _os_merge class _LibraryCache: - """ Caches properties associated with paths. diff --git a/lib/portage/util/file_copy/__init__.py b/lib/portage/util/file_copy/__init__.py index 2961853d39..f88d4d9d59 100644 --- a/lib/portage/util/file_copy/__init__.py +++ b/lib/portage/util/file_copy/__init__.py @@ -23,9 +23,10 @@ def _optimized_copyfile(src, dst): @param dst: path of destination file @type dst: str """ - with open(src, "rb", buffering=0) as src_file, open( - dst, "wb", buffering=0 - ) as dst_file: + with ( + open(src, "rb", buffering=0) as src_file, + open(dst, "wb", buffering=0) as dst_file, + ): _file_copy(src_file.fileno(), dst_file.fileno()) diff --git a/lib/portage/util/futures/_sync_decorator.py b/lib/portage/util/futures/_sync_decorator.py index 772983bc81..436e7c3462 100644 --- a/lib/portage/util/futures/_sync_decorator.py +++ b/lib/portage/util/futures/_sync_decorator.py @@ -39,9 +39,11 @@ def _sync_methods(obj, loop=None): loop = asyncio._wrap_loop(loop) return _ObjectAttrWrapper( obj, - lambda attr: _sync_decorator(attr, loop=loop) - if asyncio.iscoroutinefunction(attr) - else attr, + lambda attr: ( + _sync_decorator(attr, loop=loop) + if asyncio.iscoroutinefunction(attr) + else attr + ), )