This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class Assignment: | |
def matches(self, expression): | |
''' | |
>>> assignment = Assignment() | |
>>> assignment.matches('a=5') | |
True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
class InputError(Exception): | |
pass | |
class MatchError(Exception): | |
pass | |
class OutputError(Exception): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Help: | |
aliases = 'help' | |
priority = 'low' | |
def execute(self, commands): | |
''' | |
>>> from mock import Mock | |
>>> clean = Mock() | |
>>> clean.aliases = 'clean' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def test_eliza(self): | |
scenario = ''' | |
>>> a = 5 | |
>>> a | |
5 | |
>>> eliza | |
... | |
>>> a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
class InputError(Exception): | |
pass | |
class MatchError(Exception): | |
pass | |
class OutputError(Exception): | |
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
def test_eliza(self): | |
scenario = ''' | |
>>> a = 5 | |
>>> a | |
5 | |
>>> eliza | |
Hello. How are you feeling today? | |
>>> a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyeliza | |
class Eliza: | |
aliases = 'eliza' | |
description = 'Virtual therapist' | |
_therapist = pyeliza.eliza() | |
def execute(self, expression, context): | |
''' | |
>>> from mock import Mock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
class Context: | |
owner = None | |
def claim_for(self, owner): | |
self.owner = owner | |
def release(self): | |
self.owner = None |