added null machine to standard lib

This commit is contained in:
Peter Boin 2017-08-06 18:50:11 +10:00
parent 14b7541ec2
commit 1f3cc5a17d
2 changed files with 19 additions and 3 deletions

View File

@ -24,7 +24,10 @@ __copyright__ = "Copyright (c) 2017 {0}".format(__author__)
# =========================== Imports ===========================
__all__ = [
# Machine
'Machine', 'Position', 'CoordinateSystem', 'State', 'Mode',
'Machine', 'State', 'Mode',
'NullMachine', 'NullState', 'NullMode',
'Position', 'CoordinateSystem',
# Line
'Line',
# Block
@ -165,8 +168,8 @@ __all__ = [
# Machine
from .machine import (
Position, CoordinateSystem,
State, Mode,
Machine,
Machine, State, Mode,
NullMachine, NullState, NullMode,
)
# Line

View File

@ -503,3 +503,16 @@ class Machine(object):
new_pos = self.pos
new_pos.update(**coords) # only change given coordinates
self.pos = new_pos
# Null Machine
# A machine that presumes nothing
class NullMode(Mode):
default_mode = ''
class NullState(State):
pass # no change (yet)
class NullMachine(Machine):
MODE_CLASS = NullMode
STATE_CLASS = NullState