File tree Expand file tree Collapse file tree 1 file changed +21
-21
lines changed Expand file tree Collapse file tree 1 file changed +21
-21
lines changed Original file line number Diff line number Diff line change 41
41
# Map Phabricator types to Python types
42
42
PARAM_TYPE_MAP = {
43
43
# int types
44
- 'int' : ' int' ,
45
- 'uint' : ' int' ,
46
- 'revisionid' : ' int' ,
47
- 'revision_id' : ' int' ,
48
- 'diffid' : ' int' ,
49
- 'diff_id' : ' int' ,
50
- 'id' : ' int' ,
51
- 'enum' : ' int' ,
44
+ 'int' : int ,
45
+ 'uint' : int ,
46
+ 'revisionid' : int ,
47
+ 'revision_id' : int ,
48
+ 'diffid' : int ,
49
+ 'diff_id' : int ,
50
+ 'id' : int ,
51
+ 'enum' : int ,
52
52
53
53
# bool types
54
- 'bool' : ' bool' ,
54
+ 'bool' : bool ,
55
55
56
56
# dict types
57
- 'map' : ' dict' ,
58
- 'dict' : ' dict' ,
57
+ 'map' : dict ,
58
+ 'dict' : dict ,
59
59
60
60
# list types
61
- 'list' : ' list' ,
61
+ 'list' : list ,
62
62
63
63
# tuple types
64
- 'pair' : ' tuple' ,
64
+ 'pair' : tuple ,
65
65
66
66
# str types
67
- 'str' : 'str' ,
68
- 'string' : 'str' ,
69
- 'phid' : 'str' ,
70
- 'guids' : 'str' ,
71
- 'type' : 'str' ,
67
+ 'str' : basestring ,
68
+ 'string' : basestring ,
69
+ 'phid' : basestring ,
70
+ 'guids' : basestring ,
71
+ 'type' : basestring ,
72
72
}
73
73
74
74
STR_RE = re .compile (r'([a-zA-Z_]+)' )
@@ -93,9 +93,9 @@ def map_param_type(param_type):
93
93
sub_match = STR_RE .match (sub_type )
94
94
sub_type = sub_match .group (0 ).lower ()
95
95
96
- return [PARAM_TYPE_MAP .setdefault (sub_type , 'str' )]
96
+ return [PARAM_TYPE_MAP .setdefault (sub_type , basestring )]
97
97
98
- return PARAM_TYPE_MAP .setdefault (main_type , 'str' )
98
+ return PARAM_TYPE_MAP .setdefault (main_type , basestring )
99
99
100
100
101
101
def parse_interfaces (interfaces ):
@@ -219,7 +219,7 @@ def validate_kwarg(key, target):
219
219
# Always allow list
220
220
if isinstance (key , list ):
221
221
return all ([validate_kwarg (x , target [0 ]) for x in key ])
222
- return type (key ). __name__ == target
222
+ return isinstance (key , target )
223
223
224
224
for k in resource .get ('required' , []):
225
225
if k not in [x .split (':' )[0 ] for x in kwargs .keys ()]:
You can’t perform that action at this time.
0 commit comments