<commit_before>#! /usr/bin/env python
#
# Copyright (c) 2015 Autodesk Inc.
# All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import cmd
import json
import os
import sys

from os.path import basename, expanduser, isfile
from subprocess import Popen, PIPE
from sys import exit

def cli():
    """
        Minimalistic self-contained wrapper performing the curl calls to the ochopod proxy. The input
        is turned into a POST -H X-Shell:<> to the proxy at port TCP 9000. Any token from that input that
        matches a local file (wherever the script is running from) will force an upload for the said file.
        This mechanism is used for instance to upload the container definition YAML files when deploying a
        new cluster.

        The proxy IP is either passed as the first command-line argument or vi a $OCHOPOD_PROXY.
    """
    class Shell(cmd.Cmd):

        def __init__(self, ip):
            prompt = '%s > ' % ip
            ruler = '-'

        def precmd(self, line):
            return 'shell %s' % line if line not in ['exit'] else line

        def emptyline(self):
            pass

        def do_exit(self, _):
            raise KeyboardInterrupt<commit_msg>Fixed interactive mode by calling the cmd constructor<commit_after>#! /usr/bin/env python
#
# Copyright (c) 2015 Autodesk Inc.
# All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import cmd
import json
import os
import sys

from os.path import basename, expanduser, isfile
from subprocess import Popen, PIPE
from sys import exit

def cli():
    """
        Minimalistic self-contained wrapper performing the curl calls to the ochopod proxy. The input
        is turned into a POST -H X-Shell:<> to the proxy at port TCP 9000. Any token from that input that
        matches a local file (wherever the script is running from) will force an upload for the said file.
        This mechanism is used for instance to upload the container definition YAML files when deploying a
        new cluster.

        The proxy IP is either passed as the first command-line argument or vi a $OCHOPOD_PROXY.
    """
    class Shell(cmd.Cmd):

        def __init__(self, ip):
            cmd.Cmd.__init__(self)
            self.prompt = '%s > ' % ip
            self.ruler = '-'

        def precmd(self, line):
            return 'shell %s' % line if line not in ['exit'] else line

        def emptyline(self):
            pass

        def do_exit(self, _):
            raise KeyboardInterrupt
{'fraction_non_alphanumeric': 0.06798057697800629, 'fraction_numerical': 0.006855184233076264, 'mean_word_length': 2.8525852585258527, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6967742', 'n_tokens_mistral': 943, 'n_tokens_neox': 909, 'n_words': 463}