public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: lib/portage/tests/util/futures/asyncio/, lib/portage/util/futures/, lib/portage/, ...
@ 2023-08-02  6:31 Sam James
  0 siblings, 0 replies; only message in thread
From: Sam James @ 2023-08-02  6:31 UTC (permalink / raw
  To: gentoo-commits

commit:     4c6416780a38e2103fc6e871780ed37b8d60badb
Author:     James Le Cuirot <chewi <AT> gentoo <DOT> org>
AuthorDate: Fri Jul 21 14:52:56 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Wed Aug  2 06:31:19 2023 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=4c641678

Linting fixes

Signed-off-by: James Le Cuirot <chewi <AT> gentoo.org>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 lib/portage/dbapi/__init__.py                           | 15 ++++++++-------
 lib/portage/dbapi/porttree.py                           | 13 +++++++------
 .../ebuild/_parallel_manifest/ManifestScheduler.py      |  2 +-
 lib/portage/sync/modules/cvs/cvs.py                     |  4 ++--
 .../tests/util/futures/asyncio/test_subprocess_exec.py  |  4 ++--
 lib/portage/util/futures/retry.py                       |  2 +-
 lib/portage/util/socks5.py                              |  2 +-
 lib/portage/versions.py                                 | 17 +++++++++--------
 8 files changed, 31 insertions(+), 28 deletions(-)

diff --git a/lib/portage/dbapi/__init__.py b/lib/portage/dbapi/__init__.py
index 428e4a48e..233da8d69 100644
--- a/lib/portage/dbapi/__init__.py
+++ b/lib/portage/dbapi/__init__.py
@@ -5,7 +5,8 @@ __all__ = ["dbapi"]
 
 import re
 import warnings
-from typing import Any, Dict, List, Optional, Sequence, Tuple
+from typing import Any, Dict, List, Optional, Tuple
+from collections.abc import Sequence
 
 import portage
 
@@ -30,7 +31,7 @@ from _emerge.Package import Package
 
 class dbapi:
     _category_re = re.compile(r"^\w[-.+\w]*$", re.UNICODE)
-    _categories: Optional[Tuple[str, ...]] = None
+    _categories: Optional[tuple[str, ...]] = None
     _use_mutable = False
     _known_keys = frozenset(auxdbkeys)
     _pkg_str_aux_keys = ("EAPI", "KEYWORDS", "SLOT", "repository")
@@ -39,7 +40,7 @@ class dbapi:
         pass
 
     @property
-    def categories(self) -> Tuple[str, ...]:
+    def categories(self) -> tuple[str, ...]:
         """
         Use self.cp_all() to generate a category list. Mutable instances
         can delete the self._categories attribute in cases when the cached
@@ -77,7 +78,7 @@ class dbapi:
             # dict to map strings back to their original values.
             cpv_list.sort(key=cmp_sort_key(dbapi._cmp_cpv))
 
-    def cpv_all(self) -> List[str]:
+    def cpv_all(self) -> list[str]:
         """Return all CPVs in the db
         Args:
                 None
@@ -94,7 +95,7 @@ class dbapi:
             cpv_list.extend(self.cp_list(cp))
         return cpv_list
 
-    def cp_all(self, sort: bool = False) -> List[str]:
+    def cp_all(self, sort: bool = False) -> list[str]:
         """Implement this in a child class
         Args
                 sort - return sorted results
@@ -105,7 +106,7 @@ class dbapi:
 
     def aux_get(
         self, mycpv: str, mylist: str, myrepo: Optional[str] = None
-    ) -> List[str]:
+    ) -> list[str]:
         """Return the metadata keys in mylist for mycpv
         Args:
                 mycpv - "sys-apps/foo-1.0"
@@ -117,7 +118,7 @@ class dbapi:
         """
         raise NotImplementedError
 
-    def aux_update(self, cpv: str, metadata_updates: Dict[str, Any]) -> None:
+    def aux_update(self, cpv: str, metadata_updates: dict[str, Any]) -> None:
         """
         Args:
           cpv - "sys-apps/foo-1.0"

diff --git a/lib/portage/dbapi/porttree.py b/lib/portage/dbapi/porttree.py
index c47b66bda..fdfb6ef52 100644
--- a/lib/portage/dbapi/porttree.py
+++ b/lib/portage/dbapi/porttree.py
@@ -49,7 +49,8 @@ import functools
 
 import collections
 from collections import OrderedDict
-from typing import List, Optional, Sequence, Type, Tuple, Union
+from collections.abc import Sequence
+from typing import Optional, Union
 from urllib.parse import urlparse
 
 
@@ -502,7 +503,7 @@ class portdbapi(dbapi):
         mycpv: str,
         mytree: Optional[str] = None,
         myrepo: Optional[str] = None,
-    ) -> Union[Tuple[None, int], Tuple[str, str], Tuple[str, None]]:
+    ) -> Union[tuple[None, int], tuple[str, str], tuple[str, None]]:
         """
         Returns the location of the CPV, and what overlay it was in.
         Searches overlays first, then PORTDIR; this allows us to return the first
@@ -657,7 +658,7 @@ class portdbapi(dbapi):
         mylist: Sequence[str],
         mytree: Optional[str] = None,
         myrepo: Optional[str] = None,
-    ) -> List[str]:
+    ) -> list[str]:
         "stub code for returning auxilliary db information, such as SLOT, DEPEND, etc."
         'input: "sys-apps/foo-1.0",["SLOT","DEPEND","HOMEPAGE"]'
         'return: ["0",">=sys-libs/bar-1.0","http://www.foo.com"] or raise PortageKeyError if error'
@@ -1216,9 +1217,9 @@ class portdbapi(dbapi):
         self,
         level: str,
         origdep: str,
-        mydep: Type[DeprecationWarning] = DeprecationWarning,
-        mykey: Type[DeprecationWarning] = DeprecationWarning,
-        mylist: Type[DeprecationWarning] = DeprecationWarning,
+        mydep: type[DeprecationWarning] = DeprecationWarning,
+        mykey: type[DeprecationWarning] = DeprecationWarning,
+        mylist: type[DeprecationWarning] = DeprecationWarning,
     ) -> Union[Sequence[str], str]:
         """
         Caching match function.

