@@ -218,6 +218,8 @@ def __init__(self, files, base_vars=None):
218
218
219
219
def _add_file (self , path ):
220
220
e = path .ext [1 :].lower ()
221
+ if e == "yaml" :
222
+ e = "yml"
221
223
f = _File (
222
224
content = getattr (self , f"_ext_{ e } " )(path ),
223
225
ext = e ,
@@ -299,7 +301,7 @@ def _functions(self, obj, co_filename=None):
299
301
return m
300
302
301
303
302
- def parse_all (path , base_vars = None ):
304
+ def parse_all (path , base_vars = None , glob = "*" ):
303
305
"""Parse all the Python and YAML files in `directory`
304
306
305
307
Files are read in sorted order with all Python files first and
@@ -308,14 +310,16 @@ def parse_all(path, base_vars=None):
308
310
Args:
309
311
path (py.path): directory that ``*.py`` and ``*.yml`` files
310
312
base_vars (PKDict): initial variable state. May be hierarchical. [None]
313
+ glob (str): basename to search in in directory
311
314
Returns:
312
315
PKDict: evaluated and merged files plus base_vars
313
316
"""
314
- return Parser (
315
- pykern .pkio .sorted_glob (path .join ("*.py" ))
316
- + pykern .pkio .sorted_glob (path .join ("*.yml" )),
317
- base_vars = None ,
318
- ).result
317
+
318
+ def _glob (ext ):
319
+ return pykern .pkio .sorted_glob (path .join (f"{ glob } .{ ext } " ))
320
+
321
+ # yml & yaml need to be sorted together
322
+ return Parser (_glob ("py" ) + sorted (_glob ("yml" ), _glob ("yaml" ))).result
319
323
320
324
321
325
class _Builtins :
0 commit comments