Package schrodinger :: Package structutils :: Module smilesfilter :: Class SmilesErrorHandler
[hide private]
[frames] | no frames]

Class SmilesErrorHandler

A class that acts as an error handler for cases where SMILES generation fails. It is used as a callable that takes arguments of (index, struct, exception).

Instance Methods [hide private]
 
__init__(self, logger, struct_writer=None, message=None)
Parameters
 
__call__(self, index, struct, exception)
This logs the message to the object's 'logger' attribute and appends the structure to the object's 'struct_writer', which can be anything with an append method.
Method Details [hide private]

__init__(self, logger, struct_writer=None, message=None)
(Constructor)

 

Parameters

logger (logging.Logger)
    The logger instance that will be used to output messages.

struct_writer (obj with append method)
    An instance that will log structures that have errors. Any
    instance with an append method (such as a StructureWriter or
    list) can be used.

message (str)
    The message to use as the logging template. It should have
    format conversion specifiers for (index, structure title,
    exception) (types of int, str, exception).