Skip to content

Commit

Permalink
update: IFrameProcessor의 ready, live 구현을 메서드로 변경*
Browse files Browse the repository at this point in the history
- 기존 프로퍼티는 유지
- 내부 구현을 별도 추상 메서드로 구현
- 프로퍼터 상에서 assert로 타입 체크 추가
  • Loading branch information
404Vector committed Nov 22, 2023
1 parent 39f7595 commit b82c528
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
4 changes: 2 additions & 2 deletions v2v/_null_frame_processor_.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ async def __call__(self, input_data: FrameData) -> FrameData:
self._ready = True
return output_data

def live(self) -> bool:
def _get_live(self) -> bool:
return True

def ready(self) -> bool:
def _get_ready(self) -> bool:
return self._ready


Expand Down
19 changes: 15 additions & 4 deletions v2v/interface/_i_frame_processor_.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,30 @@ def __init__(self) -> None:
async def __call__(self, input_data: IT) -> OT:
...

@abstractmethod
def _get_ready(self) -> bool:
...

@abstractmethod
def _get_live(self) -> bool:
...

@property
def id(self):
assert self._id is not None
return self._id

@property
@abstractmethod
def live(self) -> bool:
...
__val = self._get_live()
assert type(__val) is bool
return __val

@property
@abstractmethod
def ready(self) -> bool:
...
__val = self._get_ready()
assert type(__val) is bool
return __val


__all__ = [IFrameProcessor.__name__]

0 comments on commit b82c528

Please sign in to comment.