def get_child_environment(parent_env, child_params, item_to_remove=None, child_resource_name=None):
 def is_flat_params(env_or_param):
  if (env_or_param is None):
   return False
  for sect in env_fmt.SECTIONS:
   if (sect in env_or_param):
    return False
  return True
 child_env = parent_env.user_env_as_dict()
 child_env[env_fmt.PARAMETERS] = {}
 flat_params = is_flat_params(child_params)
 new_env = Environment()
 if (flat_params and (child_params is not None)):
  child_env[env_fmt.PARAMETERS] = child_params
 new_env.load(child_env)
 if ((not flat_params) and (child_params is not None)):
  new_env.load(child_params)
 if (item_to_remove is not None):
  new_env.registry.remove_item(item_to_remove)
 if child_resource_name:
  new_env.registry.remove_resources_except(child_resource_name)
 return new_env

def get_child_environment ( parent_env , child_params , item_to_remove = None , child_resource_name = None ) : def is_flat_params ( env_or_param ) : if ( env_or_param is None ) : return False for sect in env_fmt . SECTIONS : if ( sect in env_or_param ) : return False return True child_env = parent_env . user_env_as_dict ( ) child_env [ env_fmt . PARAMETERS ] = { } flat_params = is_flat_params ( child_params ) new_env = Environment ( ) if ( flat_params and ( child_params is not None ) ) : child_env [ env_fmt . PARAMETERS ] = child_params new_env . load ( child_env ) if ( ( not flat_params ) and ( child_params is not None ) ) : new_env . load ( child_params ) if ( item_to_remove is not None ) : new_env . registry . remove_item ( item_to_remove ) if child_resource_name : new_env . registry . remove_resources_except ( child_resource_name ) return new_env
build a child environment using the parent environment and params .