def _name_from_project_path(path, project, template):
 if isinstance(template, str):
  template = re.compile(template)
 match = template.match(path)
 if (not match):
  raise ValueError(('path "%s" did not match expected pattern "%s"' % (path, template.pattern)))
 if (project is not None):
  found_project = match.group('project')
  if (found_project != project):
   raise ValueError(('Project from client (%s) should agree with project from resource(%s).' % (project, found_project)))
 return match.group('name')

def _name_from_project_path ( path , project , template ) : if isinstance ( template , str ) : template = re . compile ( template ) match = template . match ( path ) if ( not match ) : raise ValueError ( ( 'path "%s" did not match expected pattern "%s"' % ( path , template . pattern ) ) ) if ( project is not None ) : found_project = match . group ( 'project' ) if ( found_project != project ) : raise ValueError ( ( 'Project from client (%s) should agree with project from resource(%s).' % ( project , found_project ) ) ) return match . group ( 'name' )
validate a uri path and get the leaf objects name .