<commit_before># -*- coding: utf-8 -*-
# vim: set filetype=python :


import argparse
import os
import sys


class Shline(object):
    symbols = {
        'patched': {
            'branch': u'\uE0A0',
            'lock': u'\uE0A2',
            'network': u'SSH',
            'separator': u'\uE0B0',
        },
        'flat': {
            'branch': '',
            'lock': 'RO',
            'network': 'SSH',
            'separator': '',
        },
    }

    color_template = '\\[\\e%s\\]'

    def __init__(self, args):
        self.args = args
        self.cwd = self._get_cwd()
        self.reset = self.color_template % '[0m'
        self.branch = Shline.symbols[args.mode]['branch']
        self.lock = Shline.symbols[args.mode]['lock']
        self.network = Shline.symbols[args.mode]['network']
        self.separator = Shline.symbols[args.mode]['separator']
        self.segments = []

    def _get_cwd(self):
        """ We check if the current working directory is valid or not. Typically
            happens when you checkout a different branch on git that doesn't have
            this directory.
            We return the original cwd because the shell still considers that to be
            the working directory, so returning our guess will confuse people
        """
        try:
            cwd = os.getcwd()
        except OSError:
            cwd = os.getenv('PWD')  # This is where the OS thinks we are
            parts = cwd.split(os.sep)
            up = cwd
            while parts and not os.path.exists(up):
                parts.pop()
                up = os.sep.join(parts)
            try:
                os.chdir(up)
            except OSError:
                sys.stderr.write("Your current directory is invalid.")<commit_msg>Always use flat mode over SSH<commit_after># -*- coding: utf-8 -*-
# vim: set filetype=python :


import argparse
import os
import sys


class Shline(object):
    symbols = {
        'patched': {
            'branch': u'\uE0A0',
            'lock': u'\uE0A2',
            'network': u'SSH',
            'separator': u'\uE0B0',
        },
        'flat': {
            'branch': '',
            'lock': 'RO',
            'network': 'SSH',
            'separator': '',
        },
    }

    color_template = '\\[\\e%s\\]'

    def __init__(self, args):
        if os.getenv('SSH_CLIENT'):
            args.mode = 'flat'
        self.args = args
        self.cwd = self._get_cwd()
        self.reset = self.color_template % '[0m'
        self.branch = Shline.symbols[args.mode]['branch']
        self.lock = Shline.symbols[args.mode]['lock']
        self.network = Shline.symbols[args.mode]['network']
        self.separator = Shline.symbols[args.mode]['separator']
        self.segments = []

    def _get_cwd(self):
        """ We check if the current working directory is valid or not. Typically
            happens when you checkout a different branch on git that doesn't have
            this directory.
            We return the original cwd because the shell still considers that to be
            the working directory, so returning our guess will confuse people
        """
        try:
            cwd = os.getcwd()
        except OSError:
            cwd = os.getenv('PWD')  # This is where the OS thinks we are
            parts = cwd.split(os.sep)
            up = cwd
            while parts and not os.path.exists(up):
                parts.pop()
                up = os.sep.join(parts)
            try:
                os.chdir(up)
            except OSError:
                sys.stderr.write("Your current directory is invalid.")
{'fraction_non_alphanumeric': 0.12267554815431585, 'fraction_numerical': 0.004440743824590619, 'mean_word_length': 1.644167278063096, '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': '5139874', 'n_tokens_mistral': 1074, 'n_tokens_neox': 1044, 'n_words': 286}