@@ -65,30 +65,27 @@ def __repr__(self):
65
65
return f"{ self .value } "
66
66
67
67
def __contains__ (self , key ):
68
- if isinstance (self .value , dict ):
69
- return key in self ._value
70
- return False
71
-
72
- @property
73
- def initialized (self ):
74
- if isinstance (self .value , dict ):
75
- for r in self .value .values ():
76
- if not r .initialized : return False
77
- return self .value is not None
68
+ return isinstance (self .value , dict ) and key in self ._value
78
69
79
70
@property
80
71
def updated (self ):
81
72
if isinstance (self .value , dict ):
82
- for r in self .value .values ():
83
- if r ._updated : return True
73
+ return any (r ._updated for r in self .value .values ())
84
74
return self ._updated
85
75
86
76
@updated .setter
87
77
def updated (self , value ):
88
78
if isinstance (self .value , dict ):
89
- for r in self .value .values (): r ._updated = value
79
+ for r in self .value .values ():
80
+ r ._updated = value
90
81
self ._updated = value
91
82
83
+ @property
84
+ def initialized (self ):
85
+ if isinstance (self .value , dict ):
86
+ return all (r .initialized for r in self .value .values ())
87
+ return self .value is not None
88
+
92
89
@SenmlRecord .value .setter
93
90
def value (self , value ):
94
91
if value is not None :
@@ -127,7 +124,7 @@ def add_to_pack(self, pack):
127
124
if isinstance (self .value , dict ):
128
125
for r in self .value .values ():
129
126
# NOTE: should filter by updated when it's supported.
130
- if r .value is not None :
127
+ if r .value is not None : # and r.updated
131
128
pack .add (r )
132
129
else :
133
130
pack .add (self )
0 commit comments