22import os
33
44import re
5- import six
5+ # import six
66import yaml
77from abc import ABC , abstractmethod
88
@@ -72,7 +72,7 @@ def iter_configs(self):
7272 :rtype iterable(ObjectConfig)
7373 """
7474 yield self
75- for child_config in six . itervalues ( self .child_configs ):
75+ for child_config in self .child_configs . values ( ):
7676 for subtree_config in child_config .iter_configs ():
7777 yield subtree_config
7878
@@ -88,7 +88,7 @@ def create_assertion_error(self, message):
8888 return AssertionException ("%s in: %s" % (message , self .get_full_scope ()))
8989
9090 def describe_types (self , types_to_describe ):
91- if types_to_describe == six . string_types :
91+ if types_to_describe == str :
9292 result = self .describe_types (str )
9393 elif isinstance (types_to_describe , tuple ):
9494 result = []
@@ -166,7 +166,7 @@ def __contains__(self, item):
166166 return item in self .value
167167
168168 def iter_keys (self ):
169- return six . iterkeys ( self .value )
169+ return self .value . keys ( )
170170
171171 def iter_unused_keys (self ):
172172 for key in self .iter_keys ():
@@ -196,7 +196,7 @@ def get_string(self, key, none_allowed=False) -> str:
196196 """
197197 :rtype: basestring
198198 """
199- return self .get_value (key , six . string_types , none_allowed )
199+ return self .get_value (key , str , none_allowed )
200200
201201 def get_int (self , key , none_allowed = False ):
202202 """
@@ -393,7 +393,7 @@ def load_from_yaml(self, filepath, path_keys):
393393 if not isinstance (yml , dict ):
394394 # malformed YML files produce a non-dictionary
395395 raise AssertionException ("Configuration file or command '{}' does not contain settings" .format (filepath ))
396- for path_key , options in six . iteritems ( path_keys ):
396+ for path_key , options in path_keys . items ( ):
397397 key_path = path_key
398398 keys = path_key .split ('/' )
399399 self .process_path_key (dirpath , filename , key_path , yml , keys , 1 , * options )
@@ -419,7 +419,7 @@ def process_path_key(self, dirpath, filename, key_path, dictionary, keys, level,
419419 # if a wildcard is specified at this level, that means we
420420 # should process all keys as path values
421421 if key == "*" :
422- for key , val in six . iteritems ( dictionary ):
422+ for key , val in dictionary . items ( ):
423423 dictionary [key ] = self .process_path_value (dirpath , filename , key_path , val , must_exist , can_have_subdict )
424424 elif key in dictionary :
425425 dictionary [key ] = self .process_path_value (dirpath , filename , key_path , dictionary [key ], must_exist , can_have_subdict )
@@ -451,13 +451,13 @@ def process_path_value(self, dirpath, filename, key_path, val, must_exist, can_h
451451 :param must_exist: whether there must be a value
452452 :param can_have_subdict: whether the value can be a tagged string
453453 """
454- if isinstance (val , six . string_types ):
454+ if isinstance (val , str ):
455455 return self .relative_path (dirpath , filename , key_path , val , must_exist )
456456 elif isinstance (val , list ):
457457 vals = []
458458 for entry in val :
459459 if can_have_subdict and isinstance (entry , dict ):
460- for subkey , subval in six . iteritems ( entry ):
460+ for subkey , subval in entry . items ( ):
461461 vals .append ({subkey : self .relative_path (dirpath , filename , key_path , subval , must_exist )})
462462 else :
463463 vals .append (self .relative_path (dirpath , filename , key_path , entry , must_exist ))
@@ -468,7 +468,7 @@ def relative_path(dirpath, filename, key_path, val, must_exist):
468468 """
469469 returns an absolute path that is resolved relative to the file being loaded
470470 """
471- if not isinstance (val , six . string_types ):
471+ if not isinstance (val , str ):
472472 raise AssertionException ("Expected pathname for setting {} in config file {}" .format (key_path , filename ))
473473 if val .startswith ('$(' ) and val .endswith (')' ):
474474 raise AssertionException ("Shell execution is no longer supported: {}" .format (val ))
@@ -509,7 +509,7 @@ def set_string_value(self, key, default_value):
509509 :type key: str
510510 :type default_value: Optional(str)
511511 """
512- self .set_value (key , six . string_types , default_value )
512+ self .set_value (key , str , default_value )
513513
514514 def set_dict_value (self , key , default_value ):
515515 """
@@ -526,7 +526,7 @@ def set_value(self, key, allowed_types, default_value):
526526 self .options [key ] = value
527527
528528 def require_string_value (self , key ):
529- return self .require_value (key , six . string_types )
529+ return self .require_value (key , str )
530530
531531 def require_value (self , key , allowed_types ):
532532 config = self .default_config
@@ -539,7 +539,7 @@ def require_value(self, key, allowed_types):
539539def resolve_invocation_options (options : dict , invocation_config : DictConfig , invocation_defaults : dict , args : dict ) -> dict :
540540 # get overrides from the main config
541541 if invocation_config :
542- for k , v in six . iteritems ( invocation_defaults ):
542+ for k , v in invocation_defaults . items ( ):
543543 if isinstance (v , bool ):
544544 val = invocation_config .get_bool (k , True )
545545 if val is not None :
0 commit comments