Skip to content

Commit

Permalink
Cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Jun 21, 2018
1 parent 9446a9a commit 7c0bead
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions server_side/state.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import asyncio
from functools import wraps

from quart import copy_current_websocket_context
from model import ModelData, COUNTER_MAX
from quart import copy_current_websocket_context


def ensure_future_with_ws_ctx(coro_fun):
Expand All @@ -17,10 +17,12 @@ def wrapper(*args, **kwargs):


class State:
"""3. State function computes the State Representation from the Model property values and makes sure that everyone
who needs to "learn"" about the new application state is notified, such as the view which will display the
“state representation”.
Then computes the next-action-predicate which will invoke any automatic action, given the current application state
"""3. State function computes the State Representation from the Model values, and ensures that components which
need to learn about the new application state are notified, such as the view (which will display the
“state representation”).
Then computes the next-action-predicate which will invoke any automatic action, given the current application state.
This example contains state machine methods (pure model functions) e.g counting, ready, ... which compute additional
data from the model (to keep model simple and containing only the essential properties).
"""

def __init__(self, view, actions):
Expand Down Expand Up @@ -57,6 +59,7 @@ async def next_action_predicate(self, model):
ensure_future_with_ws_ctx(self.actions.launch)(ModelData())

async def render(self, model):
"""Render model to view and compute next action predicate"""
await self.representation(model)
await self.next_action_predicate(model)

Expand Down

0 comments on commit 7c0bead

Please sign in to comment.