diff --git a/lib/portage/package/ebuild/_parallel_manifest/ManifestScheduler.py b/lib/portage/package/ebuild/_parallel_manifest/ManifestScheduler.py
index bace3c298..da7529277 100644
--- a/lib/portage/package/ebuild/_parallel_manifest/ManifestScheduler.py
+++ b/lib/portage/package/ebuild/_parallel_manifest/ManifestScheduler.py
@@ -18,7 +18,7 @@ class ManifestScheduler(AsyncScheduler):
         gpg_cmd=None,
         gpg_vars=None,
         force_sign_key=None,
-        **kwargs
+        **kwargs,
     ):
         AsyncScheduler.__init__(self, **kwargs)
 

diff --git a/lib/portage/sync/modules/cvs/cvs.py b/lib/portage/sync/modules/cvs/cvs.py
index 722f54ab4..e2e3a38a8 100644
--- a/lib/portage/sync/modules/cvs/cvs.py
+++ b/lib/portage/sync/modules/cvs/cvs.py
@@ -41,7 +41,7 @@ class CVSSync(NewBase):
                         self.repo.module_specific_options["sync-cvs-repo"]
                     ),
                 ),
-                **self.spawn_kwargs
+                **self.spawn_kwargs,
             )
             != os.EX_OK
         ):
@@ -64,7 +64,7 @@ class CVSSync(NewBase):
         exitcode = portage.process.spawn_bash(
             "cd %s; exec cvs -z0 -q update -dP"
             % (portage._shell_quote(self.repo.location),),
-            **self.spawn_kwargs
+            **self.spawn_kwargs,
         )
         if exitcode != os.EX_OK:
             msg = "!!! cvs update error; exiting."

diff --git a/lib/portage/tests/util/futures/asyncio/test_subprocess_exec.py b/lib/portage/tests/util/futures/asyncio/test_subprocess_exec.py
index 607a1f741..bb284d49f 100644
--- a/lib/portage/tests/util/futures/asyncio/test_subprocess_exec.py
+++ b/lib/portage/tests/util/futures/asyncio/test_subprocess_exec.py
@@ -39,7 +39,7 @@ class SubprocessExecTestCase(TestCase):
                     echo_binary,
                     *args_tuple,
                     stdout=subprocess.PIPE,
-                    stderr=subprocess.STDOUT
+                    stderr=subprocess.STDOUT,
                 )
 
                 out, err = await proc.communicate()
@@ -155,7 +155,7 @@ class SubprocessExecTestCase(TestCase):
                         stdin=devnull,
                         stdout=subprocess.PIPE,
                         stderr=subprocess.STDOUT,
