1010import argparse
1111import plistlib
1212from datetime import datetime
13- from xml .parsers .expat import ExpatError
14-
15- from pre_commit_hooks .util import validate_required_keys
16-
17- # Plist types expected in preference manifests, and their Python equivalents
18- PFM_TYPES = {
19- "string" : str ,
20- "boolean" : bool ,
21- "dict" : dict ,
22- "dictionary" : dict ,
23- "integer" : int ,
24- "array" : list ,
25- "data" : None , # TODO: How to represent this?
26- "float" : float ,
27- "real" : float ,
28- "date" : datetime ,
29- }
13+
14+ from pre_commit_hooks .util import PLIST_TYPES , validate_required_keys
3015
3116# List keys and their expected item types
3217PFM_LIST_TYPES = {
@@ -180,7 +165,7 @@ def validate_pfm_type_strings(subkey, filename):
180165 # print('{}: Subkey type "{}" is deprecated'.format(filename, subkey["pfm_type"]))
181166 # passed = False
182167 pass # DEBUG ONLY
183- elif subkey ["pfm_type" ] not in PFM_TYPES :
168+ elif subkey ["pfm_type" ] not in PLIST_TYPES :
184169 print ('{}: Unexpected subkey type "{}"' .format (filename , subkey ["pfm_type" ]))
185170 passed = False
186171
@@ -280,11 +265,11 @@ def validate_pfm_default(subkey, filename):
280265 # TODO: Should we validate pfm_value_placeholder here too?
281266 for test_key in ("pfm_default" ,):
282267 if test_key in subkey :
283- if PFM_TYPES [subkey ["pfm_type" ]] == list :
268+ if PLIST_TYPES [subkey ["pfm_type" ]] == list :
284269 desired_type = type (subkey ["pfm_subkeys" ][0 ])
285270 else :
286271 try :
287- desired_type = PFM_TYPES [subkey ["pfm_type" ]]
272+ desired_type = PLIST_TYPES [subkey ["pfm_type" ]]
288273 except IndexError :
289274 # Unknown desired type
290275 continue
@@ -294,7 +279,7 @@ def validate_pfm_default(subkey, filename):
294279 filename ,
295280 test_key ,
296281 subkey .get ("pfm_name" ),
297- PFM_TYPES [subkey ["pfm_type" ]],
282+ PLIST_TYPES [subkey ["pfm_type" ]],
298283 type (subkey [test_key ]),
299284 )
300285 )
0 commit comments