<commit_before>#!/usr/bin/python

class Console(object):
    def __init__(self):
        pass
    def generate_url(self, vc, vmid, name, host, ticket):
        return 'http://%s:7331/console/?vmId=%s&vmName=%s&host=%s&sessionTicket=%s' % (
            vc, vmid, name, host, ticket)
<commit_msg>renaming console methods, and adding method to generate a thumbprint from the session ticket<commit_after>#!/usr/bin/python
import re


class Console(object):
    def __init__(self):
        pass


    def mkthumbprint(self, ticket):
        """
        This method uses the information in a ticket to generate a thumbprint.
        The string is split on --, and uses the second part to convert to the
        appropriate format.

        :param ticket: vim.SessionManager.AcquireCloneTicket()
        """
        # cst is a placeholder
        cst, tp = ticket.split('--')
        thumbprint = re.sub(r'tp-', '', tp)
        thumbprint = re.sub(r'-', ':', thumbprint)
        return thumbprint


    def mkurl(self, vmid, name, vc, ticket, thumbprint):
        """
        We have a Tomcat broker (web) which has a different hostname than our 
        vCenter, so we need to account for that.  The hostname appends -web to
        vc hostname.
        """

        host, domain, tld  = vc.split('.')
        host = host + '-web'
        web = '.'.join((host, domain, tld))

        return 'http://%s:7331/console/?vmId=%s&vmName=%s&host=%s&sessionTicket=%s&thumbprint=%s' % (
            web, vmid, name, vc, ticket, thumbprint)

{'fraction_non_alphanumeric': 0.12852459016393442, 'fraction_numerical': 0.005245901639344262, 'mean_word_length': 2.4681818181818183, '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': '4358338', 'n_tokens_mistral': 486, 'n_tokens_neox': 468, 'n_words': 144}