| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
FreeBSD seems to throw an OSError when locale.strxfrm is given 'Å',
which is surprising behavior. Well, maybe not, considering how many bugs
I have found with FreeBSD's implementation of locale over the course of
natsort development.
Anyway, we just ignore any input that causes locale.strxfrm to barf in
our tests.
|
| |
|
|
|
|
|
|
|
| |
The previous code change to make NaN and None ordering consistent made
it so that NANLAST did not put NaN last. Oops.
It also had made it so that NaN wasn't first for NANFIRST. Oops.
|
| |
|
|
|
|
|
|
| |
This will sort the collection as strings before sorting with the natsort
algorithm. This ensures that strings that are different but represent
the same numerical value get sorted independent of input order.
|
|
|
|
|
|
|
| |
Internally, these may be translated to the same value, so they will be
output in the same order they were input, which could lead to suprise.
This commit ensures the order is always consistent.
|
| |
|
|
|
|
|
|
| |
The new version can convert the entire mapping internally, so we use
that if possible. A new wrapper for this new function is introduced to
make the calling code consistent.
|
| |
|
|
|
|
|
| |
This makes what is happening a bit clearer, and plays with mypy much
better.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
This way we don't need to use casts in-code.
|
|
|
|
|
|
|
|
|
| |
...and to some degree private as well.
Previously, the declared hints for natsort were too restrictive.
Generics and protocols are now utilized to make the type hints more
"open" which is more realistic, since more than just basic types can be
sorted.
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The prior algorithm went as follows: Obtain ALL suffixes from the base
component of the filename. Then, starting from the back, keep the
suffixes split until a suffix is encountered that begins with the
regular expression /.\d/. It was assumed that this was intended to be a
floating point number, and not an extension, and thus the splitting
would stop at that point.
Some input has been seen where the filenames are composed nearly entirely
of Word.then.dot.and.then.dot. One entry amongst them contained
Word.then.dot.5.then.dot. This caused this one entry to be treated
differently from the rest of the entries due to the ".5", and the
sorting order was not as expected.
The new algorithm is as follows: Obtain a maxium of two suffixes. Keep
these suffixes until one of them has a length greater than 4 or starts
with the regular expression /.\d/.
This heuristic of course is not bullet-proof, but it will do a better
job on most real-world filenames than the previous algorithm.
|
|
|
|
| |
This reverts commit b85dea24e0db30d2652f6ad46fb2a199e15960d2.
|
|\ |
|
| | |
|
|/ |
|
| |
|
|
|
|
|
|
|
| |
pathlib.Path(".").parts returns an empty tuple. This is unexpected, and
caused a tuple unpacking statement to fail. The solution is to catch the
ValueError from tuple unpacking and manually construct the return
values.
|
| |
|
| |
|
|
|
|
|
| |
For some locales, the unicode cannot be decomposed otherwise the
ordering is incorrect.
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
Originally I did not realize that it was possible to put the keyword
arguments in an overload, so I ended up doing way more overload
definitions than needed.
|
| |
|
|
|
|
| |
This will expose Natsort's types to libraries using it.
|
| |
|
|
|
|
| |
Some over-specified types have been made a bit more general.
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
| |
OK - this *might* have gone a bit overboard, but I have always thought
it was hard to keep track of what most of the utility functions are
returning and this really helps.
|
|
|
|
|
|
| |
The compat and __main__ files have had type hints added. The unicode_*
files all do not need type hints (because all variables are deducable),
same with the ns_enum file.
|
|
|
|
| |
Without adding any annotations, make sure mypy is happy.
|
|
|
|
|
|
|
|
|
| |
I have been wanting to do this for quite some time, but needed the
functionality of the IntEnum for backwards-compatibility. Now that
Python 3.5 is no longer supported, the IntEnum can be used and the
definition of ns is far simpler than it used to be.
This plays nice with mypy also, which is the driving change.
|
|
|
|
| |
Added support for type hinting for consistency with `sorted` from builtints.
This allows Iterables of Custom Objects to be typed.
|
|
|
|
| |
Blacken
|