Skip to content

Commit 0117a78

Browse files
committed
Explicitly say _pybind_ops is a module type
1 parent 7741ae4 commit 0117a78

File tree

1 file changed

+3
-1
lines changed
  • src/torchcodec/decoders/_core

1 file changed

+3
-1
lines changed

src/torchcodec/decoders/_core/ops.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import io
99
import json
1010
import warnings
11+
from types import ModuleType
1112
from typing import List, Optional, Tuple
1213

1314
import torch
@@ -17,7 +18,7 @@
1718
_get_extension_path,
1819
)
1920

20-
_pybind_ops = None
21+
_pybind_ops: Optional[ModuleType] = None
2122

2223

2324
def load_torchcodec_extension():
@@ -130,6 +131,7 @@ def create_from_bytes(
130131
def create_from_file_like(
131132
file_like: io.RawIOBase, seek_mode: Optional[str] = None
132133
) -> torch.Tensor:
134+
assert _pybind_ops is not None
133135
return _convert_to_tensor(_pybind_ops.create_from_file_like(file_like, seek_mode))
134136

135137

0 commit comments

Comments
 (0)