rxnutils.routes.utils package

Submodules

rxnutils.routes.utils.validation module

Module containing routes to validate AiZynthFinder-like input dictionaries

class rxnutils.routes.utils.validation.ReactionNode(**data)

Bases: BaseModel

Node representing a reaction

Parameters:

data (Any)

type: Annotated[str, StringConstraints(pattern='^reaction$')]
children: List[MoleculeNode]
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'children': FieldInfo(annotation=List[MoleculeNode], required=True), 'type': FieldInfo(annotation=str, required=True, metadata=[StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=None, max_length=None, pattern='^reaction$')])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

class rxnutils.routes.utils.validation.MoleculeNode(*, smiles, type, children=None)

Bases: BaseModel

Node representing a molecule

Parameters:
  • smiles (str)

  • type (Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=None, max_length=None, pattern=^mol$)])

  • children (Annotated[List[ReactionNode], Len(min_length=1, max_length=1)] | None)

smiles: str
type: Annotated[str, StringConstraints(pattern='^mol$')]
children: conlist(ReactionNode, min_length=1, max_length=1) | None
model_computed_fields: ClassVar[Dict[str, ComputedFieldInfo]] = {}

A dictionary of computed field names and their corresponding ComputedFieldInfo objects.

model_config: ClassVar[ConfigDict] = {}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_fields: ClassVar[Dict[str, FieldInfo]] = {'children': FieldInfo(annotation=Union[Annotated[List[ReactionNode], Len], NoneType], required=False, default=None), 'smiles': FieldInfo(annotation=str, required=True), 'type': FieldInfo(annotation=str, required=True, metadata=[StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=None, max_length=None, pattern='^mol$')])}

Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo] objects.

This replaces Model.__fields__ from Pydantic V1.

rxnutils.routes.utils.validation.validate_dict(dict_)

Check that the route dictionary is a valid structure

Parameters:
  • dict – the route as dictionary

  • dict_ (Dict[str, Any])

Return type:

None

Module contents