<commit_before>import os
from subprocess import Popen, PIPE


class TmuxExecError(RuntimeError):
    pass


class TmuxExecutor(object):
    def __init__(self, socket=None):
        if not socket:
            socket = '/tmp/tmux-%s/default' % os.getuid()

        self.socket = socket
        pname, sname = os.path.split(socket)

        if not os.path.isdir(pname):
            os.makedirs(pname)

        self.cmd = ['/usr/bin/env', 'tmux', '-S', socket]

    def __call__(self, *command):
        cmd = self.cmd[:]
        cmd.append('--')
        cmd.extend(command)

        p = Popen(cmd, stdout=PIPE, stderr=PIPE)
        out, err = p.communicate()

        if p.returncode != 0:
            raise TmuxExecError('error executing %s: %s' % (' '.join(cmd), err))

        return out

<commit_msg>fixed bug where socket is a filename without path-information<commit_after>import os
from subprocess import Popen, PIPE


class TmuxExecError(RuntimeError):
    pass


class TmuxExecutor(object):
    def __init__(self, socket=None):
        if not socket:
            socket = '/tmp/tmux-%s/default' % os.getuid()

        self.socket = socket
        pname, sname = os.path.split(socket)

        if pname and not os.path.isdir(pname):
            os.makedirs(pname)

        self.cmd = ['/usr/bin/env', 'tmux', '-S', socket]

    def __call__(self, *command):
        cmd = self.cmd[:]
        cmd.append('--')
        cmd.extend(command)

        p = Popen(cmd, stdout=PIPE, stderr=PIPE)
        out, err = p.communicate()

        if p.returncode != 0:
            raise TmuxExecError('error executing %s: %s' % (' '.join(cmd), err))

        return out


{'fraction_non_alphanumeric': 0.13674698795180723, 'fraction_numerical': 0.0012048192771084338, 'mean_word_length': 2.2189922480620154, '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': '4066836', 'n_tokens_mistral': 558, 'n_tokens_neox': 534, 'n_words': 132}