Skip to content

Commit

Permalink
Replace BinaryIO with IO[bytes]
Browse files Browse the repository at this point in the history
  • Loading branch information
q0w committed Nov 10, 2021
1 parent 9210844 commit 6b6db19
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
10 changes: 5 additions & 5 deletions aiodocker/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
import json
import warnings
from typing import (
IO,
Any,
AsyncIterator,
BinaryIO,
Dict,
List,
Mapping,
Expand Down Expand Up @@ -229,7 +229,7 @@ async def delete(
)

@staticmethod
async def _stream(fileobj: BinaryIO) -> AsyncIterator[bytes]:
async def _stream(fileobj: IO[bytes]) -> AsyncIterator[bytes]:
chunk = fileobj.read(io.DEFAULT_BUFFER_SIZE)
while chunk:
yield chunk
Expand All @@ -240,7 +240,7 @@ async def build(
self,
*,
remote: str = None,
fileobj: BinaryIO = None,
fileobj: IO[bytes] = None,
path_dockerfile: str = None,
tag: str = None,
quiet: bool = False,
Expand All @@ -260,7 +260,7 @@ def build(
self,
*,
remote: str = None,
fileobj: BinaryIO = None,
fileobj: IO[bytes] = None,
path_dockerfile: str = None,
tag: str = None,
quiet: bool = False,
Expand All @@ -279,7 +279,7 @@ def build( # noqa: F811
self,
*,
remote: str = None,
fileobj: BinaryIO = None,
fileobj: IO[bytes] = None,
path_dockerfile: str = None,
tag: str = None,
quiet: bool = False,
Expand Down
14 changes: 2 additions & 12 deletions aiodocker/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@
import tarfile
import tempfile
from io import BytesIO
from typing import (
IO,
Any,
BinaryIO,
Iterable,
Mapping,
MutableMapping,
Optional,
Tuple,
Union,
)
from typing import IO, Any, Iterable, Mapping, MutableMapping, Optional, Tuple, Union


async def parse_result(response, response_type=None, *, encoding="utf-8"):
Expand Down Expand Up @@ -227,7 +217,7 @@ def clean_filters(filters: Mapping = None) -> str:
return json.dumps(filters)


def mktar_from_dockerfile(fileobject: BinaryIO) -> IO:
def mktar_from_dockerfile(fileobject: IO[bytes]) -> IO[bytes]:
"""
Create a zipped tar archive from a Dockerfile
**Remember to close the file object**
Expand Down

0 comments on commit 6b6db19

Please sign in to comment.