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[cod]
*$py.class *$py.class
#visual studio
.vs/
# C extensions # C extensions
*.so *.so

View File

@ -2,8 +2,13 @@ from dataclasses import dataclass
from typing import Optional, Collection, Any from typing import Optional, Collection, Any
from abc import abstractmethod from abc import abstractmethod
class DeviceLifecycleState: from enum import IntEnum
pass # TODO(Homework #3) from abc import ABC, abstractmethod
class DeviceLifecycleState(IntEnum):
INIT = 0
OPEN = 1
CLOSE = 2
class DevaceError(Exception): class DevaceError(Exception):
@ -33,8 +38,8 @@ class ActionDescriptor:
info: Optional[str] = None info: Optional[str] = None
class Device: class Device(ABC):
# TODO(Homework #3)
_state = DeviceLifecycleState.INIT _state = DeviceLifecycleState.INIT
@property @property
@ -44,9 +49,13 @@ class Device:
def close(self): def close(self):
self._state = DeviceLifecycleState.CLOSE self._state = DeviceLifecycleState.CLOSE
@property
@abstractmethod
def trait_descriptors(self) -> Collection[TraitDescriptor]: def trait_descriptors(self) -> Collection[TraitDescriptor]:
pass pass
@property
@abstractmethod
def action_descriptors(self) -> Collection[ActionDescriptor]: def action_descriptors(self) -> Collection[ActionDescriptor]:
pass pass