commit_new
This commit is contained in:
parent
3784fc13f6
commit
8200022240
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,6 +3,9 @@ __pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
#visual studio
|
||||
.vs/
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
|
@ -2,8 +2,13 @@ from dataclasses import dataclass
|
||||
from typing import Optional, Collection, Any
|
||||
from abc import abstractmethod
|
||||
|
||||
class DeviceLifecycleState:
|
||||
pass # TODO(Homework #3)
|
||||
from enum import IntEnum
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class DeviceLifecycleState(IntEnum):
|
||||
INIT = 0
|
||||
OPEN = 1
|
||||
CLOSE = 2
|
||||
|
||||
|
||||
class DevaceError(Exception):
|
||||
@ -33,8 +38,8 @@ class ActionDescriptor:
|
||||
info: Optional[str] = None
|
||||
|
||||
|
||||
class Device:
|
||||
# TODO(Homework #3)
|
||||
class Device(ABC):
|
||||
|
||||
_state = DeviceLifecycleState.INIT
|
||||
|
||||
@property
|
||||
@ -44,9 +49,13 @@ class Device:
|
||||
def close(self):
|
||||
self._state = DeviceLifecycleState.CLOSE
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def trait_descriptors(self) -> Collection[TraitDescriptor]:
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def action_descriptors(self) -> Collection[ActionDescriptor]:
|
||||
pass
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user