From 76d08be32b718f8ce7ccdb887d8deece144b05b1 Mon Sep 17 00:00:00 2001 From: Nicholas Junge Date: Fri, 15 Mar 2024 10:19:28 +0100 Subject: [PATCH] Add full example appendix --- docs/guides/transforms.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/guides/transforms.md b/docs/guides/transforms.md index a3f4e4df..05d86448 100644 --- a/docs/guides/transforms.md +++ b/docs/guides/transforms.md @@ -51,3 +51,11 @@ A few points are useful to keep in mind while writing transforms: * It is in general not advised to inject arbitrary metadata into records via a transform. If you find yourself needing to supply more metadata, consider using a `ContextProvider` instead. * When serializing Python values (like the benchmark parameters), be careful to choose a unique representation, otherwise you might not be able to reconstruct model and data versions from written records. * When designing a transform that is not invertible, consider raising a `NotImplementedError` in the `iapply()` method to prevent accidental calls to the (ill-defined) inverse. + +## Appendix: The full example code + +Here is the full example on how to use transforms for record-to-file serialization: + +```python +--8<-- "examples/transforms/transforms.py" +``` \ No newline at end of file