<commit_before>"""
dotter

Copyright (c) 2013, <NAME> (<EMAIL>)
All rights reserved.

"""
from base64 import b16encode
from subprocess import PIPE, Popen


class RankType:
    """
    These values can be used for Dotter.rank()

    """
    Max = 'max'
    Min = 'min'
    Same = 'same'
    Sink = 'sink'
    Source = 'source'


class Dotter:

    def __init__(self, directed=True, output_to_file=True, output_filename=None,
                 output_type='pdf', program='dot', strict=False):
        self.directed = directed

        self.args = [program]
        self.args.append('-T%s' % output_type)
        if output_to_file:
            if output_filename:
                self.args.append('-o')
                self.args.append(output_filename)
            else:
                self.args.append('-O')

        self.commands = []
        if strict:
            self.execute(' strict ')
        if self.directed:
            self.execute('digraph')
        else:
            self.execute('graph')
        self.execute(' {')

    def execute(self, command):
        self.commands.append(command)

    def close(self):
        self.execute('}')
        p = Popen(self.args, stdout=PIPE, stdin=PIPE)<commit_msg>Implement =Dotter.__str__()=.<commit_after>"""
dotter

Copyright (c) 2013, <NAME> (<EMAIL>)
All rights reserved.

"""
from base64 import b16encode
from subprocess import PIPE, Popen


class RankType:
    """
    These values can be used for Dotter.rank()

    """
    Max = 'max'
    Min = 'min'
    Same = 'same'
    Sink = 'sink'
    Source = 'source'


class Dotter:

    def __init__(self, directed=True, output_to_file=True, output_filename=None,
                 output_type='pdf', program='dot', strict=False):
        self.directed = directed

        self.args = [program]
        self.args.append('-T%s' % output_type)
        if output_to_file:
            if output_filename:
                self.args.append('-o')
                self.args.append(output_filename)
            else:
                self.args.append('-O')

        self.commands = []
        if strict:
            self.execute(' strict ')
        if self.directed:
            self.execute('digraph')
        else:
            self.execute('graph')
        self.execute(' {')

    def __str__(self):
        return '\n'.join(self.commands)

    def execute(self, command):
        self.commands.append(command)

    def close(self):
        self.execute('}')
        p = Popen(self.args, stdout=PIPE, stdin=PIPE)
{'fraction_non_alphanumeric': 0.13029576338928858, 'fraction_numerical': 0.006394884092725819, 'mean_word_length': 2.030266343825666, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '2527367', 'n_tokens_mistral': 802, 'n_tokens_neox': 756, 'n_words': 172}