Skip to content

Commit 5d1f6c5

Browse files
committed
add types to test/utils.py
1 parent 51814a9 commit 5d1f6c5

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

test/utils.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import zipfile
3333
from pathlib import Path
3434
from types import TracebackType
35-
from typing import Callable, Optional, ParamSpec, TypeVar
35+
from typing import Any, Callable, Optional, ParamSpec, TypeVar
3636

3737
# Requirements
3838
import pytest
@@ -75,16 +75,21 @@
7575
)
7676

7777

78-
def gen_blob_sha1(data):
78+
def gen_blob_sha1(data: bytes) -> str:
7979
# http://stackoverflow.com/questions/552659/assigning-git-sha1s-without-git
8080
m = hashlib.sha1()
8181
m.update(f'blob {len(data)}\0'.encode())
8282
m.update(data)
8383
return m.hexdigest()
8484

8585

86-
def force_rm_handle(remove_path, path, excinfo):
87-
path = Path(path)
86+
def force_rm_handle(
87+
# Callable[..., Any], str, , object
88+
remove_path: Callable[..., Any],
89+
path_str: str,
90+
excinfo: tuple[type[BaseException], BaseException, TracebackType],
91+
) -> None:
92+
path = Path(path_str)
8893
path.chmod(path.stat().st_mode | stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
8994
remove_path(path)
9095

0 commit comments

Comments
 (0)