diff options
author | Seth Morton <seth.m.morton@gmail.com> | 2021-10-29 09:33:54 -0700 |
---|---|---|
committer | Seth Morton <seth.m.morton@gmail.com> | 2021-10-29 09:52:53 -0700 |
commit | 68ae5aed1d0591ba510bcb2b6f7e548fd2476bbe (patch) | |
tree | 225ed77b0a55558f59aacad353e3feed46a13c04 /natsort | |
parent | be8d85ee80e2624c2d89bbb72bffe4a9579f0276 (diff) | |
download | natsort-68ae5aed1d0591ba510bcb2b6f7e548fd2476bbe.tar.gz |
Fix other bugs introduced in the shuffle
Diffstat (limited to 'natsort')
-rw-r--r-- | natsort/__main__.py | 19 | ||||
-rw-r--r-- | natsort/natsort.py | 6 | ||||
-rw-r--r-- | natsort/utils.py | 2 |
3 files changed, 22 insertions, 5 deletions
diff --git a/natsort/__main__.py b/natsort/__main__.py index a91e08a..d29ab14 100644 --- a/natsort/__main__.py +++ b/natsort/__main__.py @@ -27,6 +27,25 @@ class TypedArgs(argparse.Namespace): locale: bool entries: List[str] + def __init__( + self, + filter: Optional[List[NumPair]] = None, + reverse_filter: Optional[List[NumPair]] = None, + exclude: Optional[List[Num]] = None, + paths: bool = False, + reverse: bool = False, + ) -> None: + """Used by testing only""" + self.filter = filter + self.reverse_filter = reverse_filter + self.exclude = [] if exclude is None else exclude + self.paths = paths + self.reverse = reverse + self.number_type = "int" + self.signed = False + self.exp = True + self.locale = False + def main(*arguments: str) -> None: """ diff --git a/natsort/natsort.py b/natsort/natsort.py index 2804630..e3a6b95 100644 --- a/natsort/natsort.py +++ b/natsort/natsort.py @@ -25,14 +25,12 @@ from typing import ( import natsort.compat.locale from natsort import utils -from natsort.compat.locale import StrOrBytes -from natsort.ns_enum import NS_DUMB, NSType, ns +from natsort.ns_enum import NSType, NS_DUMB, ns from natsort.utils import ( KeyType, MaybeKeyType, NatsortInType, NatsortOutType, - PathArg, StrBytesNum, StrBytesPathNum, ) @@ -606,7 +604,7 @@ def index_natsorted( """ newkey: KeyType - if key is not None: + if key is None: newkey = itemgetter(1) else: diff --git a/natsort/utils.py b/natsort/utils.py index 38b11b1..df02eac 100644 --- a/natsort/utils.py +++ b/natsort/utils.py @@ -67,7 +67,7 @@ from natsort.compat.locale import ( get_strxfrm, get_thousands_sep, ) -from natsort.ns_enum import NS_DUMB, NSType, ns +from natsort.ns_enum import NSType, NS_DUMB, ns from natsort.unicode_numbers import digits_no_decimals, numeric_no_decimals # |