11from dataclasses import dataclass , field
2- from typing import Optional
2+
33from pynumaflow .proto .common import metadata_pb2
44
55"""
@@ -48,7 +48,7 @@ def keys(self, group: str) -> list[str]:
4848 """
4949 return list (self ._data .get (group , {}).keys ())
5050
51- def value (self , group : str , key : str ) -> Optional [ bytes ] :
51+ def value (self , group : str , key : str ) -> bytes | None :
5252 """
5353 Returns the value for a given group and key.
5454 """
@@ -108,7 +108,7 @@ def __len__(self) -> int:
108108 """
109109 return len (self ._data )
110110
111- def value (self , group : str , key : str ) -> Optional [ bytes ] :
111+ def value (self , group : str , key : str ) -> bytes | None :
112112 """
113113 Returns the value for a given group and key.
114114 If the group or key does not exist, returns None.
@@ -124,7 +124,7 @@ def add_key(self, group: str, key: str, value: bytes):
124124 """
125125 self ._data .setdefault (group , {})[key ] = value
126126
127- def remove_key (self , group : str , key : str ) -> Optional [ bytes ] :
127+ def remove_key (self , group : str , key : str ) -> bytes | None :
128128 """
129129 Removes the key and its value for a given group and returns the value.
130130 If this key is the only key in the group, the group will be removed.
@@ -138,7 +138,7 @@ def remove_key(self, group: str, key: str) -> Optional[bytes]:
138138 self ._data [group ] = group_data
139139 return value
140140
141- def remove_group (self , group : str ) -> Optional [ dict [str , bytes ]] :
141+ def remove_group (self , group : str ) -> dict [str , bytes ] | None :
142142 """
143143 Removes the group and all its keys and values and returns the data.
144144 Returns None if the group does not exist.
0 commit comments