def parse_storage_policies(conf):
 policies = []
 for section in conf.sections():
  if (not section.startswith('storage-policy:')):
   continue
  policy_index = section.split(':', 1)[1]
  config_options = dict(conf.items(section))
  policy_type = config_options.pop('policy_type', DEFAULT_POLICY_TYPE)
  policy_cls = BaseStoragePolicy.policy_type_to_policy_cls[policy_type]
  policy = policy_cls.from_config(policy_index, config_options)
  policies.append(policy)
 return StoragePolicyCollection(policies)

def parse_storage_policies ( conf ) : policies = [ ] for section in conf . sections ( ) : if ( not section . startswith ( 'storage-policy:' ) ) : continue policy_index = section . split ( ':' , 1 ) [ 1 ] config_options = dict ( conf . items ( section ) ) policy_type = config_options . pop ( 'policy_type' , DEFAULT_POLICY_TYPE ) policy_cls = BaseStoragePolicy . policy_type_to_policy_cls [ policy_type ] policy = policy_cls . from_config ( policy_index , config_options ) policies . append ( policy ) return StoragePolicyCollection ( policies )
parse storage policies in swift .