<commit_before># -*- coding: utf8 -*-

"""

tomber - a python Tomb (the Crypto Undertaker) wrapper
To use tomber you need to install Tomb (https://github.com/dyne/Tomb)
Copyright © 2014, <NAME> <re<EMAIL>>
Licensed under BSD License.
See also LICENSE file

"""


from subprocess import Popen, PIPE
from tools import parser


def get_message(stderr, type):
    """
    Helper to return exit messages from command execution
    """
    response = []
    for line in stderr.split('\n'):
        ret = parser.parse_line(line)
        if ret and ret['type'] == type:
            if not 'swaps' in ret['content']:
                response.append(ret['content'])
    return response


def execute(cmd):
    """
    Execute given cmd. return boolean based on exit status and error string
    """
    p = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)<commit_msg>#6 removed shell=True from Popen, and split of str arg into a list<commit_after># -*- coding: utf8 -*-

"""

tomber - a python Tomb (the Crypto Undertaker) wrapper
To use tomber you need to install Tomb (https://github.com/dyne/Tomb)
Copyright © 2014, <NAME> <reiven_at_gmail.<EMAIL>>
Licensed under BSD License.
See also LICENSE file

"""


from subprocess import Popen, PIPE
from tools import parser


def get_message(stderr, type):
    """
    Helper to return exit messages from command execution
    """
    response = []
    for line in stderr.split('\n'):
        ret = parser.parse_line(line)
        if ret and ret['type'] == type:
            if not 'swaps' in ret['content']:
                response.append(ret['content'])
    return response


def execute(cmd):
    """
    Execute given cmd. return boolean based on exit status and error string
    """
    p = Popen(cmd.split(), stdout=PIPE, stderr=PIPE)
{'fraction_non_alphanumeric': 0.11774647887323944, 'fraction_numerical': 0.006197183098591549, 'mean_word_length': 3.018099547511312, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '7510748', 'n_tokens_mistral': 551, 'n_tokens_neox': 529, 'n_words': 194}