Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
else:
# Convert structure/bs/dos dicts to objects (robust already)
if isinstance(type_tester, (dict, str)):
logger.info(
self._log_prefix.capitalize()
+ "{} detected as string or dict. Attempting "
"conversion to {} objects..."
"".format(featurizer_type, featurizer_type)
)
if isinstance(type_tester, str):
raise ValueError(
"{} column is type {}. Cannot convert."
"".format(featurizer_type, type(type_tester))
)
dto = DictToObject(
overwrite_data=True, target_col_id=featurizer_type
)
dto.set_n_jobs(self.n_jobs)
df = dto.featurize_dataframe(df, featurizer_type, inplace=False)
# Decorate with oxidstates
if featurizer_type == self.structure_col and self.guess_oxistates:
logger.info(
self._log_prefix
+ "Guessing oxidation states of structures if they were "
"not present in input."
)
sto = StructureToOxidStructure(
target_col_id=featurizer_type,
overwrite_data=True,
return_original_on_error=True,