Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package python-natsort for openSUSE:Factory 
checked in at 2022-09-12 19:08:18
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-natsort (Old)
 and      /work/SRC/openSUSE:Factory/.python-natsort.new.2083 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-natsort"

Mon Sep 12 19:08:18 2022 rev:22 rq:1002721 version:8.2.0

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-natsort/python-natsort.changes    
2022-08-20 20:27:43.473196483 +0200
+++ /work/SRC/openSUSE:Factory/.python-natsort.new.2083/python-natsort.changes  
2022-09-12 19:08:21.282554290 +0200
@@ -1,0 +2,10 @@
+Sat Sep 10 15:30:31 UTC 2022 - Arun Persaud <a...@gmx.de>
+
+- update to version 8.2.0:
+  * Changed
+    + Auto-coerce pathlib.Path objects to str since it is the least
+      astonishing behavior (@Gilthans, issues #152, #153)
+    + Reduce strictness of type hints to avoid over-constraining
+      client code (issues #154, #155)
+
+-------------------------------------------------------------------

Old:
----
  natsort-8.1.0.tar.gz

New:
----
  natsort-8.2.0.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-natsort.spec ++++++
--- /var/tmp/diff_new_pack.oS1bSd/_old  2022-09-12 19:08:21.758555628 +0200
+++ /var/tmp/diff_new_pack.oS1bSd/_new  2022-09-12 19:08:21.762555639 +0200
@@ -19,7 +19,7 @@
 %{?!python_module:%define python_module() python3-%{**}}
 %define skip_python2 1
 Name:           python-natsort
-Version:        8.1.0
+Version:        8.2.0
 Release:        0
 Summary:        Natural sorting in Python
 License:        MIT

++++++ natsort-8.1.0.tar.gz -> natsort-8.2.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/CHANGELOG.md 
new/natsort-8.2.0/CHANGELOG.md
--- old/natsort-8.1.0/CHANGELOG.md      2022-01-31 04:20:37.000000000 +0100
+++ new/natsort-8.2.0/CHANGELOG.md      2022-09-01 23:46:33.000000000 +0200
@@ -1,6 +1,15 @@
 Unreleased
 ---
 
+[8.2.0] - 2022-09-01
+---
+
+### Changed
+- Auto-coerce `pathlib.Path` objects to `str` since it is the least astonishing
+  behavior ([@Gilthans](https://github.com/Gilthans), issues #152, #153)
+- Reduce strictness of type hints to avoid over-constraining client code
+  (issues #154, #155)
+
 [8.1.0] - 2022-01-30
 ---
 
@@ -597,6 +606,7 @@
  - Sorting algorithm to support floats (including exponentials) and basic 
version number support
 
 <!---Comparison links-->
+[8.2.0]: https://github.com/SethMMorton/natsort/compare/8.1.0...8.2.0
 [8.1.0]: https://github.com/SethMMorton/natsort/compare/8.0.2...8.1.0
 [8.0.2]: https://github.com/SethMMorton/natsort/compare/8.0.1...8.0.2
 [8.0.1]: https://github.com/SethMMorton/natsort/compare/8.0.0...8.0.1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/MANIFEST.in 
new/natsort-8.2.0/MANIFEST.in
--- old/natsort-8.1.0/MANIFEST.in       2022-01-31 04:20:37.000000000 +0100
+++ new/natsort-8.2.0/MANIFEST.in       2022-09-01 23:46:33.000000000 +0200
@@ -2,6 +2,7 @@
 include CHANGELOG.md
 include tox.ini
 include RELEASING.md
+recursive-include mypy_stubs *.pyi
 graft dev
 graft docs
 graft natsort
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/PKG-INFO new/natsort-8.2.0/PKG-INFO
--- old/natsort-8.1.0/PKG-INFO  2022-01-31 04:20:39.787069300 +0100
+++ new/natsort-8.2.0/PKG-INFO  2022-09-01 23:46:35.793572200 +0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: natsort
-Version: 8.1.0
+Version: 8.2.0
 Summary: Simple yet flexible natural sorting in Python.
 Home-page: https://github.com/SethMMorton/natsort
 Author: Seth M. Morton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/docs/conf.py 
new/natsort-8.2.0/docs/conf.py
--- old/natsort-8.1.0/docs/conf.py      2022-01-31 04:20:37.000000000 +0100
+++ new/natsort-8.2.0/docs/conf.py      2022-09-01 23:46:33.000000000 +0200
@@ -59,7 +59,7 @@
 # built documents.
 #
 # The full version, including alpha/beta/rc tags.
-release = "8.1.0"
+release = "8.2.0"
 # The short X.Y version.
 version = ".".join(release.split(".")[0:2])
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/mypy_stubs/icu.pyi 
new/natsort-8.2.0/mypy_stubs/icu.pyi
--- old/natsort-8.1.0/mypy_stubs/icu.pyi        1970-01-01 01:00:00.000000000 
+0100
+++ new/natsort-8.2.0/mypy_stubs/icu.pyi        2022-09-01 23:46:33.000000000 
+0200
@@ -0,0 +1,24 @@
+from typing import overload
+
+@overload
+def Locale() -> str: ...
+@overload
+def Locale(x: str) -> str: ...
+
+class UCollAttribute:
+    NUMERIC_COLLATION: int
+
+class UCollAttributeValue:
+    ON: int
+
+class DecimalFormatSymbols:
+    kGroupingSeparatorSymbol: int
+    kDecimalSeparatorSymbol: int
+    def __init__(self, locale: str) -> None: ...
+    def getSymbol(self, symbol: int) -> str: ...
+
+class Collator:
+    @classmethod
+    def createInstance(cls, locale: str) -> Collator: ...
+    def getSortKey(self, source: str) -> bytes: ...
+    def setAttribute(self, attr: int, value: int) -> None: ...
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/natsort/__init__.py 
new/natsort-8.2.0/natsort/__init__.py
--- old/natsort-8.1.0/natsort/__init__.py       2022-01-31 04:20:37.000000000 
+0100
+++ new/natsort-8.2.0/natsort/__init__.py       2022-09-01 23:46:33.000000000 
+0200
@@ -23,7 +23,7 @@
 from natsort.ns_enum import NSType, ns
 from natsort.utils import KeyType, NatsortInType, NatsortOutType, 
chain_functions
 
-__version__ = "8.1.0"
+__version__ = "8.2.0"
 
 __all__ = [
     "natsort_key",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/natsort/compat/locale.py 
new/natsort-8.2.0/natsort/compat/locale.py
--- old/natsort-8.1.0/natsort/compat/locale.py  2022-01-31 04:20:37.000000000 
+0100
+++ new/natsort-8.2.0/natsort/compat/locale.py  2022-09-01 23:46:33.000000000 
+0200
@@ -38,21 +38,21 @@
 
     # If using icu, get the locale from the current global locale,
     def get_icu_locale() -> str:
-        try:
-            return cast(str, icu.Locale(".".join(getlocale())))
-        except TypeError:  # pragma: no cover
-            return cast(str, icu.Locale())
+        language_code, encoding = getlocale()
+        if language_code is None or encoding is None:  # pragma: no cover
+            return icu.Locale()
+        return icu.Locale(f"{language_code}.{encoding}")
 
     def get_strxfrm() -> TrxfmFunc:
-        return cast(TrxfmFunc, 
icu.Collator.createInstance(get_icu_locale()).getSortKey)
+        return icu.Collator.createInstance(get_icu_locale()).getSortKey
 
     def get_thousands_sep() -> str:
         sep = icu.DecimalFormatSymbols.kGroupingSeparatorSymbol
-        return cast(str, 
icu.DecimalFormatSymbols(get_icu_locale()).getSymbol(sep))
+        return icu.DecimalFormatSymbols(get_icu_locale()).getSymbol(sep)
 
     def get_decimal_point() -> str:
         sep = icu.DecimalFormatSymbols.kDecimalSeparatorSymbol
-        return cast(str, 
icu.DecimalFormatSymbols(get_icu_locale()).getSymbol(sep))
+        return icu.DecimalFormatSymbols(get_icu_locale()).getSymbol(sep)
 
 except ImportError:
     import locale
@@ -75,10 +75,11 @@
         # characters are incorrectly blank. Here is a lookup table of the
         # corrections I am aware of.
         if dumb_sort():
-            try:
-                loc = ".".join(locale.getlocale())
-            except TypeError:  # No locale loaded, default to ','
+            language_code, encoding = locale.getlocale()
+            if language_code is None or encoding is None:
+                # No locale loaded, default to ','
                 return ","
+            loc = f"{language_code}.{encoding}"
             return {
                 "de_DE.ISO8859-15": ".",
                 "es_ES.ISO8859-1": ".",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/natsort/natsort.py 
new/natsort-8.2.0/natsort/natsort.py
--- old/natsort-8.1.0/natsort/natsort.py        2022-01-31 04:20:37.000000000 
+0100
+++ new/natsort-8.2.0/natsort/natsort.py        2022-09-01 23:46:33.000000000 
+0200
@@ -18,42 +18,27 @@
     Optional,
     Sequence,
     Tuple,
-    Union,
+    TypeVar,
     cast,
-    overload,
 )
 
 import natsort.compat.locale
 from natsort import utils
 from natsort.ns_enum import NSType, NS_DUMB, ns
-from natsort.utils import (
-    KeyType,
-    MaybeKeyType,
-    NatsortInType,
-    NatsortOutType,
-    StrBytesNum,
-    StrBytesPathNum,
-)
+from natsort.utils import NatsortInType, NatsortOutType
 
 # Common input and output types
-Iter_ns = Iterable[NatsortInType]
-Iter_any = Iterable[Any]
-List_ns = List[NatsortInType]
-List_any = List[Any]
-List_int = List[int]
+T = TypeVar("T")
+NatsortInTypeT = TypeVar("NatsortInTypeT", bound=NatsortInType)
 
 # The type that natsort_key returns
 NatsortKeyType = Callable[[NatsortInType], NatsortOutType]
 
 # Types for os_sorted
-OSSortInType = Iterable[Optional[StrBytesPathNum]]
-OSSortOutType = Tuple[Union[StrBytesNum, Tuple[StrBytesNum, ...]], ...]
-OSSortKeyType = Callable[[Optional[StrBytesPathNum]], OSSortOutType]
-Iter_path = Iterable[Optional[StrBytesPathNum]]
-List_path = List[StrBytesPathNum]
+OSSortKeyType = Callable[[NatsortInType], NatsortOutType]
 
 
-def decoder(encoding: str) -> Callable[[NatsortInType], NatsortInType]:
+def decoder(encoding: str) -> Callable[[Any], Any]:
     """
     Return a function that can be used to decode bytes to unicode.
 
@@ -94,7 +79,7 @@
     return partial(utils.do_decoding, encoding=encoding)
 
 
-def as_ascii(s: NatsortInType) -> NatsortInType:
+def as_ascii(s: Any) -> Any:
     """
     Function to decode an input with the ASCII codec, or return as-is.
 
@@ -117,7 +102,7 @@
     return utils.do_decoding(s, "ascii")
 
 
-def as_utf8(s: NatsortInType) -> NatsortInType:
+def as_utf8(s: Any) -> Any:
     """
     Function to decode an input with the UTF-8 codec, or return as-is.
 
@@ -141,8 +126,8 @@
 
 
 def natsort_keygen(
-    key: MaybeKeyType = None, alg: NSType = ns.DEFAULT
-) -> NatsortKeyType:
+    key: Optional[Callable[[Any], NatsortInType]] = None, alg: NSType = 
ns.DEFAULT
+) -> Callable[[Any], NatsortOutType]:
     """
     Generate a key to sort strings and numbers naturally.
 
@@ -252,26 +237,12 @@
 """
 
 
-@overload
-def natsorted(
-    seq: Iter_ns, key: None = None, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_ns:
-    ...
-
-
-@overload
 def natsorted(
-    seq: Iter_any, key: KeyType, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_any:
-    ...
-
-
-def natsorted(
-    seq: Iter_any,
-    key: MaybeKeyType = None,
+    seq: Iterable[T],
+    key: Optional[Callable[[T], NatsortInType]] = None,
     reverse: bool = False,
     alg: NSType = ns.DEFAULT,
-) -> List_any:
+) -> List[T]:
     """
     Sorts an iterable naturally.
 
@@ -319,26 +290,12 @@
     return sorted(seq, reverse=reverse, key=natsort_keygen(key, alg))
 
 
-@overload
-def humansorted(
-    seq: Iter_ns, key: None = None, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_ns:
-    ...
-
-
-@overload
-def humansorted(
-    seq: Iter_any, key: KeyType, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_any:
-    ...
-
-
 def humansorted(
-    seq: Iter_any,
-    key: MaybeKeyType = None,
+    seq: Iterable[T],
+    key: Optional[Callable[[T], NatsortInType]] = None,
     reverse: bool = False,
     alg: NSType = ns.DEFAULT,
-) -> List_any:
+) -> List[T]:
     """
     Convenience function to properly sort non-numeric characters.
 
@@ -390,26 +347,12 @@
     return natsorted(seq, key, reverse, alg | ns.LOCALE)
 
 
-@overload
-def realsorted(
-    seq: Iter_ns, key: None = None, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_ns:
-    ...
-
-
-@overload
 def realsorted(
-    seq: Iter_any, key: KeyType, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_any:
-    ...
-
-
-def realsorted(
-    seq: Iter_any,
-    key: MaybeKeyType = None,
+    seq: Iterable[T],
+    key: Optional[Callable[[T], NatsortInType]] = None,
     reverse: bool = False,
     alg: NSType = ns.DEFAULT,
-) -> List_any:
+) -> List[T]:
     """
     Convenience function to properly sort signed floats.
 
@@ -462,26 +405,12 @@
     return natsorted(seq, key, reverse, alg | ns.REAL)
 
 
-@overload
-def index_natsorted(
-    seq: Iter_ns, key: None = None, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_int:
-    ...
-
-
-@overload
 def index_natsorted(
-    seq: Iter_any, key: KeyType, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_int:
-    ...
-
-
-def index_natsorted(
-    seq: Iter_any,
-    key: MaybeKeyType = None,
+    seq: Iterable[T],
+    key: Optional[Callable[[T], NatsortInType]] = None,
     reverse: bool = False,
     alg: NSType = ns.DEFAULT,
-) -> List_int:
+) -> List[int]:
     """
     Determine the list of the indexes used to sort the input sequence.
 
@@ -537,13 +466,13 @@
         ['baz', 'foo', 'bar']
 
     """
-    newkey: KeyType
+    newkey: Callable[[Tuple[int, T]], NatsortInType]
     if key is None:
         newkey = itemgetter(1)
     else:
 
-        def newkey(x: Any) -> NatsortInType:
-            return cast(KeyType, key)(itemgetter(1)(x))
+        def newkey(x: Tuple[int, T]) -> NatsortInType:
+            return cast(Callable[[T], NatsortInType], key)(itemgetter(1)(x))
 
     # Pair the index and sequence together, then sort by element
     index_seq_pair = [(x, y) for x, y in enumerate(seq)]
@@ -551,26 +480,12 @@
     return [x for x, _ in index_seq_pair]
 
 
-@overload
-def index_humansorted(
-    seq: Iter_ns, key: None = None, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_int:
-    ...
-
-
-@overload
 def index_humansorted(
-    seq: Iter_any, key: KeyType, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_int:
-    ...
-
-
-def index_humansorted(
-    seq: Iter_any,
-    key: MaybeKeyType = None,
+    seq: Iterable[T],
+    key: Optional[Callable[[T], NatsortInType]] = None,
     reverse: bool = False,
     alg: NSType = ns.DEFAULT,
-) -> List_int:
+) -> List[int]:
     """
     This is a wrapper around ``index_natsorted(seq, alg=ns.LOCALE)``.
 
@@ -619,26 +534,12 @@
     return index_natsorted(seq, key, reverse, alg | ns.LOCALE)
 
 
-@overload
 def index_realsorted(
-    seq: Iter_ns, key: None = None, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_int:
-    ...
-
-
-@overload
-def index_realsorted(
-    seq: Iter_any, key: KeyType, reverse: bool = False, alg: NSType = 
ns.DEFAULT
-) -> List_int:
-    ...
-
-
-def index_realsorted(
-    seq: Iter_any,
-    key: MaybeKeyType = None,
+    seq: Iterable[T],
+    key: Optional[Callable[[T], NatsortInType]] = None,
     reverse: bool = False,
     alg: NSType = ns.DEFAULT,
-) -> List_int:
+) -> List[int]:
     """
     This is a wrapper around ``index_natsorted(seq, alg=ns.REAL)``.
 
@@ -683,10 +584,9 @@
     return index_natsorted(seq, key, reverse, alg | ns.REAL)
 
 
-# noinspection PyShadowingBuiltins,PyUnresolvedReferences
 def order_by_index(
     seq: Sequence[Any], index: Iterable[int], iter: bool = False
-) -> Iter_any:
+) -> Iterable[Any]:
     """
     Order a given sequence by an index sequence.
 
@@ -764,7 +664,9 @@
     return utils.regex_chooser(alg).pattern[1:-1]
 
 
-def _split_apply(v: Any, key: MaybeKeyType = None) -> Iterator[str]:
+def _split_apply(
+    v: Any, key: Optional[Callable[[T], NatsortInType]] = None
+) -> Iterator[str]:
     if key is not None:
         v = key(v)
     return utils.path_splitter(str(v))
@@ -781,9 +683,12 @@
     _windows_sort_cmp.restype = wintypes.INT
     _winsort_key = cmp_to_key(_windows_sort_cmp)
 
-    def os_sort_keygen(key: MaybeKeyType = None) -> OSSortKeyType:
+    def os_sort_keygen(
+        key: Optional[Callable[[Any], NatsortInType]] = None
+    ) -> Callable[[Any], NatsortOutType]:
         return cast(
-            OSSortKeyType, lambda x: tuple(map(_winsort_key, _split_apply(x, 
key)))
+            Callable[[Any], NatsortOutType],
+            lambda x: tuple(map(_winsort_key, _split_apply(x, key))),
         )
 
 else:
@@ -802,15 +707,16 @@
 
     except ImportError:
         # No ICU installed
-        def os_sort_keygen(key: MaybeKeyType = None) -> OSSortKeyType:
-            return cast(
-                OSSortKeyType,
-                natsort_keygen(key=key, alg=ns.LOCALE | ns.PATH | 
ns.IGNORECASE),
-            )
+        def os_sort_keygen(
+            key: Optional[Callable[[Any], NatsortInType]] = None
+        ) -> Callable[[Any], NatsortOutType]:
+            return natsort_keygen(key=key, alg=ns.LOCALE | ns.PATH | 
ns.IGNORECASE)
 
     else:
         # ICU installed
-        def os_sort_keygen(key: MaybeKeyType = None) -> OSSortKeyType:
+        def os_sort_keygen(
+            key: Optional[Callable[[Any], NatsortInType]] = None
+        ) -> Callable[[Any], NatsortOutType]:
             loc = natsort.compat.locale.get_icu_locale()
             collator = icu.Collator.createInstance(loc)
             collator.setAttribute(
@@ -857,19 +763,11 @@
 """
 
 
-@overload
-def os_sorted(seq: Iter_path, key: None = None, reverse: bool = False) -> 
List_path:
-    ...
-
-
-@overload
-def os_sorted(seq: Iter_any, key: KeyType, reverse: bool = False) -> List_any:
-    ...
-
-
 def os_sorted(
-    seq: Iter_any, key: MaybeKeyType = None, reverse: bool = False
-) -> List_any:
+    seq: Iterable[T],
+    key: Optional[Callable[[T], NatsortInType]] = None,
+    reverse: bool = False,
+) -> List[T]:
     """
     Sort elements in the same order as your operating system's file browser
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/natsort/utils.py 
new/natsort-8.2.0/natsort/utils.py
--- old/natsort-8.1.0/natsort/utils.py  2022-01-31 04:20:37.000000000 +0100
+++ new/natsort-8.2.0/natsort/utils.py  2022-09-01 23:46:33.000000000 +0200
@@ -53,6 +53,7 @@
     Match,
     Optional,
     Pattern,
+    TYPE_CHECKING,
     Tuple,
     Union,
     cast,
@@ -70,9 +71,28 @@
 from natsort.ns_enum import NSType, NS_DUMB, ns
 from natsort.unicode_numbers import digits_no_decimals, numeric_no_decimals
 
+if TYPE_CHECKING:
+    from typing_extensions import Protocol
+else:
+    Protocol = object
+
 #
 # Pre-define a slew of aggregate types which makes the type hinting below 
easier
 #
+
+
+class SupportsDunderLT(Protocol):
+    def __lt__(self, __other: Any) -> bool:
+        ...
+
+
+class SupportsDunderGT(Protocol):
+    def __gt__(self, __other: Any) -> bool:
+        ...
+
+
+Sortable = Union[SupportsDunderLT, SupportsDunderGT]
+
 StrToStr = Callable[[str], str]
 AnyCall = Callable[[Any], Any]
 
@@ -83,45 +103,33 @@
 BytesTransformer = Callable[[bytes], BytesTransform]
 
 # For the number transform factory
-NumType = Union[float, int]
-MaybeNumType = Optional[NumType]
-NumTuple = Tuple[StrOrBytes, NumType]
-NestedNumTuple = Tuple[NumTuple]
-StrNumTuple = Tuple[Tuple[str], NumTuple]
-NestedStrNumTuple = Tuple[StrNumTuple]
-MaybeNumTransform = Union[NumTuple, NestedNumTuple, StrNumTuple, 
NestedStrNumTuple]
-MaybeNumTransformer = Callable[[MaybeNumType], MaybeNumTransform]
+BasicTuple = Tuple[Any, ...]
+NestedAnyTuple = Tuple[BasicTuple, ...]
+AnyTuple = Union[BasicTuple, NestedAnyTuple]
+NumTransform = AnyTuple
+NumTransformer = Callable[[Any], NumTransform]
 
 # For the string component transform factory
 StrBytesNum = Union[str, bytes, float, int]
 StrTransformer = Callable[[str], StrBytesNum]
 
 # For the final data transform factory
-TwoBlankTuple = Tuple[Tuple[()], Tuple[()]]
-TupleOfAny = Tuple[Any, ...]
-TupleOfStrAnyPair = Tuple[Tuple[str], TupleOfAny]
-FinalTransform = Union[TwoBlankTuple, TupleOfAny, TupleOfStrAnyPair]
+FinalTransform = AnyTuple
 FinalTransformer = Callable[[Iterable[Any], str], FinalTransform]
 
-# For the string parsing factory
-StrSplitter = Callable[[str], Iterable[str]]
-StrParser = Callable[[str], FinalTransform]
-
-# For the path splitter
 PathArg = Union[str, PurePath]
 MatchFn = Callable[[str], Optional[Match]]
 
+# For the string parsing factory
+StrSplitter = Callable[[str], Iterable[str]]
+StrParser = Callable[[PathArg], FinalTransform]
+
 # For the path parsing factory
 PathSplitter = Callable[[PathArg], Tuple[FinalTransform, ...]]
 
 # For the natsort key
-StrBytesPathNum = Union[str, bytes, float, int, PurePath]
-NatsortInType = Union[
-    Optional[StrBytesPathNum], Iterable[Union[Optional[StrBytesPathNum], 
Iterable[Any]]]
-]
-NatsortOutType = Tuple[
-    Union[StrBytesNum, Tuple[Union[StrBytesNum, Tuple[Any, ...]], ...]], ...
-]
+NatsortInType = Optional[Sortable]
+NatsortOutType = Tuple[Sortable, ...]
 KeyType = Callable[[Any], NatsortInType]
 MaybeKeyType = Optional[KeyType]
 
@@ -260,7 +268,7 @@
     key: None,
     string_func: Union[StrParser, PathSplitter],
     bytes_func: BytesTransformer,
-    num_func: MaybeNumTransformer,
+    num_func: NumTransformer,
 ) -> NatsortOutType:
     ...
 
@@ -271,7 +279,7 @@
     key: KeyType,
     string_func: Union[StrParser, PathSplitter],
     bytes_func: BytesTransformer,
-    num_func: MaybeNumTransformer,
+    num_func: NumTransformer,
 ) -> NatsortOutType:
     ...
 
@@ -281,7 +289,7 @@
     key: MaybeKeyType,
     string_func: Union[StrParser, PathSplitter],
     bytes_func: BytesTransformer,
-    num_func: MaybeNumTransformer,
+    num_func: NumTransformer,
 ) -> NatsortOutType:
     """
     Key to sort strings and numbers naturally.
@@ -348,7 +356,7 @@
 
         # If that failed, it must be a number.
         except TypeError:
-            return num_func(cast(NumType, val))
+            return num_func(val)
 
 
 def parse_bytes_factory(alg: NSType) -> BytesTransformer:
@@ -386,7 +394,7 @@
 
 def parse_number_or_none_factory(
     alg: NSType, sep: StrOrBytes, pre_sep: str
-) -> MaybeNumTransformer:
+) -> NumTransformer:
     """
     Create a function that will format a number (or None) into a tuple.
 
@@ -418,8 +426,8 @@
     nan_replace = float("+inf") if alg & ns.NANLAST else float("-inf")
 
     def func(
-        val: MaybeNumType, _nan_replace: float = nan_replace, _sep: StrOrBytes 
= sep
-    ) -> NumTuple:
+        val: Any, _nan_replace: float = nan_replace, _sep: StrOrBytes = sep
+    ) -> BasicTuple:
         """Given a number, place it in a tuple with a leading null string."""
         return _sep, (_nan_replace if val != val or val is None else val)
 
@@ -493,7 +501,11 @@
     normalize_input = _normalize_input_factory(alg)
     compose_input = _compose_input_factory(alg) if alg & ns.LOCALEALPHA else 
_no_op
 
-    def func(x: str) -> FinalTransform:
+    def func(x: PathArg) -> FinalTransform:
+        if isinstance(x, PurePath):
+            # While paths are technically not strings, it is natural for them
+            # to be treated the same.
+            x = str(x)
         # Apply string input transformation function and return to x.
         # Original function is usually a no-op, but some algorithms require it
         # to also be the transformation function.
@@ -725,7 +737,7 @@
     """
     if alg & ns.UNGROUPLETTERS and alg & ns.LOCALEALPHA:
         swap = alg & NS_DUMB and alg & ns.LOWERCASEFIRST
-        transform = cast(StrToStr, methodcaller("swapcase")) if swap else 
_no_op
+        transform = cast(StrToStr, methodcaller("swapcase") if swap else 
_no_op)
 
         def func(
             split_val: Iterable[NatsortInType],
@@ -831,11 +843,11 @@
 
 
 @overload
-def do_decoding(s: NatsortInType, encoding: str) -> NatsortInType:
+def do_decoding(s: Any, encoding: str) -> Any:
     ...
 
 
-def do_decoding(s: NatsortInType, encoding: str) -> NatsortInType:
+def do_decoding(s: Any, encoding: str) -> Any:
     """
     Helper to decode a *bytes* object, or return the object as-is.
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/natsort.egg-info/PKG-INFO 
new/natsort-8.2.0/natsort.egg-info/PKG-INFO
--- old/natsort-8.1.0/natsort.egg-info/PKG-INFO 2022-01-31 04:20:39.000000000 
+0100
+++ new/natsort-8.2.0/natsort.egg-info/PKG-INFO 2022-09-01 23:46:35.000000000 
+0200
@@ -1,6 +1,6 @@
 Metadata-Version: 2.1
 Name: natsort
-Version: 8.1.0
+Version: 8.2.0
 Summary: Simple yet flexible natural sorting in Python.
 Home-page: https://github.com/SethMMorton/natsort
 Author: Seth M. Morton
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/natsort.egg-info/SOURCES.txt 
new/natsort-8.2.0/natsort.egg-info/SOURCES.txt
--- old/natsort-8.1.0/natsort.egg-info/SOURCES.txt      2022-01-31 
04:20:39.000000000 +0100
+++ new/natsort-8.2.0/natsort.egg-info/SOURCES.txt      2022-09-01 
23:46:35.000000000 +0200
@@ -21,6 +21,7 @@
 docs/requirements.txt
 docs/shell.rst
 docs/special_cases_everywhere.jpg
+mypy_stubs/icu.pyi
 natsort/__init__.py
 natsort/__main__.py
 natsort/natsort.py
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/setup.cfg new/natsort-8.2.0/setup.cfg
--- old/natsort-8.1.0/setup.cfg 2022-01-31 04:20:39.787069300 +0100
+++ new/natsort-8.2.0/setup.cfg 2022-09-01 23:46:35.793572200 +0200
@@ -1,5 +1,5 @@
 [bumpversion]
-current_version = 8.1.0
+current_version = 8.2.0
 commit = True
 tag = True
 tag_name = {new_version}
@@ -64,9 +64,7 @@
        .venv
 
 [mypy]
-
-[mypy-icu]
-ignore_missing_imports = True
+mypy_path = mypy_stubs
 
 [egg_info]
 tag_build = 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/setup.py new/natsort-8.2.0/setup.py
--- old/natsort-8.1.0/setup.py  2022-01-31 04:20:37.000000000 +0100
+++ new/natsort-8.2.0/setup.py  2022-09-01 23:46:33.000000000 +0200
@@ -4,7 +4,7 @@
 
 setup(
     name="natsort",
-    version="8.1.0",
+    version="8.2.0",
     packages=find_packages(),
     entry_points={"console_scripts": ["natsort = natsort.__main__:main"]},
     python_requires=">=3.6",
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/tests/test_natsorted.py 
new/natsort-8.2.0/tests/test_natsorted.py
--- old/natsort-8.1.0/tests/test_natsorted.py   2022-01-31 04:20:37.000000000 
+0100
+++ new/natsort-8.2.0/tests/test_natsorted.py   2022-09-01 23:46:33.000000000 
+0200
@@ -5,6 +5,7 @@
 """
 
 from operator import itemgetter
+from pathlib import PurePosixPath
 from typing import List, Tuple, Union
 
 import pytest
@@ -84,6 +85,15 @@
     assert natsorted(given) == expected
 
 
+def test_natsorted_can_sorts_paths_same_as_strings() -> None:
+    paths = [
+        PurePosixPath("a/1/something"),
+        PurePosixPath("a/2/something"),
+        PurePosixPath("a/10/something"),
+    ]
+    assert [str(p) for p in natsorted(paths)] == natsorted([str(p) for p in 
paths])
+
+
 @pytest.mark.parametrize(
     "alg, expected",
     [
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/tests/test_os_sorted.py 
new/natsort-8.2.0/tests/test_os_sorted.py
--- old/natsort-8.1.0/tests/test_os_sorted.py   2022-01-31 04:20:37.000000000 
+0100
+++ new/natsort-8.2.0/tests/test_os_sorted.py   2022-09-01 23:46:33.000000000 
+0200
@@ -3,7 +3,6 @@
 Testing for the OS sorting
 """
 import platform
-from typing import cast
 
 import natsort
 import pytest
@@ -44,7 +43,7 @@
 def test_os_sorted_key() -> None:
     given = ["foo0", "foo2", "goo1"]
     expected = ["foo0", "goo1", "foo2"]
-    result = natsort.os_sorted(given, key=lambda x: cast(str, x).replace("g", 
"f"))
+    result = natsort.os_sorted(given, key=lambda x: x.replace("g", "f"))
     assert result == expected
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/tests/test_parse_number_function.py 
new/natsort-8.2.0/tests/test_parse_number_function.py
--- old/natsort-8.1.0/tests/test_parse_number_function.py       2022-01-31 
04:20:37.000000000 +0100
+++ new/natsort-8.2.0/tests/test_parse_number_function.py       2022-09-01 
23:46:33.000000000 +0200
@@ -7,7 +7,7 @@
 from hypothesis import given
 from hypothesis.strategies import floats, integers
 from natsort.ns_enum import NSType, ns
-from natsort.utils import MaybeNumTransformer, parse_number_or_none_factory
+from natsort.utils import NumTransformer, parse_number_or_none_factory
 
 
 @pytest.mark.usefixtures("with_locale_en_us")
@@ -22,7 +22,7 @@
 )
 @given(x=floats(allow_nan=False) | integers())
 def test_parse_number_factory_makes_function_that_returns_tuple(
-    x: Union[float, int], alg: NSType, example_func: MaybeNumTransformer
+    x: Union[float, int], alg: NSType, example_func: NumTransformer
 ) -> None:
     parse_number_func = parse_number_or_none_factory(alg, "", "xx")
     assert parse_number_func(x) == example_func(x)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/natsort-8.1.0/tox.ini new/natsort-8.2.0/tox.ini
--- old/natsort-8.1.0/tox.ini   2022-01-31 04:20:37.000000000 +0100
+++ new/natsort-8.2.0/tox.ini   2022-09-01 23:46:33.000000000 +0200
@@ -60,6 +60,7 @@
     pytest
     pytest-mock
     fastnumbers
+    typing_extensions
 commands =
     mypy --strict natsort tests
 skip_install = true

Reply via email to