def get_namespace_from_name(name):
    """
    can be either
    <namespace>/projects/<project_name>
    or
    <namespace>/<project_name>
    """
    if not re.match(NAMESPACE_PATTERN, name):
        sys.exit(("Argument '%s' doesn't match any recognized pattern:\n"
                  "\tfloyd [data] init <project_or_dataset_name>\n"
                  "\tfloyd [data] init <namespace>/<project_or_dataset_name>\n"
                  "\tfloyd [data] init <namespace>/[projects|dataset]/<project_or_dataset_name>\n"
                  "\n Note: Argument can only contain alphanumeric, hyphen-minus '-' , underscore '_' and dot '.' characters."
                  ) % name)

    name_parts = name.split("/", 2)
    if len(name_parts) > 1:
        return name_parts[0], name_parts[-1]
    else:
        return current_username(), name
def get_namespace_from_name ( name ) : if not re . match ( NAMESPACE_PATTERN , name ) : sys . exit ( ( "Argument '%s' doesn't match any recognized pattern:\n" "\tfloyd [data] init <project_or_dataset_name>\n" "\tfloyd [data] init <namespace>/<project_or_dataset_name>\n" "\tfloyd [data] init <namespace>/[projects|dataset]/<project_or_dataset_name>\n" "\n Note: Argument can only contain alphanumeric, hyphen-minus '-' , underscore '_' and dot '.' characters." ) % name ) name_parts = name . split ( "/" , 2 ) if len ( name_parts ) > 1 : return name_parts [ 0 ] , name_parts [ - 1 ] else : return current_username ( ) , name
can be either
    <namespace>/projects/<project_name>
    or
    <namespace>/<project_name>