From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 512EB1581EE for ; Fri, 21 Mar 2025 17:32:02 +0000 (UTC) Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: relay-lists.gentoo.org@gentoo.org) by smtp.gentoo.org (Postfix) with ESMTPSA id 3C30C343264 for ; Fri, 21 Mar 2025 17:32:02 +0000 (UTC) Received: from bobolink.gentoo.org (localhost [127.0.0.1]) by bobolink.gentoo.org (Postfix) with ESMTP id 41BC91104AD; Fri, 21 Mar 2025 17:32:01 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bobolink.gentoo.org (Postfix) with ESMTPS id 38A631104AD for ; Fri, 21 Mar 2025 17:32:01 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id E0526343262 for ; Fri, 21 Mar 2025 17:32:00 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 218C81EEA for ; Fri, 21 Mar 2025 17:31:59 +0000 (UTC) From: "Arthur Zamarin" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Arthur Zamarin" Message-ID: <1742578295.d7c5b9ee750f33b38ccfed478686130a9660b51d.arthurzam@gentoo> Subject: [gentoo-commits] proj/pkgcore/pkgcore:master commit in: src/pkgcore/ebuild/ X-VCS-Repository: proj/pkgcore/pkgcore X-VCS-Files: src/pkgcore/ebuild/ebd_ipc.py X-VCS-Directories: src/pkgcore/ebuild/ X-VCS-Committer: arthurzam X-VCS-Committer-Name: Arthur Zamarin X-VCS-Revision: d7c5b9ee750f33b38ccfed478686130a9660b51d X-VCS-Branch: master Date: Fri, 21 Mar 2025 17:31:59 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: a81e000f-ca34-43cc-9313-dd826d67ea1b X-Archives-Hash: 8f0a72927758dbd2af659c5c5d7a2626 commit: d7c5b9ee750f33b38ccfed478686130a9660b51d Author: Arthur Zamarin gentoo org> AuthorDate: Fri Mar 21 11:12:39 2025 +0000 Commit: Arthur Zamarin gentoo org> CommitDate: Fri Mar 21 17:31:35 2025 +0000 URL: https://gitweb.gentoo.org/proj/pkgcore/pkgcore.git/commit/?id=d7c5b9ee ebd_ipc: improve typing Signed-off-by: Arthur Zamarin gentoo.org> src/pkgcore/ebuild/ebd_ipc.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pkgcore/ebuild/ebd_ipc.py b/src/pkgcore/ebuild/ebd_ipc.py index ea6b9b99..d836cc79 100644 --- a/src/pkgcore/ebuild/ebd_ipc.py +++ b/src/pkgcore/ebuild/ebd_ipc.py @@ -73,7 +73,7 @@ class IpcArgumentParser(arghparse.ArgumentParser): def __init__(self, *args, **kwargs): super().__init__(*args, suppress=True, add_help=False, **kwargs) - def error(self, msg): + def error(self, msg: str): raise IpcCommandError(msg) @@ -81,18 +81,18 @@ class IpcCommand: """Commands sent from the bash side of the ebuild daemon to run.""" # argument parser for internal options - parser = None + parser: IpcArgumentParser # argument parser for command options/arguments - arg_parser = None + arg_parser: IpcArgumentParser # override IPC name for error messages - name = None + name: str def __init__(self, op): self.op = op self.pkg = op.pkg self.eapi = op.pkg.eapi self.observer = op.observer - if self.name is None: + if not hasattr(self, "name"): self.name = self.__class__.__name__.lower() def __call__(self, ebd): @@ -140,12 +140,12 @@ class IpcCommand: def parse_args(self, options, args): """Parse internal args passed from the bash side.""" - if self.parser is not None: + if hasattr(self, "parser"): _, unknown = self.parser.parse_known_args(options, namespace=self.opts) if unknown: raise UnknownOptions(unknown) - if self.arg_parser is not None: + if hasattr(self, "arg_parser"): # pull user options off the start of the argument list _, args = self.arg_parser.parse_known_optionals(args, namespace=self.opts) # parse remaining command arguments @@ -690,7 +690,7 @@ class Dosym(_Symlink): class Dohard(_Symlink): - """Python wrapper for dosym.""" + """Python wrapper for dohard.""" _link = os.link @@ -842,8 +842,8 @@ class _AlterFiles(IpcCommand): arg_parser.add_argument("-x", dest="excludes", action="store_true") arg_parser.add_argument("targets", nargs="+") - default_includes = () - default_excludes = () + default_includes: tuple[str, ...] = () + default_excludes: tuple[str, ...] = () def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs)