commit: 47d756214d27477d23bdbccca6a95b29d77345a7
Author: Brian Harring <ferringb <AT> gmail <DOT> com>
AuthorDate: Sun Dec 7 21:20:19 2025 +0000
Commit: Brian Harring <ferringb <AT> gmail <DOT> com>
CommitDate: Sun Dec 7 21:25:27 2025 +0000
URL:
https://gitweb.gentoo.org/proj/pkgcore/snakeoil.git/commit/?id=47d75621
WIP
Signed-off-by: Brian Harring <ferringb <AT> gmail.com>
src/snakeoil/bash.py | 2 +-
src/snakeoil/demandload.py | 5 ++++-
src/snakeoil/klass/__init__.py | 9 ++++++---
src/snakeoil/klass/_deprecated.py | 16 ++++++++++++----
src/snakeoil/modules.py | 6 ++++--
src/snakeoil/osutils/__init__.py | 29 +++++++++++++++++------------
src/snakeoil/sequences.py | 9 ++++++---
src/snakeoil/test/eq_hash_inheritance.py | 3 ++-
src/snakeoil/test/mixins.py | 3 ++-
src/snakeoil/test/modules.py | 5 ++++-
src/snakeoil/test/slot_shadowing.py | 2 +-
11 files changed, 59 insertions(+), 30 deletions(-)
diff --git a/src/snakeoil/bash.py b/src/snakeoil/bash.py
index dfa9a2d..a39fd9c 100644
--- a/src/snakeoil/bash.py
+++ b/src/snakeoil/bash.py
@@ -33,7 +33,7 @@ __all__ = (
iter_read_bash = deprecated(
- "snakeoil.bash.iter_read_bash has been renamed to read_bash"
+ "snakeoil.bash.iter_read_bash has been renamed to read_bash",
removal_in=(0, 12, 0)
)(lambda *a, **kw: read_bash(*a, **kw))
diff --git a/src/snakeoil/demandload.py b/src/snakeoil/demandload.py
index af4c4ab..b232e3f 100644
--- a/src/snakeoil/demandload.py
+++ b/src/snakeoil/demandload.py
@@ -8,7 +8,10 @@ from snakeoil._internals import deprecated
from .delayed import regexp
-@deprecated("snakeoil.klass.demand_compile_regexp has moved to
snakeoil.delayed.regexp")
+@deprecated(
+ "snakeoil.klass.demand_compile_regexp has moved to
snakeoil.delayed.regexp",
+ removal_in=(0, 12, 0),
+)
def demand_compile_regexp(
name: str, pattern: str, flags=0, /, scope: dict[str, typing.Any] | None =
None
) -> None:
diff --git a/src/snakeoil/klass/__init__.py b/src/snakeoil/klass/__init__.py
index 250532a..6a2ce99 100644
--- a/src/snakeoil/klass/__init__.py
+++ b/src/snakeoil/klass/__init__.py
@@ -296,7 +296,8 @@ class GenericRichComparison(GenericEquality):
@deprecated(
- "generic_equality metaclass usage is deprecated; inherit from
snakeoil.klass.GenericEquality instead."
+ "generic_equality metaclass usage is deprecated; inherit from
snakeoil.klass.GenericEquality instead.",
+ removal_in=(0, 12, 0),
)
def generic_equality(
name,
@@ -345,7 +346,8 @@ def generic_equality(
@deprecated(
- "snakeoil.klass.chained_getter is deprecated. Use operator.attrgetter
instead."
+ "snakeoil.klass.chained_getter is deprecated. Use operator.attrgetter
instead.",
+ removal_in=(0, 12, 0),
)
class chained_getter(
GenericEquality, metaclass=combine_classes(WeakInstMeta, abc.ABCMeta)
@@ -379,7 +381,8 @@ class chained_getter(
static_attrgetter = deprecated(
- "snakeoil.klass.static_attrgetter is deprecated. Use operator.attrgetter
instead"
+ "snakeoil.klass.static_attrgetter is deprecated. Use operator.attrgetter
instead",
+ removal_in=(0, 13, 0),
)(chained_getter)
diff --git a/src/snakeoil/klass/_deprecated.py
b/src/snakeoil/klass/_deprecated.py
index 9f55625..db68885 100644
--- a/src/snakeoil/klass/_deprecated.py
+++ b/src/snakeoil/klass/_deprecated.py
@@ -22,7 +22,9 @@ def immutable_instance(
return real_type(name, bases, scope)
-@deprecated("Use snakeoil.klass.meta.Immutable* metaclasses instead")
+@deprecated(
+ "Use snakeoil.klass.meta.Immutable* metaclasses instead", removal_in=(0,
12, 0)
+)
class ImmutableInstance:
"""Class that disables surface-level attribute modifications."""
@@ -41,7 +43,9 @@ class ImmutableInstance:
object.__setattr__(self, k, v)
-@deprecated("Use snakeoil.klass.meta.Immutable* metaclasses instead")
+@deprecated(
+ "Use snakeoil.klass.meta.Immutable* metaclasses instead", removal_in=(0,
12, 0)
+)
def inject_immutable_instance(scope: dict[str, typing.Any]):
"""inject immutable __setattr__ and __delattr__ implementations
@@ -85,7 +89,8 @@ def __generic_gt(self, other):
@deprecated(
- "inject_richcmp_methods_from_cmp is deprecated, migrate to
functools.total_ordering instead."
+ "inject_richcmp_methods_from_cmp is deprecated, migrate to
functools.total_ordering instead.",
+ removal_in=(0, 12, 0),
)
def inject_richcmp_methods_from_cmp(scope):
"""
@@ -137,7 +142,10 @@ def inject_richcmp_methods_from_cmp(scope):
scope.setdefault(key, func)
-@deprecated("snakeoil.klass.steal_docs is deprecated; use functools.wraps")
+@deprecated(
+ "snakeoil.klass.steal_docs is deprecated; use functools.wraps",
+ removal_in=(0, 12, 0),
+)
def steal_docs(target, ignore_missing=False, name=None):
"""
decorator to steal __doc__ off of a target class or function
diff --git a/src/snakeoil/modules.py b/src/snakeoil/modules.py
index 7c10122..32076c2 100644
--- a/src/snakeoil/modules.py
+++ b/src/snakeoil/modules.py
@@ -20,7 +20,8 @@ class FailedImport(ImportError):
@deprecated(
- "snakeoil.modules.load_attribute is deprecated. Use
importlib.import_module's package argument"
+ "snakeoil.modules.load_attribute is deprecated. Use
importlib.import_module's package argument",
+ removal_in=(0, 13, 0),
)
def load_attribute(name):
"""load an attribute from a module
@@ -46,7 +47,8 @@ def load_attribute(name):
@deprecated(
- "snakeoil.modules.load_any is deprecated. Use importlib.import_module's
package argument"
+ "snakeoil.modules.load_any is deprecated. Use importlib.import_module's
package argument",
+ removal_in=(0, 13, 0),
)
def load_any(name):
"""
diff --git a/src/snakeoil/osutils/__init__.py b/src/snakeoil/osutils/__init__.py
index 7251b62..646d5dc 100644
--- a/src/snakeoil/osutils/__init__.py
+++ b/src/snakeoil/osutils/__init__.py
@@ -27,9 +27,9 @@ from stat import (
from snakeoil._internals import deprecated
-listdir = deprecated("snakeoil.osutils.listdir is deprecated. Use
os.listdir")(
- lambda *a, **kw: os.listdir(*a, **kw)
-)
+listdir = deprecated(
+ "snakeoil.osutils.listdir is deprecated. Use os.listdir", removal_in=(0,
12, 0)
+)(lambda *a, **kw: os.listdir(*a, **kw))
def supported_systems(*systems):
@@ -176,7 +176,7 @@ def ensure_dirs(path, gid=-1, uid=-1, mode=0o777,
minimal=True):
return True
-@deprecated("snakeoil.osutils.absyymlink is deprecated")
+@deprecated("snakeoil.osutils.absyymlink is deprecated", removal_in=(1, 0, 0))
def abssymlink(path):
"""Return the absolute path of a symlink
@@ -208,7 +208,9 @@ def force_symlink(target, link):
raise
-@deprecated("snakeoil.osutils.abspath is deprecated. Us os.path.abspath")
+@deprecated(
+ "snakeoil.osutils.abspath is deprecated. Us os.path.abspath",
removal_in=(1, 0, 0)
+)
def abspath(path):
"""resolve a path absolutely, including symlink resolving.
@@ -229,7 +231,10 @@ def abspath(path):
return path
-@deprecated("snakeoil.osutils.normpath is deprecated. Us os.path.normpath")
+@deprecated(
+ "snakeoil.osutils.normpath is deprecated. Us os.path.normpath",
+ removal_in=(1, 0, 0),
+)
def normpath(mypath: str) -> str:
"""normalize path- //usr/bin becomes /usr/bin, /usr/../bin becomes /bin
@@ -244,12 +249,12 @@ def normpath(mypath: str) -> str:
# convenience. importing join into a namespace is ugly, pjoin less so
-pjoin = deprecated("snakeoil.osutils.pjoin is deprecated. Use os.path.join")(
- lambda *a, **kw: os.path.join(*a, **kw)
-)
-join = deprecated("snakeoil.osutils.join is deprecated. Use os.path.join")(
- lambda *a, **kw: os.path.join(*a, **kw)
-)
+pjoin = deprecated(
+ "snakeoil.osutils.pjoin is deprecated. Use os.path.join", removal_in=(0,
13, 0)
+)(lambda *a, **kw: os.path.join(*a, **kw))
+join = deprecated(
+ "snakeoil.osutils.join is deprecated. Use os.path.join", removal_in=(0,
13, 0)
+)(lambda *a, **kw: os.path.join(*a, **kw))
def unlink_if_exists(path):
diff --git a/src/snakeoil/sequences.py b/src/snakeoil/sequences.py
index 91cb07d..5355f09 100644
--- a/src/snakeoil/sequences.py
+++ b/src/snakeoil/sequences.py
@@ -33,7 +33,8 @@ H = TypeVar("H", bound=Hashable)
@deprecated(
- """snakeoil.klass.unstable_unique is deprecated. Use set() instead, it
will have superior performance characteristics albeit will allocate more than
this implementationd which sorted the sequence"""
+ """snakeoil.klass.unstable_unique is deprecated. Use set() instead, it
will have superior performance characteristics albeit will allocate more than
this implementationd which sorted the sequence""",
+ removal_in=(1, 0, 0),
)
def unstable_unique(sequence):
"""Given a sequence, return a list of the unique items without preserving
ordering."""
@@ -75,7 +76,8 @@ def unstable_unique(sequence):
@deprecated(
- "snakeoil.sequence.stable_unique is deprecated. Use
snakeoil.sequence.unique_stable but be aware it now requires all items be
hashable"
+ "snakeoil.sequence.stable_unique is deprecated. Use
snakeoil.sequence.unique_stable but be aware it now requires all items be
hashable",
+ removal_in=(0, 13, 0),
)
def stable_unique(iterable: Iterable[T]) -> list[T]:
"""Given a sequence, return a list of the unique items while preserving
ordering.
@@ -88,7 +90,8 @@ def stable_unique(iterable: Iterable[T]) -> list[T]:
@deprecated(
- "snakeoil.sequence.iter_stable_unique is deprecated. Use
snakeoil.sequence.unique_stable but be aware it now requires all items be
hashable"
+ "snakeoil.sequence.iter_stable_unique is deprecated. Use
snakeoil.sequence.unique_stable but be aware it now requires all items be
hashable",
+ removal_in=(0, 12, 0),
)
def iter_stable_unique(iterable: Iterable[T]) -> Iterator[T]:
"""Given a sequence, yield unique items while preserving ordering.
diff --git a/src/snakeoil/test/eq_hash_inheritance.py
b/src/snakeoil/test/eq_hash_inheritance.py
index 66c2966..5f8cc24 100644
--- a/src/snakeoil/test/eq_hash_inheritance.py
+++ b/src/snakeoil/test/eq_hash_inheritance.py
@@ -4,7 +4,8 @@ from snakeoil._internals import deprecated
@deprecated(
- "snakeoil.test.eq_hash_inheritance.Test is a noop. Remove it from your
tests"
+ "snakeoil.test.eq_hash_inheritance.Test is a noop. Remove it from your
tests",
+ removal_in=(0, 12, 0),
)
class Test:
"""Dead set of tests for asserting py2k/py3k compatibility"""
diff --git a/src/snakeoil/test/mixins.py b/src/snakeoil/test/mixins.py
index 99d3b9e..495b485 100644
--- a/src/snakeoil/test/mixins.py
+++ b/src/snakeoil/test/mixins.py
@@ -8,7 +8,8 @@ from snakeoil.compatibility import IGNORED_EXCEPTIONS
@deprecated(
- "snakeoil.test.mixins.PythonNamespaceWalker is deprecated, instead use
snakeoil.python_namespaces.submodules_of"
+ "snakeoil.test.mixins.PythonNamespaceWalker is deprecated, instead use
snakeoil.python_namespaces.submodules_of",
+ removal_in=(0, 12, 0),
)
class PythonNamespaceWalker:
ignore_all_import_failures = False
diff --git a/src/snakeoil/test/modules.py b/src/snakeoil/test/modules.py
index e96f708..902aa61 100644
--- a/src/snakeoil/test/modules.py
+++ b/src/snakeoil/test/modules.py
@@ -2,6 +2,9 @@ __all__ = ("ExportedModules",)
from snakeoil._internals import deprecated
-@deprecated("ExportedModules does nothing. Use
snakeoil.test.code_quality.Modules")
+@deprecated(
+ "ExportedModules does nothing. Use snakeoil.test.code_quality.Modules",
+ removal_in=(0, 12, 0),
+)
class ExportedModules:
pass
diff --git a/src/snakeoil/test/slot_shadowing.py
b/src/snakeoil/test/slot_shadowing.py
index 91aa577..1a8db16 100644
--- a/src/snakeoil/test/slot_shadowing.py
+++ b/src/snakeoil/test/slot_shadowing.py
@@ -111,7 +111,7 @@ class KlassWalker(_classWalker):
yield node
-@deprecated("use snakeoil.code_quality.Slots instead")
+@deprecated("use snakeoil.code_quality.Slots instead", removal_in=(0, 12, 0))
class SlotShadowing(TargetedNamespaceWalker, SubclassWalker):
target_namespace = "snakeoil"
err_if_slots_is_str = True