示例#1
0
def test_versorted():

    a = ['1.9.9a', '1.11', '1.9.9b', '1.11.4', '1.10.1']
    assert versorted(a) == natsorted(a, alg=ns.VERSION)
    assert versorted(a, reverse=True) == versorted(a)[::-1]
    a = [('a', '1.9.9a'), ('a', '1.11'), ('a', '1.9.9b'),
         ('a', '1.11.4'), ('a', '1.10.1')]
    assert versorted(a) == [('a', '1.9.9a'), ('a', '1.9.9b'), ('a', '1.10.1'),
                            ('a', '1.11'), ('a', '1.11.4')]

    # Sorting paths just got easier
    a = ['/p/Folder (10)/file1.1.0.tar.gz',
         '/p/Folder/file1.1.0.tar.gz',
         '/p/Folder (1)/file1.1.0 (1).tar.gz',
         '/p/Folder (1)/file1.1.0.tar.gz']
    assert versorted(a) == ['/p/Folder (1)/file1.1.0 (1).tar.gz',
                            '/p/Folder (1)/file1.1.0.tar.gz',
                            '/p/Folder (10)/file1.1.0.tar.gz',
                            '/p/Folder/file1.1.0.tar.gz']
    assert versorted(a, alg=ns.PATH) == ['/p/Folder/file1.1.0.tar.gz',
                                         '/p/Folder (1)/file1.1.0.tar.gz',
                                         '/p/Folder (1)/file1.1.0 (1).tar.gz',
                                         '/p/Folder (10)/file1.1.0.tar.gz']
示例#2
0
def test_versorted_returns_results_identical_to_natsorted():
    a = ['1.9.9a', '1.11', '1.9.9b', '1.11.4', '1.10.1']
    # versorted is retained for backwards compatibility
    assert versorted(a) == natsorted(a)
示例#3
0
# The grid should be adjusted in grid.py
#grid = ...
# Should the separate classifier be used?
# True | False
separateClassifier = False
# How many features does the cumulative part have?
featureCount = 100
####################

if len(sys.argv) == 2:
    # Wang's 2014 input format
    wang_pathname = sys.argv[1]
    assert os.path.exists(wang_pathname), "wang directory not found"

    # list all files we need to process
    wangfiles = natsort.versorted(glob.glob(os.path.join(wang_pathname, '*')))
    file_fg = 'Wang_foreground'
    fg_pathname = os.path.join(os.getcwd(), file_fg)
    file_bg = 'Wang_background'
    bg_pathname = os.path.join(os.getcwd(), file_bg)
    wang_fg = open(fg_pathname, 'w')
    wang_bg = open(bg_pathname, 'w')
    for wangfile in wangfiles:
        file_name = os.path.split(wangfile)[1]

        if 'f' in file_name:
            # we have a file from the k-NN classification
            continue

        if '-' in file_name:
            # foreground file (label with increasing numbers)
示例#4
0
文件: repo.py 项目: ercpe/gitbrowser
 def tags(self):
     return versorted(self.repo.tags, key=lambda x: x.name, reverse=True)
示例#5
0
def test_versorted_returns_results_identical_to_natsorted_with_VERSION():
    a = ['1.9.9a', '1.11', '1.9.9b', '1.11.4', '1.10.1']
    assert versorted(a) == natsorted(a, alg=ns.VERSION)
示例#6
0
def test_versorted_returns_results_identical_to_natsorted():
    a = ["1.9.9a", "1.11", "1.9.9b", "1.11.4", "1.10.1"]
    # versorted is retained for backwards compatibility
    assert versorted(a) == natsorted(a)
示例#7
0
def test_versorted_returns_results_identical_to_natsorted():
    a = ['1.9.9a', '1.11', '1.9.9b', '1.11.4', '1.10.1']
    # versorted is retained for backwards compatibility
    assert versorted(a) == natsorted(a)
def test_versorted():

    a = ['1.9.9a', '1.11', '1.9.9b', '1.11.4', '1.10.1']
    assert versorted(a) == natsorted(a, number_type=None)