from indigo_inchi import IndigoInchi from indigo_renderer import IndigoRenderer from .common.util import highlight from .validation import IndigoRendererSchema, IndigoRequestSchema, IndigoAutomapSchema, IndigoCheckSchema, IndigoCalculateSchema from math import sqrt from threading import local import base64 import config tls = local() indigo_api = Blueprint('indigo_api', __name__) indigo_api.indigo_defaults = { 'ignore-stereochemistry-errors': 'true', 'smart-layout': 'true', 'gross-formula-add-rsites': 'true', 'mass-skip-error-on-pseudoatoms': 'false', } indigo_api_logger = logging.getLogger('indigo') LOG_MAX_SYMBOLS = 50 def get_shorten_text(intext): if len(intext) < LOG_MAX_SYMBOLS: return intext return "{} ...".format(intext.strip().ljust(LOG_MAX_SYMBOLS)[:LOG_MAX_SYMBOLS]) def LOG_DATA(*args): format_shorten = []