Skip to content

Instantly share code, notes, and snippets.

View bebraw's full-sized avatar

Juho Vepsäläinen bebraw

View GitHub Profile
import re
class Assignment:
def matches(self, expression):
'''
>>> assignment = Assignment()
>>> assignment.matches('a=5')
True
from collections import deque
class InputError(Exception):
pass
class MatchError(Exception):
pass
class OutputError(Exception):
pass
from file import PluginDirectory
from interpreter import Interpreter
from plugin_loader import PluginLoader
class Application:
def run(self):
plugin_loader = PluginLoader()
plugin_directory = PluginDirectory()
commands = plugin_loader.load(plugin_directory)
class Help:
aliases = 'help'
priority = 'low'
def execute(self, commands):
'''
>>> from mock import Mock
>>> clean = Mock()
>>> clean.aliases = 'clean'
from file import PluginDirectory
from interpreter import Interpreter
from plugin_loader import PluginLoader
class Application:
def run(self):
plugin_loader = PluginLoader()
plugin_directory = PluginDirectory()
commands = plugin_loader.load(plugin_directory)
...
def test_eliza(self):
scenario = '''
>>> a = 5
>>> a
5
>>> eliza
...
>>> a
from collections import deque
class InputError(Exception):
pass
class MatchError(Exception):
pass
class OutputError(Exception):
pass
...
def test_eliza(self):
scenario = '''
>>> a = 5
>>> a
5
>>> eliza
Hello. How are you feeling today?
>>> a
import pyeliza
class Eliza:
aliases = 'eliza'
description = 'Virtual therapist'
_therapist = pyeliza.eliza()
def execute(self, expression, context):
'''
>>> from mock import Mock
import inspect
class Context:
owner = None
def claim_for(self, owner):
self.owner = owner
def release(self):
self.owner = None