def _parse_resource_declarations(cls, declarations, resource_map):
        """Parse out what resources are declared as shared for this recipe."""

        resources = {}

        for decl in declarations:
            name = decl.pop('name')
            typename = decl.pop('type')
            desc = decl.pop('description', None)
            autocreate = decl.pop('autocreate', False)

            args = decl

            res_type = resource_map.get(typename)
            if res_type is None:
                raise UnknownRecipeResourceType("Could not find shared resource type", type=typename, name=name)

            # If the resource defines an argument schema, make sure we enforce it.
            if hasattr(res_type, "ARG_SCHEMA"):
                try:
                    args = res_type.ARG_SCHEMA.verify(args)
                except ValidationError as exc:
                    raise RecipeFileInvalid("Recipe file resource declarttion has invalid parameters", resource=name, error_message=exc.msg, **exc.params)

            if name in resources:
                raise RecipeFileInvalid("Attempted to add two shared resources with the same name", name=name)

            res = ResourceDeclaration(name, resource_map.get(typename), args, autocreate, desc, typename)
            resources[name] = res

        return resources
def _parse_resource_declarations ( cls , declarations , resource_map ) : resources = { } for decl in declarations : name = decl . pop ( 'name' ) typename = decl . pop ( 'type' ) desc = decl . pop ( 'description' , None ) autocreate = decl . pop ( 'autocreate' , False ) args = decl res_type = resource_map . get ( typename ) if res_type is None : raise UnknownRecipeResourceType ( "Could not find shared resource type" , type = typename , name = name ) if hasattr ( res_type , "ARG_SCHEMA" ) : try : args = res_type . ARG_SCHEMA . verify ( args ) except ValidationError as exc : raise RecipeFileInvalid ( "Recipe file resource declarttion has invalid parameters" , resource = name , error_message = exc . msg , ** exc . params ) if name in resources : raise RecipeFileInvalid ( "Attempted to add two shared resources with the same name" , name = name ) res = ResourceDeclaration ( name , resource_map . get ( typename ) , args , autocreate , desc , typename ) resources [ name ] = res return resources
Parse out what resources are declared as shared for this recipe.