| Branch: | Tag: | Revision:

root / lib / utils / @ 18397489

History | View | Annotate | Download (7.3 kB)

# Date Author Comment
dd27bc21 04/19/2012 09:04 pm Michael Hanselmann

utils.algo: Use str.isdigit instead of regular expression

str.isdigit is about 4x faster than using a regular expression ("\d+").
This is in the inner sorting code so speed matters.

$ python -m timeit -s 'import re; s = re.compile("^\d+$")' \
's.match(""); s.match("Hello World"); s.match("1234")'...

9c709b31 11/16/2011 10:41 am René Nussbaumer

algo: Make a dict from an flat list

This is in preparation to take deeper dict constructs from the command
line. You can feed the optionslist directly constructed of type
"identkeyval" to it and it returns a fully deflated dict.

This is mainly needed for the resource model changes where we have to...

6d0accae 11/04/2011 08:09 am Michael Hanselmann

utils.algo: Add utility to convert sequence to dictionary

Useful for converting list of query fields to a dictionary and to
convert RPC definitions. Includes duplicate detection.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

d60946d9 11/02/2011 05:28 pm René Nussbaumer

utils.algo: Add a function to insert a list into a list

Signed-off-by: René Nussbaumer <>
Reviewed-by: Michael Hanselmann <>

cdf71b12 10/25/2011 05:05 pm Andrea Spadaccini

Add the JoinDisjointDicts function to utils.algo

Add a function that joins two dictionaries, enforcing the constraint
that the two key sets should be disjoint. Also, add unit tests for this

Signed-off-by: Andrea Spadaccini <>...

d5fca545 08/03/2011 06:27 pm Iustin Pop

Fix small typo in docstring

Signed-off-by: Iustin Pop <>
Reviewed-by: Michael Hanselmann <>

0a9a0e5a 05/24/2011 12:37 pm René Nussbaumer

utils.algo: Add InvertDict to invert a dict

Signed-off-by: René Nussbaumer <>
Reviewed-by: Iustin Pop <>

7d4da09e 03/15/2011 02:50 pm Michael Hanselmann

utils: Export NiceSortKey function

The ability to split a string into a list of strings and integers can be
handy elsewhere and is necessary for sorting query results by names.

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>...

7d444d59 01/11/2011 05:32 pm Michael Hanselmann

utils: Move RunningTimeout to utils.algo

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>

4fd029cf 01/10/2011 06:15 pm Michael Hanselmann

utils: Split algorithms into separate file

Signed-off-by: Michael Hanselmann <>
Reviewed-by: Iustin Pop <>