[
  {
    "path": ".github/FUNDING.yml",
    "content": "---\n# These are supported funding model platforms\ngithub: [pydanny]\npatreon:  # Replace with a single Patreon username\nopen_collective:  # Replace with a single Open Collective username\nko_fi:  # Replace with a single Ko-fi username\ntidelift:  # Replace with a single Tidelift platform-name/package-name e.g., npm/babel\ncommunity_bridge:  # Replace with a single Community Bridge project-name e.g., cloud-foundry\nliberapay:  # Replace with a single Liberapay username\nissuehunt:  # Replace with a single IssueHunt username\notechie:  # Replace with a single Otechie username\nlfx_crowdfunding:  # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry\ncustom:  # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/bug_report.md",
    "content": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the bug**\nA clear and concise description of what the bug is.\n\n**To Reproduce**\nSteps to reproduce the behavior:\n1. Go to '...'\n2. Click on '....'\n3. Scroll down to '....'\n4. See error\n\n**Expected behavior**\nA clear and concise description of what you expected to happen.\n\n**Screenshots**\nIf applicable, add screenshots to help explain your problem.\n\n**Desktop (please complete the following information):**\n - OS: [e.g. iOS]\n - Browser [e.g. chrome, safari]\n - Version [e.g. 22]\n\n**Smartphone (please complete the following information):**\n - Device: [e.g. iPhone6]\n - OS: [e.g. iOS8.1]\n - Browser [e.g. stock browser, safari]\n - Version [e.g. 22]\n\n**Additional context**\nAdd any other context about the problem here.\n"
  },
  {
    "path": ".github/ISSUE_TEMPLATE/feature_request.md",
    "content": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Is your feature request related to a problem? Please describe.**\nA clear and concise description of what the problem is. Ex. I'm always frustrated when [...]\n\n**Describe the solution you'd like**\nA clear and concise description of what you want to happen.\n\n**Describe alternatives you've considered**\nA clear and concise description of any alternative solutions or features you've considered.\n\n**Additional context**\nAdd any other context or screenshots about the feature request here.\n"
  },
  {
    "path": ".github/workflows/contributing.yml",
    "content": "---\nname: Contributing\non:\n  push:\n    branches: [main]\njobs:\n  contrib-readme-job:\n    runs-on: ubuntu-latest\n    name: A job to automate contrib in readme\n    steps:\n      - name: Contribute List\n        uses: akhilmhdh/contributors-readme-action@v2.3.6\n        env:\n          GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }}\n"
  },
  {
    "path": ".github/workflows/python-ci.yml",
    "content": "---\nname: CI\non: [push]\njobs:\n  build:\n    runs-on: ubuntu-latest\n    strategy:\n      matrix:\n        python-version: ['3.10', '3.11', '3.12']\n    steps:\n      - uses: actions/checkout@v3\n      - name: Set up Python ${{ matrix.python-version }}\n        uses: actions/setup-python@v4\n        with:\n          python-version: ${{ matrix.python-version }}\n      - name: Install dependencies\n        run: |\n          python -m pip install uv\n          uv pip install -p ${{ matrix.python-version }} '.[dev]'\n      - name: Lint with ruff and black\n        run: |\n          # stop the build if there are linting errors\n          make lint\n      - name: Test with pytest\n        run: |-\n          pytest\n"
  },
  {
    "path": ".github/workflows/python-publish.yml",
    "content": "---\n# This workflow will upload a Python Package using Twine when a release is created\n# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries\n\n# This workflow uses actions that are not certified by GitHub.\n# They are provided by a third-party and are governed by\n# separate terms of service, privacy policy, and support\n# documentation.\nname: Publish Python Package\non:\n  release:\n    types: [published]\npermissions:\n  contents: read\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v3\n      - name: Set up Python\n        uses: actions/setup-python@v3\n        with:\n          python-version: 3.x\n      - name: Install dependencies\n        run: |\n          pip install uv\n          uv pip install -p 3.12 build\n      - name: Build package\n        run: |\n          rm -rf dist\n          python -m build\n      - name: Publish package\n        uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29\n        with:\n          user: __token__\n          password: ${{ secrets.PYPI_API_TOKEN }}\n"
  },
  {
    "path": ".gitignore",
    "content": "# Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n*$py.class\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python\nbuild/\ndevelop-eggs/\ndist/\ndownloads/\neggs/\n.eggs/\nlib/\nlib64/\nparts/\nsdist/\nvar/\nwheels/\nshare/python-wheels/\n*.egg-info/\n.installed.cfg\n*.egg\nMANIFEST\n\n# PyInstaller\n#  Usually these files are written by a python script from a template\n#  before PyInstaller builds the exe, so as to inject date/other infos into it.\n*.manifest\n*.spec\n\n# Installer logs\npip-log.txt\npip-delete-this-directory.txt\n\n# Unit test / coverage reports\nhtmlcov/\n.tox/\n.nox/\n.coverage\n.coverage.*\n.cache\nnosetests.xml\ncoverage.xml\n*.cover\n*.py,cover\n.hypothesis/\n.pytest_cache/\ncover/\n\n# Translations\n*.mo\n*.pot\n\n# Django stuff:\n*.log\nlocal_settings.py\ndb.sqlite3\ndb.sqlite3-journal\n\n# Flask stuff:\ninstance/\n.webassets-cache\n\n# Scrapy stuff:\n.scrapy\n\n# Sphinx documentation\ndocs/_build/\n\n# PyBuilder\n.pybuilder/\ntarget/\n\n# Jupyter Notebook\n.ipynb_checkpoints\n\n# IPython\nprofile_default/\nipython_config.py\n\n# pyenv\n#   For a library or package, you might want to ignore these files since the code is\n#   intended to run in multiple environments; otherwise, check them in:\n# .python-version\n\n# pipenv\n#   According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.\n#   However, in case of collaboration, if having platform-specific dependencies or dependencies\n#   having no cross-platform support, pipenv may install dependencies that don't work, or not\n#   install all needed dependencies.\n#Pipfile.lock\n\n# poetry\n#   Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.\n#   This is especially recommended for binary packages to ensure reproducibility, and is more\n#   commonly ignored for libraries.\n#   https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control\n#poetry.lock\n\n# pdm\n#   Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.\n#pdm.lock\n#   pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it\n#   in version control.\n#   https://pdm.fming.dev/#use-with-ide\n.pdm.toml\n\n# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm\n__pypackages__/\n\n# Celery stuff\ncelerybeat-schedule\ncelerybeat.pid\n\n# SageMath parsed files\n*.sage.py\n\n# Environments\n.env\n.venv\nenv/\nvenv/\nENV/\nenv.bak/\nvenv.bak/\n\n# Spyder project settings\n.spyderproject\n.spyproject\n\n# Rope project settings\n.ropeproject\n\n# mkdocs documentation\n/site\n\n# mypy\n.mypy_cache/\n.dmypy.json\ndmypy.json\n\n# Pyre type checker\n.pyre/\n\n# pytype static type analyzer\n.pytype/\n\n# Cython debug symbols\ncython_debug/\n\n# PyCharm\n#  JetBrains specific template is maintained in a separate JetBrains.gitignore that can\n#  be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore\n#  and can be added to the global gitignore or merged into this file.  For a more nuclear\n#  option (not recommended) you can uncomment the following to ignore the entire idea folder.\n#.idea/\n\n.hypothesis/\n.vscode/\n.ruff_cache/\nchangelog.json\n.idea\n.DS_Store\n"
  },
  {
    "path": ".readthedocs.yml",
    "content": "---\nversion: 2\nbuild:\n  os: ubuntu-22.04\n  tools:\n    python: '3.10'\n  jobs:\n    pre_build: [\"pip install '.[dev]'\", mkdocs build]\nmkdocs:\n  configuration: mkdocs.yml\n  fail_on_warning: false\n"
  },
  {
    "path": "CHANGELOG.md",
    "content": "# [v0.7.0](https://github.com/pydanny/dj-notebook/releases/tag/v0.7.0)\n\n## What's Changed - New Feature\n\n* Allow notebooks in other locations by @nmpowell in https://github.com/pydanny/dj-notebook/pull/162\n\n## What's Changed\n\n* Change byline by @pydanny in https://github.com/pydanny/dj-notebook/pull/144\n* Add django-extensions to contributors by @pydanny in https://github.com/pydanny/dj-notebook/pull/145\n* Add mkdocs include so README is the index by @pydanny in https://github.com/pydanny/dj-notebook/pull/150\n* Add changelog to docs site by @pydanny in https://github.com/pydanny/dj-notebook/pull/151\n* Add code reference using mkdocstrings by @pydanny in https://github.com/pydanny/dj-notebook/pull/154\n* Lint the yaml and add to CI by @pydanny in https://github.com/pydanny/dj-notebook/pull/158\n* Add csv_to_df function by @pydanny in https://github.com/pydanny/dj-notebook/pull/160\n\n## New Contributors\n* @nmpowell made their first contribution in https://github.com/pydanny/dj-notebook/pull/162\n\n**Full Changelog**: https://github.com/pydanny/dj-notebook/compare/v0.6.1...v0.7.0\n\n# [v0.6.1](https://github.com/pydanny/dj-notebook/releases/tag/v0.6.1)\n\n2023-10-22T05:57:56Z by\n[@pydanny](https://github.com/pydanny)\n\n## What's Changed\n\nFixing borked release caused by inconsistent PyPI trove classifiers\n\n\n**Full Changelog**: https://github.com/pydanny/dj-notebook/compare/v0.6.0...v0.6.1\n\n---\n\n\n# [v0.6.0](https://github.com/pydanny/dj-notebook/releases/tag/v0.6.0)\n\n2023-10-22T05:01:55Z by\n[@pydanny](https://github.com/pydanny)\n\n## What's Changed\n* Add missing read frame example by @pydanny in https://github.com/pydanny/dj-notebook/pull/107\n* Raise warning if not run in debug by @skyforest in https://github.com/pydanny/dj-notebook/pull/109\n* Added chrisdev to other contributors by @specbeck in https://github.com/pydanny/dj-notebook/pull/110\n* Prep for mypy by @pydanny in https://github.com/pydanny/dj-notebook/pull/112\n* Use ruff for isort by @pydanny in https://github.com/pydanny/dj-notebook/pull/113\n* Document how to install dj-notebook in PyCharm Professional. by @geoffbeier in https://github.com/pydanny/dj-notebook/pull/117\n* Link to pycharm instructions in the docs by @pydanny in https://github.com/pydanny/dj-notebook/pull/119\n* Add support for Python 3.12 by @pydanny in https://github.com/pydanny/dj-notebook/pull/116\n* Remove special case for test harness from application code. by @geoffbeier in https://github.com/pydanny/dj-notebook/pull/120\n* Add social cards to docs by @pydanny in https://github.com/pydanny/dj-notebook/pull/125\n* Remove official support for Python 3.9 by @pydanny in https://github.com/pydanny/dj-notebook/pull/127\n* improve path definitions/config discovery by @geoffbeier in https://github.com/pydanny/dj-notebook/pull/121\n* Document new activate function arguments by @pydanny in https://github.com/pydanny/dj-notebook/pull/129\n* fix broken link to pycharm page from info box on installation page by @geoffbeier in https://github.com/pydanny/dj-notebook/pull/131\n\n## New Contributors\n* @geoffbeier made their first contribution in https://github.com/pydanny/dj-notebook/pull/117\n\n**Full Changelog**: https://github.com/pydanny/dj-notebook/compare/v0.5.0...v0.6.0\n\n---\n\n# [v0.5.0](https://github.com/pydanny/dj-notebook/releases/tag/v0.5.0)\n\n2023-10-10T15:01:07Z by\n[@pydanny](https://github.com/pydanny)\n\n## What's Changed\n\n```\nplus.model_graph(plus.User)\n```\n![](https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgTG9nRW50cnkgLS0tIFVzZXIKICBVc2VyIC0tLSBBYnN0cmFjdFVzZXIKICBVc2VyIC0tLSBHcm91cAogIFVzZXIgLS0tIFBlcm1pc3Npb24K)\n\n* Added model graph by @pydanny in https://github.com/pydanny/dj-notebook/pull/78 and https://github.com/pydanny/dj-notebook/pull/101\n* Prepping for DjangoCon sprints 2023 by @pydanny in https://github.com/pydanny/dj-notebook/pull/80\n* Added first implementation of new logo by @Tejoooo in https://github.com/pydanny/dj-notebook/pull/89\n* Update and Add logo to all docs  by @pydanny in https://github.com/pydanny/dj-notebook/pull/91\n* Implement improve graphing of models via django-schema-graph by @pydanny in https://github.com/pydanny/dj-notebook/pull/101\n* In docs, corrected changed order and corrected table of contents by @pydanny in https://github.com/pydanny/dj-notebook/pull/104\n\n## New Contributors\n* @Tejoooo made their first contribution in https://github.com/pydanny/dj-notebook/pull/89\n\n**Full Changelog**: https://github.com/pydanny/dj-notebook/compare/v0.4.0...v0.5.0\n\n---\n\n# [v0.4.0](https://github.com/pydanny/dj-notebook/releases/tag/v0.4.0)\n\n## What's Changed\n* Add LICENSE file by @pydanny in https://github.com/pydanny/dj-notebook/pull/54\n* Add issue templates by @pydanny in https://github.com/pydanny/dj-notebook/pull/55\n* Update CHANGELOG.md by @pydanny in https://github.com/pydanny/dj-notebook/pull/57\n* Improve display of load items by @pydanny in https://github.com/pydanny/dj-notebook/pull/59\n* Add display_mermaid function by @pydanny in https://github.com/pydanny/dj-notebook/pull/61\n* Optimize plus print functionality by @pydanny in https://github.com/pydanny/dj-notebook/pull/62\n* Add missing attribution for prestto and evieclutton by @pydanny in https://github.com/pydanny/dj-notebook/pull/64\n* docs(contributor): contributors readme action update by @pydanny in https://github.com/pydanny/dj-notebook/pull/65\n* Update pyproject.toml with docs link by @specbeck in https://github.com/pydanny/dj-notebook/pull/66\n\n## New Contributors\n* @skyforest made their first contribution in https://github.com/pydanny/dj-notebook/pull/39\n* @akashverma0786 made their first contribution in https://github.com/pydanny/dj-notebook/pull/49\n* @specbeck made their first contribution in https://github.com/pydanny/dj-notebook/pull/66\n\n**Full Changelog**: https://github.com/pydanny/dj-notebook/compare/v0.3.0...v0.4.0\n\n---\n\n# [v0.3.0](https://github.com/pydanny/dj-notebook/releases/tag/v0.3.0)\n\n2023-10-03T17:22:45Z by\n[@pydanny](https://github.com/pydanny)\n\n## New Features\n\n* Add django pandas to activate return object by @skyforest in https://github.com/pydanny/dj-notebook/pull/45\n\n## Other Changes\n* Improve the release notes by @pydanny in https://github.com/pydanny/dj-notebook/pull/26\n* Add Jupyter-Book for docs by @pydanny in https://github.com/pydanny/dj-notebook/pull/28\n* Fix deployment to RTD by @pydanny in https://github.com/pydanny/dj-notebook/pull/29\n* Better usage instructions by @pydanny in https://github.com/pydanny/dj-notebook/pull/30\n* Better usage instructions by @pydanny in https://github.com/pydanny/dj-notebook/pull/31\n* Create FUNDING.yml by @pydanny in https://github.com/pydanny/dj-notebook/pull/35\n* Improve test coverage by @skyforest in https://github.com/pydanny/dj-notebook/pull/39\n* Add contributing segment to readme by @pydanny in https://github.com/pydanny/dj-notebook/pull/40\n* docs(contributor): contributors readme action update by @pydanny in https://github.com/pydanny/dj-notebook/pull/41\n* Add the name to the contributing job by @pydanny in https://github.com/pydanny/dj-notebook/pull/42\n* Documented queryset to dataframe by @pydanny in https://github.com/pydanny/dj-notebook/pull/47\n* Add:Content in features-list by @akashverma0786 in https://github.com/pydanny/dj-notebook/pull/49\n\n## New Contributors\n* @skyforest made their first contribution in https://github.com/pydanny/dj-notebook/pull/39\n* @akashverma0786 made their first contribution in https://github.com/pydanny/dj-notebook/pull/49\n\n**Full Changelog**: https://github.com/pydanny/dj-notebook/compare/v0.2.1...v0.3.0\n\n---\n\n# [v0.2.2](https://github.com/pydanny/dj-notebook/releases/tag/v0.2.2)\n\n2023-09-26T15:24:15Z by\n[@pydanny](https://github.com/pydanny)\n\n## What's Changed\n* Correct the release notes by @pydanny in https://github.com/pydanny/dj-notebook/pull/26\n\n\n**Full Changelog**: https://github.com/pydanny/dj-notebook/compare/v0.2.1...v0.2.2\n\n"
  },
  {
    "path": "CODE_OF_CONDUCT.md",
    "content": "# Contributor Covenant Code of Conduct\n\n## Our Pledge\n\nWe as members, contributors, and leaders pledge to make participation in our\ncommunity a harassment-free experience for everyone, regardless of age, body\nsize, visible or invisible disability, ethnicity, sex characteristics, gender\nidentity and expression, level of experience, education, socio-economic status,\nnationality, personal appearance, race, religion, or sexual identity\nand orientation.\n\nWe pledge to act and interact in ways that contribute to an open, welcoming,\ndiverse, inclusive, and healthy community.\n\n## Our Standards\n\nExamples of behavior that contributes to a positive environment for our\ncommunity include:\n\n* Demonstrating empathy and kindness toward other people\n* Being respectful of differing opinions, viewpoints, and experiences\n* Giving and gracefully accepting constructive feedback\n* Accepting responsibility and apologizing to those affected by our mistakes,\n  and learning from the experience\n* Focusing on what is best not just for us as individuals, but for the\n  overall community\n\nExamples of unacceptable behavior include:\n\n* The use of sexualized language or imagery, and sexual attention or\n  advances of any kind\n* Trolling, insulting or derogatory comments, and personal or political attacks\n* Public or private harassment\n* Publishing others' private information, such as a physical or email\n  address, without their explicit permission\n* Other conduct which could reasonably be considered inappropriate in a\n  professional setting\n\n## Enforcement Responsibilities\n\nCommunity leaders are responsible for clarifying and enforcing our standards of\nacceptable behavior and will take appropriate and fair corrective action in\nresponse to any behavior that they deem inappropriate, threatening, offensive,\nor harmful.\n\nCommunity leaders have the right and responsibility to remove, edit, or reject\ncomments, commits, code, wiki edits, issues, and other contributions that are\nnot aligned to this Code of Conduct, and will communicate reasons for moderation\ndecisions when appropriate.\n\n## Scope\n\nThis Code of Conduct applies within all community spaces, and also applies when\nan individual is officially representing the community in public spaces.\nExamples of representing our community include using an official e-mail address,\nposting via an official social media account, or acting as an appointed\nrepresentative at an online or offline event.\n\n## Enforcement\n\nInstances of abusive, harassing, or otherwise unacceptable behavior may be\nreported to the community leaders responsible for enforcement at\n.\nAll complaints will be reviewed and investigated promptly and fairly.\n\nAll community leaders are obligated to respect the privacy and security of the\nreporter of any incident.\n\n## Enforcement Guidelines\n\nCommunity leaders will follow these Community Impact Guidelines in determining\nthe consequences for any action they deem in violation of this Code of Conduct:\n\n### 1. Correction\n\n**Community Impact**: Use of inappropriate language or other behavior deemed\nunprofessional or unwelcome in the community.\n\n**Consequence**: A private, written warning from community leaders, providing\nclarity around the nature of the violation and an explanation of why the\nbehavior was inappropriate. A public apology may be requested.\n\n### 2. Warning\n\n**Community Impact**: A violation through a single incident or series\nof actions.\n\n**Consequence**: A warning with consequences for continued behavior. No\ninteraction with the people involved, including unsolicited interaction with\nthose enforcing the Code of Conduct, for a specified period of time. This\nincludes avoiding interactions in community spaces as well as external channels\nlike social media. Violating these terms may lead to a temporary or\npermanent ban.\n\n### 3. Temporary Ban\n\n**Community Impact**: A serious violation of community standards, including\nsustained inappropriate behavior.\n\n**Consequence**: A temporary ban from any sort of interaction or public\ncommunication with the community for a specified period of time. No public or\nprivate interaction with the people involved, including unsolicited interaction\nwith those enforcing the Code of Conduct, is allowed during this period.\nViolating these terms may lead to a permanent ban.\n\n### 4. Permanent Ban\n\n**Community Impact**: Demonstrating a pattern of violation of community\nstandards, including sustained inappropriate behavior,  harassment of an\nindividual, or aggression toward or disparagement of classes of individuals.\n\n**Consequence**: A permanent ban from any sort of public interaction within\nthe community.\n\n## Attribution\n\nThis Code of Conduct is adapted from the [Contributor Covenant][homepage],\nversion 2.0, available at\nhttps://www.contributor-covenant.org/version/2/0/code_of_conduct.html.\n\nCommunity Impact Guidelines were inspired by [Mozilla's code of conduct\nenforcement ladder](https://github.com/mozilla/diversity).\n\n[homepage]: https://www.contributor-covenant.org\n\nFor answers to common questions about this code of conduct, see the FAQ at\nhttps://www.contributor-covenant.org/faq. Translations are available at\nhttps://www.contributor-covenant.org/translations.\n"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "Please read the [Development - Contributing](https://dj-notebook.readthedocs.io/en/latest/contributing/) guidelines in the documentation site.\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU General Public License is a free, copyleft license for\nsoftware and other kinds of works.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nthe GNU General Public License is intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.  We, the Free Software Foundation, use the\nGNU General Public License for most of our software; it applies also to\nany other work released this way by its authors.  You can apply it to\nyour programs, too.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  To protect your rights, we need to prevent others from denying you\nthese rights or asking you to surrender the rights.  Therefore, you have\ncertain responsibilities if you distribute copies of the software, or if\nyou modify it: responsibilities to respect the freedom of others.\n\n  For example, if you distribute copies of such a program, whether\ngratis or for a fee, you must pass on to the recipients the same\nfreedoms that you received.  You must make sure that they, too, receive\nor can get the source code.  And you must show them these terms so they\nknow their rights.\n\n  Developers that use the GNU GPL protect your rights with two steps:\n(1) assert copyright on the software, and (2) offer you this License\ngiving you legal permission to copy, distribute and/or modify it.\n\n  For the developers' and authors' protection, the GPL clearly explains\nthat there is no warranty for this free software.  For both users' and\nauthors' sake, the GPL requires that modified versions be marked as\nchanged, so that their problems will not be attributed erroneously to\nauthors of previous versions.\n\n  Some devices are designed to deny users access to install or run\nmodified versions of the software inside them, although the manufacturer\ncan do so.  This is fundamentally incompatible with the aim of\nprotecting users' freedom to change the software.  The systematic\npattern of such abuse occurs in the area of products for individuals to\nuse, which is precisely where it is most unacceptable.  Therefore, we\nhave designed this version of the GPL to prohibit the practice for those\nproducts.  If such problems arise substantially in other domains, we\nstand ready to extend this provision to those domains in future versions\nof the GPL, as needed to protect the freedom of users.\n\n  Finally, every program is threatened constantly by software patents.\nStates should not allow patents to restrict development and use of\nsoftware on general-purpose computers, but in those that do, we wish to\navoid the special danger that patents applied to a free program could\nmake it effectively proprietary.  To prevent this, the GPL assures that\npatents cannot be used to render the program non-free.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Use with the GNU Affero General Public License.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU Affero General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the special requirements of the GNU Affero General Public License,\nsection 13, concerning interaction through a network will apply to the\ncombination as such.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU General Public License from time to time.  Such new versions will\nbe similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU General Public License as published by\n    the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU General Public License for more details.\n\n    You should have received a copy of the GNU General Public License\n    along with this program.  If not, see <https://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If the program does terminal interaction, make it output a short\nnotice like this when it starts in an interactive mode:\n\n    <program>  Copyright (C) <year>  <name of author>\n    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n    This is free software, and you are welcome to redistribute it\n    under certain conditions; type `show c' for details.\n\nThe hypothetical commands `show w' and `show c' should show the appropriate\nparts of the General Public License.  Of course, your program's commands\nmight be different; for a GUI interface, you would use an \"about box\".\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU GPL, see\n<https://www.gnu.org/licenses/>.\n\n  The GNU General Public License does not permit incorporating your program\ninto proprietary programs.  If your program is a subroutine library, you\nmay consider it more useful to permit linking proprietary applications with\nthe library.  If this is what you want to do, use the GNU Lesser General\nPublic License instead of this License.  But first, please read\n<https://www.gnu.org/licenses/why-not-lgpl.html>.\n"
  },
  {
    "path": "Makefile",
    "content": "changelog:  # Install gh cli and jq first\n\tgh api \\\n\t-H \"Accept: application/vnd.github+json\" \\\n\t-H \"X-GitHub-Api-Version: 2022-11-28\" \\\n\t/repos/pydanny/dj-notebook/releases/latest > changelog.json\n\t\n\tpython utils/update_changelog.py\n\trm changelog.json\n\nformat:\n\tblack .\n\truff check . --fix\n\tyamlfix .\n\nlint:\n\tblack .\n\truff check .\n\tyamlfix .\n\nmypy:\n\tmypy .\n\nVERSION=v$(shell grep -m 1 version pyproject.toml | tr -s ' ' | tr -d '\"' | tr -d \"'\" | cut -d' ' -f3)\n\ntag:\n\techo \"Tagging version $(VERSION)\"\n\tgit tag -a $(VERSION) -m \"Creating version $(VERSION)\"\n\tgit push origin $(VERSION)\n\n\ntest:\n\tcoverage run -m pytest .\n\tcoverage report -m\n\tcoverage html\n\ninstall:\n\tpip install -e '.[dev]'\n"
  },
  {
    "path": "README.md",
    "content": "<p align=\"center\">\n  <a href=\"https://dj-notebook.readthedocs.io\"><img src=\"https://dj-notebook.readthedocs.io/en/latest/img/dj-notebook-logo.png\" alt=\"dj-notebook\"></a>\n</p>\n\nDjango + shell_plus + Jupyter notebooks made easy\n\n---\n\nA Jupyter notebook with access to objects from the Django ORM is a powerful tool to introspect data and run ad-hoc queries. \n\nFull documentation available at [dj-notebook](https://dj-notebook.readthedocs.io/)\n\n---\n\n## Features\n\nThe ever-growing list of features:\n\n- Easy Jupyter notebooks with Django\n- Built-in integration with the imported objects from django-extensions `shell_plus`\n- Saves the state between sessions so you don't need to remember what you did\n- Inheritance diagrams on any object, including ORM models\n- Converts any Django QuerySet to Pandas Dataframe\n- Handy function for displaying MermaidJS charts \n- Generates visual maps of model relations\n- Works in the browser, VSCode, PyCharm, Emacs, Vim, and more!\n\n## Installation\n\nUse your installation tool of choice, here we use venv and pip:\n\n```bash\npython -m venv venv\nsource venv/bin/activate\npip install dj_notebook\n```\n\n## Usage\n\nFirst, find your project's `manage.py` file and open it. Copy whatever is being set to `DJANGO_SETTINGS_MODULE` into your clipboard.\n\nCreate an ipython notebook in the same directory as `manage.py`, or another directory of your choosing. In VSCode,\nsimply add a new `.ipynb` file. If using Jupyter Lab, use the `File -> New ->\nNotebook` menu option.\n\nThen in the first cell enter:\n\n```python\nfrom dj_notebook import activate\n\nplus = activate()\n\n# If you have created your notebook in a different directory, instead do:\n# plus = activate(search_dir=\"/path/to/your/project\")\n\n# If that throws an error, try one of the following:\n\n# DJANGO_SETTINGS_MODULE_VALUE aka \"book_store.settings\"\n# plus = activate(\"DJANGO_SETTINGS_MODULE_VALUE\")\n\n# Point to location of dotenv file with Django settings\n# plus = activate(dotenv_file='.env')\n```\n\nIn future cells, you can now load and run Django objects, including the ORM. This three line snippet should give an idea of what you can now do:\n\n```python\nfrom django.contrib.auth import get_user_model\nUser = get_user_model()\nUser.objects.all()\n```\n\n## Usage Plus\n\nBut wait, it gets better!\n\nWhen you activated the Django environment, you instantiated a variable called 'plus'. The 'plus' variable  is an object that contains everything loaded from django-extensions' `shell_plus`. Here's a demonstration, try running this snippet:\n\n```python\nplus.User.objects.all()\n```\n\nWe also provide a utility for introspection of classes, which can be useful in sophisticated project architectures. Running this code in a Jupyter notebook shell:\n\n```python\nplus.diagram(plus.User)\n```\n\nGenerates this image\n\n<img src=\"https://mermaid.ink/img/Y2xhc3NEaWFncmFtCiAgY2xhc3MgZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfVXNlclsiZGphbmdvLmNvbnRyaWIuYXV0aC5tb2RlbHM6OlVzZXIiXQogIGRqYW5nb19kYl9tb2RlbHNfdXRpbHNfQWx0ZXJzRGF0YSA8fC0tIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbAogIGNsYXNzIGRqYW5nb19kYl9tb2RlbHNfdXRpbHNfQWx0ZXJzRGF0YVsiZGphbmdvLmRiLm1vZGVscy51dGlsczo6QWx0ZXJzRGF0YSJdCiAgZGphbmdvX2NvbnRyaWJfYXV0aF9iYXNlX3VzZXJfQWJzdHJhY3RCYXNlVXNlciA8fC0tIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX0Fic3RyYWN0VXNlcgogIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX1Blcm1pc3Npb25zTWl4aW4gPHwtLSBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19BYnN0cmFjdFVzZXIKICBjbGFzcyBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19BYnN0cmFjdFVzZXJbImRqYW5nby5jb250cmliLmF1dGgubW9kZWxzOjpBYnN0cmFjdFVzZXIiXQogIGNsYXNzIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbFsiZGphbmdvLmRiLm1vZGVscy5iYXNlOjpNb2RlbCJdCiAgY2xhc3MgZGphbmdvX2NvbnRyaWJfYXV0aF9iYXNlX3VzZXJfQWJzdHJhY3RCYXNlVXNlclsiZGphbmdvLmNvbnRyaWIuYXV0aC5iYXNlX3VzZXI6OkFic3RyYWN0QmFzZVVzZXIiXQogIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbCA8fC0tIGRqYW5nb19jb250cmliX2F1dGhfYmFzZV91c2VyX0Fic3RyYWN0QmFzZVVzZXIKICBkamFuZ29fZGJfbW9kZWxzX2Jhc2VfTW9kZWwgPHwtLSBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19QZXJtaXNzaW9uc01peGluCiAgZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfQWJzdHJhY3RVc2VyIDx8LS0gZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfVXNlcgogIGNsYXNzIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX1Blcm1pc3Npb25zTWl4aW5bImRqYW5nby5jb250cmliLmF1dGgubW9kZWxzOjpQZXJtaXNzaW9uc01peGluIl0=\"/>\n\nHere's another useful diagram:\n\n```python\nplus.model_graph(plus.User)\n```\n\n<image src=\"https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgTG9nRW50cnkgLS0tIFVzZXIKICBVc2VyIC0tLSBBYnN0cmFjdFVzZXIKICBVc2VyIC0tLSBHcm91cAogIFVzZXIgLS0tIFBlcm1pc3Npb24K\"/>\n\n## QuerySet to Dataframe\n\nWant to convert a Django query to a Pandas Dataframe? We got you covered.\n\n```python\nplus.read_frame(plus.User.objects.all())\n```\n\n## More things you can do!\n\n[dj-notebook official documentation](https://dj-notebook.readthedocs.io/)\n\n\n## Contributors\n\n<!-- readme: contributors -start -->\n<table>\n<tr>\n    <td align=\"center\">\n        <a href=\"https://github.com/pydanny\">\n            <img src=\"https://avatars.githubusercontent.com/u/62857?v=4\" width=\"100;\" alt=\"pydanny\"/>\n            <br />\n            <sub><b>Daniel Roy Greenfeld</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/skyforest\">\n            <img src=\"https://avatars.githubusercontent.com/u/13559970?v=4\" width=\"100;\" alt=\"skyforest\"/>\n            <br />\n            <sub><b>Cody Antunez</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/geoffbeier\">\n            <img src=\"https://avatars.githubusercontent.com/u/133355?v=4\" width=\"100;\" alt=\"geoffbeier\"/>\n            <br />\n            <sub><b>Geoff Beier</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/nmpowell\">\n            <img src=\"https://avatars.githubusercontent.com/u/184579?v=4\" width=\"100;\" alt=\"nmpowell\"/>\n            <br />\n            <sub><b>Nick Powell</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/specbeck\">\n            <img src=\"https://avatars.githubusercontent.com/u/98754084?v=4\" width=\"100;\" alt=\"specbeck\"/>\n            <br />\n            <sub><b>Saransh Sood</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/anna-zhydko\">\n            <img src=\"https://avatars.githubusercontent.com/u/68199135?v=4\" width=\"100;\" alt=\"anna-zhydko\"/>\n            <br />\n            <sub><b>Anna Zhydko</b></sub>\n        </a>\n    </td></tr>\n<tr>\n    <td align=\"center\">\n        <a href=\"https://github.com/Tejoooo\">\n            <img src=\"https://avatars.githubusercontent.com/u/112956566?v=4\" width=\"100;\" alt=\"Tejoooo\"/>\n            <br />\n            <sub><b>Tejo Kaushal</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/bloodearnest\">\n            <img src=\"https://avatars.githubusercontent.com/u/1042?v=4\" width=\"100;\" alt=\"bloodearnest\"/>\n            <br />\n            <sub><b>Simon Davy</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/akashverma0786\">\n            <img src=\"https://avatars.githubusercontent.com/u/138790903?v=4\" width=\"100;\" alt=\"akashverma0786\"/>\n            <br />\n            <sub><b>Null</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/DaveParr\">\n            <img src=\"https://avatars.githubusercontent.com/u/8363743?v=4\" width=\"100;\" alt=\"DaveParr\"/>\n            <br />\n            <sub><b>Dave Parr</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/syyong\">\n            <img src=\"https://avatars.githubusercontent.com/u/12908907?v=4\" width=\"100;\" alt=\"syyong\"/>\n            <br />\n            <sub><b>Siew-Yit Yong</b></sub>\n        </a>\n    </td></tr>\n</table>\n<!-- readme: contributors -end -->\n\n## Special thanks\n\nThese are people who aren't in our formal git history but should be.\n\n- [Tom Preston](https://github.com/prestto) did seminal work on Python paths that later became the foundation of dj-notebook\n- [Evie Clutton](https://github.com/evieclutton) was co-author of a pull request and they don't show up in the contributor  list above\n- [Tim Schilling](https://github.com/tim-schilling) assisted with the `model_graph` method\n- [Charlie Denton](https://github.com/meshy) is responsible for django-schema-graph, which we leverage as part of the `model_graph` feature\n- [Christopher Clarke](https://github.com/chrisdev) built `django-pandas`, which dj-notebook uses\n- [Stephen Moore](https://github.com/delfick) for some early work done on the internals of dj-notebook before it was open sourced.\n- [django-extensions](django-extensions) for providing so many useful tools over the years, and being one of the backbones of this project\n\n<!-- readme: prestto,evieclutton,tim-schilling,meshy,chrisdev,delfick,django-extensions -start -->\n<table>\n<tr>\n    <td align=\"center\">\n        <a href=\"https://github.com/prestto\">\n            <img src=\"https://avatars.githubusercontent.com/u/13559801?v=4\" width=\"100;\" alt=\"prestto\"/>\n            <br />\n            <sub><b>Tom Preston</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/evieclutton\">\n            <img src=\"https://avatars.githubusercontent.com/u/44432176?v=4\" width=\"100;\" alt=\"evieclutton\"/>\n            <br />\n            <sub><b>Null</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/tim-schilling\">\n            <img src=\"https://avatars.githubusercontent.com/u/1281215?v=4\" width=\"100;\" alt=\"tim-schilling\"/>\n            <br />\n            <sub><b>Tim Schilling</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/meshy\">\n            <img src=\"https://avatars.githubusercontent.com/u/767671?v=4\" width=\"100;\" alt=\"meshy\"/>\n            <br />\n            <sub><b>Charlie Denton</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/chrisdev\">\n            <img src=\"https://avatars.githubusercontent.com/u/701689?v=4\" width=\"100;\" alt=\"chrisdev\"/>\n            <br />\n            <sub><b>Christopher  Clarke</b></sub>\n        </a>\n    </td>\n    <td align=\"center\">\n        <a href=\"https://github.com/delfick\">\n            <img src=\"https://avatars.githubusercontent.com/u/109301?v=4\" width=\"100;\" alt=\"delfick\"/>\n            <br />\n            <sub><b>Stephen Moore</b></sub>\n        </a>\n    </td></tr>\n<tr>\n    <td align=\"center\">\n        <a href=\"https://github.com/django-extensions\">\n            <img src=\"https://avatars.githubusercontent.com/u/65559?v=4\" width=\"100;\" alt=\"django-extensions\"/>\n            <br />\n            <sub><b>Django Extensions</b></sub>\n        </a>\n    </td></tr>\n</table>\n<!-- readme: prestto,evieclutton,tim-schilling,meshy,chrisdev,delfick,django-extensions -end -->\n\n## Construction\n\nThis package was created with [Cookiecutter](https://github.com/cookiecutter/cookiecutter) and the [simplicity](https://github.com/pydanny/simplicity) project template.\n"
  },
  {
    "path": "docs/activation.md",
    "content": "# Activation\n\nWe try our best to make activating dj-notebook as easy as possible. It should be easy to do, but more complicated projects will require manipulation of paths. The goal of this page is to provide all the instruction users may need or link to external docs as necessary.\n\n!!! info \"Using dj-notebook with PyCharm\"\n\n    If using PyCharm the [instructions described here](../pycharm) are a very useful reference.\n\n## Auto-discovery\n\n_New in dj-notebook 0.6.0_\n\nCreate an ipython notebook in the same directory as `manage.py`. In VSCode,\nsimply add a new `.ipynb` file. If using Jupyter Lab, use the `File -> New ->\nNotebook` menu option. \n\nIn the first cell type the following:\n\n```python\n\nfrom dj_notebook import activate\n\nplus = activate()\n```\n\n## Specifying settings\n\nIf that doesn't work, find the project's `manage.py` file and open it.\nCopy whatever is being set to `DJANGO_SETTINGS_MODULE` as a string\nargument to `activate` function like so:\n\n```python\nplus = activate('book_store.settings')\n```\n \n## Using `.env` file to specify settings\n\n_New in dj-notebook 0.6.0_\n\ndj-notebook has support for .env files. Assuming our `.env` file is at `/me/projects/djangopackages/.env` and looks like this:\n\n```\nSECRET_KEY=TopSecretValueHere\nDEBUG=True\nDJANGO_SETTINGS_MODULE=book_store.settings\n```\n\nThen we can pass in that file in this manner:\n\n```python\nplus = activate(dotenv_file='/me/projects/djangopackages/.env')\n```\n\n## Advanced: Modifying the Path\n\nThis advanced technique is when you want to activate dj-notebook in a different directory from the Django project. For example, in dj-notebook the [usage](./usage) page is completely seperate:\n\n```\ndocs\n└── usage.ipynb\ntests/django_test_project\n└── manage.py\n```\n\nTo address that, in the `docs/usage.ipynb` file we modify the path to include `django_test_project` so dj-notebook can find with a simple `activate()` call:\n\n```python\nimport pathlib\nimport sys\n\nhere = pathlib.Path(\".\").parent\nPROJECT_ROOT = (here / \"..\" / \"tests\" / \"django_test_project\").resolve()\nsys.path.insert(0, str(PROJECT_ROOT))\n```\n\n!!! note\n\n    For the sake of clarity, the above code is not visible in dj-notebook's rendered [usage](./usage) instructions. This is a hidden cell, so look in the [unrendered usage.ipynb file](https://github.com/pydanny/dj-notebook/blob/main/docs/usage.ipynb)."
  },
  {
    "path": "docs/changelog.md",
    "content": "# Changelog\n\n{%\n   include-markdown \"../CHANGELOG.md\"\n   start=\"<!--start-->\"\n   end=\"<!--end-->\"\n   heading-offset=1\n%}\n"
  },
  {
    "path": "docs/contributing.md",
    "content": "# Contributing\n\n## Git workflow\n\n* Fork the repository\n* Make your changes in your fork\n* Open a pull request to upstream repository - main branch\n\n## Development\n\nInstall the package in editable mode with test dependencies:\n\n```bash\npip install -e '.[test]'\n```\n\nCode away!\n\n### Standards\n\ndj-notebook follows these standards:\n\n- Styleguide: [PEP-8](https://peps.python.org/pep-0008/)\n- Code of Conduct: [Contributor Covenant](https://www.contributor-covenant.org)\n- Boring Technology for Packaging: setuptools and build\n\n### Code quality\n\nLinting and formatting is done with Black and Ruff:\n\n```bash \nmake lint\n```\n\n### Testing\n\n```bash\nmake test\n```\n\n---\n## Advanced\n\nOdds are you won't need these things.\n\n### Building the project locally\n\nGo to the project root\n\n```bash\npip install --upgrade build\npython -m build\n```\n\nTest the project, forcing reinstall if necessary\n\n```bash\npip install dist/*.whl --force-reinstall\n```\n\n\n"
  },
  {
    "path": "docs/index.md",
    "content": "# Home\n\n{%\n   include-markdown \"../README.md\"\n   start=\"<!--intro-start-->\"\n   end=\"<!--intro-end-->\"\n%}\n"
  },
  {
    "path": "docs/installation.md",
    "content": "# Installation\n\nUse your installation tool of choice, here we use venv and pip:\n\n```bash\npython -m venv venv\nsource venv/bin/activate\npip install dj-notebook\n```\n\n\n!!! info \"Using dj-notebook with PyCharm\"\n\n    PyCharm users need to take a few extra steps described [here](../pycharm).\n"
  },
  {
    "path": "docs/pycharm.md",
    "content": "# Using dj-notebook with PyCharm\n\nPyCharm Professional has built-in integration for Jupyter notebooks. This integration works well with dj-notebook once your jupyter and dj-notebook are added to your existing Django project's virtual environment.\n\n## Quick Start\n\n1. Open your existing django project in pycharm.\n2. Make sure that pycharm's interpreter is configured for your project's virtual environment.\n3. Add dj-notebook and jupyter to that virtual environment.\n4. Create a new notebook and load your django settings in the first cell.\n5. Execute that cell to launch the Jupyter server.\n\n## Adding dj-notebook to your Virtual Environment\n\n![PyCharm Interpreter Menu](img/pycharm/interpreter_menu.png)\n\nOnce pycharm has loaded your django project, you can inspect the virtual environment used by the project's interpreter by using the interpreter menu in the lower right corner of the project window. Click on the current interpreter (1) then choose \"Interpreter Settings...\" to to confirm the location of the virtual environment and see which packages are loaded there.\n\nIf jupyter and dj-notebook are not already installed, you can add them from the IDE by clicking the add button then searching for dj-notebook:\n\n![PyCharm - Add package](img/pycharm/add_package.png)\n\nThen click \"Install Package\":\n\n![PyCharm - Install dj-notebook](img/pycharm/install_dj-notebook.png)\n\n## Using dj-notebook Within PyCharm's Integrated Notebook View\n\nOnce dj-notebook is installed, you can create a new notebook from within the project explorer:\n\n![PyCharm - Create new notebook](img/pycharm/create_notebook.png)\n\nIn the new notebook, when you execute your first cell, PyCharm will start the Jupyter server and display the results inline. Once the server is started, dj-notebook [just works, as described in the usage guide](https://dj-notebook.readthedocs.io/en/latest/usage/). PyCharm's notebook interface [is documented here](https://www.jetbrains.com/help/pycharm/jupyter-notebook-support.html#ui).\n\n![PyCharm - working notebook](img/pycharm/notebook_working.png)\n\n"
  },
  {
    "path": "docs/reference/index.md",
    "content": "# Reference - Code API\n\nHere's the reference or code API, the classes, functions, parameters, attributes, and\nall the dj-notebook parts.\n\nIf you want to **learn dj-notebook** you are much better off reading the\n[usage docs](https://dj-notebook.readthedocs.io/en/latest/usage/)."
  },
  {
    "path": "docs/reference/plus.md",
    "content": "# `Plus` class\n\nHere's the reference for the `Plus`  class, with all its parameters, attributes, and methods. \n\n::: dj_notebook.shell_plus.Plus\n    options:\n        show_source: true\n        members:\n            - csv_to_df\n            - diagram    \n            - mermaid                            \n            - model_graph\n            - model_graph_schema            \n            - print\n            - read_frame\n\n\n"
  },
  {
    "path": "docs/releasing.md",
    "content": "# Releasing on PyPI\n\n1. Update the `version` in `pyproject.toml` and `__version__` in` `src/__init__.py`. We use semantic versioning\n2. Create a branch called `release-x.x.x`\n3. At the command line, run `make tag`\n4. Go to [tags page](https://github.com/pydanny/dj-notebook/tags), choose the most recent tag, and click `Draft a new release`\n5. Click `Generate release notes` and then `Publish release notes`\n6. Run `make changelog`\n7. Use `git commit` and `git push` any files changed by this release\n8. Send up with `git push origin release-x.x.x`\n9. Merge to main"
  },
  {
    "path": "docs/usage.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"# Usage\\n\",\n    \"\\n\",\n    \"All examples here are based on dj-notebook's test project at:   \\n\",\n    \"\\n\",\n    \"[github.com/pydanny/dj-notebook/blob/main/tests/django_test_project](https://github.com/pydanny/dj-notebook/blob/main/tests/django_test_project)\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {\n    \"tags\": [\n     \"remove-input\",\n     \"hide_code\"\n    ]\n   },\n   \"outputs\": [],\n   \"source\": [\n    \"# Special configuration\\n\",\n    \"import pathlib\\n\",\n    \"import sys\\n\",\n    \"\\n\",\n    \"# project base\\n\",\n    \"here = pathlib.Path(\\\".\\\").parent\\n\",\n    \"PROJECT_ROOT = (here / \\\"..\\\" / \\\"tests\\\" / \\\"django_test_project\\\").resolve()\\n\",\n    \"sys.path.insert(0, str(PROJECT_ROOT))\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"##  Activation\\n\",\n    \"\\n\",\n    \"First, activate the project. If that doesn't work, try one of [the other methods](../activation) for activating dj-notebook.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"></pre>\\n\"\n      ],\n      \"text/plain\": []\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"from dj_notebook import activate\\n\",\n    \"\\n\",\n    \"plus = activate(\\\"book_store.settings\\\")\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Now we can use the ORM:\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"<QuerySet [<User: Audrey>, <User: Daniel>]>\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"from django.contrib.auth import get_user_model\\n\",\n    \"\\n\",\n    \"User = get_user_model()\\n\",\n    \"\\n\",\n    \"# Clean up the users\\n\",\n    \"User.objects.all().delete()\\n\",\n    \"\\n\",\n    \"# Create some users\\n\",\n    \"User.objects.create_user(\\\"Audrey\\\")\\n\",\n    \"User.objects.create_user(\\\"Daniel\\\")\\n\",\n    \"\\n\",\n    \"# Query the users\\n\",\n    \"User.objects.all()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Usage Plus\\n\",\n    \"\\n\",\n    \"When you activated the Django environment, you instantiated a variable called 'plus'. The 'plus' variable is an object that contains everything loaded from django-extensions' shell_plus. Here's a demonstration, let try running this snippet:\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"<QuerySet [<User: Audrey>, <User: Daniel>]>\"\n      ]\n     },\n     \"execution_count\": 13,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"plus.User.objects.all()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"Or this:\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"name\": \"stdout\",\n     \"output_type\": \"stream\",\n     \"text\": [\n      \"admin | log entry | Can add log entry\\n\",\n      \"admin | log entry | Can change log entry\\n\",\n      \"admin | log entry | Can delete log entry\\n\",\n      \"admin | log entry | Can view log entry\\n\",\n      \"auth | group | Can add group\\n\"\n     ]\n    }\n   ],\n   \"source\": [\n    \"for perm in plus.Permission.objects.all()[:5]:\\n\",\n    \"    print(perm)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Dataframes from QuerySets\\n\",\n    \"\\n\",\n    \"_New in dj-notebook 0.3.0_\\n\",\n    \"\\n\",\n    \"Powered by [django-pandas](https://github.com/chrisdev/django-pandas), we can also trivially turn any Django QuerySet into a Dataframe.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>id</th>\\n\",\n       \"      <th>password</th>\\n\",\n       \"      <th>last_login</th>\\n\",\n       \"      <th>is_superuser</th>\\n\",\n       \"      <th>username</th>\\n\",\n       \"      <th>first_name</th>\\n\",\n       \"      <th>last_name</th>\\n\",\n       \"      <th>email</th>\\n\",\n       \"      <th>is_staff</th>\\n\",\n       \"      <th>is_active</th>\\n\",\n       \"      <th>date_joined</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>30</td>\\n\",\n       \"      <td>!e91xGexuejHJTtcK5UK6VLPs74uTojmlMVbBCHF1</td>\\n\",\n       \"      <td>None</td>\\n\",\n       \"      <td>False</td>\\n\",\n       \"      <td>Audrey</td>\\n\",\n       \"      <td></td>\\n\",\n       \"      <td></td>\\n\",\n       \"      <td></td>\\n\",\n       \"      <td>False</td>\\n\",\n       \"      <td>True</td>\\n\",\n       \"      <td>2023-10-21 12:54:07.318920+00:00</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>31</td>\\n\",\n       \"      <td>!wqNcAZOEw4KUIQdaIzMyf46lgEYKbrLsGDHZgqtE</td>\\n\",\n       \"      <td>None</td>\\n\",\n       \"      <td>False</td>\\n\",\n       \"      <td>Daniel</td>\\n\",\n       \"      <td></td>\\n\",\n       \"      <td></td>\\n\",\n       \"      <td></td>\\n\",\n       \"      <td>False</td>\\n\",\n       \"      <td>True</td>\\n\",\n       \"      <td>2023-10-21 12:54:07.319889+00:00</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"   id                                   password last_login  is_superuser  \\\\\\n\",\n       \"0  30  !e91xGexuejHJTtcK5UK6VLPs74uTojmlMVbBCHF1       None         False   \\n\",\n       \"1  31  !wqNcAZOEw4KUIQdaIzMyf46lgEYKbrLsGDHZgqtE       None         False   \\n\",\n       \"\\n\",\n       \"  username first_name last_name email  is_staff  is_active  \\\\\\n\",\n       \"0   Audrey                                False       True   \\n\",\n       \"1   Daniel                                False       True   \\n\",\n       \"\\n\",\n       \"                       date_joined  \\n\",\n       \"0 2023-10-21 12:54:07.318920+00:00  \\n\",\n       \"1 2023-10-21 12:54:07.319889+00:00  \"\n      ]\n     },\n     \"execution_count\": 15,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"plus.read_frame(plus.User.objects.all())\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Diagrams of Objects\\n\",\n    \"\\n\",\n    \"We're not done yet! \\n\",\n    \"\\n\",\n    \"We also provide a utility for introspection of classes, which can be useful in sophisticated project architectures. Let's see what happens when we use the `plus.diagram()` function:\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/Y2xhc3NEaWFncmFtCiAgY2xhc3MgZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfVXNlclsiZGphbmdvLmNvbnRyaWIuYXV0aC5tb2RlbHM6OlVzZXIiXQogIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbCA8fC0tIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX1Blcm1pc3Npb25zTWl4aW4KICBjbGFzcyBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19BYnN0cmFjdFVzZXJbImRqYW5nby5jb250cmliLmF1dGgubW9kZWxzOjpBYnN0cmFjdFVzZXIiXQogIGRqYW5nb19kYl9tb2RlbHNfdXRpbHNfQWx0ZXJzRGF0YSA8fC0tIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbAogIGNsYXNzIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbFsiZGphbmdvLmRiLm1vZGVscy5iYXNlOjpNb2RlbCJdCiAgY2xhc3MgZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfUGVybWlzc2lvbnNNaXhpblsiZGphbmdvLmNvbnRyaWIuYXV0aC5tb2RlbHM6OlBlcm1pc3Npb25zTWl4aW4iXQogIGRqYW5nb19jb250cmliX2F1dGhfYmFzZV91c2VyX0Fic3RyYWN0QmFzZVVzZXIgPHwtLSBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19BYnN0cmFjdFVzZXIKICBkamFuZ29fZGJfbW9kZWxzX2Jhc2VfTW9kZWwgPHwtLSBkamFuZ29fY29udHJpYl9hdXRoX2Jhc2VfdXNlcl9BYnN0cmFjdEJhc2VVc2VyCiAgZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfUGVybWlzc2lvbnNNaXhpbiA8fC0tIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX0Fic3RyYWN0VXNlcgogIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX0Fic3RyYWN0VXNlciA8fC0tIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX1VzZXIKICBjbGFzcyBkamFuZ29fZGJfbW9kZWxzX3V0aWxzX0FsdGVyc0RhdGFbImRqYW5nby5kYi5tb2RlbHMudXRpbHM6OkFsdGVyc0RhdGEiXQogIGNsYXNzIGRqYW5nb19jb250cmliX2F1dGhfYmFzZV91c2VyX0Fic3RyYWN0QmFzZVVzZXJbImRqYW5nby5jb250cmliLmF1dGguYmFzZV91c2VyOjpBYnN0cmFjdEJhc2VVc2VyIl0=\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"plus.diagram(plus.User)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Visualizing relations between models\\n\",\n    \"\\n\",\n    \"_New in dj-notebook 0.5.0_\\n\",\n    \"\\n\",\n    \"Useful for introspecting new or existing projects!\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"></pre>\\n\"\n      ],\n      \"text/plain\": []\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgTG9nRW50cnkgLS0tIFVzZXIKICBVc2VyIC0tLSBBYnN0cmFjdFVzZXIKICBVc2VyIC0tLSBHcm91cAogIFVzZXIgLS0tIFBlcm1pc3Npb24K\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"plus.model_graph(plus.User)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Rendering mermaid diagrams using dj-notebook\\n\",\n    \"\\n\",\n    \"_New in dj-notebook 0.4.0_\\n\",\n    \"\\n\",\n    \"Mermaid is such a useful tool tool that dj-notebook provides a shortcut.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/CmZsb3djaGFydCBURAogICAgQVtwaXAgaW5zdGFsbCBkai1ub3RlYm9va10KICAgIEJbZnJvbSBkal9ub3RlYm9vayBpbXBvcnQgYWN0aXZhdGVdCiAgICBDWyJwbHVzID0gYWN0aXZhdGUoKSJdCiAgICBEWyJwbHVzLm1lcm1haWQoZGlhZ3JhbSkiXQogICAgCiAgICBBIC0tPnx3YWl0IGEgZmV3IHNlY29uZHN8IEIKICAgIEIgLS4tPiBDCiAgICBDIC0uLT4gRAo=\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"diagram = \\\"\\\"\\\"\\n\",\n    \"flowchart TD\\n\",\n    \"    A[pip install dj-notebook]\\n\",\n    \"    B[from dj_notebook import activate]\\n\",\n    \"    C[\\\"plus = activate()\\\"]\\n\",\n    \"    D[\\\"plus.mermaid(diagram)\\\"]\\n\",\n    \"    \\n\",\n    \"    A -->|wait a few seconds| B\\n\",\n    \"    B -.-> C\\n\",\n    \"    C -.-> D\\n\",\n    \"\\\"\\\"\\\"\\n\",\n    \"\\n\",\n    \"plus.mermaid(diagram)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Printing what dj-notebook loads from django-extensions\\n\",\n    \"\\n\",\n    \"_Vastly improved in dj-notebook 0.4.0_\\n\",\n    \"\\n\",\n    \"There are two ways to get a list of the loaded items by dj-notebook's `activate()` function:\\n\",\n    \"\\n\",\n    \"```python\\n\",\n    \"# Print all the objects to the screen on activate\\n\",\n    \"plus = activate(quiet_load=False)\\n\",\n    \"# Print the objects to the screen at any time\\n\",\n    \"plus.print()\\n\",\n    \"```\\n\",\n    \"\\n\",\n    \"Here is `plus.print()` in action:\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"><span style=\\\"color: #959077; text-decoration-color: #959077; background-color: #272822\\\"># Shell Plus Model Imports</span><span style=\\\"background-color: #272822\\\">                                                                                         </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> book_outlet.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Address, Author, Book, Country</span><span style=\\\"background-color: #272822\\\">                                                      </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.admin.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> LogEntry</span><span style=\\\"background-color: #272822\\\">                                                                   </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.auth.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Group, Permission, User</span><span style=\\\"background-color: #272822\\\">                                                     </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.contenttypes.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> ContentType</span><span style=\\\"background-color: #272822\\\">                                                         </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.sessions.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Session</span><span style=\\\"background-color: #272822\\\">                                                                 </span>\\n\",\n       \"<span style=\\\"color: #959077; text-decoration-color: #959077; background-color: #272822\\\"># Shell Plus Django Imports</span><span style=\\\"background-color: #272822\\\">                                                                                        </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.core.cache </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> cache</span><span style=\\\"background-color: #272822\\\">                                                                                </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.conf </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> settings</span><span style=\\\"background-color: #272822\\\">                                                                                   </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.auth </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> get_user_model</span><span style=\\\"background-color: #272822\\\">                                                                     </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> transaction</span><span style=\\\"background-color: #272822\\\">                                                                                  </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Avg, Case, Count, F, Max, Min, Prefetch, Q, Sum, When</span><span style=\\\"background-color: #272822\\\">                                 </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.utils </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> timezone</span><span style=\\\"background-color: #272822\\\">                                                                                  </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.urls </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> reverse</span><span style=\\\"background-color: #272822\\\">                                                                                    </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Exists, OuterRef, Subquery</span><span style=\\\"background-color: #272822\\\">                                                            </span>\\n\",\n       \"<span style=\\\"background-color: #272822\\\">                                                                                                                   </span>\\n\",\n       \"</pre>\\n\"\n      ],\n      \"text/plain\": [\n       \"\\u001b[38;2;149;144;119;48;2;39;40;34m# Shell Plus Model Imports\\u001b[0m\\u001b[48;2;39;40;34m                                                                                         \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mbook_outlet\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAddress\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAuthor\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mBook\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCountry\\u001b[0m\\u001b[48;2;39;40;34m                                                      \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34madmin\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mLogEntry\\u001b[0m\\u001b[48;2;39;40;34m                                                                   \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mauth\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mGroup\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mPermission\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mUser\\u001b[0m\\u001b[48;2;39;40;34m                                                     \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontenttypes\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mContentType\\u001b[0m\\u001b[48;2;39;40;34m                                                         \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34msessions\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSession\\u001b[0m\\u001b[48;2;39;40;34m                                                                 \\u001b[0m\\n\",\n       \"\\u001b[38;2;149;144;119;48;2;39;40;34m# Shell Plus Django Imports\\u001b[0m\\u001b[48;2;39;40;34m                                                                                        \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcore\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcache\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcache\\u001b[0m\\u001b[48;2;39;40;34m                                                                                \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mconf\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34msettings\\u001b[0m\\u001b[48;2;39;40;34m                                                                                   \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mauth\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mget_user_model\\u001b[0m\\u001b[48;2;39;40;34m                                                                     \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mtransaction\\u001b[0m\\u001b[48;2;39;40;34m                                                                                  \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAvg\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCase\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCount\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mF\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mMax\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mMin\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mPrefetch\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mQ\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSum\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mWhen\\u001b[0m\\u001b[48;2;39;40;34m                                 \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mutils\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mtimezone\\u001b[0m\\u001b[48;2;39;40;34m                                                                                  \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34murls\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mreverse\\u001b[0m\\u001b[48;2;39;40;34m                                                                                    \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mExists\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mOuterRef\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSubquery\\u001b[0m\\u001b[48;2;39;40;34m                                                            \\u001b[0m\\n\",\n       \"\\u001b[48;2;39;40;34m                                                                                                                   \\u001b[0m\\n\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"plus.print()\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"metadata\": {},\n   \"source\": [\n    \"## Dataframes from CSVs\\n\",\n    \"\\n\",\n    \"_New in dj-notebook 0.7.0_\\n\",\n    \"\\n\",\n    \"This turns strings or files on defined paths into Dataframes.\\n\",\n    \"\\n\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<div>\\n\",\n       \"<style scoped>\\n\",\n       \"    .dataframe tbody tr th:only-of-type {\\n\",\n       \"        vertical-align: middle;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe tbody tr th {\\n\",\n       \"        vertical-align: top;\\n\",\n       \"    }\\n\",\n       \"\\n\",\n       \"    .dataframe thead th {\\n\",\n       \"        text-align: right;\\n\",\n       \"    }\\n\",\n       \"</style>\\n\",\n       \"<table border=\\\"1\\\" class=\\\"dataframe\\\">\\n\",\n       \"  <thead>\\n\",\n       \"    <tr style=\\\"text-align: right;\\\">\\n\",\n       \"      <th></th>\\n\",\n       \"      <th>Name</th>\\n\",\n       \"      <th>FirstLetter</th>\\n\",\n       \"    </tr>\\n\",\n       \"  </thead>\\n\",\n       \"  <tbody>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>0</th>\\n\",\n       \"      <td>Daniel</td>\\n\",\n       \"      <td>D</td>\\n\",\n       \"    </tr>\\n\",\n       \"    <tr>\\n\",\n       \"      <th>1</th>\\n\",\n       \"      <td>Audrey</td>\\n\",\n       \"      <td>A</td>\\n\",\n       \"    </tr>\\n\",\n       \"  </tbody>\\n\",\n       \"</table>\\n\",\n       \"</div>\"\n      ],\n      \"text/plain\": [\n       \"     Name FirstLetter\\n\",\n       \"0  Daniel           D\\n\",\n       \"1  Audrey           A\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"csv_string = \\\"\\\"\\\"Name,FirstLetter\\n\",\n    \"Daniel,D\\n\",\n    \"Audrey,A\\\"\\\"\\\"\\n\",\n    \"\\n\",\n    \"# Also works with plus.csv_to_df(pathlib.path('path/to/data.csv'))\\n\",\n    \"plus.csv_to_df(csv_string)\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"dj-notebook\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.10.6\"\n  },\n  \"orig_nbformat\": 4\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "mkdocs.yml",
    "content": "---\nsite_name: dj-notebook\nrepo_url: https://github.com/pydanny/dj-notebook\ntheme:\n  name: material\n  features:\n    - navigation.instant\n    - navigation.instant.prefetch\n    - search.suggest\n    - search.highlight\n    - search.share\n  logo: img/dj-notebook-logo.png\n  icon:\n    repo: fontawesome/brands/github\nmarkdown_extensions:\n  - admonition\n  - pymdownx.details\n  - pymdownx.superfences\nplugins:\n  - mkdocs-jupyter:\n      remove_tag_config:\n        remove_input_tags: [hide_code]\n  - include-markdown:\n      start: <!--start-->\n      end: <!--end-->\n  - search\n  - social\n  - mkdocstrings:\n      handlers:\n        python:\n          options:\n            extensions: [griffe_typingdoc]\n            show_root_heading: true\n            show_if_no_docstring: true\n            inherited_members: true\n            members_order: source\n            separate_signature: true\n            unwrap_annotated: true\n            merge_init_into_class: true\n            docstring_section_style: spacy\n            signature_crossrefs: true\n            show_symbol_type_heading: true\n            show_symbol_type_toc: true\nnav:\n  - Introduction: index.md\n  - Installation:\n      - Installation: installation.md\n      - Using with PyCharm: pycharm.md\n  - Activation: activation.md\n  - Usage: usage.ipynb\n  - Reference (Code API): [reference/index.md, reference/plus.md]\n  - Contributing: contributing.md\n  - Releasing: releasing.md\n  - Changelog: changelog.md\n"
  },
  {
    "path": "pyproject.toml",
    "content": "[build-system]\nrequires = [\"setuptools>=61.0\"]\nbuild-backend = \"setuptools.build_meta\"\n\n[project]\nname = \"dj_notebook\"\nversion = \"0.7.0\"\ndescription = \"Django + shell_plus + Jupyter notebooks made easy\"\nreadme = \"README.md\"\nauthors = [\n  {name = \"Daniel Roy Greenfeld\", email = \"daniel@feldroy.com\"},\n  {name = \"Anna Zhydko\", email = \"anna.zhydko@krakentechnologies.ltd\"}\n]\nmaintainers = [\n  {name = \"Daniel Roy Greenfeld\", email = \"daniel@feldroy.com\"},\n  {name = \"Anna Zhydko\", email = \"anna.zhydko@krakentechnologies.ltd\"}\n]\nclassifiers = [\n  \"Development Status :: 5 - Production/Stable\",\n  \"Framework :: Django :: 4.0\",\n  \"Framework :: Django :: 4.1\",\n  \"Framework :: Django :: 4.2\",\n  \"Framework :: Django :: 5.0\",\n  \"Framework :: Jupyter\",\n  \"License :: OSI Approved :: GNU General Public License (GPL)\",\n  \"Programming Language :: Python :: 3.10\",\n  \"Programming Language :: Python :: 3.11\",\n  \"Programming Language :: Python :: 3.12\"\n]\nlicense = {text = \"GNU General Public License v3\"}\ndependencies = [\n  \"django\",\n  \"django-extensions\",\n  \"django-pandas\",\n  \"django-schema-graph\",\n  \"ipython\",\n  \"jupyter\",\n  \"pandas\",\n  \"rich\",\n  \"python-dotenv\"\n]\n\n[project.optional-dependencies]\ndev = [\n    \"black\",  # code auto-formatting\n    \"black[jupyter]\",\n    \"coverage\",  # testing\n    \"griffe-typingdoc==0.2.2\",\n    \"mkdocs-material\",\n    \"mkdocs-jupyter\",\n    \"mkdocs-material[imaging]\",\n    \"mkdocs-include-markdown-plugin\",\n    \"mkdocstrings[python]>=0.18\",    \n    \"mypy\",  # linting\n    \"pytest\",  # testing\n    \"ruff\",  # linting\n    \"yamlfix\"  # fixing the YAML\n]\n\n[project.urls]\n\nbugs = \"https://github.com/pydanny/dj-notebook/issues\"\nchangelog = \"https://github.com/pydanny/dj-notebook/blob/master/CHANGELOG.md\"\nhomepage = \"https://github.com/pydanny/dj-notebook\"\ndocumentation = \"https://dj-notebook.readthedocs.io/\"\n\n[tool.setuptools]\npackage-dir = {\"\" = \"src\"}\n\n\n# Mypy\n# ----\n\n[tool.mypy]\nfiles = \".\"\nexclude = [\n  \"tests/*\"\n]\n\n# Use strict defaults\nstrict = true\nwarn_unreachable = true\nwarn_no_return = true\n\n[[tool.mypy.overrides]]\n# Don't require test functions to include types\nmodule = \"tests.*\"\nallow_untyped_defs = true\ndisable_error_code = \"attr-defined\"\n\n# Ruff\n# ----\n\n[tool.ruff]\nselect = [\n    \"E\",  # pycodestyle\n    \"F\",  # pyflakes\n    \"I\",  # isort\n]\nignore = [\n    \"E501\",  # line too long - black takes care of this for us\n]\n\n[tool.ruff.per-file-ignores]\n# Allow unused imports in __init__ files as these are convenience imports\n\"**/__init__.py\" = [ \"F401\" ]\n\n[tool.ruff.isort]\nlines-after-imports = 2\nsection-order = [\n    \"future\",\n    \"standard-library\",\n    \"third-party\",\n    \"first-party\",\n    \"project\",\n    \"local-folder\",\n]\n\n[tool.ruff.isort.sections]\n\"project\" = [\n    \"src\",\n    \"tests\",\n]"
  },
  {
    "path": "src/dj_notebook/__init__.py",
    "content": "import importlib\nimport os\nimport sys\nimport warnings\nfrom pathlib import Path\n\nimport django\nfrom django.conf import settings as django_settings\nfrom django.core.exceptions import ImproperlyConfigured\nfrom django.core.management.color import no_style\nfrom django_extensions.management import shells\nfrom IPython.utils.capture import capture_output\nfrom rich.status import Status\n\nfrom .config_helper import StrPath, find_django_settings_module\nfrom .shell_plus import Plus\n\n\n__version__ = \"0.7.0\"\n\n\ndef activate(\n    settings: str | None = None,\n    quiet_load: bool = True,\n    *,\n    dotenv_file: StrPath | None = None,\n    search_dir: StrPath | None = None,\n) -> Plus:\n    with Status(\n        \"Loading dj-notebook...\\n  Use Plus.print() to see what's been loaded.\",\n        spinner=\"bouncingBar\",\n    ):\n        if settings:\n            # If the caller specified a settings module explicitly, use that\n            os.environ[\"DJANGO_SETTINGS_MODULE\"] = settings\n        else:\n            source, discovered_settings = find_django_settings_module(\n                dotenv_file=dotenv_file,\n                search_dir=search_dir,\n            )\n            if discovered_settings:\n                if not quiet_load:\n                    print(\n                        f\"Using {discovered_settings} as DJANGO_SETTINGS_MODULE, discovered from {source}\"\n                    )\n                os.environ[\"DJANGO_SETTINGS_MODULE\"] = discovered_settings\n                try:\n                    _ = importlib.util.find_spec(discovered_settings)\n                except ModuleNotFoundError:\n                    source_path = Path(source)\n                    if source.endswith(\"manage.py\") and source_path.is_file():\n                        source_dir = Path(source).parent.absolute()\n                        warnings.warn(\n                            f\"{discovered_settings} from {source} could not be loaded. Adding {str(source_dir)} to search path.\"\n                        )\n                        sys.path.append(str(source_dir))\n            else:\n                raise ImproperlyConfigured(\n                    \"DJANGO_SETTINGS_MODULE was not specified and could not be discovered.\"\n                )\n        os.environ[\"DJANGO_ALLOW_ASYNC_UNSAFE\"] = \"true\"\n        try:\n            django.setup()\n        except ModuleNotFoundError as e:\n            raise ImproperlyConfigured(\n                f\"DJANGO_SETTINGS_MODULE {e.name} could not be loaded in django.setup()\"\n            )\n\n        with capture_output() as c:\n            plus = Plus(shells.import_objects({\"quiet_load\": False}, no_style()))\n\n        plus._import_object_history = c.stdout\n\n        # Log a warning message when DEBUG is set to False\n        if not plus.settings.DEBUG:\n            warnings.warn(\"Django is running in production mode with dj-notebook.\")\n\n        if quiet_load is False:\n            plus.print()\n\n    return plus\n"
  },
  {
    "path": "src/dj_notebook/config_helper.py",
    "content": "import ast\nimport os\nfrom pathlib import Path\nfrom typing import Generator, Tuple\n\nfrom dotenv import load_dotenv\n\n\n# taken from dotenv, which declares a similar type (but it doesn't look public...)\n# review note: the | syntax is new in python 3.10. If older pythons are generally being supported here, this should be\n# rewritten as Union[str, os.PathLike[str]]\nStrPath = str | os.PathLike[str]\n\n\ndef setdefault_calls(module_path: Path) -> Generator[ast.Call, None, None]:\n    \"\"\"Yields all calls to `os.environ.setdefault` within a module.\"\"\"\n    with open(module_path, \"r\") as module_src:\n        parsed_module = ast.parse(module_src.read())\n    environ_id = None\n    for node in ast.walk(parsed_module):\n        if isinstance(node, ast.ImportFrom) and node.module == \"os\":\n            for name in node.names:\n                if isinstance(name, ast.alias) and name.name == \"environ\":\n                    environ_id = name.asname if name.asname is not None else name.name\n        if (\n            isinstance(node, ast.Call)\n            and isinstance(node.func, ast.Attribute)\n            and node.func.attr == \"setdefault\"\n        ):\n            if (\n                isinstance(node.func.value, ast.Attribute)\n                and node.func.value.attr == \"environ\"\n            ):\n                if (\n                    isinstance(node.func.value.value, ast.Name)\n                    and node.func.value.value.id == \"os\"\n                ):\n                    yield node\n            elif (\n                isinstance(node.func.value, ast.Name)\n                and node.func.value.id == environ_id\n            ):\n                yield node\n\n\ndef is_root(path: Path) -> bool:\n    \"\"\"\n    returns True if the supplied path is the root directory. This is only here because it seems clearer than\n    `path.samefile(path.parent)` when reading a loop that walks up a directory hierarchy.\n    \"\"\"\n    return path.samefile(path.parent)\n\n\n# review note: the | syntax is new in python 3.10. If older pythons are generally being supported here, the type for\n# dotenv_file should be rewritten as Optional[StrPath] = None and the return type should be annotated as\n# Tuple[str, Optional[str]]\ndef find_django_settings_module(\n    *,\n    dotenv_file: StrPath | None = None,\n    search_dir: StrPath | None = None,\n) -> Tuple[str, str | None]:\n    \"\"\"\n    Find the name of the first settings module from the environment or the closest `manage.py` file.\n    Returns: a tuple(source, module name) telling the caller where the module was found and the name of the module.\n\n    Optional keyword-only arguments:\n        dotenv_file: Absolute or relative path to .env file, loaded prior to searching the environment.\n        search_dir: Absolute or relative path to the directory to start searching for a `manage.py` file, used if\n            `dotenv_file` is `None`.\n    If both `dotenv_file` and `search_dir` are `None`, the environment variable DJANGO_SETTINGS_MODULE is checked,\n    and the current working directory (and its parents and immediate subdirectories) is searched for a `manage.py` file.\n    \"\"\"\n    settings_module = None\n    # First see if this has either already been set in the environment or put in a .env file that python-dotenv will\n    # treat that way\n    if dotenv_file:\n        # load with override=True if the caller has specified a dotenv file explicitly\n        source = \"dotenv\"\n        load_dotenv(dotenv_file, override=bool(dotenv_file))\n        settings_module = os.environ.get(\"DJANGO_SETTINGS_MODULE\", None)\n    elif not search_dir:\n        source = \"environment\"\n        settings_module = os.environ.get(\"DJANGO_SETTINGS_MODULE\", None)\n    # If we get nothing from the environment, look for a `manage.py` script containing a call that sets a default in the\n    # search directory, the current working directory, or any parent. This should accommodate the common pattern of\n    # - app1\n    # - app2\n    # - project\n    # --> settings.py\n    # - scripts\n    # - notebooks\n    # --> analysis_notebook.ipynb\n    # - manage.py\n    current_search_dir = Path(search_dir or Path.cwd()).resolve()\n    while settings_module is None:\n        manage_py = current_search_dir / \"manage.py\"\n        if manage_py.is_file():\n            for call in setdefault_calls(manage_py):\n                if (\n                    len(call.args) == 2\n                    and call.args[0].value == \"DJANGO_SETTINGS_MODULE\"\n                ):\n                    settings_module = call.args[1].value\n                    source = f\"{manage_py.resolve().absolute()}\"\n        elif is_root(current_search_dir):\n            break\n        else:\n            current_search_dir = current_search_dir.parent.resolve()\n    if not settings_module:\n        # Finally, go one level down into children of the search directory to see if a `manage.py` with a default\n        # for `DJANGO_SETTINGS_MODULE` can be found there. This accommodates the common pattern of\n        # - analysis.ipynb\n        # - src\n        # --> manage.py\n        # --> project\n        # ----> settings.py\n        # ...\n        for p in [\n            Path(subdir)\n            for subdir in os.scandir(Path(search_dir or Path.cwd()).resolve())\n        ]:\n            manage_py = p / \"manage.py\"\n            if manage_py.is_file():\n                for call in setdefault_calls(manage_py):\n                    if (\n                        len(call.args) == 2\n                        and call.args[0].value == \"DJANGO_SETTINGS_MODULE\"\n                    ):\n                        settings_module = call.args[1].value\n                        source = manage_py.resolve().absolute()\n                        break\n\n    return str(source), settings_module\n"
  },
  {
    "path": "src/dj_notebook/shell_plus.py",
    "content": "\"\"\"\nThis module is intended to be imported at the beginning of a jupyter notebook\nto enable access to django objects with everything from django-extensions'\nshell_plus command and other utilities.:\n\n    from dj_notebook import activate\n    plus = activate\n\nAs it accesses the database, it requires that:\n- The database is running in the background\n- The database connection variables are correctly configured\n\"\"\"\n\n\nimport base64\nimport io\nimport pathlib\nimport typing\n\nimport IPython\nimport pandas as pd\nfrom django.db import models as django_models\nfrom django.db.models.query import QuerySet\nfrom django.utils.functional import cached_property\nfrom django_pandas.io import read_frame\nfrom IPython.display import display\nfrom rich.console import Console\nfrom rich.status import Status\nfrom rich.syntax import Syntax\nfrom schema_graph import schema\n\n\nconsole = Console()\n\n\ndef display_mermaid(graph: str) -> None:\n    \"\"\"Renders the display with Mermaid.\"\"\"\n    graphbytes = graph.encode(\"ascii\")\n    base64_bytes = base64.b64encode(graphbytes)\n    base64_string = base64_bytes.decode(\"ascii\")\n    display(IPython.display.Image(url=\"https://mermaid.ink/img/\" + base64_string))\n\n\nclass DiagramClass:\n    \"\"\"This class draws a class diagram for a given class and its ancestors.\"\"\"\n\n    def __init__(self, base_class: type) -> None:\n        self.base_class = base_class\n\n        # To avoid duplicates the graph is a set\n        self.graph = set()\n\n        # Add the base_class to the graph\n        self.graph.add(\n            f'  class {self.namify(self.base_class)}[\"{self.base_class.__module__}::{self.base_class.__name__}\"]'  # noqa: E501\n        )\n\n        # Draw connections between the base_class and its ancestors\n        self.draw_connections(self.base_class)\n\n        # Convert the set to a \\n-seperated text file prefixed\n        # with the classDiagram keyword from mermaidjs\n        text = \"classDiagram\\n\" + \"\\n\".join(self.graph)\n\n        # Use Mermaid to render the graph and Ipthon to display it\n        display_mermaid(text)\n\n    def draw_connections(self, class_: type) -> None:\n        \"\"\"Draw connections between a class and its ancestors,\n        includes nodes and edges.\"\"\"\n        for base in class_.__bases__:\n            if base is not object:\n                base_name = self.namify(base)\n                self.graph.add(\n                    f'  class {base_name}[\"{base.__module__}::{base.__name__}\"]'\n                )\n                connection = f\"  {base_name} <|-- {self.namify(class_)}\"\n                self.graph.add(connection)\n                self.draw_connections(base)\n\n    def namify(self, class_: object) -> str:\n        \"\"\"This provides a node name that keeps Mermaid happy.\"\"\"\n        return f\"{class_.__module__}_{class_.__name__}\".replace(\".\", \"_\")\n\n\nclass Plus:\n    \"\"\"Location of all the objects loaded by shell_plus and extra\n    Jupyter-specific utilities.\"\"\"\n\n    def __init__(self, helpers: dict[str, object]) -> None:\n        self.helpers = helpers\n\n    def __getattribute__(self, name: str) -> object:\n        try:\n            return object.__getattribute__(self, name)\n        except AttributeError:\n            helpers = object.__getattribute__(self, \"helpers\")\n            if name in helpers:\n                return helpers[name]\n            else:\n                raise\n\n    def diagram(self, class_: object) -> None:\n        \"\"\"Draw a class diagram for a given class and its ancestors.\"\"\"\n        if not isinstance(class_, type):\n            class_ = type(class_)\n        DiagramClass(class_)\n\n    def print(self) -> None:\n        \"\"\"Print all the objects contained by the Plus object.\"\"\"\n        console.print(Syntax(self._import_object_history, \"python\"))\n\n    def read_frame(self, qs: QuerySet) -> pd.DataFrame:\n        \"\"\"Converts a Django QuerySet into a Pandas DataFrame.\"\"\"\n        return read_frame(qs)\n\n    def mermaid(self, diagram: str) -> None:\n        \"\"\"Render a mermaid diagram.\"\"\"\n        display_mermaid(diagram)\n\n    @cached_property\n    def model_graph_schema(self) -> dict[typing.Any, typing.Any]:\n        \"\"\"Cached property for the graph data.\"\"\"\n        with Status(\n            \"Converting the models into a schema graph...\",\n            spinner=\"bouncingBar\",\n        ):\n            graph = schema.get_schema()\n        return graph\n\n    def model_graph(self, model: django_models.Model, max_nodes: int = 20) -> None:\n        \"\"\"Draw a diagram of the specified model in the database.\"\"\"\n        edges = get_edges_for_model(self.model_graph_schema, model)\n\n        if len(edges) > max_nodes:\n            console.print(\n                f\"[red bold]Warning: Model {model} has more than {max_nodes} nodes. \"\n                \"The diagram may be too large to render.\"\n            )\n\n        output = \"\"\"flowchart TD\\n\"\"\"\n        for edge in edges:\n            output += (\n                f\"  {edge.source.split('.')[-1]} --- {edge.target.split('.')[-1]}\\n\"\n            )\n        display_mermaid(output)\n\n    def csv_to_df(self, filepath_or_string: pathlib.Path | str) -> pd.DataFrame:\n        \"\"\"Read a CSV file into a Pandas DataFrame.\"\"\"\n        # Process as a Path object\n        if isinstance(filepath_or_string, pathlib.Path):\n            return pd.read_csv(filepath_or_string)\n\n        # Process as a string, which we convert to a filebuffer\n        buffer = io.StringIO(filepath_or_string)\n        return pd.read_csv(buffer)\n\n\ndef get_node_for_model(graph, model: django_models.Model):\n    try:\n        return next(\n            filter(lambda x: x.id == schema.get_model_id(model), graph.nodes), None\n        )\n    except StopIteration:\n        raise Exception(\"Model not found in graph\")\n\n\ndef get_edges_for_model(graph, model: django_models.Model):\n    node = get_node_for_model(graph, model)\n    return list(\n        filter(lambda x: x.source == node.id or x.target == node.id, graph.edges)\n    )\n"
  },
  {
    "path": "tests/__init__.py",
    "content": ""
  },
  {
    "path": "tests/config_debug_false.py",
    "content": "# This very incomplete configuration allows unit tests to take the same path as a standard call\n# to activate(). This one enables the test for a warning when DEBUG == False to pass.\n\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n]\n\nUSE_TZ = True\nDEBUG = False\n"
  },
  {
    "path": "tests/config_test_harness.py",
    "content": "# This very incomplete configuration allows unit tests to take the same path as a standard call\n# to activate()\n\nINSTALLED_APPS = [\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n]\n\nUSE_TZ = True\nDEBUG = True\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/__init__.py",
    "content": ""
  },
  {
    "path": "tests/django_test_project/book_outlet/admin.py",
    "content": "from django.contrib import admin\n\nfrom .models import Address, Author, Book, Country\n\n\n# Register your models here.\n\n\nclass BookAdmin(admin.ModelAdmin):\n    prepopulated_fields = {\"slug\": (\"title\",)}\n    list_filter = (\n        \"title\",\n        \"rating\",\n    )\n    list_display = (\n        \"title\",\n        \"author\",\n    )\n\n\nadmin.site.register(Book, BookAdmin)\nadmin.site.register(Author)\nadmin.site.register(Address)\nadmin.site.register(Country)\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/apps.py",
    "content": "from django.apps import AppConfig\n\n\nclass BookOutletConfig(AppConfig):\n    default_auto_field = \"django.db.models.BigAutoField\"\n    name = \"book_outlet\"\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/0001_initial.py",
    "content": "# Generated by Django 4.2.2 on 2023-06-14 11:14\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n    initial = True\n\n    dependencies = []\n\n    operations = [\n        migrations.CreateModel(\n            name=\"Book\",\n            fields=[\n                (\n                    \"id\",\n                    models.BigAutoField(\n                        auto_created=True,\n                        primary_key=True,\n                        serialize=False,\n                        verbose_name=\"ID\",\n                    ),\n                ),\n                (\"title\", models.CharField(max_length=50)),\n                (\"rating\", models.IntegerField()),\n            ],\n        ),\n    ]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/0002_book_author_book_is_bestselling_alter_book_rating.py",
    "content": "# Generated by Django 4.2.2 on 2023-06-14 16:20\n\nimport django.core.validators\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n    dependencies = [\n        (\"book_outlet\", \"0001_initial\"),\n    ]\n\n    operations = [\n        migrations.AddField(\n            model_name=\"book\",\n            name=\"author\",\n            field=models.CharField(max_length=100, null=True),\n        ),\n        migrations.AddField(\n            model_name=\"book\",\n            name=\"is_bestselling\",\n            field=models.BooleanField(default=False),\n        ),\n        migrations.AlterField(\n            model_name=\"book\",\n            name=\"rating\",\n            field=models.IntegerField(\n                validators=[\n                    django.core.validators.MinValueValidator(1),\n                    django.core.validators.MaxValueValidator(5),\n                ]\n            ),\n        ),\n    ]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/0003_book_slug.py",
    "content": "# Generated by Django 4.2.2 on 2023-06-28 10:50\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n    dependencies = [\n        (\"book_outlet\", \"0002_book_author_book_is_bestselling_alter_book_rating\"),\n    ]\n\n    operations = [\n        migrations.AddField(\n            model_name=\"book\",\n            name=\"slug\",\n            field=models.SlugField(default=\"\"),\n        ),\n    ]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/0004_author_alter_book_slug_alter_book_author.py",
    "content": "# Generated by Django 4.2.2 on 2023-07-05 11:09\n\nimport django.db.models.deletion\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n    dependencies = [\n        (\"book_outlet\", \"0003_book_slug\"),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name=\"Author\",\n            fields=[\n                (\n                    \"id\",\n                    models.BigAutoField(\n                        auto_created=True,\n                        primary_key=True,\n                        serialize=False,\n                        verbose_name=\"ID\",\n                    ),\n                ),\n                (\"first_name\", models.CharField(max_length=100)),\n                (\"last_name\", models.CharField(max_length=100)),\n            ],\n        ),\n        migrations.AlterField(\n            model_name=\"book\",\n            name=\"slug\",\n            field=models.SlugField(blank=True, default=\"\"),\n        ),\n        migrations.AlterField(\n            model_name=\"book\",\n            name=\"author\",\n            field=models.ForeignKey(\n                null=True,\n                on_delete=django.db.models.deletion.CASCADE,\n                to=\"book_outlet.author\",\n            ),\n        ),\n    ]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/0005_alter_book_author.py",
    "content": "# Generated by Django 4.2.2 on 2023-07-05 11:33\n\nimport django.db.models.deletion\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n    dependencies = [\n        (\"book_outlet\", \"0004_author_alter_book_slug_alter_book_author\"),\n    ]\n\n    operations = [\n        migrations.AlterField(\n            model_name=\"book\",\n            name=\"author\",\n            field=models.ForeignKey(\n                null=True,\n                on_delete=django.db.models.deletion.CASCADE,\n                related_name=\"books\",\n                to=\"book_outlet.author\",\n            ),\n        ),\n    ]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/0006_address_author_address.py",
    "content": "# Generated by Django 4.2.2 on 2023-07-12 11:12\n\nimport django.db.models.deletion\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n    dependencies = [\n        (\"book_outlet\", \"0005_alter_book_author\"),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name=\"Address\",\n            fields=[\n                (\n                    \"id\",\n                    models.BigAutoField(\n                        auto_created=True,\n                        primary_key=True,\n                        serialize=False,\n                        verbose_name=\"ID\",\n                    ),\n                ),\n                (\"street\", models.CharField(max_length=80)),\n                (\"postal_code\", models.CharField(max_length=5)),\n                (\"city\", models.CharField(max_length=50)),\n            ],\n        ),\n        migrations.AddField(\n            model_name=\"author\",\n            name=\"address\",\n            field=models.OneToOneField(\n                null=True,\n                on_delete=django.db.models.deletion.CASCADE,\n                to=\"book_outlet.address\",\n            ),\n        ),\n    ]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/0007_country_alter_address_options_and_more.py",
    "content": "# Generated by Django 4.2.2 on 2023-07-14 09:35\n\nfrom django.db import migrations, models\n\n\nclass Migration(migrations.Migration):\n    dependencies = [\n        (\"book_outlet\", \"0006_address_author_address\"),\n    ]\n\n    operations = [\n        migrations.CreateModel(\n            name=\"Country\",\n            fields=[\n                (\n                    \"id\",\n                    models.BigAutoField(\n                        auto_created=True,\n                        primary_key=True,\n                        serialize=False,\n                        verbose_name=\"ID\",\n                    ),\n                ),\n                (\"name\", models.CharField(max_length=80)),\n                (\"code\", models.CharField(max_length=2)),\n            ],\n        ),\n        migrations.AlterModelOptions(\n            name=\"address\",\n            options={\"verbose_name_plural\": \"Address Entries\"},\n        ),\n        migrations.AddField(\n            model_name=\"book\",\n            name=\"published_countries\",\n            field=models.ManyToManyField(to=\"book_outlet.country\"),\n        ),\n    ]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/migrations/__init__.py",
    "content": ""
  },
  {
    "path": "tests/django_test_project/book_outlet/models.py",
    "content": "from django.core.validators import MaxValueValidator, MinValueValidator\nfrom django.db import models\nfrom django.urls import reverse\nfrom django.utils.text import slugify\n\n\nclass Country(models.Model):\n    name = models.CharField(max_length=80)\n    code = models.CharField(max_length=2)\n\n    def __str__(self):\n        return f\"{self.name}, {self.code}\"\n\n    class Meta:\n        verbose_name_plural = \"Countries\"\n\n\nclass Address(models.Model):\n    street = models.CharField(max_length=80)\n    postal_code = models.CharField(max_length=5)\n    city = models.CharField(max_length=50)\n\n    def __str__(self):\n        return f\"{self.street}, {self.postal_code}, {self.city}\"\n\n    class Meta:\n        verbose_name_plural = \"Address Entries\"\n\n\nclass Author(models.Model):\n    first_name = models.CharField(max_length=100)\n    last_name = models.CharField(max_length=100)\n    address = models.OneToOneField(Address, on_delete=models.CASCADE, null=True)\n\n    def full_name(self):\n        return f\"{self.first_name} {self.last_name}\"\n\n    def __str__(self):\n        return self.full_name()\n\n\nclass Book(models.Model):\n    title = models.CharField(max_length=50)\n    rating = models.IntegerField(\n        validators=[MinValueValidator(1), MaxValueValidator(5)]\n    )\n    author = models.ForeignKey(\n        Author, on_delete=models.CASCADE, null=True, related_name=\"books\"\n    )\n    is_bestselling = models.BooleanField(default=False)\n    slug = models.SlugField(default=\"\", blank=True, null=False, db_index=True)\n    published_countries = models.ManyToManyField(Country)\n\n    def get_absolute_url(self):\n        return reverse(\"book-detail\", args=[self.slug])\n\n    def save(self, *args, **kwargs):\n        self.slug = slugify(self.title)\n        super().save(*args, **kwargs)\n\n    def __str__(self):\n        return f\"{self.title} ({self.rating})\"\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/templates/book_outlet/base.html",
    "content": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n    <meta charset=\"UTF-8\">\n    <title>{% block title %}{% endblock %}</title>\n</head>\n<body>\n    {% block content %}\n    {% endblock %}\n</body>\n</html>\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/templates/book_outlet/book_detail.html",
    "content": "{% extends \"book_outlet/base.html\" %}\n\n{% block title %}\n    {{ title }}\n{% endblock %}\n\n{% block content %}\n    <h1>{{ title }}</h1>\n    <h2>{{ author }}</h2>\n    <p> The book has a rating of {{ rating }}\n    {% if is_bestseller %}\n        and is a bestseller.\n    {% else %}\n        but isn't a bestseller.\n    {% endif %}\n    </p>\n{% endblock %}"
  },
  {
    "path": "tests/django_test_project/book_outlet/templates/book_outlet/index.html",
    "content": "{% extends \"book_outlet/base.html\" %}\n\n{% block title %} All books {% endblock %}\n\n{% block content %}\n    <ul>\n        {% for book in books %}\n            <li><a href=\"{{ book.get_absolute_url }}\">{{book.title}} (Rating: {{ book.rating }})</a></li>\n        {% endfor %}\n    </ul>\n    <hr>\n    <p>Total Nuber of Books: {{ total_number_of_books }}</p>\n    <p>Average Rating: {{ average_rating.rating__avg }}</p>\n\n{% endblock %}\n\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/tests.py",
    "content": "# Create your tests here.\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/urls.py",
    "content": "from django.urls import path\n\nfrom . import views\n\n\nurlpatterns = [\n    path(\"\", views.index),\n    path(\"<slug:slug>\", views.book_detail, name=\"book-detail\"),\n]\n"
  },
  {
    "path": "tests/django_test_project/book_outlet/views.py",
    "content": "from django.db.models import Avg\nfrom django.http import Http404\nfrom django.shortcuts import get_object_or_404, render\n\nfrom .models import Book\n\n\n# Create your views here.\n\n\ndef index(request):\n    books = Book.objects.all().order_by(\"-title\")\n    num_books = books.count()\n    avg_rating = books.aggregate(Avg(\"rating\"))\n\n    return render(\n        request,\n        \"book_outlet/index.html\",\n        {\n            \"books\": books,\n            \"total_number_of_books\": num_books,\n            \"average_rating\": avg_rating,\n        },\n    )\n\n\ndef book_detail(request, slug):\n    try:\n        book = Book.objects.get(slug=slug)\n    except Book.DoesNotExist:\n        raise Http404()\n    book = get_object_or_404(Book, slug=slug)\n    return render(\n        request,\n        \"book_outlet/book_detail.html\",\n        {\n            \"title\": book.title,\n            \"author\": book.author,\n            \"rating\": book.rating,\n            \"is_bestseller\": book.is_bestselling,\n        },\n    )\n"
  },
  {
    "path": "tests/django_test_project/book_store/__init__.py",
    "content": ""
  },
  {
    "path": "tests/django_test_project/book_store/asgi.py",
    "content": "\"\"\"\nASGI config for book_store project.\n\nIt exposes the ASGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/4.1/howto/deployment/asgi/\n\"\"\"\n\nimport os\n\nfrom django.core.asgi import get_asgi_application\n\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"book_store.settings\")\n\napplication = get_asgi_application()\n"
  },
  {
    "path": "tests/django_test_project/book_store/settings.py",
    "content": "\"\"\"\nDjango settings for book_store project.\n\nGenerated by 'django-admin startproject' using Django 4.1.7.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/4.1/topics/settings/\n\nFor the full list of settings and their values, see\nhttps://docs.djangoproject.com/en/4.1/ref/settings/\n\"\"\"\n\nfrom pathlib import Path\n\n\n# Build paths inside the project like this: BASE_DIR / 'subdir'.\nBASE_DIR = Path(__file__).resolve().parent.parent\n\n\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/4.1/howto/deployment/checklist/\n\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = \"django-insecure-4_!#@9yicst-z-*7mtf026@qp0+modu41si78gg88h_f12n(y1\"\n\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\n\nALLOWED_HOSTS = []\n\n\n# Application definition\n\nINSTALLED_APPS = [\n    \"book_outlet\",\n    \"django.contrib.admin\",\n    \"django.contrib.auth\",\n    \"django.contrib.contenttypes\",\n    \"django.contrib.sessions\",\n    \"django.contrib.messages\",\n    \"django.contrib.staticfiles\",\n]\n\nMIDDLEWARE = [\n    \"django.middleware.security.SecurityMiddleware\",\n    \"django.contrib.sessions.middleware.SessionMiddleware\",\n    \"django.middleware.common.CommonMiddleware\",\n    \"django.middleware.csrf.CsrfViewMiddleware\",\n    \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n    \"django.contrib.messages.middleware.MessageMiddleware\",\n    \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n]\n\nROOT_URLCONF = \"book_store.urls\"\n\nTEMPLATES = [\n    {\n        \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n        \"DIRS\": [],\n        \"APP_DIRS\": True,\n        \"OPTIONS\": {\n            \"context_processors\": [\n                \"django.template.context_processors.debug\",\n                \"django.template.context_processors.request\",\n                \"django.contrib.auth.context_processors.auth\",\n                \"django.contrib.messages.context_processors.messages\",\n            ],\n        },\n    },\n]\n\nWSGI_APPLICATION = \"book_store.wsgi.application\"\n\n\n# Database\n# https://docs.djangoproject.com/en/4.1/ref/settings/#databases\n\nDATABASES = {\n    \"default\": {\n        \"ENGINE\": \"django.db.backends.sqlite3\",\n        \"NAME\": BASE_DIR / \"data.sqlite3\",\n    }\n}\n\n\n# Password validation\n# https://docs.djangoproject.com/en/4.1/ref/settings/#auth-password-validators\n\nAUTH_PASSWORD_VALIDATORS = [\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.\"\n        \"UserAttributeSimilarityValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.MinimumLengthValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\",\n    },\n    {\n        \"NAME\": \"django.contrib.auth.password_validation.NumericPasswordValidator\",\n    },\n]\n\n\n# Internationalization\n# https://docs.djangoproject.com/en/4.1/topics/i18n/\n\nLANGUAGE_CODE = \"en-us\"\n\nTIME_ZONE = \"UTC\"\n\nUSE_I18N = True\n\nUSE_TZ = True\n\n\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/4.1/howto/static-files/\n\nSTATIC_URL = \"static/\"\n\n# Default primary key field type\n# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field\n\nDEFAULT_AUTO_FIELD = \"django.db.models.BigAutoField\"\n"
  },
  {
    "path": "tests/django_test_project/book_store/urls.py",
    "content": "\"\"\"book_store URL Configuration\n\nThe `urlpatterns` list routes URLs to views. For more information please see:\n    https://docs.djangoproject.com/en/4.1/topics/http/urls/\nExamples:\nFunction views\n    1. Add an import:  from my_app import views\n    2. Add a URL to urlpatterns:  path('', views.home, name='home')\nClass-based views\n    1. Add an import:  from other_app.views import Home\n    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')\nIncluding another URLconf\n    1. Import the include() function: from django.urls import include, path\n    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))\n\"\"\"\nfrom django.contrib import admin\nfrom django.urls import include, path\n\n\nurlpatterns = [path(\"admin/\", admin.site.urls), path(\"\", include(\"book_outlet.urls\"))]\n"
  },
  {
    "path": "tests/django_test_project/book_store/wsgi.py",
    "content": "\"\"\"\nWSGI config for book_store project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/4.1/howto/deployment/wsgi/\n\"\"\"\n\nimport os\n\nfrom django.core.wsgi import get_wsgi_application\n\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"book_store.settings\")\n\napplication = get_wsgi_application()\n"
  },
  {
    "path": "tests/django_test_project/example_fk.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"application/vnd.jupyter.widget-view+json\": {\n       \"model_id\": \"a6a7088ce9fc45e3bb46a3c6dbf1f2cf\",\n       \"version_major\": 2,\n       \"version_minor\": 0\n      },\n      \"text/plain\": [\n       \"Output()\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"></pre>\\n\"\n      ],\n      \"text/plain\": []\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"from dj_notebook import activate\\n\",\n    \"\\n\",\n    \"\\n\",\n    \"plus = activate(\\\"book_store.settings\\\")\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"></pre>\\n\"\n      ],\n      \"text/plain\": []\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgQm9vayAtLS0gQXV0aG9yCiAgQm9vayAtLS0gQ291bnRyeQo=\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"from rich import print\\n\",\n    \"\\n\",\n    \"# print(plus.graph_data)\\n\",\n    \"plus.model_graph(plus.Book)\\n\",\n    \"# for model, relations in plus.graph_data.items():\\n\",\n    \"#     print(model, [x for x in relations])\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgQm9vayAtLS0gQ291bnRyeQo=\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"plus.model_graph(plus.Country)\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 4,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/Zmxvd2NoYXJ0IFRECiAgTG9nRW50cnkgLS0tIFVzZXIKICBVc2VyIC0tLSBBYnN0cmFjdFVzZXIKICBVc2VyIC0tLSBHcm91cAogIFVzZXIgLS0tIFBlcm1pc3Npb24K\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"plus.model_graph(plus.User)\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"dj-notebook\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.10.6\"\n  },\n  \"orig_nbformat\": 4\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "tests/django_test_project/example_long_form.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"import django\\n\",\n    \"import os\\n\",\n    \"\\n\",\n    \"os.environ.setdefault(\\\"DJANGO_SETTINGS_MODULE\\\", \\\"book_store.settings\\\")\\n\",\n    \"os.environ[\\\"DJANGO_ALLOW_ASYNC_UNSAFE\\\"] = \\\"true\\\"\\n\",\n    \"django.setup()\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"<QuerySet []>\"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"from book_outlet.models import Book\\n\",\n    \"\\n\",\n    \"Book.objects.all()\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"dj-notebook\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.10.6\"\n  },\n  \"orig_nbformat\": 4\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "tests/django_test_project/example_mermaid.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"></pre>\\n\"\n      ],\n      \"text/plain\": []\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"from dj_notebook import activate\\n\",\n    \"\\n\",\n    \"plus = activate(\\\"book_store.settings\\\")\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 21,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/CmZsb3djaGFydCBURAogICAgQihmcm9tIGRqX25vdGVib29rIGltcG9ydCBhY3RpdmF0ZSkKICAgIENbInBsdXMgPSBhY3RpdmF0ZSgpIl0KICAgIEQoInBsdXMubWVybWFpZChkaWFncmFtKSIpCiAgICBBW3BpcCBpbnN0YWxsIGRqLW5vdGVib29rXSAtLT58d2FpdCBhIGZldyBzZWNvbmRzfCBCCiAgICBCIC0uLT4gQwogICAgQyAtLi0+IEQK\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"diagram = \\\"\\\"\\\"\\n\",\n    \"flowchart TD\\n\",\n    \"    B(from dj_notebook import activate)\\n\",\n    \"    C[\\\"plus = activate()\\\"]\\n\",\n    \"    D(\\\"plus.mermaid(diagram)\\\")\\n\",\n    \"    A[pip install dj-notebook] -->|wait a few seconds| B\\n\",\n    \"    B -.-> C\\n\",\n    \"    C -.-> D\\n\",\n    \"\\\"\\\"\\\"\\n\",\n    \"\\n\",\n    \"plus.mermaid(diagram)\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": []\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"dj-notebook\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.10.6\"\n  },\n  \"orig_nbformat\": 4\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "tests/django_test_project/example_print.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 1,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"application/vnd.jupyter.widget-view+json\": {\n       \"model_id\": \"eb7342be620e4f32a22efe83e24b19b0\",\n       \"version_major\": 2,\n       \"version_minor\": 0\n      },\n      \"text/plain\": [\n       \"Output()\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"><span style=\\\"color: #959077; text-decoration-color: #959077; background-color: #272822\\\"># Shell Plus Model Imports</span><span style=\\\"background-color: #272822\\\">                                                                                         </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> book_outlet.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Address, Author, Book, Country</span><span style=\\\"background-color: #272822\\\">                                                      </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.admin.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> LogEntry</span><span style=\\\"background-color: #272822\\\">                                                                   </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.auth.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Group, Permission, User</span><span style=\\\"background-color: #272822\\\">                                                     </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.contenttypes.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> ContentType</span><span style=\\\"background-color: #272822\\\">                                                         </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.sessions.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Session</span><span style=\\\"background-color: #272822\\\">                                                                 </span>\\n\",\n       \"<span style=\\\"color: #959077; text-decoration-color: #959077; background-color: #272822\\\"># Shell Plus Django Imports</span><span style=\\\"background-color: #272822\\\">                                                                                        </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.core.cache </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> cache</span><span style=\\\"background-color: #272822\\\">                                                                                </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.conf </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> settings</span><span style=\\\"background-color: #272822\\\">                                                                                   </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.auth </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> get_user_model</span><span style=\\\"background-color: #272822\\\">                                                                     </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> transaction</span><span style=\\\"background-color: #272822\\\">                                                                                  </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Avg, Case, Count, F, Max, Min, Prefetch, Q, Sum, When</span><span style=\\\"background-color: #272822\\\">                                 </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.utils </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> timezone</span><span style=\\\"background-color: #272822\\\">                                                                                  </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.urls </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> reverse</span><span style=\\\"background-color: #272822\\\">                                                                                    </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Exists, OuterRef, Subquery</span><span style=\\\"background-color: #272822\\\">                                                            </span>\\n\",\n       \"<span style=\\\"background-color: #272822\\\">                                                                                                                   </span>\\n\",\n       \"</pre>\\n\"\n      ],\n      \"text/plain\": [\n       \"\\u001b[38;2;149;144;119;48;2;39;40;34m# Shell Plus Model Imports\\u001b[0m\\u001b[48;2;39;40;34m                                                                                         \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mbook_outlet\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAddress\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAuthor\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mBook\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCountry\\u001b[0m\\u001b[48;2;39;40;34m                                                      \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34madmin\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mLogEntry\\u001b[0m\\u001b[48;2;39;40;34m                                                                   \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mauth\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mGroup\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mPermission\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mUser\\u001b[0m\\u001b[48;2;39;40;34m                                                     \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontenttypes\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mContentType\\u001b[0m\\u001b[48;2;39;40;34m                                                         \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34msessions\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSession\\u001b[0m\\u001b[48;2;39;40;34m                                                                 \\u001b[0m\\n\",\n       \"\\u001b[38;2;149;144;119;48;2;39;40;34m# Shell Plus Django Imports\\u001b[0m\\u001b[48;2;39;40;34m                                                                                        \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcore\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcache\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcache\\u001b[0m\\u001b[48;2;39;40;34m                                                                                \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mconf\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34msettings\\u001b[0m\\u001b[48;2;39;40;34m                                                                                   \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mauth\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mget_user_model\\u001b[0m\\u001b[48;2;39;40;34m                                                                     \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mtransaction\\u001b[0m\\u001b[48;2;39;40;34m                                                                                  \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAvg\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCase\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCount\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mF\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mMax\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mMin\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mPrefetch\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mQ\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSum\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mWhen\\u001b[0m\\u001b[48;2;39;40;34m                                 \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mutils\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mtimezone\\u001b[0m\\u001b[48;2;39;40;34m                                                                                  \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34murls\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mreverse\\u001b[0m\\u001b[48;2;39;40;34m                                                                                    \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mExists\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mOuterRef\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSubquery\\u001b[0m\\u001b[48;2;39;40;34m                                                            \\u001b[0m\\n\",\n       \"\\u001b[48;2;39;40;34m                                                                                                                   \\u001b[0m\\n\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    },\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"></pre>\\n\"\n      ],\n      \"text/plain\": []\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"from dj_notebook import activate\\n\",\n    \"\\n\",\n    \"plus = activate(\\\"book_store.settings\\\", quiet_load=False)\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"<QuerySet [<User: Audrey>, <User: Daniel>]>\"\n      ]\n     },\n     \"execution_count\": 2,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"plus.User.objects.all()\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 3,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<pre style=\\\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\\\"><span style=\\\"color: #959077; text-decoration-color: #959077; background-color: #272822\\\"># Shell Plus Model Imports</span><span style=\\\"background-color: #272822\\\">                                                                                         </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> book_outlet.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Address, Author, Book, Country</span><span style=\\\"background-color: #272822\\\">                                                      </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.admin.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> LogEntry</span><span style=\\\"background-color: #272822\\\">                                                                   </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.auth.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Group, Permission, User</span><span style=\\\"background-color: #272822\\\">                                                     </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.contenttypes.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> ContentType</span><span style=\\\"background-color: #272822\\\">                                                         </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.sessions.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Session</span><span style=\\\"background-color: #272822\\\">                                                                 </span>\\n\",\n       \"<span style=\\\"color: #959077; text-decoration-color: #959077; background-color: #272822\\\"># Shell Plus Django Imports</span><span style=\\\"background-color: #272822\\\">                                                                                        </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.core.cache </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> cache</span><span style=\\\"background-color: #272822\\\">                                                                                </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.conf </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> settings</span><span style=\\\"background-color: #272822\\\">                                                                                   </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.contrib.auth </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> get_user_model</span><span style=\\\"background-color: #272822\\\">                                                                     </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> transaction</span><span style=\\\"background-color: #272822\\\">                                                                                  </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Avg, Case, Count, F, Max, Min, Prefetch, Q, Sum, When</span><span style=\\\"background-color: #272822\\\">                                 </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.utils </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> timezone</span><span style=\\\"background-color: #272822\\\">                                                                                  </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.urls </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> reverse</span><span style=\\\"background-color: #272822\\\">                                                                                    </span>\\n\",\n       \"<span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">from</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> django.db.models </span><span style=\\\"color: #ff4689; text-decoration-color: #ff4689; background-color: #272822\\\">import</span><span style=\\\"color: #f8f8f2; text-decoration-color: #f8f8f2; background-color: #272822\\\"> Exists, OuterRef, Subquery</span><span style=\\\"background-color: #272822\\\">                                                            </span>\\n\",\n       \"<span style=\\\"background-color: #272822\\\">                                                                                                                   </span>\\n\",\n       \"</pre>\\n\"\n      ],\n      \"text/plain\": [\n       \"\\u001b[38;2;149;144;119;48;2;39;40;34m# Shell Plus Model Imports\\u001b[0m\\u001b[48;2;39;40;34m                                                                                         \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mbook_outlet\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAddress\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAuthor\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mBook\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCountry\\u001b[0m\\u001b[48;2;39;40;34m                                                      \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34madmin\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mLogEntry\\u001b[0m\\u001b[48;2;39;40;34m                                                                   \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mauth\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mGroup\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mPermission\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mUser\\u001b[0m\\u001b[48;2;39;40;34m                                                     \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontenttypes\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mContentType\\u001b[0m\\u001b[48;2;39;40;34m                                                         \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34msessions\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSession\\u001b[0m\\u001b[48;2;39;40;34m                                                                 \\u001b[0m\\n\",\n       \"\\u001b[38;2;149;144;119;48;2;39;40;34m# Shell Plus Django Imports\\u001b[0m\\u001b[48;2;39;40;34m                                                                                        \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcore\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcache\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcache\\u001b[0m\\u001b[48;2;39;40;34m                                                                                \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mconf\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34msettings\\u001b[0m\\u001b[48;2;39;40;34m                                                                                   \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mcontrib\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mauth\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mget_user_model\\u001b[0m\\u001b[48;2;39;40;34m                                                                     \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mtransaction\\u001b[0m\\u001b[48;2;39;40;34m                                                                                  \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mAvg\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCase\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mCount\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mF\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mMax\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mMin\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mPrefetch\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mQ\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSum\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mWhen\\u001b[0m\\u001b[48;2;39;40;34m                                 \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mutils\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mtimezone\\u001b[0m\\u001b[48;2;39;40;34m                                                                                  \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34murls\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mreverse\\u001b[0m\\u001b[48;2;39;40;34m                                                                                    \\u001b[0m\\n\",\n       \"\\u001b[38;2;255;70;137;48;2;39;40;34mfrom\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdjango\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mdb\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m.\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mmodels\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;255;70;137;48;2;39;40;34mimport\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mExists\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mOuterRef\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m,\\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34m \\u001b[0m\\u001b[38;2;248;248;242;48;2;39;40;34mSubquery\\u001b[0m\\u001b[48;2;39;40;34m                                                            \\u001b[0m\\n\",\n       \"\\u001b[48;2;39;40;34m                                                                                                                   \\u001b[0m\\n\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"plus.print()\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": []\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"dj-notebook\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.10.6\"\n  },\n  \"orig_nbformat\": 4\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "tests/django_test_project/example_short_form.ipynb",
    "content": "{\n \"cells\": [\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 2,\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"from dj_notebook import activate\\n\",\n    \"\\n\",\n    \"plus = activate(\\\"book_store.settings\\\")\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 6,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"<QuerySet []>\"\n      ]\n     },\n     \"execution_count\": 6,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"plus.User.objects.all()\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 5,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/plain\": [\n       \"<QuerySet []>\"\n      ]\n     },\n     \"execution_count\": 5,\n     \"metadata\": {},\n     \"output_type\": \"execute_result\"\n    }\n   ],\n   \"source\": [\n    \"from django.contrib.auth import get_user_model\\n\",\n    \"\\n\",\n    \"User = get_user_model()\\n\",\n    \"User.objects.all()\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": 7,\n   \"metadata\": {},\n   \"outputs\": [\n    {\n     \"data\": {\n      \"text/html\": [\n       \"<img src=\\\"https://mermaid.ink/img/Y2xhc3NEaWFncmFtCiAgY2xhc3MgZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfVXNlclsiZGphbmdvLmNvbnRyaWIuYXV0aC5tb2RlbHM6OlVzZXIiXQogIGRqYW5nb19kYl9tb2RlbHNfdXRpbHNfQWx0ZXJzRGF0YSA8fC0tIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbAogIGNsYXNzIGRqYW5nb19kYl9tb2RlbHNfdXRpbHNfQWx0ZXJzRGF0YVsiZGphbmdvLmRiLm1vZGVscy51dGlsczo6QWx0ZXJzRGF0YSJdCiAgZGphbmdvX2NvbnRyaWJfYXV0aF9iYXNlX3VzZXJfQWJzdHJhY3RCYXNlVXNlciA8fC0tIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX0Fic3RyYWN0VXNlcgogIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX1Blcm1pc3Npb25zTWl4aW4gPHwtLSBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19BYnN0cmFjdFVzZXIKICBjbGFzcyBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19BYnN0cmFjdFVzZXJbImRqYW5nby5jb250cmliLmF1dGgubW9kZWxzOjpBYnN0cmFjdFVzZXIiXQogIGNsYXNzIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbFsiZGphbmdvLmRiLm1vZGVscy5iYXNlOjpNb2RlbCJdCiAgY2xhc3MgZGphbmdvX2NvbnRyaWJfYXV0aF9iYXNlX3VzZXJfQWJzdHJhY3RCYXNlVXNlclsiZGphbmdvLmNvbnRyaWIuYXV0aC5iYXNlX3VzZXI6OkFic3RyYWN0QmFzZVVzZXIiXQogIGRqYW5nb19kYl9tb2RlbHNfYmFzZV9Nb2RlbCA8fC0tIGRqYW5nb19jb250cmliX2F1dGhfYmFzZV91c2VyX0Fic3RyYWN0QmFzZVVzZXIKICBkamFuZ29fZGJfbW9kZWxzX2Jhc2VfTW9kZWwgPHwtLSBkamFuZ29fY29udHJpYl9hdXRoX21vZGVsc19QZXJtaXNzaW9uc01peGluCiAgZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfQWJzdHJhY3RVc2VyIDx8LS0gZGphbmdvX2NvbnRyaWJfYXV0aF9tb2RlbHNfVXNlcgogIGNsYXNzIGRqYW5nb19jb250cmliX2F1dGhfbW9kZWxzX1Blcm1pc3Npb25zTWl4aW5bImRqYW5nby5jb250cmliLmF1dGgubW9kZWxzOjpQZXJtaXNzaW9uc01peGluIl0=\\\"/>\"\n      ],\n      \"text/plain\": [\n       \"<IPython.core.display.Image object>\"\n      ]\n     },\n     \"metadata\": {},\n     \"output_type\": \"display_data\"\n    }\n   ],\n   \"source\": [\n    \"plus.diagram(plus.User)\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"dj-notebook\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.10.6\"\n  },\n  \"orig_nbformat\": 4\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 2\n}\n"
  },
  {
    "path": "tests/django_test_project/manage.py",
    "content": "#!/usr/bin/env python\n\"\"\"Django's command-line utility for administrative tasks.\"\"\"\nimport os\nimport sys\n\n\ndef main():\n    \"\"\"Run administrative tasks.\"\"\"\n    os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"book_store.settings\")\n    try:\n        from django.core.management import execute_from_command_line\n    except ImportError as exc:\n        raise ImportError(\n            \"Couldn't import Django. Are you sure it's installed and \"\n            \"available on your PYTHONPATH environment variable? Did you \"\n            \"forget to activate a virtual environment?\"\n        ) from exc\n    execute_from_command_line(sys.argv)\n\n\nif __name__ == \"__main__\":\n    main()\n"
  },
  {
    "path": "tests/env.django_settings_module",
    "content": "DJANGO_SETTINGS_MODULE=bip.config"
  },
  {
    "path": "tests/fake_manage_alias_environ.py",
    "content": "from os import environ as os_environ\n\n\nif __name__ == \"__main__\":\n    os_environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"baz.settings\")\n"
  },
  {
    "path": "tests/fake_manage_fully_qualified.py",
    "content": "import os\n\n\nif __name__ == \"__main__\":\n    os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"foo.settings\")\n"
  },
  {
    "path": "tests/fake_manage_import_environ.py",
    "content": "from os import environ\n\n\nif __name__ == \"__main__\":\n    environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"bar.settings\")\n"
  },
  {
    "path": "tests/fake_other_environ_and_real_environ_setdefault.py",
    "content": "import os\n\n\nclass Environ:\n    def setdefault(self, k: str, v: str) -> None:\n        print(f\"{k}={v}\")\n\n\nenviron = Environ()\n\nif __name__ == \"__main__\":\n    environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"foo.bar.settings\")\n    os.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"foo.bar.os.environ.settings\")\n"
  },
  {
    "path": "tests/fake_other_environ_setdefault.py",
    "content": "class Environ:\n    def setdefault(self, k: str, v: str) -> None:\n        print(f\"{k}={v}\")\n\n\nenviron = Environ()\n\nif __name__ == \"__main__\":\n    environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"foo.bar.settings\")\n"
  },
  {
    "path": "tests/sample.csv",
    "content": "Name,Age,Weight\nA,1,100\nB,2,200"
  },
  {
    "path": "tests/test_config_helper.py",
    "content": "import os\nfrom pathlib import Path\n\nfrom dj_notebook.config_helper import find_django_settings_module, setdefault_calls\n\n\nclass EnvironmentGuard:\n    def __enter__(self):\n        self.original_environment = {}\n        for k in os.environ.keys():\n            self.original_environment[k] = os.environ[k]\n        return None\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        for k in os.environ.keys():\n            del os.environ[k]\n        for k in self.original_environment.keys():\n            os.environ[k] = self.original_environment[k]\n\n\ndef test_setdefault_calls_fully_qualified():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    manage_py = script_dir_path / \"fake_manage_fully_qualified.py\"\n    calls = list(setdefault_calls(manage_py))\n    assert len(calls) == 1\n    assert calls[0].args[0].value == \"DJANGO_SETTINGS_MODULE\"\n    assert calls[0].args[1].value == \"foo.settings\"\n\n\ndef test_setdefault_calls_import_function():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    manage_py = script_dir_path / \"fake_manage_import_environ.py\"\n    calls = list(setdefault_calls(manage_py))\n    assert len(calls) == 1\n    assert calls[0].args[0].value == \"DJANGO_SETTINGS_MODULE\"\n    assert calls[0].args[1].value == \"bar.settings\"\n\n\ndef test_setdefault_calls_import_alias():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    manage_py = script_dir_path / \"fake_manage_alias_environ.py\"\n    calls = list(setdefault_calls(manage_py))\n    assert len(calls) == 1\n    assert calls[0].args[0].value == \"DJANGO_SETTINGS_MODULE\"\n    assert calls[0].args[1].value == \"baz.settings\"\n\n\ndef test_setdefault_calls_skips_wrong_function():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    manage_py = script_dir_path / \"fake_other_environ_setdefault.py\"\n    calls = list(setdefault_calls(manage_py))\n    assert len(calls) == 0\n\n\ndef test_setdefault_calls_skips_wrong_function_finds_right_function():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    manage_py = script_dir_path / \"fake_other_environ_and_real_environ_setdefault.py\"\n    calls = list(setdefault_calls(manage_py))\n    assert len(calls) == 1\n    assert calls[0].args[0].value == \"DJANGO_SETTINGS_MODULE\"\n    assert calls[0].args[1].value == \"foo.bar.os.environ.settings\"\n\n\ndef test_find_django_settings_module_dotenv():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    env_file = script_dir_path / \"env.django_settings_module\"\n    with EnvironmentGuard():\n        source, found = find_django_settings_module(dotenv_file=env_file)\n        assert source == \"dotenv\"\n        assert os.environ[\"DJANGO_SETTINGS_MODULE\"] == found\n        assert found == \"bip.config\"\n\n\ndef test_find_django_settings_module_dotenv_overrides():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    env_file = script_dir_path / \"env.django_settings_module\"\n    with EnvironmentGuard():\n        os.environ[\"DJANGO_SETTINGS_MODULE\"] = \"something.else\"\n        source, found = find_django_settings_module(dotenv_file=env_file)\n        assert source == \"dotenv\"\n        assert os.environ[\"DJANGO_SETTINGS_MODULE\"] == found\n        assert found == \"bip.config\"\n\n\ndef test_find_django_settings_module_os_environment():\n    with EnvironmentGuard():\n        os.environ[\"DJANGO_SETTINGS_MODULE\"] = \"something.else\"\n        source, found = find_django_settings_module()\n        assert source == \"environment\"\n        assert os.environ[\"DJANGO_SETTINGS_MODULE\"] == found\n        assert found == \"something.else\"\n\n\ndef test_find_django_settings_module_remote_path():\n    script_dir_path = Path(os.path.dirname(os.path.realpath(__file__)))\n    django_project_path = script_dir_path / \"django_test_project\"\n    old_cwd = os.getcwd()\n    # Change to a directory that is not the django project or adjacent.\n    os.chdir(script_dir_path / \"..\")\n    with EnvironmentGuard():\n        source, found = find_django_settings_module(search_dir=django_project_path)\n        assert source == str(django_project_path / \"manage.py\")\n        assert found == \"book_store.settings\"\n    # Change to the parent directory in order to search children\n    source, found = None, None\n    with EnvironmentGuard():\n        source, found = find_django_settings_module(\n            search_dir=django_project_path / \"..\"\n        )\n        assert source == str(django_project_path / \"manage.py\")\n        assert found == \"book_store.settings\"\n    # Change to a child directory in order to search parents\n    source, found = None, None\n    with EnvironmentGuard():\n        source, found = find_django_settings_module(\n            search_dir=django_project_path / \"book_store\"\n        )\n        assert source == str(django_project_path / \"manage.py\")\n        assert found == \"book_store.settings\"\n    os.chdir(old_cwd)\n"
  },
  {
    "path": "tests/test_dj_notebook.py",
    "content": "import os\nfrom os import environ\nfrom pathlib import Path\nfrom unittest.mock import patch\n\nimport django.conf\nimport pandas\nimport pytest\nfrom dj_notebook import Plus, activate\nfrom dj_notebook.shell_plus import DiagramClass\nfrom django import conf as django_conf\nfrom django.core.exceptions import ImproperlyConfigured\nfrom dotenv import load_dotenv\n\n\nclass SettingsCleaner:\n    \"\"\"\n    A context manager that saves and restores the value of `DJANGO_SETTINGS_MODULE` along with resetting\n    `djang.conf.settings` on both enter and exit, to prevent tests that rely on different django settings\n    from accidentally depending on each other.\n    \"\"\"\n\n    def __enter__(self):\n        self.old_settings_env = environ.get(\"DJANGO_SETTINGS_MODULE\", None)\n        if self.old_settings_env is not None:\n            del environ[\"DJANGO_SETTINGS_MODULE\"]\n        django_conf.settings = django.conf.LazySettings()\n        return None\n\n    def __exit__(self, exc_type, exc_val, exc_tb):\n        if self.old_settings_env is not None:\n            environ[\"DJANGO_SETTINGS_MODULE\"] = self.old_settings_env\n        elif \"DJANGO_SETTINGS_MODULE\" in environ:\n            del environ[\"DJANGO_SETTINGS_MODULE\"]\n        django.conf.settings = django.conf.LazySettings()\n\n\ndef test_thing():\n    with SettingsCleaner():\n        plus = activate(\"tests.config_test_harness\")\n        # TODO capture STDOUT and assert on it\n        assert plus.print() is None\n\n\ndef test_namify():\n    \"\"\"\n    Test the `namify` method of the `DiagramClass`.\n\n    Checks if the `namify` method correctly converts the class\n    name and its module into a format that replaces dots with underscores.\n    Test covers three scenarios:\n    1. Built-in classes (e.g., `str`).\n    2. Custom classes (e.g., `DiagramClass`).\n    3. Nested classes (e.g., `OuterClass.InnerClass`).\n\n    TODO: Maybe add scenarios of periods included in naming to\n    test conversion\n    \"\"\"\n    # Create an instance of DiagramClass - include a sample class\n    diagram = DiagramClass(str)\n\n    # Test built-in class\n    assert diagram.namify(str) == \"builtins_str\"\n\n    # Test custom class\n    assert diagram.namify(DiagramClass) == \"dj_notebook_shell_plus_DiagramClass\"\n\n    # Test nested class\n    class OuterClass:\n        class InnerClass:\n            pass\n\n    assert diagram.namify(OuterClass.InnerClass) == \"tests_test_dj_notebook_InnerClass\"\n\n\ndef test_draw_connections():\n    \"\"\"\n    Test the `draw_connections` functionality of the `DiagramClass`.\n\n    Verifies that the graph generated by `DiagramClass` correctly\n    reflects the relationships between a sample class (`SampleClass`) and its\n    direct base classes (`TestClassA` and `TestClassB`).\n\n    TODO: There is an oddity with needing to add 2 leading spaces to the\n    assertions... look on line 47 in the `draw_connections` definition\n    which it needs to match.\n    \"\"\"\n\n    # Define base classes\n    class TestClassA:\n        pass\n\n    class TestClassB:\n        pass\n\n    # Create a sample class that inherits from the base classes\n    class SampleClass(TestClassA, TestClassB):\n        pass\n\n    diagram = DiagramClass(SampleClass)\n\n    # Check if the graph has nodes for the SampleClass and its ancestors\n    sample_class_node = (\n        f\"  class {diagram.namify(SampleClass)}\"\n        f'[\"{SampleClass.__module__}::{SampleClass.__name__}\"]'\n    )\n    assert sample_class_node in diagram.graph\n\n    test_class_a_node = (\n        f\"  class {diagram.namify(TestClassA)}\"\n        f'[\"{TestClassA.__module__}::{TestClassA.__name__}\"]'\n    )\n    assert test_class_a_node in diagram.graph\n\n    test_class_b_node = (\n        f\"  class {diagram.namify(TestClassB)}\"\n        f'[\"{TestClassB.__module__}::{TestClassB.__name__}\"]'\n    )\n    assert test_class_b_node in diagram.graph\n\n    # Check if the graph has connections between the SampleClass and its ancestors\n    assert (\n        f\"  {diagram.namify(TestClassA)} <|-- {diagram.namify(SampleClass)}\"\n        in diagram.graph\n    )\n    assert (\n        f\"  {diagram.namify(TestClassB)} <|-- {diagram.namify(SampleClass)}\"\n        in diagram.graph\n    )\n\n\n# Create a mock for QuerySet.\nclass MockQuerySet:\n    pass\n\n\n@pytest.fixture\ndef mock_read_frame():\n    # Mock the external read_frame function from django_pandas.io\n    # since this proj uses a wrapper around it - test directly\n    with patch(\"django_pandas.io.read_frame\") as mock_rf:\n        mock_rf.return_value = \"Mocked DataFrame\"\n        yield mock_rf\n\n\ndef test_read_frame(mock_read_frame):\n    \"\"\"\n    Tests the `read_frame` method of the `Plus`\n    class to ensure it properly delegates to the\n    `django_pandas.io` wrapper around pandas,\n    using a provided QuerySet.\n\n    The test mocks this function to return \"Mocked DataFrame\"\n    and checks if the `Plus` method returns this when given a mock QuerySet.\n    \"\"\"\n    plus_instance = Plus(helpers={})\n    mock_qs = MockQuerySet()\n\n    # Bypass __getattribute__ and directly set the read_frame method to the mock\n    plus_instance.read_frame = mock_read_frame\n\n    result = plus_instance.read_frame(mock_qs)\n\n    # assert mocked query called\n    mock_read_frame.assert_called_once_with(mock_qs)\n    assert result == \"Mocked DataFrame\"\n\n\ndef test_csv_to_df():\n    \"\"\"\n    Tests the `csv_to_df` method of the `Plus`\n    class to ensure it returns a CSV.\n\n    The test mocks this function to return \"Mocked DataFrame\"\n    and checks if the `Plus` method returns this when given a mock CSV.\n    \"\"\"\n    plus_instance = Plus(helpers={})\n    csv_path = Path(\"tests/sample.csv\")\n    with open(csv_path) as f:\n        csv_string = f.read()\n\n    result_from_string = plus_instance.csv_to_df(csv_string)\n    result_from_path = plus_instance.csv_to_df(csv_path)\n\n    # assert results are dataframes\n    assert isinstance(result_from_string, pandas.DataFrame)\n    assert isinstance(result_from_path, pandas.DataFrame)\n\n    # assert content is correct\n    assert result_from_string.at[0, \"Name\"] == \"A\"\n    assert result_from_path.at[0, \"Name\"] == \"A\"\n\n\ndef test_warning_when_debug_false(capfd):\n    \"\"\"\n    Test if the correct warning and message are displayed when DEBUG is False.\n\n    Checks for error string message in both stout and warnings.\n    Test assumes that calling activate(\"fake_settings\") results in\n    a state where DEBUG is False.\n\n    Args:\n        capfd: Pytest fixture to capture stdout and stderr.\n    \"\"\"\n\n    with SettingsCleaner():\n        with pytest.warns(UserWarning) as record:\n            activate(\"tests.config_debug_false\")\n\n        # Capture STDOUT and STDERR\n        capfd.readouterr()\n\n        # Check warning message\n        assert \"Django is running in production mode with dj-notebook.\" in [\n            str(r.message) for r in record.list\n        ]\n\n\ndef test_settings_discovery_subdirectory():\n    # when run from the makefile, this gets its cwd set to the project root. for discovery to work as intended, the cwd\n    # needs to be tests\n    old_cwd = os.getcwd()\n    os.chdir(os.path.dirname(os.path.realpath(__file__)))\n    try:\n        with SettingsCleaner():\n            activate()\n            assert environ[\"DJANGO_SETTINGS_MODULE\"] == \"book_store.settings\"\n    finally:\n        os.chdir(old_cwd)\n\n\ndef test_settings_discovery_envfile_invalid_module():\n    # Create a .env file next to this test script with an invalid module, and make sure it fails with an ImproperlyConfigured exception\n    script_dir = os.path.dirname(os.path.realpath(__file__))\n    old_cwd = os.getcwd()\n    os.chdir(script_dir)\n    env_path = Path(script_dir) / \".env\"\n    assert not env_path.exists(), \"cowardly refusing to overwrite existing .env file\"\n    try:\n        with open(env_path, \"w\") as envfile:\n            envfile.write(\"DJANGO_SETTINGS_MODULE=blockbuster_video.settings\")\n        with SettingsCleaner():\n            load_dotenv(str(env_path))\n            with pytest.raises(ImproperlyConfigured):\n                activate()\n    finally:\n        os.chdir(old_cwd)\n        os.unlink(env_path)\n"
  },
  {
    "path": "utils/update_changelog.py",
    "content": "import json\nimport pathlib\nimport typing\n\n\ndef main() -> None:\n    changes: dict[str, typing.Any] = json.loads(\n        pathlib.Path(\"changelog.json\").read_text()\n    )\n    previous_changelog: str = pathlib.Path(\"CHANGELOG.md\").read_text()\n\n    new_changelog: str = f\"\"\"\n# [{changes[\"tag_name\"]}]({changes['html_url']})\n\n{changes['created_at']} by\n[@{changes['author']['login']}]({changes['author']['html_url']})\n\n## {changes[\"body\"]}\n\n---\n\n{previous_changelog}\n\"\"\"\n    new_changelog = new_changelog.replace(\"## ##\", \"##\")\n\n    pathlib.Path(\"CHANGELOG.md\").write_text(new_changelog)\n\n\nif __name__ == \"__main__\":\n    main()\n"
  }
]