<commit_before>#!/usr/bin/env python
"""ED encoder/decoder tools
    bl4de | <EMAIL> | Twitter: @_bl4de | H1: bl4de | GitHub: bl4de

    Simple encoder/decoder tool
    ./ed.py [string to encode] [input encoding] [output encoding]
"""
import base64
import sys
import urllib


def __get_char_hex_value(c):
    """returns 61; for 'a' truncated from 0x61"""
    return hex(ord(c)).replace("0x", "")


def to_base_64(s):
    return base64.b64encode(s)


def from_base_64(s):
    return base64.b64decode(s)


def url_encode(s):
    return urllib.quote(s)


def to_ascii(s):
    return s


def from_ascii(s):
    return s


def from_hex(s):
    xs = ""
    decimals = s.split()
    for d in decimals:
        xs += str(int(d, 10))

    return xs


def to_hex(s):
    xs = ""
    hexnums = s.split()
    for d in hexnums:
        hexnum = str(hex(int(d, 10))).replace("0x", "")
        if len(hexnum) < 2:
            hexnum = "0" + hexnum
        xs += hexnum + " "

    return xs


def to_html_entities(s):
    xs = ""<commit_msg>[encoder] fixed conversion to hex; small refactoring<commit_after>#!/usr/bin/env python
"""ED encoder/decoder tools
    bl4de | <EMAIL> | Twitter: @_bl4de | H1: bl4de | GitHub: bl4de

    Simple encoder/decoder tool
    ./ed.py [string to encode] [input encoding] [output encoding]
"""
import base64
import sys
import urllib


def __get_char_hex_value(c):
    """returns 61; for 'a' truncated from 0x61"""
    return hex(ord(c)).replace("0x", "")


def to_base_64(s):
    return base64.b64encode(s)


def from_base_64(s):
    return base64.b64decode(s)


def url_encode(s):
    return urllib.quote(s)


def to_ascii(s):
    return s


def from_ascii(s):
    return s


def from_hex(s):
    xs = ""
    for d in list(s):
        xs += str(int(d, 10))

    return xs


def to_hex(s):
    xs = ""
    for d in list(s):
        hexnum = str(hex(ord(d))).replace("0x", "")
        if len(hexnum) < 2:
            hexnum = "0" + hexnum
        xs += hexnum + " "

    return xs


def to_html_entities(s):
    xs = ""
{'fraction_non_alphanumeric': 0.14348894348894348, 'fraction_numerical': 0.030466830466830467, 'mean_word_length': 2.7153284671532845, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '3043624', 'n_tokens_mistral': 848, 'n_tokens_neox': 758, 'n_words': 201}