diff options
author | Seth M Morton <seth.m.morton@gmail.com> | 2018-11-10 13:20:16 -0800 |
---|---|---|
committer | Seth M Morton <seth.m.morton@gmail.com> | 2018-11-10 13:20:16 -0800 |
commit | a298a67c80ad0663a7ef65d5bf9387581aaa2cc0 (patch) | |
tree | 0ff417c97f78b7998e89f0a3b8b15601e2bc76c6 | |
parent | b7711d7159245cf485b211ca9cc773428b28d7f5 (diff) | |
parent | 53576ffa27c28fc89c23a2a777f929788f82bb23 (diff) | |
download | natsort-a298a67c80ad0663a7ef65d5bf9387581aaa2cc0.tar.gz |
Merge branch 'master' of github.com:SethMMorton/natsort
-rw-r--r-- | docs/howitworks.rst | 11 | ||||
-rw-r--r-- | docs/intro.rst | 11 | ||||
-rw-r--r-- | docs/locale_issues.rst | 28 | ||||
-rw-r--r-- | tox.ini | 3 |
4 files changed, 26 insertions, 27 deletions
diff --git a/docs/howitworks.rst b/docs/howitworks.rst index 1138c86..3ecb406 100644 --- a/docs/howitworks.rst +++ b/docs/howitworks.rst @@ -356,7 +356,8 @@ can see why this happens: This isn't very convenient... how do we solve it? We can split the path across the path separators and then sort. A convenient way do to this is -with the `Path.parts`_ method from :mod:`pathlib`: +with the :data:`Path.parts <pathlib.PurePath.parts>` property from +:mod:`pathlib`: .. code-block:: pycon @@ -365,8 +366,9 @@ with the `Path.parts`_ method from :mod:`pathlib`: ['/p/Folder/file.tar.gz', '/p/Folder (1)/file (1).tar.gz', '/p/Folder (1)/file.tar.gz', '/p/Folder (10)/file.tar.gz'] Almost! It seems like there is some funny business going on in the final -filename component as well. We can solve that nicely and quickly with `Path.suffixes`_ -and `Path.stem`_. +filename component as well. We can solve that nicely and quickly with +:data:`Path.suffixes <pathlib.PurePath.suffixes>` and :data:`Path.stem +<pathlib.PurePath.stem>`. .. code-block:: pycon @@ -1097,9 +1099,6 @@ what the rest of the world assumes. .. _The second major special case I encountered was sorting of different types: https://github.com/SethMMorton/natsort/issues/7 .. _A rather unexpected special case I encountered was sorting collections containing NaN: https://github.com/SethMMorton/natsort/issues/27 -.. _Path.parts: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.parts -.. _Path.suffixes: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.suffixes -.. _Path.stem: https://docs.python.org/3/library/pathlib.html#pathlib.PurePath.stem .. _It's hard to compare floating point numbers: http://www.drdobbs.com/cpp/its-hard-to-compare-floating-point-numbe/240149806 .. _caught a bit off guard when the request was initially made: https://github.com/SethMMorton/natsort/issues/14 .. _at the code: https://github.com/SethMMorton/natsort/tree/master/natsort diff --git a/docs/intro.rst b/docs/intro.rst index 8174e10..08e6b9c 100644 --- a/docs/intro.rst +++ b/docs/intro.rst @@ -271,12 +271,11 @@ How do I debug :func:`~natsorted`? How *does* :mod:`natsort` work? If you don't want to read :ref:`howitworks`, here is a quick primer. - :mod:`natsort` provides a `key function <https://docs.python.org/3/howto/sorting.html#key-functions>`_ - that can be passed to `list.sort() <https://docs.python.org/3/library/stdtypes.html#list.sort>`_ - or `sorted() <https://docs.python.org/3/library/functions.html#sorted>`_ in order to - modify the default sorting behavior. This key is generated on-demand with the - key generator :func:`natsort.natsort_keygen`. :func:`natsort.natsorted` is essentially - a wrapper for the following code: + :mod:`natsort` provides a :term:`key function` that can be passed to + :meth:`list.sort` or :func:`sorted` in order to modify the default sorting + behavior. This key is generated on-demand with the key generator + :func:`natsort.natsort_keygen`. :func:`natsort.natsorted` is essentially a + wrapper for the following code: .. code-block:: pycon diff --git a/docs/locale_issues.rst b/docs/locale_issues.rst index 24396f0..88cf3b8 100644 --- a/docs/locale_issues.rst +++ b/docs/locale_issues.rst @@ -31,25 +31,23 @@ Corollary: Do Not Reuse :func:`~natsort.natsort_keygen` After Changing Locale +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ If you change locale, the old function will not work as expected. -The `locale <https://docs.python.org/3.5/library/locale.html>`_ library works -with a global state. When :func:`~natsort.natsort_keygen` is called it does the -best job that it can to make the returned function as static as possible and -independent of the global state, but the -`strxfrm <https://docs.python.org/3.5/library/locale.html#locale.strxfrm>`_ -function must access this global state to work; therefore, if you change -locale and use ``ns.LOCALE`` then you should discard the old key. +The :mod:`locale` library works with a global state. When +:func:`~natsort.natsort_keygen` is called it does the best job that it can to +make the returned function as static as possible and independent of the global +state, but the :func:`locale.strxfrm` function must access this global state to +work; therefore, if you change locale and use ``ns.LOCALE`` then you should +discard the old key. .. note:: If you use `PyICU`_ then you may be able to reuse keys after changing locale. -The `locale <https://docs.python.org/3.5/library/locale.html>`_ Module From the StdLib Has Issues -------------------------------------------------------------------------------------------------- +The :mod:`locale` Module From the StdLib Has Issues +--------------------------------------------------- :mod:`natsort` will use `PyICU`_ for :func:`~natsort.humansorted` or -``ns.LOCALE`` if it is installed. If not, it will fall back on the `locale -<https://docs.python.org/3.5/library/locale.html>`_ library from the Python -stdlib. If you do not have `PyICU`_ installed, please keep the following known -problems and issues in mind. +``ns.LOCALE`` if it is installed. If not, it will fall back on the +:mod:`locale` library from the Python stdlib. If you do not have `PyICU`_ +installed, please keep the following known problems and issues in mind. .. note:: Remember, if you have `PyICU`_ installed you shouldn't need to worry about any of these. @@ -70,8 +68,8 @@ locale): .. _bug_note: -The `locale <https://docs.python.org/3.5/library/locale.html>`_ Module Is Broken on Mac OS X -++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ +The :mod:`locale` Module Is Broken on Mac OS X +++++++++++++++++++++++++++++++++++++++++++++++ It's not Python's fault, but the OS... the locale library for BSD-based systems (of which Mac OS X is one) is broken. See the following links: @@ -39,6 +39,7 @@ deps = flake8-bugbear pep8-naming commands = flake8 +skip_install = true # Build documentation. [testenv:docs] @@ -47,6 +48,7 @@ deps = sphinx_rtd_theme commands = {envpython} setup.py build_sphinx +skip_install = true # Release the code to PyPI [testenv:release] @@ -57,3 +59,4 @@ commands = check-manifest {envpython} setup.py sdist bdist_wheel twine upload dist/* +skip_install = true |