Package pyamf :: Package adapters :: Module util
[hide private]
[frames] | no frames]

Source Code for Module pyamf.adapters.util

 1  # Copyright (c) 2007-2009 The PyAMF Project. 
 2  # See LICENSE for details. 
 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 -def to_list(obj, encoder):
16 """ 17 Converts an arbitrary object C{obj} to a list. 18 19 @rtype: L{list} 20 """ 21 return list(obj)
22
23 -def to_dict(obj, encoder):
24 """ 25 Converts an arbitrary object C{obj} to a dict. 26 27 @rtype: L{dict} 28 """ 29 return dict(obj)
30
31 -def to_set(obj, encoder):
32 """ 33 Converts an arbitrary object C{obj} to a set. 34 35 @rtype: L{set} 36 """ 37 return set(obj)
38
39 -def to_tuple(x, encoder):
40 """ 41 Converts an arbitrary object C{obj} to a tuple. 42 43 @rtype: L{tuple} 44 """ 45 return tuple(x)
46