<commit_before>import logging
import string

def decipher(cipher_txt,key):
    """
    Deciphers a given cipher text with a key
    """
    #Perform basic normalisation of the inputs
    key = key.lower()
    cipher_txt = cipher_txt.upper().replace(" ","").translate(string.punctuation)
    logging.info(cipher_txt)
    #remove duplicate characters
    __key = ""
    for c in key:
        if c not in __key:
            __key += c
    #Find the order of the key, based on the position of the chars
    #in the alphabet
    __key_sorted = sorted(__key)
    key_order = []
    for c in __key:
        key_order.append(__key_sorted.index(c))
    logging.info("Key order for {}: {}".format(key,key_order))
    
    #split the cipher text based on the length of the key into chunks
    chunks = []
    col_width = int(len(cipher_txt)//len(key_order))
    logging.info("col width: {}".format(col_width))
    for i in range(len(key_order)):
        chunks.append(cipher_txt[i*col_width:(i*col_width)+col_width])
    logging.info("Chunks: {}".format(chunks))
    
    #Order the chunks in the order of the key
    ordered_chunks = []
    for pos in key_order:
        ordered_chunks.append(chunks[pos])

    out = ""
    for c in range(col_width):
        for chunk in range(len(ordered_chunks)):
            out += ordered_chunks[chunk][c]
    logging.info("Output: {}".format(out))

    return out<commit_msg>Added local logger to transposition cipher<commit_after>import logging
import string


logger = logging.getLogger(__name__)
logger.setLevel(20)

def decipher(cipher_txt,key):
    """
    Deciphers a given cipher text with a key
    """
    #Perform basic normalisation of the inputs
    key = key.lower()
    cipher_txt = cipher_txt.upper().replace(" ","").translate(string.punctuation)
    logger.debug("Cipher text: {}".format(cipher_txt))
    #remove duplicate characters
    __key = ""
    for c in key:
        if c not in __key:
            __key += c
    #Find the order of the key, based on the position of the chars
    #in the alphabet
    __key_sorted = sorted(__key)
    key_order = []
    for c in __key:
        key_order.append(__key_sorted.index(c))
    logger.debug("Key order for {}: {}".format(key,key_order))
    
    #split the cipher text based on the length of the key into chunks
    chunks = []
    col_width = int(len(cipher_txt)//len(key_order))
    logger.debug("col width: {}".format(col_width))
    for i in range(len(key_order)):
        chunks.append(cipher_txt[i*col_width:(i*col_width)+col_width])
    logger.debug("Chunks: {}".format(chunks))
    
    #Order the chunks in the order of the key
    ordered_chunks = []
    for pos in key_order:
        ordered_chunks.append(chunks[pos])

    out = ""
    for c in range(col_width):
        for chunk in range(len(ordered_chunks)):
            out += ordered_chunks[chunk][c]
    logger.debug("Output: {}".format(out))

    return out
{'fraction_non_alphanumeric': 0.11738535249828884, 'fraction_numerical': 0.0006844626967830253, 'mean_word_length': 3.00960219478738, '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': '4731190', 'n_tokens_mistral': 943, 'n_tokens_neox': 917, 'n_words': 259}