./textproc/py-natsort, Natural sorting for python

[ CVSweb ] [ Homepage ] [ RSS ] [ Required by ] [ Add to tracker ]


Branch: CURRENT, Version: 5.2.0, Package name: py27-natsort-5.2.0, Maintainer: kamelderouiche

When you try to sort a list of strings that contain numbers, the
normal python sort algorithm sorts lexicographically, so you might
not get the results that you expect:

>>> a = ['a2', 'a9', 'a1', 'a4', 'a10']
>>> sorted(a)
['a1', 'a10', 'a2', 'a4', 'a9']

Notice that it has the order ('1', '10', '2') - this is because the
list is being sorted in lexicographical order, which sorts numbers
like you would letters (i.e. 'b', 'ba', 'c').

natsort provides a function natsorted that helps sort lists
"naturally", either as real numbers (i.e. signed/unsigned floats
or ints), or as versions. Using natsorted is simple:

>>> from natsort import natsorted
>>> a = ['a2', 'a9', 'a1', 'a4', 'a10']
>>> natsorted(a)
['a1', 'a2', 'a4', 'a9', 'a10']

natsorted identifies numbers anywhere in a string and sorts them
naturally.


Required to run:
[devel/py-setuptools] [lang/python27]

Required to build:
[pkgtools/cwrappers]

Master sites:

SHA1: 09d7a8f555f008499dbbc336cb99ecee7e623810
RMD160: 344bcd650423328a011749d0a9c4a25e5fd5a743
Filesize: 132.27 KB

Version history: (Expand)


CVS history: (Expand)


   2018-02-20 10:32:31 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-natsort: updated to 5.2.0

v. 5.2.0
Add ns.NUMAFTER to cause numbers to be placed after non-numbers.
Add natcmp function (Python 2 only).
   2017-11-15 15:13:58 by Adam Ciarcinski | Files touched by this commit (2) | Package updated
Log message:
py-natsort: updated to 5.1.1

5.1.1:
* Added additional unicode number support for Python 3.7.
* Added information on how to install and test.
   2017-08-22 09:46:22 by Adam Ciarcinski | Files touched by this commit (2)
Log message:
5.1.0:
- Fixed ``StopIteration`` warning on Python 3.6+.
- All Unicode input is now normalized.
   2017-05-09 13:54:07 by Adam Ciarcinski | Files touched by this commit (4)
Log message:
Changes 5.0.3:
- Improved development infrastructure.
- Migrated documentation to ReadTheDocs.
   2016-11-30 15:38:58 by Thomas Klausner | Files touched by this commit (2)
Log message:
Clean up pkglint. Add some test dependencies, 4 more are not packaged
yet.
   2016-11-30 15:13:48 by Jaromir Dolecek | Files touched by this commit (4)
Log message:
Add py-natsort 5.0.1 - Natural sorting for Python

based on wip version