@@ -19,7 +19,7 @@ def dive(obj, required=False):
19
19
result ['options' ] = {}
20
20
if not 'properties' in obj :
21
21
raise AnsibleFilterError ('missing properties key' )
22
- for propkey , propval in obj ['properties' ]. iteritems ( ):
22
+ for propkey , propval in iteritems ( obj ['properties' ]):
23
23
required = bool ('required' in obj and propkey in obj ['required' ])
24
24
result ['options' ][propkey ] = dive (propval , required )
25
25
elif obj ['type' ] == 'array' :
@@ -28,7 +28,7 @@ def dive(obj, required=False):
28
28
raise AnsibleFilterError ('missing items key in array' )
29
29
if not 'properties' in obj ['items' ]:
30
30
raise AnsibleFilterError ('missing properties in items' )
31
- for propkey , propval in obj ['items' ]['properties' ]. iteritems ( ):
31
+ for propkey , propval in iteritems ( obj ['items' ]['properties' ]):
32
32
required = bool ('required' in obj ['items' ] and propkey in obj ['items' ]['required' ])
33
33
result ['options' ][propkey ] = dive (propval , required )
34
34
elif obj ['type' ] in ['str' , 'bool' , 'int' ]:
@@ -43,16 +43,15 @@ def dive(obj, required=False):
43
43
return result
44
44
45
45
def u_to_str (object , context , maxlevels , level ):
46
- typ = pprint ._type (object )
47
- if typ is unicode :
46
+ if isinstance (object , unicode ):
48
47
object = str (object )
49
48
return pprint ._safe_repr (object , context , maxlevels , level )
50
49
51
50
def to_argspec (value ):
52
51
data = jsonref .loads (json .dumps (value ))
53
52
result = dive (data ['schema' ])
54
53
printer = pprint .PrettyPrinter ()
55
- printer .format = u_to_str
54
+ # printer.format = u_to_str
56
55
return printer .pformat (result ['options' ])
57
56
58
57
0 commit comments