MolecularDiffusion.utils.io¶
Classes¶
A multi-GPU-friendly python command line logger. |
Functions¶
Context manager to capture all rdkit loggings. |
|
|
Print a prompt on the command line and wait for a choice. |
|
Evaluate an expression into a Python literal structure. |
Context manager to suppress all rdkit loggings. |
|
|
Module Contents¶
- class MolecularDiffusion.utils.io.CaptureStdIO(stdout=True, stderr=False)¶
Bases:
object- file¶
- stderr = False¶
- stdout = True¶
- class MolecularDiffusion.utils.io.RankState¶
- class MolecularDiffusion.utils.io.RankedLogger(name: str = __name__, rank_zero_only: bool = False, extra: Mapping[str, object] | None = None)¶
Bases:
logging.LoggerAdapterA multi-GPU-friendly python command line logger.
Initialize the adapter with a logger and a dict-like object which provides contextual information. This constructor signature allows easy stacking of LoggerAdapters, if so desired.
You can effectively pass keyword arguments as shown in the following example:
adapter = LoggerAdapter(someLogger, dict(p1=v1, p2=”v2”))
- log(level: int, msg: str, rank: int | None = None, *args, **kwargs) None¶
Delegate a log call to the underlying logger, after adding contextual information from this adapter instance.
- rank_zero_only = False¶
- MolecularDiffusion.utils.io.capture_rdkit_log()¶
Context manager to capture all rdkit loggings.
Example:
>>> with utils.capture_rdkit_log() as log: >>> ... >>> print(log.content)
- MolecularDiffusion.utils.io.input_choice(prompt, choice=('y', 'n'))¶
Print a prompt on the command line and wait for a choice.
- MolecularDiffusion.utils.io.literal_eval(string)¶
Evaluate an expression into a Python literal structure.
- MolecularDiffusion.utils.io.no_rdkit_log()¶
Context manager to suppress all rdkit loggings.