| |
@@ -145,18 +145,13 @@
|
| |
|
| |
def remove_duplicates(func):
|
| |
def wrapper(*args, **kwargs):
|
| |
- rv = func(*args, **kwargs)
|
| |
- if isinstance(rv, list) and len(rv):
|
| |
- rv = list(set(rv))
|
| |
- return rv
|
| |
+ value = func(*args, **kwargs)
|
| |
+ if not isinstance(value, list):
|
| |
+ return value
|
| |
+
|
| |
+ unique = []
|
| |
+ for item in value:
|
| |
+ if item not in unique:
|
| |
+ unique.append(item)
|
| |
+ return unique
|
| |
return wrapper
|
| |
-
|
| |
-
|
| |
- def to_hashable(val):
|
| |
- if isinstance(val, list) or isinstance(val, tuple):
|
| |
- return tuple([to_hashable(v) for v in val])
|
| |
- if isinstance(val, dict):
|
| |
- return tuple([(k, to_hashable(val[k])) for k in sorted(val.keys())])
|
| |
- if isinstance(val, set):
|
| |
- return tuple(sorted(val))
|
| |
- return val
|
| |
just change set to dict.fromkeys