@@ -121,26 +121,26 @@ def convert_python_to_numpy(
121121 dataset [component ] = initialize_array (data_type , component , len (objects ))
122122
123123 for i , obj in enumerate (objects ):
124- # As each object is a separate dictionary, and the properties may differ per object, we need to check
125- # all properties . Non-existing properties
126- for prop , value in obj .items ():
127- if prop == "extra" :
128- # The "extra" property is a special one. It can store any type of information associated with
124+ # As each object is a separate dictionary, and the attributes may differ per object, we need to check
125+ # all attributes . Non-existing attributes
126+ for attribute , value in obj .items ():
127+ if attribute == "extra" :
128+ # The "extra" attribute is a special one. It can store any type of information associated with
129129 # an object, but it will not be used in the calculations. Therefore it is not included in the
130- # numpy array, so we can skip this property
130+ # numpy array, so we can skip this attribute
131131 continue
132132
133- if prop not in dataset [component ].dtype .names :
134- # If a property doen't exist, the user made a mistake. Let's be merciless in that case,
133+ if attribute not in dataset [component ].dtype .names :
134+ # If a attribute doen't exist, the user made a mistake. Let's be merciless in that case,
135135 # for their own good.
136- raise ValueError (f"Invalid property '{ prop } ' for { component } { data_type } data." )
136+ raise ValueError (f"Invalid attribute '{ attribute } ' for { component } { data_type } data." )
137137
138138 # Now just assign the value and raise an error if the value cannot be stored in the specific
139- # numpy array data format for this property .
139+ # numpy array data format for this attribute .
140140 try :
141- dataset [component ][i ][prop ] = value
141+ dataset [component ][i ][attribute ] = value
142142 except ValueError as ex :
143- raise ValueError (f"Invalid '{ prop } ' value for { component } { data_type } data: { ex } " ) from ex
143+ raise ValueError (f"Invalid '{ attribute } ' value for { component } { data_type } data: { ex } " ) from ex
144144 return dataset
145145
146146
@@ -226,11 +226,11 @@ def convert_numpy_to_python(
226226 if not isinstance (example_data , np .ndarray ) or example_data .ndim != 1 :
227227 raise ValueError ("Invalid data format" )
228228
229- # Convert each numpy array to a list of objects, which contains only the non-NaN properties :
229+ # Convert each numpy array to a list of objects, which contains only the non-NaN attributes :
230230 # For example: {"node": [{"id": 0, ...}, {"id": 1, ...}], "line": [{"id": 2, ...}]}
231231 return {
232232 component : [
233- {property : obj [property ].tolist () for property in objects .dtype .names if not is_nan (obj [property ])}
233+ {attribute : obj [attribute ].tolist () for attribute in objects .dtype .names if not is_nan (obj [attribute ])}
234234 for obj in objects
235235 ]
236236 for component , objects in data .items ()
0 commit comments