Natsort algorithm not set to PATH
Closed this issue · 2 comments
The natsort algorithm is not set to natsort.PATH
. This causes issues with sorting files and folders.
For example:
zenodo/
├─rational_dimension.ipynb
├─quasiperiod_svm_learning_curve_dim_4.py
├─quasiperiod_svm_learning_curve_dim_3.py
├─quasiperiod_svm_learning_curve_dim_2.py
├─quasiperiod_svm_hyperparameter_tuning.py
├─quasiperiod_log_svm_learning_curve_dim_10.py
├─quasiperiod_log_svm_learning_curve_dim_3.py
├─quasiperiod_log_svm_learning_curve_dim_2.py
├─quasiperiod_log_svm_hyperparameter_tuning.py
├─a_quasiperiod.m
├─README.txt
└─QUASIPERIOD.ipynb
More info: https://natsort.readthedocs.io/en/master/examples.html#sort-os-generated-paths
Relevant code:
seedir/seedir/folderstructurehelpers.py
Lines 117 to 126 in c4e85c1
I think I was wrong. I close this issue.
One tip for the reader who wants to set the algorithm explicitly: use sort_key=ns.natsort_keygen(alg=ns.PATH)
@J535D165 thanks for sharing this, I was not aware of the potential issues with paths and natsort. Your second comment looks like a great workaround.
The sorting I implemented for seedir only works off of the basename of each item - so it hopefully avoids any sorting issues due to parsing slashes and parent folders. But if there are other instances that would be remedied by adding natsort.PATH
, I would probably be in favor of adding