From e0d0eed0a5941e9e4c85441e05a61be6e97fcd93 Mon Sep 17 00:00:00 2001 From: Aliaksandr Dziarkach <18146690+AliaksandrDziarkach@users.noreply.github.com> Date: Tue, 10 Oct 2023 14:43:24 +0300 Subject: [PATCH] #1303 Return original format Fix indentation --- api/http/indigo_service/jsonapi.py | 4 ++-- api/http/indigo_service/service.py | 13 ++++++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/api/http/indigo_service/jsonapi.py b/api/http/indigo_service/jsonapi.py index 0847195127..356ae658b3 100644 --- a/api/http/indigo_service/jsonapi.py +++ b/api/http/indigo_service/jsonapi.py @@ -188,7 +188,7 @@ class CompoundPair(GenericModel, Generic[OutputFormatT]): def make_compound_response( - value: str, compound_format: CompoundFormat, original_format: str + value: str, compound_format: CompoundFormat ) -> CompoundResponse: if compound_format == CompoundFormat.AUTO: raise RuntimeError( @@ -199,7 +199,7 @@ def make_compound_response( **{ "data": { "type": "compound", - "attributes": {"structure": value, "format": compound_format, "original_format": original_format}, + "attributes": {"structure": value, "format": compound_format}, } } ) diff --git a/api/http/indigo_service/service.py b/api/http/indigo_service/service.py index 251f93e171..d6d478c3ac 100644 --- a/api/http/indigo_service/service.py +++ b/api/http/indigo_service/service.py @@ -73,19 +73,18 @@ def to_string( if string_format == jsonapi.CompoundFormat.AUTO: string_format = jsonapi.CompoundFormat.MOLFILE - original_format = compound.getOriginalFormat() if string_format == jsonapi.CompoundFormat.SMILES: - return compound.smiles(), string_format, original_format + return compound.smiles(), string_format if string_format == jsonapi.CompoundFormat.MOLFILE: - return compound.molfile(), string_format, original_format + return compound.molfile(), string_format if string_format == jsonapi.CompoundFormat.CML: - return compound.cml(), string_format, original_format + return compound.cml(), string_format if string_format == jsonapi.CompoundFormat.SMARTS: - return compound.smarts(), string_format, original_format + return compound.smarts(), string_format if string_format == jsonapi.CompoundFormat.KET: - return compound.json(), string_format, original_format + return compound.json(), string_format if string_format == jsonapi.CompoundFormat.INCHI: - return IndigoInchi(indigo()).getInchi(compound), string_format, original_format + return IndigoInchi(indigo()).getInchi(compound), string_format raise RuntimeError(f"{string_format} is not supported")