#246 PR: Allow sorting with custom sorting key

Open skjerns

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 1 files from the diff.

@@ -252,16 +252,20 @@
Loading
252 252
#==============================================================================
253 253
# Sorting
254 254
#==============================================================================
255 -
def sort_against(list1, list2, reverse=False):
255 +
def sort_against(list1, list2, reverse=False, sort_key=None):
256 256
    """
257 257
    Arrange items of list1 in the same order as sorted(list2).
258 258
259 259
    In other words, apply to list1 the permutation which takes list2 
260 260
    to sorted(list2, reverse).
261 261
    """
262 +
    if sort_key is None:
263 +
        key = lambda x: x[0]
264 +
    else:
265 +
        key = lambda x: sort_key(x[0])
262 266
    try:
263 267
        return [item for _, item in 
264 -
                sorted(zip(list2, list1), key=lambda x: x[0], reverse=reverse)]
268 +
                sorted(zip(list2, list1), key=key, reverse=reverse)]
265 269
    except:
266 270
        return list1
267 271

Learn more Showing 8 files with coverage changes found.

Changes in spyder_kernels/utils/dochelpers.py
-101
+101
Loading file...
Changes in spyder_kernels/py3compat.py
-56
+56
Loading file...
Changes in spyder_kernels/customize/utils.py
-2
+2
Loading file...
Changes in spyder_kernels/customize/umr.py
-2
+2
Loading file...
Changes in spyder_kernels/customize/spyderpdb.py
-2
+1
Loading file...
Changes in spyder_kernels/customize/spydercustomize.py
-2
+2
Loading file...
Changes in spyder_kernels/utils/nsview.py
-2
+2
Loading file...
Changes in spyder_kernels/utils/iofuncs.py
-1
+1
Loading file...
Files Coverage
spyder_kernels -6.13% 50.78%
Project Totals (22 files) 50.78%
Loading