Skip to content

Commit

Permalink
#1303 Return original format
Browse files Browse the repository at this point in the history
Fix indentation
  • Loading branch information
AliaksandrDziarkach committed Oct 10, 2023
1 parent 992165a commit e0d0eed
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
4 changes: 2 additions & 2 deletions api/http/indigo_service/jsonapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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},
}
}
)
Expand Down
13 changes: 6 additions & 7 deletions api/http/indigo_service/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down

0 comments on commit e0d0eed

Please sign in to comment.