Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Commit

Permalink
Fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
john-cado committed Sep 20, 2024
1 parent e3c062d commit 2122d03
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions varc_core/systems/base_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import zipfile
from base64 import b64encode
from datetime import datetime
from typing import IO, Any, List, Optional, Union
from typing import Any, List, Optional, Union

import lz4.frame
import lz4.frame # type: ignore
import mss
import psutil
from tqdm import tqdm
Expand All @@ -38,22 +38,22 @@

class _TarLz4Wrapper:

def __init__(self, path) -> None:
def __init__(self, path: str) -> None:
self._lz4 = lz4.frame.open(path, 'wb')
self._tar = tarfile.open(fileobj=self._lz4, mode="w")

def writestr(self, path: str, value: Union[str, bytes]):
def writestr(self, path: str, value: Union[str, bytes]) -> None:
info = tarfile.TarInfo(path)
info.size = len(value)
self._tar.addfile(info, io.BytesIO(value if isinstance(value, bytes) else value.encode()))

def write(self, path: str, arcname: str):
def write(self, path: str, arcname: str) -> None:
self._tar.add(path, arcname)

def __enter__(self):
def __enter__(self) -> "_TarLz4Wrapper":
return self

def __exit__(self, type, value, traceback):
def __exit__(self, type: Any, value: Any, traceback: Any) -> None:
self._tar.close()
self._lz4.close()

Expand Down

0 comments on commit 2122d03

Please sign in to comment.