Skip to content

Commit

Permalink
more _FutureGroup typing
Browse files Browse the repository at this point in the history
  • Loading branch information
bchess committed Apr 26, 2024
1 parent a55e119 commit f200987
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tensorizer/_futuregroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class _FutureGroup:
def __init__(self, futures: Sequence[concurrent.futures.Future]):
def __init__(self, futures): # type: (Sequence[_Future]) -> None
self.futures = futures

def cancel(self) -> bool:
Expand Down
8 changes: 4 additions & 4 deletions tensorizer/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -4201,7 +4201,7 @@ def _prepare_for_write_opaque(
w.set_min_file_version_number(OPAQUE_TENSORIZER_VERSION)

@staticmethod
def _do_clone(write_spec, dependency: Optional[concurrent.futures.Future]):
def _do_clone(write_spec, dependency: Optional[_Future]):
if dependency is not None:
dependency.result(_TIMEOUT)
write_spec.tensor = write_spec.tensor.clone().detach()
Expand Down Expand Up @@ -4234,7 +4234,7 @@ def _prepare_for_write_encryption(
]
)

clone_tasks = []
clone_tasks: List[_Future] = []
for w in shared_write_specs[1:]:
clone_tasks.append(
self._computation_pool.submit(
Expand Down Expand Up @@ -4401,7 +4401,7 @@ def compute_sha256(
for w in write_specs:
old_tensor_data_task = w.tensor_data_task

hash_tasks = []
hash_tasks: List[_Future] = []
if w.include_crc32:
crc32_task = self._computation_pool.submit(
compute_crc32, w, old_tensor_data_task
Expand All @@ -4418,7 +4418,7 @@ def compute_sha256(
self._jobs.extend(hash_tasks)

def _do_encryption(self, write_specs: Sequence[_WriteSpec]) -> None:
def encrypt(write_spec, dependency: _Future):
def encrypt(write_spec, dependency: Optional[_Future]):
if dependency is not None:
dependency.result(_TIMEOUT)
try:
Expand Down

0 comments on commit f200987

Please sign in to comment.