<commit_before># Copyright (C) 2020 <NAME>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.

import contextlib


class MockSpawn():
    def __init__(self, ctrl, *args, **kwargs):
        self.ctrl = ctrl
        self.last_command = None
        # set some expected attributes
        self.before = None
        self.echo = False

    def sendline(self, line, *args, **kwargs):
        self.last_command = line
        if self.ctrl.output is None:
            # just echo last input for before (what replwrap is assembling<commit_msg>riotctrl_shell.tests: add missing method to MockSpawn<commit_after># Copyright (C) 2020 <NAME>
#
# This file is subject to the terms and conditions of the GNU Lesser
# General Public License v2.1. See the file LICENSE in the top level
# directory for more details.

import contextlib


class MockSpawn():
    def __init__(self, ctrl, *args, **kwargs):
        self.ctrl = ctrl
        self.last_command = None
        # set some expected attributes
        self.before = None
        self.echo = False

    def read_nonblocking(self, size=1, timeout=-1):
        # do nothing, only used to flush pexpect output
        pass

    def sendline(self, line, *args, **kwargs):
        self.last_command = line
        if self.ctrl.output is None:
            # just echo last input for before (what replwrap is assembling
{'fraction_non_alphanumeric': 0.07891156462585033, 'fraction_numerical': 0.009523809523809525, 'mean_word_length': 2.7240506329113923, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3305217', 'n_tokens_mistral': 417, 'n_tokens_neox': 401, 'n_words': 169}