<commit_before>from excep import *

def get_leaf(hrn):
    parts = hrn.split(".")
    return ".".join(parts[-1:])

def get_authority(hrn):
    
    parts = hrn.split(".")
    return ".".join(parts[:-1])

def get_auth_type(type):
    if (type=="slice") or (type=="user") or (type=="sa"):
        return "sa"
    elif (type=="component") or (type=="ma"):
        return "ma"
    else:
        raise UnknownGeniType(type)

def hrn_to_pl_slicename(hrn):
    parts = hrn.split(".")
    return parts[-2] + "_" + parts[-1]

# assuming hrn is the hrn of an authority, return the plc authority name
def hrn_to_pl_authname(hrn):
    parts = hrn.split(".")
    return parts[-1]

# assuming hrn is the hrn of an authority, return the plc login_base
def hrn_to_pl_login_base(hrn):
    return hrn_to_pl_authname(hrn)
<commit_msg> added some helper functions<commit_after>from excep import *

def get_leaf(hrn):
    parts = hrn.split(".")
    return ".".join(parts[-1:])

def get_authority(hrn):
    
    parts = hrn.split(".")
    return ".".join(parts[:-1])

def get_auth_type(type):
    if (type=="slice") or (type=="user") or (type=="sa"):
        return "sa"
    elif (type=="component") or (type=="ma"):
        return "ma"
    else:
        raise UnknownGeniType(type)

def hrn_to_pl_slicename(hrn):
    parts = hrn.split(".")
    return parts[-2] + "_" + parts[-1]

# assuming hrn is the hrn of an authority, return the plc authority name
def hrn_to_pl_authname(hrn):
    parts = hrn.split(".")
    return parts[-1]

# assuming hrn is the hrn of an authority, return the plc login_base
def hrn_to_pl_login_base(hrn):
    return hrn_to_pl_authname(hrn)

def hostname_to_hrn(self, login_base, hostname):
    """
    Convert hrn to plantelab name.
    """
    genihostname = "_".join(hostname.split("."))
    return ".".join([self.hrn, login_base, genihostname])

def slicename_to_hrn(self, slicename):
    """
    Convert hrn to planetlab name.
    """
    parts = slicename.split("_")
    slice_hrn = ".".join([self.hrn, parts[0]]) + "." + "_".join(parts[1:])

    return slice_hrn

{'fraction_non_alphanumeric': 0.16104146576663453, 'fraction_numerical': 0.0057859209257473485, 'mean_word_length': 3.3319415448851775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1021361', 'n_tokens_mistral': 777, 'n_tokens_neox': 774, 'n_words': 187}