-                        loop=loop
+                        loop=loop,
                     )
                 )
 

diff --git a/lib/portage/util/futures/retry.py b/lib/portage/util/futures/retry.py
index 496bfb562..a8a3ad4fb 100644
--- a/lib/portage/util/futures/retry.py
+++ b/lib/portage/util/futures/retry.py
@@ -84,7 +84,7 @@ def _retry(
     reraise,
     func,
     *args,
-    **kwargs
+    **kwargs,
 ):
     """
     Retry coroutine, used to implement retry decorator.

diff --git a/lib/portage/util/socks5.py b/lib/portage/util/socks5.py
index 147e37054..fedb8599d 100644
--- a/lib/portage/util/socks5.py
+++ b/lib/portage/util/socks5.py
@@ -54,7 +54,7 @@ class ProxyManager:
         self._pids = spawn(
             [_python_interpreter, server_bin, self.socket_path],
             returnpid=True,
-            **spawn_kwargs
+            **spawn_kwargs,
         )
 
     def stop(self):

diff --git a/lib/portage/versions.py b/lib/portage/versions.py
index 4b97c6124..74855e63b 100644
--- a/lib/portage/versions.py
+++ b/lib/portage/versions.py
@@ -19,7 +19,8 @@ import re
 import typing
 import warnings
 from functools import lru_cache
-from typing import Any, Dict, List, Optional, Sequence, Tuple, Union
+from typing import Any, Optional, Union
+from collections.abc import Sequence
 
 
 import portage
@@ -264,7 +265,7 @@ def vercmp(ver1: str, ver2: str, silent: int = 1) -> Optional[int]:
     return rval
 
 
-def pkgcmp(pkg1: Tuple[str, str, str], pkg2: Tuple[str, str, str]) -> Optional[int]:
+def pkgcmp(pkg1: tuple[str, str, str], pkg2: tuple[str, str, str]) -> Optional[int]:
     """
     Compare 2 package versions created in pkgsplit format.
 
@@ -291,7 +292,7 @@ def pkgcmp(pkg1: Tuple[str, str, str], pkg2: Tuple[str, str, str]) -> Optional[i
     return vercmp("-".join(pkg1[1:]), "-".join(pkg2[1:]))
 
 
-def _pkgsplit(mypkg: str, eapi: Any = None) -> Optional[Tuple[str, str, str]]:
+def _pkgsplit(mypkg: str, eapi: Any = None) -> Optional[tuple[str, str, str]]:
     """
     @param mypkg: pv
     @return:
@@ -323,7 +324,7 @@ def catpkgsplit(
     mydata: Union[str, "_pkg_str"],
     silent: int = 1,
     eapi: Any = None,
-) -> Optional[Tuple[str, ...]]:
+) -> Optional[tuple[str, ...]]:
     """
     Takes a Category/Package-Version-Rev and returns a list of each.
 
@@ -375,7 +376,7 @@ class _pkg_str(str):
     def __new__(
         cls,
         cpv: str,
-        metadata: Optional[Dict[str, Any]] = None,
+        metadata: Optional[dict[str, Any]] = None,
         settings: Any = None,
         eapi: Any = None,
         repo: Optional[str] = None,
@@ -391,7 +392,7 @@ class _pkg_str(str):
     def __init__(
         self,
         cpv: str,
-        metadata: Optional[Dict[str, Any]] = None,
+        metadata: Optional[dict[str, Any]] = None,
         settings: Any = None,
         eapi: Any = None,
         repo: Optional[str] = None,
@@ -500,7 +501,7 @@ class _pkg_str(str):
 
 def pkgsplit(
     mypkg: str, silent: int = 1, eapi: Any = None
-) -> Optional[Tuple[str, str, str]]:
+) -> Optional[tuple[str, str, str]]:
     """
     @param mypkg: either a pv or cpv
     @return:
@@ -603,7 +604,7 @@ def cpv_sort_key(eapi: Any = None) -> Any:
     return cmp_sort_key(cmp_cpv)
 
 
-def catsplit(mydep: str) -> List[str]:
+def catsplit(mydep: str) -> list[str]:
     return mydep.split("/", 1)
 
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-02  6:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-02  6:31 [gentoo-commits] proj/portage:master commit in: lib/portage/tests/util/futures/asyncio/, lib/portage/util/futures/, lib/portage/, Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox