commit_new

This commit is contained in:
MarieMih 2023-10-26 19:34:03 +03:00
parent 3784fc13f6
commit 8200022240
2 changed files with 18 additions and 6 deletions

3
.gitignore vendored
View File

@ -3,6 +3,9 @@ __pycache__/
*.py[cod]
*$py.class
#visual studio
.vs/
# C extensions
*.so

View File

@ -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