{
  "__type": "IngestedDoc",
  "__tag": 4010,
  "_content": {
    "Notes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Raises": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Yields": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Methods": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Returns": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A mini-implementation of an automatic serialiser-deserialiser for nested dataclass like class based on type annotations."
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Receives": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Warnings": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Attributes": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    },
    "Extended Summary": {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Example      "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "In [14]: from dataclasses import dataclass\n    ...: from typing import Optional, Union, List\n    ...:\n\nNote that Author and Reviewer are isomorphic even if totally unrelated.\n\nIn [15]: @dataclass\n    ...: class Author:\n    ...:     first: Optional[str]\n    ...:     last: str\n    ...:\n    ...: @dataclass\n    ...: class Reviewer:\n    ...:     first: Optional[str]\n    ...:     last: str\n    ...:\n\nHere, items can be heterogenous, or of ambiguous type based only on its fields values.\n\nIn [16]: @dataclass\n    ...: class Book:\n    ...:     author: List[Union[Author, Reviewer]]\n    ...:     title: str\n    ...:\n\nIn [17]: obj = Book([Author(\"Matthias\", \"B\"), Reviewer(\"Tony\", \"Fast\")], \"pyshs\")\n    ...:\n    ...: data = serialize(obj , Book)\n    ...:\n    ...: deserialize(Book, Book, data)\n\nOut[17]: Book(author=[Author(first='Matthias', last='B'), Reviewer(first='Tony', last='Fast')], title='pyshs')\n\n                      ^...................................^\n                                        .\n                                        .Note the conserved types.",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Unlike other similar libraries that automatically serialise/deserialise it has the following properties:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "object do not need to have a give baseclass, they need to have an __init__   or _deserialise class method that takes each parameter as kwargs."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Subclass or isomorphic classes are kept in the de-serialisation, in   particular in Union and List of Unions. That is to say it will properly   de-serialise and heterogenous list or dict, as long as those respect the   type annotation."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Both Pydantic and Jetblack-serialize would have erased the types and returned either 2 Authors or 2 Reviewers."
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "it is also compatible with Rust Serde with adjacently tagged Unions (not"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "critical but nice to have)"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    },
    "Other Parameters": {
      "__type": "Section",
      "__tag": 4015,
      "children": [],
      "title": [],
      "level": 0,
      "target": null
    }
  },
  "_ordered_sections": [
    "Summary",
    "Extended Summary",
    "Parameters",
    "Attributes",
    "Methods",
    "Returns",
    "Yields",
    "Receives",
    "Other Parameters",
    "Raises",
    "Warns",
    "Warnings",
    "Notes"
  ],
  "item_file": "/papyri/serde.py",
  "item_line": 0,
  "item_type": "module",
  "aliases": [
    "papyri.serde"
  ],
  "example_section_data": {
    "__type": "Section",
    "__tag": 4015,
    "children": [],
    "title": [],
    "level": 0,
    "target": null
  },
  "see_also": [],
  "signature": null,
  "references": null,
  "qa": "papyri.serde",
  "arbitrary": [
    {
      "__type": "Section",
      "__tag": 4015,
      "children": [
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "A mini-implementation of an automatic serialiser-deserialiser for nested dataclass like class based on type annotations."
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Example       "
            }
          ]
        },
        {
          "__type": "Code",
          "__tag": 4050,
          "value": "In [14]: from dataclasses import dataclass\n    ...: from typing import Optional, Union, List\n    ...:\n\nNote that Author and Reviewer are isomorphic even if totally unrelated.\n\nIn [15]: @dataclass\n    ...: class Author:\n    ...:     first: Optional[str]\n    ...:     last: str\n    ...:\n    ...: @dataclass\n    ...: class Reviewer:\n    ...:     first: Optional[str]\n    ...:     last: str\n    ...:\n\nHere, items can be heterogenous, or of ambiguous type based only on its fields values.\n\nIn [16]: @dataclass\n    ...: class Book:\n    ...:     author: List[Union[Author, Reviewer]]\n    ...:     title: str\n    ...:\n\n\nIn [17]: obj = Book([Author(\"Matthias\", \"B\"), Reviewer(\"Tony\", \"Fast\")], \"pyshs\")\n    ...:\n    ...: data = serialize(obj , Book)\n    ...:\n    ...: deserialize(Book, Book, data)\n\nOut[17]: Book(author=[Author(first='Matthias', last='B'), Reviewer(first='Tony', last='Fast')], title='pyshs')\n\n                      ^...................................^\n                                        .\n                                        .Note the conserved types.",
          "execution_status": null
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Unlike other similar libraries that automatically serialise/deserialise it has the following properties:"
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "object do not need to have a give baseclass, they need to have an __init__   or _deserialise class method that takes each parameter as kwargs."
                    }
                  ]
                }
              ]
            },
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "Paragraph",
                  "__tag": 4045,
                  "children": [
                    {
                      "__type": "Text",
                      "__tag": 4046,
                      "value": "Subclass or isomorphic classes are kept in the de-serialisation, in   particular in Union and List of Unions. That is to say it will properly   de-serialise and heterogenous list or dict, as long as those respect the   type annotation."
                    }
                  ]
                }
              ]
            }
          ]
        },
        {
          "__type": "Paragraph",
          "__tag": 4045,
          "children": [
            {
              "__type": "Text",
              "__tag": 4046,
              "value": "Both Pydantic and Jetblack-serialize would have erased the types and returned either 2 Authors or 2 Reviewers."
            }
          ]
        },
        {
          "__type": "BulletList",
          "__tag": 4053,
          "ordered": false,
          "start": 1,
          "children": [
            {
              "__type": "ListItem",
              "__tag": 4054,
              "children": [
                {
                  "__type": "DefList",
                  "__tag": 4033,
                  "children": [
                    {
                      "__type": "DefListItem",
                      "__tag": 4037,
                      "dt": {
                        "__type": "Paragraph",
                        "__tag": 4045,
                        "children": [
                          {
                            "__type": "Text",
                            "__tag": 4046,
                            "value": "it is also compatible with Rust Serde with adjacently tagged Unions (not"
                          }
                        ]
                      },
                      "dd": [
                        {
                          "__type": "Paragraph",
                          "__tag": 4045,
                          "children": [
                            {
                              "__type": "Text",
                              "__tag": 4046,
                              "value": "critical but nice to have)"
                            }
                          ]
                        }
                      ]
                    }
                  ]
                }
              ]
            }
          ]
        }
      ],
      "title": [],
      "level": 0,
      "target": null
    }
  ],
  "local_refs": []
}