Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if field == "fix_com":
data = self._fix_com
elif field == "fix_orientation":
data = self._fix_orientation
else:
data = getattr(self, field)
# Do we add this data?
if isinstance(data, (np.ndarray, list, tuple, dict, str)) and (len(data) == 0): continue
# If we added masses for orientation, continue
if (field == "masses") and (self._custom_masses is False):
continue
if field == "geometry":
ret[field] = hash_helpers.float_prep(data, GEOMETRY_NOISE).ravel().tolist()
elif field == "fragment_charges":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE).tolist()
elif field == "charge":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE)
elif field == "masses":
ret[field] = hash_helpers.float_prep(data, MASS_NOISE).tolist()
else:
ret[field] = data
self.validate(data=ret)
return ret
if field == "fix_com":
data = self._fix_com
elif field == "fix_orientation":
data = self._fix_orientation
else:
data = getattr(self, field)
# Do we add this data?
if isinstance(data, (np.ndarray, list, tuple, dict, str)) and (len(data) == 0): continue
# If we added masses for orientation, continue
if (field == "masses") and (self._custom_masses is False):
continue
if field == "geometry":
ret[field] = hash_helpers.float_prep(data, GEOMETRY_NOISE).ravel().tolist()
elif field == "fragment_charges":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE).tolist()
elif field == "charge":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE)
elif field == "masses":
ret[field] = hash_helpers.float_prep(data, MASS_NOISE).tolist()
else:
ret[field] = data
self.validate(data=ret)
return ret
else:
data = getattr(self, field)
# Do we add this data?
if isinstance(data, (np.ndarray, list, tuple, dict, str)) and (len(data) == 0): continue
# If we added masses for orientation, continue
if (field == "masses") and (self._custom_masses is False):
continue
if field == "geometry":
ret[field] = hash_helpers.float_prep(data, GEOMETRY_NOISE).ravel().tolist()
elif field == "fragment_charges":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE).tolist()
elif field == "charge":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE)
elif field == "masses":
ret[field] = hash_helpers.float_prep(data, MASS_NOISE).tolist()
else:
ret[field] = data
self.validate(data=ret)
return ret
# Do we add this data?
if isinstance(data, (np.ndarray, list, tuple, dict, str)) and (len(data) == 0): continue
# If we added masses for orientation, continue
if (field == "masses") and (self._custom_masses is False):
continue
if field == "geometry":
ret[field] = hash_helpers.float_prep(data, GEOMETRY_NOISE).ravel().tolist()
elif field == "fragment_charges":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE).tolist()
elif field == "charge":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE)
elif field == "masses":
ret[field] = hash_helpers.float_prep(data, MASS_NOISE).tolist()
else:
ret[field] = data
self.validate(data=ret)
return ret
# Do we add this data?
if isinstance(data, (np.ndarray, list, tuple, dict, str)) and (len(data) == 0): continue
# If we added masses for orientation, continue
if (field == "masses") and (self._custom_masses is False):
continue
if field == "geometry":
ret[field] = hash_helpers.float_prep(data, GEOMETRY_NOISE).ravel().tolist()
elif field == "fragment_charges":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE).tolist()
elif field == "charge":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE)
elif field == "masses":
ret[field] = hash_helpers.float_prep(data, MASS_NOISE).tolist()
else:
ret[field] = data
self.validate(data=ret)
return ret
elif field == "fix_orientation":
data = self._fix_orientation
else:
data = getattr(self, field)
# Do we add this data?
if isinstance(data, (np.ndarray, list, tuple, dict, str)) and (len(data) == 0): continue
# If we added masses for orientation, continue
if (field == "masses") and (self._custom_masses is False):
continue
if field == "geometry":
ret[field] = hash_helpers.float_prep(data, GEOMETRY_NOISE).ravel().tolist()
elif field == "fragment_charges":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE).tolist()
elif field == "charge":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE)
elif field == "masses":
ret[field] = hash_helpers.float_prep(data, MASS_NOISE).tolist()
else:
ret[field] = data
self.validate(data=ret)
return ret
elif field == "fix_orientation":
data = self._fix_orientation
else:
data = getattr(self, field)
# Do we add this data?
if isinstance(data, (np.ndarray, list, tuple, dict, str)) and (len(data) == 0): continue
# If we added masses for orientation, continue
if (field == "masses") and (self._custom_masses is False):
continue
if field == "geometry":
ret[field] = hash_helpers.float_prep(data, GEOMETRY_NOISE).ravel().tolist()
elif field == "fragment_charges":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE).tolist()
elif field == "charge":
ret[field] = hash_helpers.float_prep(data, CHARGE_NOISE)
elif field == "masses":
ret[field] = hash_helpers.float_prep(data, MASS_NOISE).tolist()
else:
ret[field] = data
self.validate(data=ret)
return ret