new typing style

This commit is contained in:
Maxim Devaev
2022-09-04 18:08:40 +03:00
parent 4b75221e94
commit ee3e224e39
129 changed files with 593 additions and 941 deletions

View File

@@ -27,7 +27,6 @@ import struct
import dataclasses
from typing import IO
from typing import Optional
from .... import aiotools
from .... import aiofs
@@ -57,7 +56,7 @@ class ImageInfo:
complete: bool
@classmethod
def from_bytes(cls, data: bytes) -> Optional["ImageInfo"]:
def from_bytes(cls, data: bytes) -> ("ImageInfo" | None):
try:
parsed = list(struct.unpack(_IMAGE_INFO_FORMAT, data))
except struct.error:
@@ -97,7 +96,7 @@ class DeviceInfo:
path: str
size: int
free: int
image: Optional[ImageInfo]
image: (ImageInfo | None)
@classmethod
async def read(cls, device_path: str) -> "DeviceInfo":