@@ -22,9 +22,12 @@ def __init__(
2222 if map is None :
2323 map = c_void_p ()
2424 owner = True
25- status = get_fxnc ().FXNValueCreateValueMap (byref (map ))
25+ status = get_fxnc ().FXNValueMapCreate (byref (map ))
2626 if status != FXNStatus .OK :
27- raise RuntimeError (f"Failed to create value map with error: { status_to_error (status )} " )
27+ raise RuntimeError (
28+ f"Failed to create value map "
29+ f"with error: { status_to_error (status )} "
30+ )
2831 self .__map = map
2932 self .__owner = owner
3033
@@ -39,7 +42,10 @@ def key(self, index: int) -> str:
3942 if status == FXNStatus .OK :
4043 return buffer .value .decode ("utf-8" )
4144 else :
42- raise RuntimeError (f"Failed to get value map key at index { index } with error: { status_to_error (status )} " )
45+ raise RuntimeError (
46+ f"Failed to get value map key at index { index } "
47+ f"with error: { status_to_error (status )} "
48+ )
4349
4450 def __getitem__ (self , key : str ) -> Value | None :
4551 value = c_void_p ()
@@ -48,10 +54,12 @@ def __getitem__(self, key: str) -> Value | None:
4854 key .encode (),
4955 byref (value )
5056 )
51- if status == FXNStatus .OK :
52- return Value (value , owner = False )
53- else :
54- raise RuntimeError (f"Failed to get value map value for key '{ key } ' with error: { status_to_error (status )} " )
57+ if status != FXNStatus .OK :
58+ raise RuntimeError (
59+ f"Failed to get value map value for key '{ key } ' "
60+ f"with error: { status_to_error (status )} "
61+ )
62+ return Value (value , owner = False )
5563
5664 def __setitem__ (
5765 self ,
@@ -64,7 +72,10 @@ def __setitem__(
6472 value ._Value__value
6573 )
6674 if status != FXNStatus .OK :
67- raise RuntimeError (f"Failed to set value map value for key '{ key } ' with error: { status_to_error (status )} " )
75+ raise RuntimeError (
76+ f"Failed to set value map value for key '{ key } ' "
77+ f"with error: { status_to_error (status )} "
78+ )
6879
6980 def __len__ (self ) -> int :
7081 count = c_int32 ()
@@ -82,7 +93,7 @@ def __exit__(self, exc_type, exc_value, traceback):
8293
8394 def __release (self ):
8495 if self .__map and self .__owner :
85- get_fxnc ().FXNValueRelease (self .__map )
96+ get_fxnc ().FXNValueMapRelease (self .__map )
8697 self .__map = None
8798
8899 @classmethod
0 commit comments