Skip to content

Commit 3d45d47

Browse files
laggykillerWyattBlue
authored andcommitted
Implement keys() method in av.dictionary.Dictionary to allow calling dict() on it
1 parent 99087dd commit 3d45d47

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

av/dictionary.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ def __iter__(self):
4242
def __repr__(self):
4343
return f"av.Dictionary({dict(self)!r})"
4444

45+
def keys(self):
46+
return list(self)
47+
4548
def copy(self):
4649
other: Dictionary = Dictionary()
4750
lib.av_dict_copy(cython.address(other.ptr), self.ptr, 0)

av/dictionary.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Dictionary:
77
def __len__(self) -> int: ...
88
def __iter__(self) -> Iterator[str]: ...
99
def __repr__(self) -> str: ...
10+
def keys(self) -> Iterable[str]: ...
1011
def copy(self) -> Dictionary: ...
1112
def pop(self, key: str) -> str: ...
1213
def update(

0 commit comments

Comments
 (0)