Skip to content

Type Definitions

fragmentretro.typing is a good place to store your type definitions to make code clean and pass mypy tests.

Example Usage

from fragmentretro.typing import BondType

def _find_fragmentation_bonds(mol: Mol) -> list[BondType]:
    return list(FindBRICSBonds(mol))

where BondType is defined in fragmentretro.typing as:

type BondType = tuple[tuple[int, int], tuple[str, str]]

Source Code

fragmentretro.typing

Type definitions for FragmentRetro package.

BondType = tuple[tuple[int, int], tuple[str, str]]

AtomMappingType = tuple[int, ...]

CombType = tuple[int]

SolutionType = list[CombType]

BBsType = set[str]

StageCombDictType = dict[int, list[CombType]]

CombBBsDictType = dict[CombType, BBsType]

FragmentBBsDictType = dict[str, tuple[CombType, BBsType]]

FilterIndicesType = list[int]

CombFilterIndicesDictType = dict[CombType, FilterIndicesType]

MolProperties

Bases: TypedDict

Type definition for molecular properties.

Source code in src/fragmentretro/typing.py
class MolProperties(TypedDict, total=True):
    """Type definition for molecular properties."""

    cano_smiles: str
    num_heavy_atoms: int
    num_rings: int
    pfp: list[int]  # Pattern Fingerprint