Skip to content

Commit 4836c6d

Browse files
committed
Implement keys, values, items interface
Signed-off-by: Cristian Le <cristian.le@mpsd.mpg.de>
1 parent fa5448d commit 4836c6d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

fmf/base.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
import re
88
import subprocess
99
import sys
10-
from collections.abc import Generator, Iterator, Mapping
10+
from collections.abc import (Generator, ItemsView, Iterator, KeysView, Mapping,
11+
ValuesView)
1112
from io import open
1213
from pprint import pformat as pretty
1314
# TODO: py3.10: typing.Optional, typing.Union -> '|' operator
@@ -886,6 +887,15 @@ def __contains__(self, item: str) -> bool:
886887
else:
887888
return item in self.data
888889

890+
def keys(self) -> KeysView[str]:
891+
return self.data.keys()
892+
893+
def values(self) -> ValuesView[DataType]:
894+
return self.data.values()
895+
896+
def items(self) -> ItemsView[str, DataType]:
897+
return self.data.items()
898+
889899
def __fspath__(self) -> str:
890900
path = self.name
891901
parent = self.parent

0 commit comments

Comments
 (0)