mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-12-22 02:30:44 -06:00
chore: fix some typingish
This commit is contained in:
parent
7b5d4adb7e
commit
837dbb3e41
1 changed files with 5 additions and 4 deletions
|
@ -42,6 +42,7 @@ from types import TracebackType
|
||||||
from typing import (
|
from typing import (
|
||||||
Any,
|
Any,
|
||||||
Dict,
|
Dict,
|
||||||
|
Generator,
|
||||||
List,
|
List,
|
||||||
NoReturn,
|
NoReturn,
|
||||||
Optional,
|
Optional,
|
||||||
|
@ -55,7 +56,7 @@ from typing import (
|
||||||
from urllib.error import HTTPError
|
from urllib.error import HTTPError
|
||||||
from urllib.request import urlopen
|
from urllib.request import urlopen
|
||||||
|
|
||||||
__version__ = "23.8a3-16-gcbef848-dev"
|
__version__ = "23.8a3-17-g7b5d4ad-dev"
|
||||||
|
|
||||||
|
|
||||||
class Spinner:
|
class Spinner:
|
||||||
|
@ -956,7 +957,7 @@ class ViVenv:
|
||||||
return len([f for f in self.meta.files if Path(f).is_file()]) == 0
|
return len([f for f in self.meta.files if Path(f).is_file()]) == 0
|
||||||
|
|
||||||
def get_size(self) -> None:
|
def get_size(self) -> None:
|
||||||
size = sum(p.stat().st_size for p in Path(self.path).rglob("*"))
|
size = float(sum(p.stat().st_size for p in Path(self.path).rglob("*")))
|
||||||
for unit in ("B", "K", "M", "G", "T"):
|
for unit in ("B", "K", "M", "G", "T"):
|
||||||
if size < 1024:
|
if size < 1024:
|
||||||
break
|
break
|
||||||
|
@ -965,7 +966,7 @@ class ViVenv:
|
||||||
self.size = f"{size:.1f}{unit}B"
|
self.size = f"{size:.1f}{unit}B"
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
def use(self, keep: bool = True) -> None:
|
def use(self, keep: bool = True) -> Generator[None, None, None]:
|
||||||
run_mode = Env().viv_run_mode
|
run_mode = Env().viv_run_mode
|
||||||
_path = self.path
|
_path = self.path
|
||||||
try:
|
try:
|
||||||
|
@ -1161,7 +1162,7 @@ def uses_viv(txt: str) -> bool:
|
||||||
DEPENDENCY_BLOCK_MARKER = r"(?i)^#\s+script\s+dependencies:\s*$"
|
DEPENDENCY_BLOCK_MARKER = r"(?i)^#\s+script\s+dependencies:\s*$"
|
||||||
|
|
||||||
|
|
||||||
def read_dependency_block(txt: str) -> List[str]:
|
def read_dependency_block(txt: str) -> Generator[str, None, None]:
|
||||||
lines = iter(txt.splitlines())
|
lines = iter(txt.splitlines())
|
||||||
for line in lines:
|
for line in lines:
|
||||||
if re.match(DEPENDENCY_BLOCK_MARKER, line):
|
if re.match(DEPENDENCY_BLOCK_MARKER, line):
|
||||||
|
|
Loading…
Reference in a new issue