From 9d07dedde9e80ea8adc7a479985ce0c5442595d1 Mon Sep 17 00:00:00 2001 From: Hao-Wei Pang Date: Thu, 12 Oct 2023 22:48:18 -0400 Subject: [PATCH] Use isinstance to type check correctly --- src/Parse.jl | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/Parse.jl b/src/Parse.jl index 0c3fd4b0..b23fee1a 100644 --- a/src/Parse.jl +++ b/src/Parse.jl @@ -166,14 +166,10 @@ export getatomdictsmiles getatomdictinchi(inchi) = getatomdictfromrdkit(Chem.AddHs(Chem.MolFromInchi(inchi))) export getatomdictinchi function getatomdictadjlist(adjlist) - try - mol = species.Species().from_adjacency_list(adjlist).molecule[1] - catch - @error("Unable to parse adjlist $adjlist") - end - if isa(mol, molecule.Molecule) + mol = species.Species().from_adjacency_list(adjlist).molecule[1] + if pybuiltin(:isinstance)(mol, molecule.Molecule) getatomdictfromrmg(mol) - elseif isa(mol, fragment.Fragment) + elseif pybuiltin(:isinstance)(mol, fragment.Fragment) mol.assign_representative_molecule() getatomdictfromrmg(mol.mol_repr) else