<commit_before>#!/usr/bin/env python
# coding: utf-8

import os
import sys
import re
import random
import fcntl
import termios
import struct
import subprocess as sp

from os.path import dirname, join
from os import environ

ROOT = dirname(__file__)


class Doge(object):
    default_doge = join(ROOT, 'static/doge.txt')

    # wow pls extend this if you see it
    known_processes = (
        # wow shells and terminals and etc
        'zsh', 'urxvt', 'tmux', 'fish', 'ssh', 'mutt', 'screen', 'mosh-client',

        # pretty browsers
        'chromium', 'luakit', 'uzbl-core', 'firefox', 'jumanji',

        # many wms (borrow from djmelik/archey)
        'awesome', 'beryl', 'blackbox', 'bspwm', 'compiz', 'dwm',
        'enlightenment', 'herbstluftwm', 'fluxbox', 'fvwm', 'i3', 'icewm',
        'kwin', 'metacity', 'musca', 'openbox', 'pekwm', 'ratpoison',
        'scrotwm', 'wmaker', 'wmfs', 'wmii', 'xfwm4', 'xmonad',
        'gnome-shell', 'devilspie2',

        # such services and daemons
        'mpd', 'nginx', 'dzen2', 'systemd', 'lighttpd', 'prosody',
    )

    def __init__(self, tty, doge_path=default_doge):
        self.tty = tty
        self.doge_path = doge_path

        self.real_data = []

    def setup(self):
        if self.tty.is_tty:
            # is tty, wow get doge
            doge = self.load_doge()
            max_doge = max(map(clean_len, doge)) + 15
        else:
            # no tty, such no doge
            doge = []
            max_doge = 15

        if self.tty.width < max_doge:
            sys.stderr.write('wow, such small terminal\n')
            sys.stderr.write('no doge under {0} column\n'.format(max_doge))
            sys.exit(1)

        # so many line<commit_msg>such services<commit_after>#!/usr/bin/env python
# coding: utf-8

import os
import sys
import re
import random
import fcntl
import termios
import struct
import subprocess as sp

from os.path import dirname, join
from os import environ

ROOT = dirname(__file__)


class Doge(object):
    default_doge = join(ROOT, 'static/doge.txt')

    # wow pls extend this if you see it
    known_processes = (
        # wow shells and terminals and etc
        'zsh', 'urxvt', 'tmux', 'fish', 'ssh', 'mutt', 'screen', 'mosh-client',

        # pretty browsers
        'chromium', 'luakit', 'uzbl-core', 'firefox', 'jumanji',

        # many wms (borrow from djmelik/archey)
        'awesome', 'beryl', 'blackbox', 'bspwm', 'compiz', 'dwm',
        'enlightenment', 'herbstluftwm', 'fluxbox', 'fvwm', 'i3', 'icewm',
        'kwin', 'metacity', 'musca', 'openbox', 'pekwm', 'ratpoison',
        'scrotwm', 'wmaker', 'wmfs', 'wmii', 'xfwm4', 'xmonad',
        'gnome-shell', 'devilspie2',

        # such services and daemons
        'mpd', 'nginx', 'dzen2', 'systemd', 'lighttpd', 'prosody',
        'mongod', 'postgres', 'mysqld', 'redis-server',
        
        # programming languages
        'ruby', 'python', 'java',
        
        # shells
        'sh', 'bash', 'zsh'
    )

    def __init__(self, tty, doge_path=default_doge):
        self.tty = tty
        self.doge_path = doge_path

        self.real_data = []

    def setup(self):
        if self.tty.is_tty:
            # is tty, wow get doge
            doge = self.load_doge()
            max_doge = max(map(clean_len, doge)) + 15
        else:
            # no tty, such no doge
            doge = []
            max_doge = 15

        if self.tty.width < max_doge:
            sys.stderr.write('wow, such small terminal\n')
            sys.stderr.write('no doge under {0} column\n'.format(max_doge))
            sys.exit(1)

        # so many line
{'fraction_non_alphanumeric': 0.14368610113290964, 'fraction_numerical': 0.0060790273556231, 'mean_word_length': 2.3211009174311927, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4063327', 'n_tokens_mistral': 1316, 'n_tokens_neox': 1256, 'n_words': 329}