.. _py-Config: ********************************************************** Config ********************************************************** .. default-domain:: py .. py:currentmodule:: mod .. cpp:namespace:: mod .. class:: LabelType Selector for which type of label to use in algorithms. .. attribute:: String Vertices and edges are considered to be labelled with character strings. If only first-order terms are present, then strings are generated as a serialisation of the term. .. attribute:: Term Vertices and edges are considered to be labelled with first-order terms. If only strings are present, then first-order terms are generated by parsing the strings. This may result in an :class:`TermParsingError` if a string can not be parsed. .. class:: LabelRelation Selector for which type of labelled morphism to use in an algorithm. For strings they are all defined to be equivalent to string equality. .. attribute:: Isomorphism Terms are considered isomorphic when their most general unifier is a renaming. .. attribute:: Specialisation A term :math:`t_2` is more special than, or isomorphic to, a term :math:`t_1` if there is a substitution which can be applied to :math: `t_1` to make the terms equal. This relation means that the right-hand side of a comparison is the more specialised term. .. attribute:: Unification Terms unify if a most general unifier (MGU) exists. The found MGU is used for substitution in some algorithms. .. class:: LabelSettings A group label settings commonly used together in algorithms. .. method:: __init__(type, relation) __init__(type, relation, stereoRelation) __init__(type, relation, withStereo, stereoRelation) Construct label settings that only uses at least the vertex and edge labels. If ``stereoRelation`` is given but ``withStereo`` is not, then ``withStereo`` defaults to ``True``. :param LabelType type: How to interpret labels. :param LabelRelation relation: The relation that should hold in morphisms between two labels. :param bool withStereo: A flag to specify if stereo information should be included. Defaults to ``False``, unless ``stereoRelation`` is given, then ``True``. :param LabelRelation stereoRelation: The relation that should hold in morphisms between stereo data. Defaults to :class:`LabelRelation.Isomorphism`, but is only used when ``withStereo`` is ``True``. .. attribute:: type :type: LabelType .. attribute:: relation :type: LabelRelation .. attribute:: withStereo :type: bool .. attribute:: stereoRelation :type: LabelRelation .. class:: IsomorphismPolicy For some functions there is a choice of how to handle given arguments where two different objects may be isomorphic. Most notably the case is with graphs (:class:`Graph`). .. attribute:: Check Objects are checked for isomorphism as needed and exceptions are thrown when different objects are isomorphic. If in doubt, use this. .. attribute:: TrustMe No checks are performed and the function trusts the caller to have performed the equivalent isomorphism checks. Only use this when you are completely sure that no exceptions would have been thrown if using :attr:`Check`. .. warning:: Generally the library has undefined behaviour if you use this option but an exception would have been thrown with :attr:`Check`. .. class:: SmilesClassPolicy When loading SMILES strings, the class labels can be recorded and mapped into the corresponding vertices of the loaded graph. This policy dictates what should happen when the same class label is written on multiple atoms. .. attribute:: AllOrNone If a class label is duplicated, then no labels are mapped to vertices. .. attribute:: ThrowOnDuplicate If a class label is duplicated, throw a :class:`InputError`. .. attribute:: MapUnique Map all class labels that are unique to vertices. .. class:: Action Utility enum for deciding what to do in certain cases. .. attribute:: Error Abort the function and produce an error message, e.g., through and exception. .. attribute:: Warn Write a warning, but otherwise do as if it was `Ignore`. .. attribute:: Ignore Ignore the case. The function taking the action as argument should describe what this means. .. class:: MDLOptions An aggregation of options for the various loading functions for MDL formats. Generally each option is defaulted to follow the specification of the formats, unless it is harmless to deviate (e.g., relaxed white-space parsing). .. attribute:: addHydrogens = True Use the MDL valence model to add hydrogens to atoms with default valence, or disable all hydrogen addition. :type: bool .. attribute:: allowAbstract = False Allow non-standard atom symbols. The standard symbols are the element symbols and those specifying wildcard atoms. :type: bool .. attribute:: applyV2000AtomAliases = True In MOL V2000 CTAB blocks, replace atom labels by their aliases. After application, the atom is considered abstract without errors, and hydrogen addition is suppressed. :type: bool .. attribute:: Action onPatternIsotope = Action::Error Action onPatternCharge = Action::Error; Action onPatternRadical = Action::Error; What to do when an atom with symbol ``*`` has an isotope, charge, or radical. ``Action.Ignore`` means assuming the isotope, charge, or radical was not there. .. attribute:: onImplicitValenceOnAbstract = Action.Error What to do when ``addHydrogens and allowAbstract`` and an abstract atom is encountered with implicit valence. ``Action.Ignore`` means adding no hydrogens. :type: Action .. attribute:: onV2000UnhandledProperty = Action.Warn What to do when a property line in a V2000 MOL file is not recognized. ``Action.Ignore`` means simply ignoring that particular line. :type: Action .. attribute:: fullyIgnoreV2000UnhandledKnownProperty = False Warnings are usually stored as "loading warnings", even when they are ignored as during parsing. Setting this to ``True`` will act as if ``onV2000UnhandledProperty = Actions::Ignore`` and skip the storage, but only for a pre-defined known subset of properties. :type: bool .. attribute:: onV3000UnhandledAtomProperty = Action.Warn What to do when a property in atom line in a V3000 MOL file is not recognized. ``Action.Ignore`` means simply ignoring that particular property. :type: Action .. attribute:: onV2000Charge4 = Action.Warn What to do when an atom in a V2000 MOL file has the charge 4 (doublet radical). :type: Action .. attribute:: onV2000AbstractISO = Action.Warn What to do when an abstract atom in a V2000 MOL file has a non-default ISO or mass difference value. :type: Action .. attribute:: onRAD1 = Action.Error onRAD3 = Action.Error onRAD4 = Action.Error onRAD5 = Action.Error onRAD6 = Action.Error What to do when an atom has assigned the indicated radical state. ``Action.Ignore`` means pretending the atom has no radical state assigned. :type: Action .. attribute:: onUnsupportedQueryBondType = Action.Error What to do when a bond type 5, 6, or 7 are encountered (constrained query bond types). ``Action.Ignore`` means assigning a term variable, as if the type was 8. :type: Action .. class:: Config This class contains a range of inner classes of config settings. See :doc:`the libMØD documentation`. .. data:: config This variable is initialised to the return value of :func:`getConfig`, i.e., just use this instead of the method. .. method:: getConfig() :returns: the singleton :cpp:class:`Config` instance used by the library.