Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
amit lissack committed Jan 4, 2021
1 parent 75efde6 commit 0426993
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
18 changes: 18 additions & 0 deletions robot-server/robot_server/service/session/models/command.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
"""Modeling of session commands.
Creating a new command type requires these steps:
1) Creation of a CommandDefinition enum identifying the command
type.
2) If necessary, define a data payload model.
3) If necessary, define a result payload model.
4) Create specialized `SessionCommandRequest` and `SessionCommandResponse`
types using the CommandDefinition Literal(s), data, and result payload models.
If there are no data and result models, then add the CommandDefinition to
`CommandsEmptyData` type.
5) If not using `CommandsEmptyData` then add specialized request and response
types to `RequestTypes` and `ResponseTypes`.
"""
from datetime import datetime
from enum import Enum
import typing
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
"""
Command type definitions.
Definitions should be grouped into thematic namespaces.
"""
import typing
from enum import Enum


class CommandDefinition(str, Enum):
"""The base of command definition enumerations."""
def __new__(cls, value):
"""Create a string enum."""
namespace = cls.namespace()
Expand All @@ -17,9 +23,9 @@ def __new__(cls, value):
@staticmethod
def namespace():
"""
This is primarily for allowing definitions to define a
namespace. The name space will be used to make the value of the
enum. It will be "{namespace}.{value}"
Override to create a namespoce for the member definitions. The
name.space will be used to make the value of the enum. It will
be "{namespace}.{value}"
"""
return None

Expand Down

0 comments on commit 0426993

Please sign in to comment.