Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to sort numbers after non-numbers #49

Merged

Conversation

SethMMorton
Copy link
Owner

This will close #48, which requests the ability to put numbers after non-numbers, rather than before which is the default.

This was implemented by changing the string separator that is added between or in front of numbers from an empty string to a sequence of high numeric-valued characters when the new option (ns.NUMAFTER) is requested.

This is in preparation for adding a few new versions of the null
string, one which will be sorted after other strings, and another
pair which will be used when locale is not enabled.
All infrastructure has been added, but no tests have been yet been
inserted to verify that the code is working properly. That will come
in the next commit.
These tests verify that the option puts numbers after non-numbers.
@SethMMorton SethMMorton added this to the Version 5.2.0 milestone Feb 10, 2018
The implementation that was used for the "always last" separator
for NUMAFTER when LOCALE was turned on for non-OSX OSs was buggy.

This new implementation does not rely on string value tricks, but rather
implements a sentinel-based methodology to identify the "always last"
separator and place it last explicitly.
@codecov
Copy link

codecov bot commented Feb 11, 2018

Codecov Report

Merging #49 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #49      +/-   ##
==========================================
+ Coverage   99.63%   99.65%   +0.01%     
==========================================
  Files          10       10              
  Lines         552      574      +22     
==========================================
+ Hits          550      572      +22     
  Misses          2        2
Impacted Files Coverage Δ
natsort/ns_enum.py 100% <100%> (ø) ⬆️
natsort/utils.py 100% <100%> (ø) ⬆️
natsort/compat/locale.py 96.36% <100%> (+1.12%) ⬆️
natsort/natsort.py 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2e47446...4d18c76. Read the comment docs.

@SethMMorton SethMMorton merged commit b8175a1 into master Feb 15, 2018
@SethMMorton SethMMorton deleted the 48-feature-request-natsorted-sort-by-letters-then-numbers branch February 15, 2018 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request natsorted(): Sort by letters, then numbers
1 participant