Skip to content

Commit 43a17a0

Browse files
committed
Fix type hint for packet, is_annexb
1 parent 21ddc60 commit 43a17a0

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

av/packet.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
from collections.abc import Buffer
12
from fractions import Fraction
2-
from typing import Buffer, Iterator
3+
from typing import Iterator
34

45
from av.subtitles.subtitle import SubtitleSet
56

@@ -22,3 +23,4 @@ class Packet(Buffer):
2223

2324
def __init__(self, input: int | bytes | None = None) -> None: ...
2425
def decode(self) -> Iterator[SubtitleSet]: ...
26+
def __buffer__(self, arg1) -> memoryview: ...

tests/test_bitstream.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
from .common import TestCase, fate_suite
66

77

8-
def is_annexb(packet: Packet) -> bool:
8+
def is_annexb(packet: Packet | bytes | None) -> bool:
9+
if packet is None:
10+
return False
11+
912
data = bytes(packet)
1013
return data[:3] == b"\0\0\x01" or data[:4] == b"\0\0\0\x01"
1114

0 commit comments

Comments
 (0)