commit:     23633624dc568ea0d890371fba51689c364fefec
Author:     Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sat Dec  6 23:52:40 2025 +0000
Commit:     Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Sun Dec  7 00:02:00 2025 +0000
URL:        
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=23633624

chore: more typing of sequences and deprecation suppressions in tests

Signed-off-by: Brian Harring <ferringb <AT> gmail.com>

 src/snakeoil/bash.py             | 2 +-
 src/snakeoil/osutils/__init__.py | 7 ++++---
 src/snakeoil/sequences.py        | 3 +--
 tests/test_osutils.py            | 3 ++-
 tests/test_sequences.py          | 2 ++
 5 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/snakeoil/bash.py b/src/snakeoil/bash.py
index 7437f95..f682a8c 100644
--- a/src/snakeoil/bash.py
+++ b/src/snakeoil/bash.py
@@ -189,7 +189,7 @@ def read_dict(
     d = {}
     if not source_isiter:
         filename = bash_source
-        i = iter_read_bash(bash_source, 
allow_inline_comments=allow_inline_comments)
+        i = read_bash(bash_source, allow_inline_comments=allow_inline_comments)
     else:
         if filename is None:
             # XXX what to do?

diff --git a/src/snakeoil/osutils/__init__.py b/src/snakeoil/osutils/__init__.py
index bb7fc68..1628097 100644
--- a/src/snakeoil/osutils/__init__.py
+++ b/src/snakeoil/osutils/__init__.py
@@ -105,6 +105,7 @@ def ensure_dirs(path, gid=-1, uid=-1, mode=0o777, 
minimal=True):
         permissions, False if not.
     """
 
+    join = os.path.join
     try:
         st = os.stat(path)
     except OSError:
@@ -114,7 +115,7 @@ def ensure_dirs(path, gid=-1, uid=-1, mode=0o777, 
minimal=True):
             # if the dir perms would lack +wx, we have to force it
             force_temp_perms = (mode & 0o300) != 0o300
             resets = []
-            apath = normpath(os.path.abspath(path))
+            apath = os.path.normpath(os.path.abspath(path))
             sticky_parent = False
 
             for directory in apath.split(os.path.sep):
@@ -188,7 +189,7 @@ def abssymlink(path):
     if mylink[0] != "/":
         mydir = os.path.dirname(path)
         mylink = mydir + "/" + mylink
-    return normpath(mylink)
+    return os.path.normpath(mylink)
 
 
 def force_symlink(target, link):
@@ -228,7 +229,7 @@ def abspath(path):
         return path
 
 
-@deprecated("snakeoil.osutils.norpath is deprecated.  Us os.path.normpath")
+@deprecated("snakeoil.osutils.normpath is deprecated.  Us os.path.normpath")
 def normpath(mypath: str) -> str:
     """normalize path- //usr/bin becomes /usr/bin, /usr/../bin becomes /bin
 

diff --git a/src/snakeoil/sequences.py b/src/snakeoil/sequences.py
index 92ef4a1..2d31721 100644
--- a/src/snakeoil/sequences.py
+++ b/src/snakeoil/sequences.py
@@ -67,7 +67,6 @@ def unstable_unique(sequence):
             i += 1
         return t[:lasti]
 
-    # blah.  back to original portage.unique_array
     u = []
     for x in sequence:
         if x not in u:
@@ -204,7 +203,7 @@ def predicate_split(
 ): ...
 
 
-def predicate_split(func, stream, /, key=None) -> tuple[list[T], list[T]]:
+def predicate_split(func, stream: Iterable[T], /, key=None) -> tuple[list[T], 
list[T]]:
     """
     Given a stream and a function, split the stream into two sequences based on
     the results of the func for that item

diff --git a/tests/test_osutils.py b/tests/test_osutils.py
index 7cd6162..6718097 100644
--- a/tests/test_osutils.py
+++ b/tests/test_osutils.py
@@ -11,7 +11,7 @@ import pytest
 
 from snakeoil import osutils
 from snakeoil.contexts import Namespace
-from snakeoil.deprecation import suppress_deprecations
+from snakeoil.deprecation import suppress_deprecation_warning, 
suppress_deprecations
 from snakeoil.osutils import listdir_dirs, listdir_files, sizeof_fmt, 
supported_systems
 from snakeoil.osutils.mount import MNT_DETACH, MS_BIND, mount, umount
 
@@ -189,6 +189,7 @@ class TestAbsSymlink:
         assert osutils.abssymlink(linkname) == str(target)
 
 
+@suppress_deprecation_warning()
 class Test_Native_NormPath:
     func = staticmethod(osutils.normpath)
 

diff --git a/tests/test_sequences.py b/tests/test_sequences.py
index f9866ed..0fad4c2 100644
--- a/tests/test_sequences.py
+++ b/tests/test_sequences.py
@@ -5,6 +5,7 @@ from operator import itemgetter
 import pytest
 
 from snakeoil import sequences
+from snakeoil.deprecation import suppress_deprecation_warning
 from snakeoil.sequences import (
     iter_stable_unique,
     split_elements,
@@ -18,6 +19,7 @@ class UnhashableComplex(complex):
         raise TypeError
 
 
+@suppress_deprecation_warning()
 class TestStableUnique:
     def common_check(self, func):
         # silly

Reply via email to