@@ -292,12 +292,12 @@ def __delattr__(self, key):
292292class ConfigLoader (object ):
293293 """A object for loading configurations from just about anywhere.
294294
295- The resulting configuration is packaged as a :class:`Struct `.
295+ The resulting configuration is packaged as a :class:`Config `.
296296
297297 Notes
298298 -----
299299 A :class:`ConfigLoader` does one thing: load a config from a source
300- (file, command line arguments) and returns the data as a :class:`Struct` .
300+ (file, command line arguments) and returns the data as a :class:`Config` object .
301301 There are lots of things that :class:`ConfigLoader` does not do. It does
302302 not implement complex logic for finding config files. It does not handle
303303 default values or merge multiple configs. These things need to be
@@ -324,10 +324,10 @@ def __init__(self, log=None):
324324 {}
325325 """
326326 self .clear ()
327- if log is None :
327+ if log is None :
328328 self .log = self ._log_default ()
329329 self .log .debug ('Using default logger' )
330- else :
330+ else :
331331 self .log = log
332332
333333 def clear (self ):
@@ -375,7 +375,7 @@ class JSONFileConfigLoader(FileConfigLoader):
375375 """A Json file loader for config"""
376376
377377 def load_config (self ):
378- """Load the config from a file and return it as a Struct ."""
378+ """Load the config from a file and return it as a Config object ."""
379379 self .clear ()
380380 try :
381381 self ._find_file ()
@@ -386,32 +386,31 @@ def load_config(self):
386386 return self .config
387387
388388 def _read_file_as_dict (self ):
389- with open (self .full_filename ) as f :
389+ with open (self .full_filename ) as f :
390390 return json .load (f )
391391
392392 def _convert_to_config (self , dictionary ):
393393 if 'version' in dictionary :
394394 version = dictionary .pop ('version' )
395- else :
395+ else :
396396 version = 1
397- self .log .warn ("Unrecognized JSON config file version, assuming version : {}" .format (version ))
397+ self .log .warn ("Unrecognized JSON config file version, assuming version {}" .format (version ))
398398
399399 if version == 1 :
400400 return Config (dictionary )
401- else :
402- raise ValueError ('Unknown version of JSON config file : version number {version}' .format (version = version ))
401+ else :
402+ raise ValueError ('Unknown version of JSON config file: {version}' .format (version = version ))
403403
404404
405405class PyFileConfigLoader (FileConfigLoader ):
406406 """A config loader for pure python files.
407407
408408 This is responsible for locating a Python config file by filename and
409- profile name, then executing it in a namespace where it could have access
410- to subconfigs.
409+ path, then executing it to construct a Config object.
411410 """
412411
413412 def load_config (self ):
414- """Load the config from a file and return it as a Struct ."""
413+ """Load the config from a file and return it as a Config object ."""
415414 self .clear ()
416415 try :
417416 self ._find_file ()
@@ -645,7 +644,7 @@ def load_config(self, argv=None, aliases=None, flags=None):
645644 lhs = aliases [lhs ]
646645 if '.' not in lhs :
647646 # probably a mistyped alias, but not technically illegal
648- self .log .warn ("Unrecognized alias: '%s', it will probably have no effect. %s,-- %s" % ( lhs , raw , aliases ) )
647+ self .log .warn ("Unrecognized alias: '%s', it will probably have no effect." , raw )
649648 try :
650649 self ._exec_config_str (lhs , rhs )
651650 except Exception :
0 commit comments