Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
synnefo
Commits
903bb385
Commit
903bb385
authored
Jan 11, 2013
by
Kostas Papadimitriou
Browse files
Additional common helper methodt
parent
74f12fd3
Changes
1
Hide whitespace changes
Inline
Side-by-side
snf-common/synnefo/lib/utils.py
View file @
903bb385
...
...
@@ -68,3 +68,21 @@ def merge_time(timetuple):
t1
=
float
(
seconds
)
+
(
float
(
microseconds
)
*
0.000001
)
return
datetime
.
datetime
.
fromtimestamp
(
t1
)
def
case_unique
(
iterable
):
"""
Compare case uniquness across iterable contents. Return diff.
>>> case_compare(['a','b','c'])
[]
>>> case_compaer(['a','A','b','c'])
['A']
"""
icase
=
set
(
map
(
unicode
.
lower
,
iterable
))
same
=
len
(
icase
)
==
len
(
iterable
)
if
not
same
:
return
list
(
set
(
iterable
)
-
set
(
icase
))
return
[]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment