Package CHEM :: Package Web :: Package cgibin :: Module Util
[hide private]
[frames] | no frames]

Module Util



Miscellaneous utility functions

Functions [hide private]
 
formatMolecularFormula(molFormula)
Convert numbers to subscripts
 
loadObjectsFromQueuesById(objectsById, objectQueuesById, neededObjectIds)
objectsById: Dictionary to be populated with (id: object) instances pulled out of the respective objectQueues from objectQueuesById objectQueuesById: The "cache" of objects, keyed by ID.
 
saveObjectsToQueuesById(objectsById, objectQueuesById)
objectsById: Dictionary of (id: object) pairs to deposit in the respective objectQueues of objectQueuesById objectQueuesById: The "cache" of objects, keyed by ID.
Variables [hide private]
  log = logging.getLogger(Const.APPLICATION_NAME)
  handler = logging.StreamHandler(sys.stderr)
  formatter = logging.Formatter(Const.LOGGER_FORMAT)
  objectCache = {}
Function Details [hide private]

loadObjectsFromQueuesById(objectsById, objectQueuesById, neededObjectIds)

 

objectsById:
    Dictionary to be populated with (id: object) instances pulled out of the
    respective objectQueues from objectQueuesById
objectQueuesById:
    The "cache" of objects, keyed by ID.  Actually store a Queue of possibly multiple objects
    for each ID, and just retrieve the first available to store in objectsById.
neededObjectIds:
    Set of IDs of the objects to look for and load from the objectQueues
return:
    Returns the set of "newObjectIds."  That is, the IDs of objects which were needed but were NOT
    found to be available in the objectQueues.  Thus, caller will have to make own arrangements
    to fill in these blanks.

saveObjectsToQueuesById(objectsById, objectQueuesById)

 

objectsById:
    Dictionary of (id: object) pairs to deposit in the 
    respective objectQueues of objectQueuesById
objectQueuesById:
    The "cache" of objects, keyed by ID.  Actually store a Queue of possibly multiple objects
    for each ID, and just add any available in objectsById.