mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 00:57:33 +08:00
polish code with new pre-commit rule (#2923)
This commit is contained in:
@@ -15,30 +15,25 @@
|
||||
"""
|
||||
|
||||
from abc import ABC, abstractmethod
|
||||
from collections import defaultdict
|
||||
from collections.abc import Sequence
|
||||
from pathlib import Path
|
||||
from typing import (TYPE_CHECKING, Any, Callable, Generic, NamedTuple,
|
||||
Optional, TypeVar, Union)
|
||||
|
||||
from typing import Generic, TypeVar
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
|
||||
class MediaIO(ABC, Generic[_T]):
|
||||
|
||||
@abstractmethod
|
||||
def load_bytes(self, data: bytes) -> _T:
|
||||
"""
|
||||
将字节数据加载为对象,并返回该对象。
|
||||
如果加载失败,则抛出异常。
|
||||
|
||||
|
||||
Args:
|
||||
data (bytes): 要加载的字节数据。
|
||||
|
||||
|
||||
Raises:
|
||||
NotImplementedError: 当前类未实现此方法。
|
||||
|
||||
|
||||
Returns:
|
||||
_T: 加载后的对象。
|
||||
"""
|
||||
@@ -56,13 +51,13 @@ class MediaIO(ABC, Generic[_T]):
|
||||
def load_file(self, filepath: Path) -> _T:
|
||||
"""
|
||||
加载文件,返回解析后的数据。
|
||||
|
||||
|
||||
Args:
|
||||
filepath (Path): 文件路径,必须是一个绝对路径。
|
||||
|
||||
|
||||
Raises:
|
||||
NotImplementedError: 当前方法未被实现。
|
||||
|
||||
|
||||
Returns:
|
||||
_T: 任意类型,表示解析后的数据。
|
||||
"""
|
||||
|
Reference in New Issue
Block a user