@@ -147,22 +147,18 @@ def _to_dict(self) -> dict[str, dict]:
147147 # some can not be uploaded, e.g., id, creator, creation_date
148148 simple_props = ["alias" , "main_entity_type" , "name" , "description" ]
149149
150- # TODO(eddiebergman): Begging for a walrus if we can drop 3.7
151150 simple_prop_values = {}
152151 for prop_name in simple_props :
153- content = getattr (self , prop_name , None )
154- if content is not None :
152+ if (content := getattr (self , prop_name , None )) is not None :
155153 simple_prop_values ["oml:" + prop_name ] = content
156154
157155 # maps from attribute name (which is used as outer tag name) to immer
158156 # tag name e.g., self.tasks -> <oml:tasks><oml:task_id>1987</oml:task_id></oml:tasks>
159157 complex_props = {"tasks" : "task_id" , "runs" : "run_id" }
160158
161- # TODO(eddiebergman): Begging for a walrus if we can drop 3.7
162159 complex_prop_values = {}
163160 for prop_name , inner_name in complex_props .items ():
164- content = getattr (self , prop_name , None )
165- if content is not None :
161+ if (content := getattr (self , prop_name , None )) is not None :
166162 complex_prop_values ["oml:" + prop_name ] = {"oml:" + inner_name : content }
167163
168164 return {
0 commit comments