1
2
3
4 """
5 Useful helpers for adapters.
6
7 @since: 0.4
8 """
9
10 import __builtin__
11
12 if not hasattr(__builtin__, 'set'):
13 from sets import Set as set
14
15
17 """
18 Converts an arbitrary object C{obj} to a list.
19
20 @rtype: L{list}
21 """
22 return list(obj)
23
24
26 """
27 Converts an arbitrary object C{obj} to a dict.
28
29 @rtype: L{dict}
30 """
31 return dict(obj)
32
33
35 """
36 Converts an arbitrary object C{obj} to a set.
37
38 @rtype: L{set}
39 """
40 return set(obj)
41
42
44 """
45 Converts an arbitrary object C{obj} to a tuple.
46
47 @rtype: L{tuple}
48 """
49 return tuple(x)
50
52 """
53 Converts an arbitrary object C{obj} to a string.
54
55 @rtype: L{tuple}
56 @since: 0.5
57 """
58 return str(x)
59