Showing preview only (674K chars total). Download the full file or copy to clipboard to get everything.
Repository: aio-libs/aiohttp-debugtoolbar
Branch: master
Commit: f1ab053f5799
Files: 98
Total size: 640.3 KB
Directory structure:
gitextract_uy8tz9g5/
├── .codecov.yml
├── .coveragerc
├── .flake8
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── auto-merge.yml
│ ├── ci.yml
│ └── codeql.yml
├── .gitignore
├── .mypy.ini
├── .pre-commit-config.yaml
├── CHANGES.rst
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.rst
├── aiohttp_debugtoolbar/
│ ├── __init__.py
│ ├── main.py
│ ├── middlewares.py
│ ├── panels/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── headers.py
│ │ ├── logger.py
│ │ ├── middlewares.py
│ │ ├── performance.py
│ │ ├── request_vars.py
│ │ ├── routes.py
│ │ ├── settings.py
│ │ ├── templates/
│ │ │ ├── headers.jinja2
│ │ │ ├── logger.jinja2
│ │ │ ├── middlewares.jinja2
│ │ │ ├── performance.jinja2
│ │ │ ├── request_vars.jinja2
│ │ │ ├── routes.jinja2
│ │ │ ├── settings.jinja2
│ │ │ ├── sqlalchemy_explain.jinja2
│ │ │ ├── sqlalchemy_select.jinja2
│ │ │ ├── traceback.jinja2
│ │ │ └── versions.jinja2
│ │ ├── traceback.py
│ │ └── versions.py
│ ├── py.typed
│ ├── static/
│ │ ├── css/
│ │ │ ├── dashboard.css
│ │ │ ├── debugger.css
│ │ │ ├── prism.css
│ │ │ ├── toolbar.css
│ │ │ └── toolbar_button.css
│ │ ├── font/
│ │ │ └── FONT_LICENSE
│ │ └── js/
│ │ ├── README.rst
│ │ ├── debugger.js
│ │ ├── jquery.cookie.js
│ │ ├── prism.js
│ │ ├── r.js
│ │ ├── require.js
│ │ ├── tests.html
│ │ └── toolbar.js
│ ├── tbtools/
│ │ ├── __init__.py
│ │ ├── console.py
│ │ ├── repr.py
│ │ └── tbtools.py
│ ├── templates/
│ │ ├── console.jinja2
│ │ ├── exception.jinja2
│ │ ├── exception_summary.jinja2
│ │ ├── global_tab.jinja2
│ │ ├── history_tab.jinja2
│ │ ├── redirect.jinja2
│ │ ├── settings_tab.jinja2
│ │ └── toolbar.jinja2
│ ├── toolbar.py
│ ├── utils.py
│ └── views.py
├── demo/
│ ├── README.rst
│ ├── demo.py
│ ├── static/
│ │ ├── main.js
│ │ └── require-1.0.6.js
│ └── templates/
│ ├── ajax.jinja2
│ ├── error.jinja2
│ └── index.jinja2
├── examples/
│ ├── extra_panels/
│ │ ├── extra_pgsql.py
│ │ ├── extra_redis.py
│ │ ├── extra_tpl/
│ │ │ ├── request_pgsql.jinja2
│ │ │ └── request_redis.jinja2
│ │ └── server.py
│ └── simple.py
├── pytest.ini
├── requirements-dev.txt
├── requirements.txt
├── setup.py
└── tests/
├── conftest.py
├── pep492/
│ └── test_await.py
├── test_debug.py
├── test_exception_views.py
├── test_imports.py
├── test_middleware.py
├── test_panel.py
├── test_panels_versions.py
├── test_server_push.py
├── test_utils.py
└── tpl/
└── test.jinja2
================================================
FILE CONTENTS
================================================
================================================
FILE: .codecov.yml
================================================
codecov:
branch: master
notify:
after_n_builds: 10
================================================
FILE: .coveragerc
================================================
[run]
branch = True
source = aiohttp_debugtoolbar, tests
omit = site-packages, .tox
================================================
FILE: .flake8
================================================
[flake8]
enable-extensions = G
max-doc-length = 90
max-line-length = 90
select = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,B901,B902,B903,B950
# E226: Missing whitespace around arithmetic operators can help group things together.
# E501: Superseeded by B950 (from Bugbear)
# E722: Superseeded by B001 (from Bugbear)
# W503: Mutually exclusive with W504.
ignore = E226,E501,E722,W503
per-file-ignores =
# I900: Requirements not needed for examples
examples/*:I900
# S101: Pytest uses assert
tests/*:S101
# flake8-import-order
application-import-names = aiohttp_debugtoolbar
import-order-style = pycharm
# flake8-requirements
known-modules = :[aiohttp_debugtoolbar]
requirements-file = requirements-dev.txt
================================================
FILE: .github/dependabot.yml
================================================
version: 2
updates:
- package-ecosystem: pip
directory: "/"
schedule:
interval: daily
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
================================================
FILE: .github/workflows/auto-merge.yml
================================================
name: Dependabot auto-merge
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
dependabot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2.5.0
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
================================================
FILE: .github/workflows/ci.yml
================================================
name: CI
on:
push:
branches:
- master
- '[0-9].[0-9]+' # matches to backport branches, e.g. 3.6
tags: [ 'v*' ]
pull_request:
branches:
- master
- '[0-9].[0-9]+'
jobs:
lint:
name: Linter
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.9
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Pre-Commit hooks
uses: pre-commit/action@v3.0.1
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements-dev.txt
- name: Install itself
run: |
pip install .
- name: Mypy
run: mypy
- name: Prepare twine checker
run: |
pip install -U build twine wheel
python -m build
- name: Run twine checker
run: |
twine check dist/*
test:
name: Test
strategy:
matrix:
pyver: ['3.9', '3.10', '3.11', '3.12', '3.13']
os: [ubuntu, macos, windows]
include:
- pyver: pypy-3.9
os: ubuntu
runs-on: ${{ matrix.os }}-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python ${{ matrix.pyver }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.pyver }}
cache: 'pip'
cache-dependency-path: '**/requirements*.txt'
- name: Install dependencies
uses: py-actions/py-dependency-install@v4
with:
path: requirements.txt
- name: Run unittests
run: pytest --cov-report=xml tests
env:
COLOR: 'yes'
- run: python -m coverage xml
- name: Upload coverage
uses: codecov/codecov-action@v5
with:
file: ./coverage.xml
flags: unit
check: # This job does nothing and is only used for the branch protection
if: always()
needs: [lint, test]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
deploy:
name: Deploy
environment: release
runs-on: ubuntu-latest
needs: check
# Run only on pushing a tag
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.13
- name: Install dependencies
run:
python -m pip install -U build setuptools wheel twine
- name: Make dists
run:
python -m build
- name: Make Release
uses: aio-libs/create-release@v1.6.6
with:
changes_file: CHANGES.rst
name: aiohttp-debugtoolbar
version_file: aiohttp_debugtoolbar/__init__.py
github_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_API_TOKEN }}
dist_dir: dist
fix_issue_regex: "`#(\\d+) <https://github.com/aio-libs/aiohttp-debugtoolbar/issues/\\1>`"
fix_issue_repl: "(#\\1)"
================================================
FILE: .github/workflows/codeql.yml
================================================
name: "CodeQL"
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
schedule:
- cron: "33 2 * * 2"
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
language: [ python ]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
languages: ${{ matrix.language }}
queries: +security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v4
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4
with:
category: "/language:${{ matrix.language }}"
================================================
FILE: .gitignore
================================================
># Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
venv/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml
cover
# Translations
*.mo
*.pot
# Django stuff:
*.log
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# PyCharm
.idea
# vim
*.swp
.pytest_cache
<<<<<<< HEAD
.python-version
=======
>>>>>>> b32a82ee01dcc2d96a18cf00e5a6a614d880a724
================================================
FILE: .mypy.ini
================================================
[mypy]
files = aiohttp_debugtoolbar, demo, examples, tests
#check_untyped_defs = True
follow_imports_for_stubs = True
#disallow_any_decorated = True
#disallow_any_generics = True
#disallow_any_unimported = True
disallow_incomplete_defs = True
disallow_subclassing_any = True
#disallow_untyped_calls = True
#disallow_untyped_decorators = True
#disallow_untyped_defs = True
implicit_reexport = False
no_implicit_optional = True
show_error_codes = True
strict_equality = True
warn_incomplete_stub = True
warn_redundant_casts = True
warn_unreachable = True
warn_unused_ignores = True
#warn_return_any = True
[mypy-aiopg.*]
ignore_missing_imports = True
================================================
FILE: .pre-commit-config.yaml
================================================
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
hooks:
- id: check-merge-conflict
- repo: https://github.com/asottile/yesqa
rev: v1.5.0
hooks:
- id: yesqa
additional_dependencies:
- flake8-bandit==4.1.1
- flake8-bugbear==23.7.10
- flake8-import-order==0.18.2
- flake8-requirements==1.7.8
- repo: https://github.com/psf/black
rev: '23.7.0'
hooks:
- id: black
language_version: python3 # Should be a command that runs python
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: 'v4.4.0'
hooks:
- id: end-of-file-fixer
exclude: >-
^docs/[^/]*\.svg$
- id: requirements-txt-fixer
- id: trailing-whitespace
- id: file-contents-sorter
files: |
CONTRIBUTORS.txt|
docs/spelling_wordlist.txt|
.gitignore|
.gitattributes
- id: check-case-conflict
- id: check-json
- id: check-xml
- id: check-executables-have-shebangs
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: check-added-large-files
- id: check-symlinks
- id: debug-statements
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- id: detect-private-key
exclude: ^examples/
- repo: https://github.com/PyCQA/flake8
rev: '6.1.0'
hooks:
- id: flake8
exclude: "^docs/"
additional_dependencies:
- flake8-bandit==4.1.1
- flake8-bugbear==23.7.10
- flake8-import-order==0.18.2
- flake8-requirements==1.7.8
- repo: https://github.com/asottile/pyupgrade
rev: 'v3.10.1'
hooks:
- id: pyupgrade
args: ['--py36-plus']
- repo: https://github.com/Lucas-C/pre-commit-hooks-markup
rev: v1.0.1
hooks:
- id: rst-linter
files: >-
^[^/]+[.]rst$
================================================
FILE: CHANGES.rst
================================================
=======
CHANGES
=======
.. towncrier release notes start
0.6.1 (2023-11-19)
==================
- Filtered out requests to debugtoolbar itself from the requests history.
- Improved import time by delaying loading of package data.
- Fixed static URLs when using yarl 1.9+.
- Fixed a warning in the ``re`` module.
- Switched to ``aiohttp.web.AppKey`` for aiohttp 3.9.
- Dropped Python 3.7 and added Python 3.11.
0.6.0 (2020-01-25)
==================
- Fixed ClassBasedView support. #207
- Dropped aiohttp<3.3 support.
- Dropped Python 3.4 support.
- Dropped ``yield from`` and ``@asyncio.coroutine`` support.
0.5.0 (2018-02-14)
==================
- Added safe filter to render_content. #195
- Added support for aiohtp 3.
0.4.1 (2017-08-30)
==================
- Fixed issue with redirects without location header. #174
0.4.0 (2017-05-04)
==================
- Added asyncio trove classifier.
- Addes support for aiohttp 2.0.7+.
0.3.0 (2016-11-18)
==================
- Fixed middleware route finding when using sub-apps. #65
- Added examples for extra panels: pgsql & redis monitor. #59
0.2.0 (2016-11-08)
==================
- Refactored test suite.
0.1.4 (2016-11-07)
==================
- Renamed to aiohttp-debugtoolbar.
- Fixed imcompatibility with aiohttp 1.1.
0.1.3 (2016-10-27)
==================
- Fixed a link to request info page, sort request information alphabetically. #52
0.1.2 (2016-09-27)
==================
- Fixed empty functions names in performance panel. #43 (Thanks @kammala!)
- Fixed flashing message during page rendering issue. #46
0.1.1 (2016-02-21)
==================
- Fixed a demo.
- Added syntax highlight in traceback view, switched highlighter from
highlight.js to prism.js. #31
0.1.0 (2016-02-13)
==================
- Added Python 3.5 support. (Thanks @stormandco!)
- Added view source button in RoutesDebugPanel. (Thanks @stormandco!)
- Dropped support for Python 3.3. (Thanks @sloria!)
- Added middleware in setup method. (Thanks @sloria!)
- Fixed bug with interactive console.
- Fixed support for aiohttp>=0.21.1.
0.0.5 (2015-09-13)
==================
- Fixed IPv6 socket family error. (Thanks @stormandco!)
0.0.4 (2015-09-05)
==================
- Fixed support for aiohttp>=0.17. (Thanks @himikof!)
0.0.3 (2015-07-03)
==================
- Switched template engine from mako to jinja2. (Thanks @iho!)
- Added custom *yield from* to track context switches inside coroutine.
- Implemented panel for collecting request log messages.
- Disable toolbar code injecting for non web.Response answers
(StreamResponse or WebSocketResponse for example). #12
0.0.2 (2015-05-26)
==================
- Redesigned UI look-and-feel.
- Renamed `toolbar_middleware_factory` to just `middleware`.
0.0.1 (2015-05-18)
==================
- Initial release.
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2015-2018 Nikolai Novik
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: MANIFEST.in
================================================
include LICENSE
include CHANGES.rst
include README.rst
graft aiohttp_debugtoolbar
global-exclude *.pyc *.swp
================================================
FILE: Makefile
================================================
# Some simple testing tasks (sorry, UNIX only).
flake:
flake8 --exclude=pep492 aiohttp_debugtoolbar tests
test: flake
pytest -s ./tests/
vtest:
pytest -s -v ./tests/
cov cover coverage: flake
pytest -s --cov-report term --cov-report html --cov aiohttp_debugtoolbar
@echo "open file://`pwd`/htmlcov/index.html"
clean:
rm -rf `find . -name __pycache__`
rm -f `find . -type f -name '*.py[co]' `
rm -f `find . -type f -name '*~' `
rm -f `find . -type f -name '.*~' `
rm -f `find . -type f -name '@*' `
rm -f `find . -type f -name '#*#' `
rm -f `find . -type f -name '*.orig' `
rm -f `find . -type f -name '*.rej' `
rm -f .coverage
rm -rf coverage
rm -rf build
rm -rf cover
rm -rf htmlcov
doc:
make -C docs html
@echo "open file://`pwd`/docs/_build/html/index.html"
.PHONY: all build venv flake test vtest testloop cov clean doc
================================================
FILE: README.rst
================================================
aiohttp-debugtoolbar
====================
.. image:: https://travis-ci.org/aio-libs/aiohttp-debugtoolbar.svg?branch=master
:target: https://travis-ci.org/aio-libs/aiohttp-debugtoolbar
:alt: |Build status|
.. image:: https://codecov.io/gh/aio-libs/aiohttp-debugtoolbar/branch/master/graph/badge.svg
:target: https://codecov.io/gh/aio-libs/aiohttp-debugtoolbar
:alt: |Coverage status|
.. image:: https://img.shields.io/pypi/v/aiohttp-debugtoolbar.svg
:target: https://pypi.python.org/pypi/aiohttp-debugtoolbar
:alt: PyPI
.. image:: https://badges.gitter.im/Join%20Chat.svg
:target: https://gitter.im/aio-libs/Lobby
:alt: Chat on Gitter
**aiohttp_debugtoolbar** provides a debug toolbar for your aiohttp_
web application. Library is port of pyramid_debugtoolbar_ and
still in early development stages. Basic functionality has been
ported:
* basic panels
* intercept redirects
* intercept and pretty print exception
* interactive python console
* show source code
.. image:: https://raw.githubusercontent.com/aio-libs/aiohttp_debugtoolbar/master/demo/aiohttp_debugtoolba_sceenshot.png
Ported Panels
-------------
``HeaderDebugPanel``, ``PerformanceDebugPanel``, ``TracebackPanel``,
``SettingsDebugPanel``, ``MiddlewaresDebugPanel``, ``VersionDebugPanel``,
``RoutesDebugPanel``, ``RequestVarsDebugPanel``, ``LoggingPanel``
Help Needed
-----------
Are you coder looking for a project to contribute to
python/asyncio libraries? This is the project for you!
Install and Configuration
-------------------------
::
$ pip install aiohttp_debugtoolbar
In order to plug in ``aiohttp_debugtoolbar``, call
``aiohttp_debugtoolbar.setup`` on your app.
.. code:: python
import aiohttp_debugtoolbar
app = web.Application(loop=loop)
aiohttp_debugtoolbar.setup(app)
Full Example
------------
.. code:: python
import asyncio
import jinja2
import aiohttp_debugtoolbar
import aiohttp_jinja2
from aiohttp import web
@aiohttp_jinja2.template('index.html')
async def basic_handler(request):
return {'title': 'example aiohttp_debugtoolbar!',
'text': 'Hello aiohttp_debugtoolbar!',
'app': request.app}
async def exception_handler(request):
raise NotImplementedError
async def init(loop):
# add aiohttp_debugtoolbar middleware to you application
app = web.Application(loop=loop)
# install aiohttp_debugtoolbar
aiohttp_debugtoolbar.setup(app)
template = """
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<h1>{{ text }}</h1>
<p>
<a href="{{ app.router['exc_example'].url() }}">
Exception example</a>
</p>
</body>
</html>
"""
# install jinja2 templates
loader = jinja2.DictLoader({'index.html': template})
aiohttp_jinja2.setup(app, loader=loader)
# init routes for index page, and page with error
app.router.add_route('GET', '/', basic_handler, name='index')
app.router.add_route('GET', '/exc', exception_handler,
name='exc_example')
return app
loop = asyncio.get_event_loop()
app = loop.run_until_complete(init(loop))
web.run_app(app, host='127.0.0.1', port=9000)
Settings
--------
.. code:: python
aiohttp_debugtoolbar.setup(app, hosts=['172.19.0.1', ])
Supported options
- enabled: The debugtoolbar is disabled if False. By default is set to True.
- intercept_redirects: If True, intercept redirect and display an intermediate page with a link to the redirect page. By default is set to True.
- hosts: The list of allow hosts. By default is set to ['127.0.0.1', '::1'].
- exclude_prefixes: The list of forbidden hosts. By default is set to [].
- check_host: If False, disable the host check and display debugtoolbar for any host. By default is set to True.
- max_request_history: The max value for storing requests. By default is set to 100.
- max_visible_requests: The max value of display requests. By default is set to 10.
- path_prefix: The prefix of path to debugtoolbar. By default is set to '/_debugtoolbar'.
Thanks!
-------
I've borrowed a lot of code from following projects. I highly
recommend to check them out:
* pyramid_debugtoolbar_
* django-debug-toolbar_
* flask-debugtoolbar_
Play With Demo
--------------
https://github.com/aio-libs/aiohttp_debugtoolbar/tree/master/demo
Requirements
------------
* aiohttp_
* aiohttp_jinja2_
.. _Python: https://www.python.org
.. _asyncio: http://docs.python.org/3/library/asyncio.html
.. _aiohttp: https://github.com/KeepSafe/aiohttp
.. _aiopg: https://github.com/aio-libs/aiopg
.. _aiomysql: https://github.com/aio-libs/aiomysql
.. _aiohttp_jinja2: https://github.com/aio-libs/aiohttp_jinja2
.. _pyramid_debugtoolbar: https://github.com/Pylons/pyramid_debugtoolbar
.. _django-debug-toolbar: https://github.com/django-debug-toolbar/django-debug-toolbar
.. _flask-debugtoolbar: https://github.com/mgood/flask-debugtoolbar
================================================
FILE: aiohttp_debugtoolbar/__init__.py
================================================
from .main import setup
from .middlewares import middleware
from .utils import APP_KEY
__version__ = "0.6.1"
__all__ = ("setup", "middleware", "APP_KEY")
================================================
FILE: aiohttp_debugtoolbar/main.py
================================================
import secrets
from pathlib import Path
from typing import Iterable, Literal, Sequence, Type, TypedDict, Union
import aiohttp_jinja2
import jinja2
from aiohttp import web
from . import panels, views
from .middlewares import middleware
from .panels.base import DebugPanel
from .utils import (
APP_KEY,
AppState,
ExceptionHistory,
STATIC_ROUTE_NAME,
TEMPLATE_KEY,
ToolbarStorage,
_Config,
)
from .views import ExceptionDebugView
default_panel_names = (
panels.HeaderDebugPanel,
panels.PerformanceDebugPanel,
panels.RequestVarsDebugPanel,
panels.TracebackPanel,
panels.LoggingPanel,
)
default_global_panel_names = (
panels.RoutesDebugPanel,
panels.SettingsDebugPanel,
panels.MiddlewaresDebugPanel,
panels.VersionDebugPanel,
)
class _AppDetails(TypedDict):
exc_history: ExceptionHistory
pdtb_token: str
request_history: ToolbarStorage
settings: _Config
def setup(
app: web.Application,
*,
enabled: bool = True,
intercept_exc: Literal["debug", "display", False] = "debug",
intercept_redirects: bool = True,
panels: Iterable[Type[DebugPanel]] = default_panel_names,
extra_panels: Iterable[Type[DebugPanel]] = (),
extra_templates: Union[str, Path, Iterable[Union[str, Path]]] = (),
global_panels: Iterable[Type[DebugPanel]] = default_global_panel_names,
hosts: Sequence[str] = ("127.0.0.1", "::1"),
exclude_prefixes: Iterable[str] = (),
check_host: bool = True, # disable host check
button_style: str = "",
max_request_history: int = 100,
max_visible_requests: int = 10,
path_prefix: str = "/_debugtoolbar",
) -> None:
config = _Config(
enabled=enabled,
intercept_exc=intercept_exc,
intercept_redirects=intercept_redirects,
panels=tuple(panels),
extra_panels=tuple(extra_panels),
global_panels=tuple(global_panels),
hosts=hosts,
exclude_prefixes=tuple(exclude_prefixes),
check_host=check_host,
button_style=button_style,
max_visible_requests=max_visible_requests,
path_prefix=path_prefix,
)
if middleware not in app.middlewares:
app.middlewares.append(middleware)
APP_ROOT = Path(__file__).parent
templates_app = APP_ROOT / "templates"
templates_panels = APP_ROOT / "panels/templates"
if isinstance(extra_templates, (str, Path)):
templ: Iterable[Union[str, Path]] = (extra_templates,)
else:
templ = extra_templates
loader = jinja2.FileSystemLoader((templates_app, templates_panels, *templ))
aiohttp_jinja2.setup(app, loader=loader, app_key=TEMPLATE_KEY)
static_location = APP_ROOT / "static"
exc_handlers = ExceptionDebugView()
app.router.add_static(
path_prefix + "/static", static_location, name=STATIC_ROUTE_NAME
)
app.router.add_route(
"GET", path_prefix + "/source", exc_handlers.source, name="debugtoolbar.source"
)
app.router.add_route(
"GET",
path_prefix + "/execute",
exc_handlers.execute,
name="debugtoolbar.execute",
)
# app.router.add_route('GET', path_prefix + '/console',
# exc_handlers.console,
# name='debugtoolbar.console')
app.router.add_route(
"GET",
path_prefix + "/exception",
exc_handlers.exception,
name="debugtoolbar.exception",
)
# TODO: fix when sql will be ported
# app.router.add_route('GET', path_prefix + '/sqlalchemy/sql_select',
# name='debugtoolbar.sql_select')
# app.router.add_route('GET', path_prefix + '/sqlalchemy/sql_explain',
# name='debugtoolbar.sql_explain')
app.router.add_route(
"GET", path_prefix + "/sse", views.sse, name="debugtoolbar.sse"
)
app.router.add_route(
"GET",
path_prefix + "/{request_id}",
views.request_view,
name="debugtoolbar.request",
)
app.router.add_route(
"GET", path_prefix, views.request_view, name="debugtoolbar.main"
)
app[APP_KEY] = AppState(
{
"exc_history": ExceptionHistory(),
"pdtb_token": secrets.token_hex(10),
"request_history": ToolbarStorage(max_request_history),
"settings": config,
}
)
if intercept_exc:
app[APP_KEY]["exc_history"].eval_exc = intercept_exc == "debug"
================================================
FILE: aiohttp_debugtoolbar/middlewares.py
================================================
import sys
import aiohttp_jinja2
from aiohttp import web
from aiohttp.typedefs import Handler
from aiohttp.web_exceptions import HTTPMove
from .tbtools.tbtools import get_traceback
from .toolbar import DebugToolbar
from .utils import (
APP_KEY,
ContextSwitcher,
REDIRECT_CODES,
TEMPLATE_KEY,
addr_in,
hexlify,
)
__all__ = ("middleware",)
HTML_TYPES = ("text/html", "application/xhtml+xml")
@web.middleware
async def middleware(request: web.Request, handler: Handler) -> web.StreamResponse:
app = request.app
if APP_KEY not in app:
raise RuntimeError(
"Please setup debug toolbar with " "aiohttp_debugtoolbar.setup method"
)
# just create namespace for handler
settings = app[APP_KEY]["settings"]
request_history = app[APP_KEY]["request_history"]
exc_history = app[APP_KEY]["exc_history"]
intercept_exc = app[APP_KEY]["settings"]["intercept_exc"]
if not app[APP_KEY]["settings"]["enabled"]:
return await handler(request)
# request['exc_history'] = exc_history
panel_classes = settings.get("panels", ()) + settings.get("extra_panels", ())
global_panel_classes = settings.get("global_panels", ())
hosts = settings.get("hosts", [])
show_on_exc_only = settings.get("show_on_exc_only")
intercept_redirects = settings["intercept_redirects"]
root_url = app.router["debugtoolbar.main"].url_for().raw_path
exclude_prefixes = settings.get("exclude_prefixes", ())
exclude = (root_url,) + exclude_prefixes
p = request.raw_path
starts_with_excluded = list(filter(None, map(p.startswith, exclude)))
# FIXME: error when run trough unixsocket
if request.transport:
peername = request.transport.get_extra_info("peername")
last_proxy_addr = peername[0]
else:
last_proxy_addr = ""
# TODO: rethink access policy by host
if settings.get("check_host"):
if starts_with_excluded or not addr_in(last_proxy_addr, hosts):
return await handler(request)
toolbar = DebugToolbar(request, panel_classes, global_panel_classes)
_handler = handler
context_switcher = ContextSwitcher()
for panel in toolbar.panels:
_handler = panel.wrap_handler(_handler, context_switcher)
try:
response = await context_switcher(_handler(request))
except HTTPMove as exc:
if not intercept_redirects:
raise
# Intercept http redirect codes and display an html page with a
# link to the target.
if not getattr(exc, "location", None):
raise
response = web.Response(
status=exc.status, reason=exc.reason, text=exc.text, headers=exc.headers
)
context = {"redirect_to": exc.location, "redirect_code": exc.status}
_response = aiohttp_jinja2.render_template(
"redirect.jinja2", request, context, app_key=TEMPLATE_KEY
)
response = _response
except web.HTTPException:
raise
except Exception as e:
if intercept_exc:
tb = get_traceback(
info=sys.exc_info(),
skip=1,
show_hidden_frames=False,
ignore_system_exceptions=True,
exc=e,
app=request.app,
)
for frame in tb.frames:
exc_history.frames[frame.id] = frame
exc_history.tracebacks[tb.id] = tb
request["pdbt_tb"] = tb
# TODO: find out how to port following to aiohttp
# or just remove it
# token = request.app[APP_KEY]['pdtb_token']
# qs = {'token': token, 'tb': str(tb.id)}
# msg = 'Exception at %s\ntraceback url: %s'
#
# exc_url = request.app.router['debugtoolbar.exception']\
# .url(query=qs)
# assert exc_url, msg
# exc_msg = msg % (request.path, exc_url)
# logger.exception(exc_msg)
# subenviron = request.environ.copy()
# del subenviron['PATH_INFO']
# del subenviron['QUERY_STRING']
# subrequest = type(request).blank(exc_url, subenviron)
# subrequest.script_name = request.script_name
# subrequest.path_info = \
# subrequest.path_info[len(request.script_name):]
#
# response = request.invoke_subrequest(subrequest)
body = tb.render_full(request).encode("utf-8", "replace")
response = web.Response(body=body, status=500, content_type="text/html")
await toolbar.process_response(request, response)
request["id"] = str(id(request))
toolbar.status = response.status
request_history.put(request["id"], toolbar)
toolbar.inject(request, response)
return response
else:
# logger.exception('Exception at %s' % request.path)
raise e
toolbar.status = response.status
if intercept_redirects:
# Intercept http redirect codes and display an html page with a
# link to the target.
if response.status in REDIRECT_CODES and getattr(response, "location", None):
context = {
"redirect_to": response.location,
"redirect_code": response.status,
}
_response = aiohttp_jinja2.render_template(
"redirect.jinja2", request, context, app_key=TEMPLATE_KEY
)
response = _response
await toolbar.process_response(request, response)
request["id"] = hexlify(id(request))
# Don't store the favicon.ico request
# it's requested by the browser automatically
# Also ignore requests for debugtoolbar itself.
tb_request = request.path.startswith(settings["path_prefix"])
if not tb_request and request.path != "/favicon.ico":
request_history.put(request["id"], toolbar)
if not show_on_exc_only and response.content_type in HTML_TYPES:
toolbar.inject(request, response)
return response
toolbar_html_template = """\
<script type="text/javascript">
var fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet")
fileref.setAttribute("type", "text/css")
fileref.setAttribute("href", "%(css_path)s")
document.getElementsByTagName("head")[0].appendChild(fileref)
</script>
<div id="pDebug">
<div style="display: block; %(button_style)s" id="pDebugToolbarHandle">
<a title="Show Toolbar" id="pShowToolBarButton"
href="%(toolbar_url)s" target="pDebugToolbar">«
FIXME: Debug Toolbar</a>
</div>
</div>
"""
================================================
FILE: aiohttp_debugtoolbar/panels/__init__.py
================================================
from .headers import HeaderDebugPanel as HeaderDebugPanel
from .logger import LoggingPanel as LoggingPanel
from .middlewares import MiddlewaresDebugPanel as MiddlewaresDebugPanel
from .performance import PerformanceDebugPanel as PerformanceDebugPanel
from .request_vars import RequestVarsDebugPanel as RequestVarsDebugPanel
from .routes import RoutesDebugPanel as RoutesDebugPanel
from .settings import SettingsDebugPanel as SettingsDebugPanel
from .traceback import TracebackPanel as TracebackPanel
from .versions import VersionDebugPanel as VersionDebugPanel
__all__ = (
"HeaderDebugPanel",
"LoggingPanel",
"MiddlewaresDebugPanel",
"PerformanceDebugPanel",
"RequestVarsDebugPanel",
"RoutesDebugPanel",
"SettingsDebugPanel",
"TracebackPanel",
"VersionDebugPanel",
)
================================================
FILE: aiohttp_debugtoolbar/panels/base.py
================================================
from abc import ABC
from ..utils import render
class DebugPanel(ABC):
"""Base class for debug panels.
A new instance of this class is created for every request.
A panel is notified of events throughout the request lifecycle. It
is then persisted and used later by the toolbar to render its results
as a tab on the interface. The lifecycle hooks are available in the
following order:
- :meth:`.__init__`
- :meth:`.wrap_handler`
- :meth:`.process_beforerender`
- :meth:`.process_response`
Each of these hooks is overridable by a subclass to gleen information
from the request and other events for later display.
The panel is later used to render its results. This is done on-demand
and in the lifecycle of a request to the debug toolbar by invoking
:meth:`.render_content`. Any data stored within :attr:`.data` is
injected into the template prior to rendering and is thus a common
location to store the contents of previous events.
"""
#: A unique identifier for the name of the panel. This **must** be
#: defined by a subclass.
name: str
#: If ``False`` then the panel's tab will be disabled and
#: :meth:`.render_content` will not be invoked. Most subclasses will
#: want to set this to ``True``.
has_content = False
#: If the client is able to activate/de-activate the panel then this
#: should be ``True``.
user_activate = False
#: This property will be set by the toolbar, indicating the user's
#: decision to activate or deactivate the panel. If ``user_activate``
#: is ``False`` then ``is_active`` will always be set to ``True``.
is_active = False
#: Must be overridden by subclasses that are using the default
#: implementation of ``render_content``. This is an
#: :term:`asset specification` pointing at the template to be rendered
#: for the panel. Usually of the format
#: ``'mylib:templates/panel.jinja2'``.
template: str
#: Title showing in toolbar. Must be overridden.
nav_title: str
#: Subtitle showing until title in toolbar.
nav_subtitle = ""
#: Title showing in panel. Must be overridden.
title: str
#: The URL invoked when the panel's tab is cliked. May be overridden to
#: define an arbitrary URL for the panel or do some other custom action
#: when the user clicks on the panel's tab in the toolbar.
url = ""
@property
def request(self):
return self._request
# Panel methods
def __init__(self, request):
"""Configure the panel for a request.
:param request: The instance of :class:`aiohttp.web.Request` that
this object is wrapping.
"""
self._request = request
self.data = {}
def render_content(self, request):
"""Return a string containing the HTML to be rendered for the panel.
By default this will render the template defined by the
:attr:`.template` attribute with a rendering context defined by
:attr:`.data` combined with the ``dict`` returned from
:meth:`.render_vars`.
The ``request`` here is the active request in the toolbar. Not the
original request that this panel represents.
"""
context = self.data.copy()
context.update(self.render_vars(request))
return render(self.template, request.app, context, request=request)
@property
def dom_id(self):
"""The ``id`` tag of the panel's tab. May be used by CSS and
Javascript to implement custom styles and actions."""
return "pDebug%sPanel" % (self.name.replace(" ", ""))
async def process_response(self, response): # noqa: B027
"""Receives the response generated by the request.
Override this method to track properties of the response.
"""
def wrap_handler(self, handler, context_switcher):
"""May be overridden to monitor the entire lifecycle of the request.
A handler receives a request and returns a response. An example
implementation may be:
.. code-block:: python
def wrap_handler(self, handler, context_switcher):
async def wrapper(request):
start_time = time.time()
response = await handler(request)
end_time = time.time()
self.data['duration'] = end_time - start_time
return response
return wrapper
context_switcher can be used for context switch tracking, you can
add your callback right before context switch in or out.
"""
return handler
def render_vars(self, request):
"""Invoked by the default implementation of :meth:`.render_content`
and should return a ``dict`` of values to use when rendering the
panel's HTML content. This value is usually injected into templates
as the rendering context.
The ``request`` here is the active request in the toolbar. Not the
original request that this panel represents.
"""
return {}
================================================
FILE: aiohttp_debugtoolbar/panels/headers.py
================================================
from .base import DebugPanel
__all__ = ["HeaderDebugPanel"]
class HeaderDebugPanel(DebugPanel):
"""
A panel to display HTTP request and response headers.
"""
name = "Header"
has_content = True
template = "headers.jinja2"
title = "HTTP Headers"
nav_title = title
def __init__(self, request):
super().__init__(request)
self._request_headers = [(k, v) for k, v in sorted(request.headers.items())]
async def process_response(self, response):
response_headers = [(k, v) for k, v in sorted(response.headers.items())]
self.data = {
"request_headers": self._request_headers,
"response_headers": response_headers,
}
================================================
FILE: aiohttp_debugtoolbar/panels/logger.py
================================================
import datetime
import logging
from collections import deque
from .base import DebugPanel
from ..utils import format_fname
class RequestTrackingHandler(logging.Handler):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._records = deque(maxlen=1000)
@property
def records(self):
return self._records
def emit(self, record):
self._records.append(record)
class LoggingPanel(DebugPanel):
name = "logging"
template = "logger.jinja2"
title = "Log Messages"
nav_title = "Logging"
def __init__(self, request):
super().__init__(request)
self._log_handler = RequestTrackingHandler()
def _install_handler(self):
logging.root.addHandler(self._log_handler)
def _uninstall_handler(self):
logging.root.removeHandler(self._log_handler)
def wrap_handler(self, handler, context_switcher):
context_switcher.add_context_in(self._install_handler)
context_switcher.add_context_out(self._uninstall_handler)
return handler
async def process_response(self, response):
records = []
for record in self._log_handler.records:
records.append(
{
"message": record.getMessage(),
"time": datetime.datetime.fromtimestamp(record.created),
"level": record.levelname,
"file": format_fname(record.pathname),
"file_long": record.pathname,
"line": record.lineno,
}
)
self.data = {"records": records}
@property
def has_content(self):
if self.data.get("records"):
return True
return False
@property
def nav_subtitle(self):
if self.data:
return "%d" % len(self.data.get("records"))
================================================
FILE: aiohttp_debugtoolbar/panels/middlewares.py
================================================
from .base import DebugPanel
from ..utils import STATIC_ROUTE_NAME
__all__ = ["MiddlewaresDebugPanel"]
class MiddlewaresDebugPanel(DebugPanel):
"""
A panel to display the middlewares used by your aiohttp application.
"""
name = "Middlewares"
has_content = True
template = "middlewares.jinja2"
title = "Middlewares"
nav_title = title
def __init__(self, request):
super().__init__(request)
if not request.app.middlewares:
self.has_content = False
self.is_active = False
else:
self.populate(request)
def populate(self, request):
middleware_names = []
for m in request.app.middlewares:
if hasattr(m, "__name__"):
# name for regular functions
middleware_names.append(m.__name__)
else:
middleware_names.append(m.__repr__())
self.data = {"middlewares": middleware_names}
def render_vars(self, request):
static_path = self._request.app.router[STATIC_ROUTE_NAME].canonical
return {"static_path": static_path}
================================================
FILE: aiohttp_debugtoolbar/panels/performance.py
================================================
import cProfile as profile
import pstats
import time
try:
import resource
except ImportError: # Fails on Windows
resource = None # type: ignore[assignment]
from .base import DebugPanel
from ..utils import format_fname
__all__ = ["PerformanceDebugPanel"]
class PerformanceDebugPanel(DebugPanel):
"""
Panel that looks at the performance of a request.
It will display the time a request took and, optionally, the
cProfile output.
"""
name = "Performance"
user_activate = True
stats = None
function_calls = None
has_content = True
has_resource = bool(resource)
template = "performance.jinja2"
title = "Performance"
nav_title = title
def __init__(self, request):
super().__init__(request)
self.profiler = profile.Profile()
def _wrap_timer_handler(self, handler):
if self.has_resource:
async def resource_timer_handler(request):
_start_time = time.time()
self._start_rusage = resource.getrusage(resource.RUSAGE_SELF)
try:
result = await handler(request)
except BaseException:
raise
finally:
self._end_rusage = resource.getrusage(resource.RUSAGE_SELF)
self.total_time = (time.time() - _start_time) * 1000
return result
return resource_timer_handler
async def noresource_timer_handler(request):
_start_time = time.time()
try:
result = await handler(request)
except BaseException:
raise
finally:
self.total_time = (time.time() - _start_time) * 1000
return result
return noresource_timer_handler
def _wrap_profile_handler(self, handler):
if not self.is_active:
return handler
async def profile_handler(request):
try:
self.profiler.enable()
try:
result = await handler(request)
finally:
self.profiler.disable()
except BaseException:
raise
finally:
stats = pstats.Stats(self.profiler)
function_calls = []
flist = stats.sort_stats("cumulative").fcn_list
for func in flist:
current = {}
info = stats.stats[func]
# Number of calls
if info[0] != info[1]:
current["ncalls"] = "%d/%d" % (info[1], info[0])
else:
current["ncalls"] = info[1]
# Total time
current["tottime"] = info[2] * 1000
# Quotient of total time divided by number of calls
if info[1]:
current["percall"] = info[2] * 1000 / info[1]
else:
current["percall"] = 0
# Cumulative time
current["cumtime"] = info[3] * 1000
# Quotient of the cumulative time divided by the number
# of primitive calls.
if info[0]:
current["percall_cum"] = info[3] * 1000 / info[0]
else:
current["percall_cum"] = 0
# Filename
filename = pstats.func_std_string(func)
current["filename_long"] = filename
current["filename"] = format_fname(filename)
function_calls.append(current)
self.stats = stats
self.function_calls = function_calls
return result
return profile_handler
def wrap_handler(self, handler, context_switcher):
handler = self._wrap_profile_handler(handler)
handler = self._wrap_timer_handler(handler)
return handler
@property
def nav_subtitle(self):
return "%0.2fms" % (self.total_time)
def _elapsed_ru(self, name):
return getattr(self._end_rusage, name) - getattr(self._start_rusage, name)
async def process_response(self, response):
vars = {"timing_rows": None, "stats": None, "function_calls": []}
if self.has_resource:
utime = 1000 * self._elapsed_ru("ru_utime")
stime = 1000 * self._elapsed_ru("ru_stime")
vcsw = self._elapsed_ru("ru_nvcsw")
ivcsw = self._elapsed_ru("ru_nivcsw")
# minflt = self._elapsed_ru('ru_minflt')
# majflt = self._elapsed_ru('ru_majflt')
# these are documented as not meaningful under Linux. If you're
# running BSD # feel free to enable them, and add any others that
# I hadn't gotten to before I noticed that I was getting nothing
# but zeroes and that the docs agreed. :-(
#
# blkin = self._elapsed_ru('ru_inblock')
# blkout = self._elapsed_ru('ru_oublock')
# swap = self._elapsed_ru('ru_nswap')
# rss = self._end_rusage.ru_maxrss
# srss = self._end_rusage.ru_ixrss
# urss = self._end_rusage.ru_idrss
# usrss = self._end_rusage.ru_isrss
# TODO l10n on values
rows = (
("User CPU time", "%0.3f msec" % utime),
("System CPU time", "%0.3f msec" % stime),
("Total CPU time", "%0.3f msec" % (utime + stime)),
("Elapsed time", "%0.3f msec" % self.total_time),
("Context switches", "%d voluntary, %d involuntary" % (vcsw, ivcsw)),
# (_('Memory use'), '%d max RSS, %d shared, %d unshared' % (
# rss, srss, urss + usrss)),
# (_('Page faults'), '%d no i/o, %d requiring i/o' % (
# minflt, majflt)),
# (_('Disk operations'), '%d in, %d out, %d swapout' % (
# blkin, blkout, swap)),
)
vars["timing_rows"] = rows
if self.is_active:
vars["stats"] = self.stats
vars["function_calls"] = self.function_calls
self.data = vars
================================================
FILE: aiohttp_debugtoolbar/panels/request_vars.py
================================================
from pprint import saferepr
from .base import DebugPanel
__all__ = ["RequestVarsDebugPanel"]
class RequestVarsDebugPanel(DebugPanel):
"""
A panel to display request variables (POST/GET, session, cookies, and
ad-hoc request attributes).
"""
name = "RequestVars"
has_content = True
template = "request_vars.jinja2"
title = "Request Vars"
nav_title = title
def __init__(self, request):
super().__init__(request)
async def process_response(self, response):
self.data = data = {}
request = self.request
post_data = await request.post()
data.update(
{
"get": [(k, request.query.getall(k)) for k in sorted(request.query)],
"post": [(k, saferepr(post_data.getall(k))) for k in sorted(post_data)],
"cookies": [(k, v) for k, v in sorted(request.cookies.items())],
"attrs": [(k, v) for k, v in sorted(request.items())],
}
)
# TODO: think about aiohttp_security
# session to separate table
session = request.get("aiohttp_session")
if session and not session.empty:
data.update(
{
"session": [(k, v) for k, v in sorted(session.items())],
}
)
================================================
FILE: aiohttp_debugtoolbar/panels/routes.py
================================================
import inspect
from .base import DebugPanel
__all__ = ["RoutesDebugPanel"]
class RoutesDebugPanel(DebugPanel):
"""
A panel to display the routes used by your aiohttp application.
"""
name = "Routes"
has_content = True
template = "routes.jinja2"
title = "Routes"
nav_title = title
def __init__(self, request):
super().__init__(request)
self.populate(request)
def populate(self, request):
info = []
router = request.app.router
for route in router.routes():
info.append(
{
"name": route.name or "",
"method": route.method,
"info": sorted(route.get_info().items()),
"handler": repr(route.handler),
"source": inspect.getsource(route.handler),
}
)
self.data = {"routes": info}
================================================
FILE: aiohttp_debugtoolbar/panels/settings.py
================================================
from operator import itemgetter
from .base import DebugPanel
from ..utils import APP_KEY
__all__ = ["SettingsDebugPanel"]
class SettingsDebugPanel(DebugPanel):
"""
A panel to display debug toolbar setting for now.
"""
name = "Settings"
has_content = True
template = "settings.jinja2"
title = "Settings"
nav_title = title
def __init__(self, request):
super().__init__(request)
# TODO: show application setting here
# always repr this stuff before it's sent to the template to appease
# dumbass stuff like MongoDB's __getattr__ that always returns a
# Collection, which fails when Jinja tries to look up __html__ on it.
settings = request.app[APP_KEY]["settings"]
# filter out non-pyramid prefixed settings to avoid duplication
reprs = [(k, repr(v)) for k, v in settings.items()]
self.data = {"settings": sorted(reprs, key=itemgetter(0))}
================================================
FILE: aiohttp_debugtoolbar/panels/templates/headers.jinja2
================================================
<h4>Request Headers</h4>
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in request_headers %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<h4>Response Headers</h4>
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in response_headers %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
================================================
FILE: aiohttp_debugtoolbar/panels/templates/logger.jinja2
================================================
{% if records %}:
<table class="table table-striped table-condensed">
<thead>
<tr>
<th>Level</th>
<th>Time</th>
<th>Message</th>
<th>Location</th>
</tr>
</thead>
<tbody>
{% for record in records %}
<tr>
<td>{{ record['level'] }}</td>
<td>{{ record['time'] }}</td>
<td>{{ record['message'] }}</td>
<td title="{{ record['file_long'] }}:{{record['line']}}">{{record['file']}}:{{record['line']}}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}:
<p>No messages logged.</p>
{% endif %}
================================================
FILE: aiohttp_debugtoolbar/panels/templates/middlewares.jinja2
================================================
<table class="table table-striped">
<thead>
<tr>
<th>Order (from server to application)</th>
<th>Middleware</th>
</tr>
</thead>
<tbody>
{% for middleware in middlewares %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ i }}</td>
<td>{{ middleware }}</td>
</tr>
{% endfor %}
</tbody>
</table>
================================================
FILE: aiohttp_debugtoolbar/panels/templates/performance.jinja2
================================================
{% if timing_rows %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Resource</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in timing_rows %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>Resource statistics have been disabled. This is because the 'resource'
module could not be found. This module is not supported under Windows.</p>
{% endif %}
<h4>Profile</h4>
{% if stats %}
<p>Times in milliseconds</p>
<table class="pDebugSortable table table-striped">
<thead>
<tr>
<th>Calls</th>
<th>Total</th>
<th>Percall</th>
<th>Cumu</th>
<th>CumuPer</th>
<th>Func</th>
</tr>
</thead>
<tbody>
{% for row in function_calls %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ row['ncalls'] }}</td>
<td>{{ '%.4f' % row['tottime'] }}</td>
<td>{{ '%.4f' % row['percall'] }}</td>
<td>{{ '%.4f' % row['cumtime'] }}</td>
<td>{{ '%.4f' % row['percall_cum'] }}</td>
<td title="{{ row['filename_long'] }}">{{ row['filename']|e }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>The profiler is not activated. Activate the checkbox in the toolbar to use it.</p>
{% endif %}
================================================
FILE: aiohttp_debugtoolbar/panels/templates/request_vars.jinja2
================================================
<h4>Cookie Variables</h4>
{% if cookies %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in cookies %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No cookie data</p>
{% endif %}
<h4>Session Variables</h4>
{% if session %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in session %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No session data</p>
{% endif %}
<h4>GET Variables</h4>
{% if get %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in get %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td class="value">{{ ', '.join(value) }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No GET data</p>
{% endif %}
<h4>POST Variables</h4>
{% if post %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Variable</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in post %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No POST data</p>
{% endif %}
<h4>Request attributes</h4>
{% if attrs %}
<table class="table table-striped">
<colgroup>
<col style="width:20%"/>
<col/>
</colgroup>
<thead>
<tr>
<th>Attribute</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in attrs %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td class="value">{{ value }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>No request attributes</p>
{% endif %}
================================================
FILE: aiohttp_debugtoolbar/panels/templates/routes.jinja2
================================================
<table class="table table-striped">
<thead>
<tr>
<th>Route Name</th>
<th>Method</th>
<th>Route Info</th>
<th>View Callable</th>
</tr>
</thead>
<tbody>
{% for route_info in routes %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ route_info['name'] }}</td>
<td>{{ route_info['method'] }}</td>
<td>
<ul>
{% for name, value in route_info['info'] %}
<li>{{ name }}: {{ value }}
{% endfor %}
</ul>
</td>
<td>
<div class="row">
<div class="col-md-11">{{ route_info['handler']|e }}</div>
<div class="col-md-1">
<button class="btn btn-primary pull-right" type="button"
data-toggle="collapse"
data-target="#collapseSource{{ loop.index }}"
aria-expanded="false"
aria-controls="collapseSource{{ loop.index }}">
Source
</button>
</div>
</div>
<div class="collapse" id="collapseSource{{ loop.index }}">
<pre><code class="language-python">{{ route_info['source'] }}</code></pre>
</div>
</td>
</tr>
{% endfor %}
</tbody>
</table>
================================================
FILE: aiohttp_debugtoolbar/panels/templates/settings.jinja2
================================================
<table class="table table-striped">
<thead>
<tr>
<th>Key</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for key, value in settings %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td>{{ key }}</td>
<td>{{ value|e }}</td>
</tr>
{% endfor %}
</tbody>
</table>
================================================
FILE: aiohttp_debugtoolbar/panels/templates/sqlalchemy_explain.jinja2
================================================
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="ExplainModalLabel">EXPLAIN</h3>
</div>
<div class="modal-body">
<div class="pDebugPanelTitle">
<h3>SQL Explained</h3>
</div>
<div class="pDebugPanelContent">
<div class="scroll">
<dl>
<dt>Executed SQL</dt>
<dd>{{ sql }}</dd>
<dt>Time</dt>
<dd>{{ '%.2f' % (duration) }} ms</dd>
</dl>
<table class="djSqlExplain table table-striped"
>
<thead>
<tr>
{% for h in headers %}
<th>{{ h.upper() }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in result %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
{% for column in row %}
<td>{{ column.replace(' ', ' ') }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
================================================
FILE: aiohttp_debugtoolbar/panels/templates/sqlalchemy_select.jinja2
================================================
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="SelectModalLabel">SELECT</h3>
</div>
<div class="modal-body">
<div class="piDebugPanelTitle">
<h3>SQL Select</h3>
</div>
<div class="piDebugPanelContent">
<div class="scroll">
<dl>
<dt>Executed SQL</dt>
<dd>{{ sql }}</dd>
<dt>Time</dt>
<dd>{{ '%.2f' % (duration) }} ms</dd>
</dl>
{% if result %}
<table class="djSqlExplain table table-striped"
>
<thead>
<tr>
{% for h in headers %}
<th>{{ h.upper() }}</th>
{% endfor %}
</tr>
</thead>
<tbody>
{% for row in result %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
{% for column in row %}
<td>{{ column }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<p>Empty set</p>
{% endif %]
</div>
</div>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
================================================
FILE: aiohttp_debugtoolbar/panels/templates/traceback.jinja2
================================================
<div class="debugger">
<h1>{{ exception_type }}</h1>
<div class="detail">
<pre class= "errormsg">{{ exception }}</pre>
</div>
<h2 class="traceback">Traceback <small>(most recent call last)</small></h2>
{{ summary }}
<div class="plain">
<p>
<input type="hidden" name="language" value="pytb">
This is the Copy/Paste friendly version of the traceback.
</p>
<textarea cols="50" rows="10" name="code"
readonly>{{ plaintext }}</textarea>
</div>
<div class="explanation">
<p>
<b>Warning: this feature should not be enabled on production
systems.</b>
</p>
{% if evalex %}
<p>
Hover over any gray area in the traceback and click on the
<button class="btn btn-xs btn-default">
<span class="glyphicon glyphicon-console" aria-hidden="true"></span>
</button>
button on the right hand side of that gray area to show an interactive
console for the associated frame. Type arbitrary Python into the
console; it will be evaluated in the context of the associated frame. In
the interactive console there are helpers available for introspection:
<ul>
<li><code>dump()</code> shows all variables in the frame
<li><code>dump(obj)</code> dumps all that's known about the object
</ul>
</p>
{% endif %}
<p>
Hover over any gray area in the traceback and click on
<button class="btn btn-xs btn-default">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span>
</button>
on the right hand side of that gray area to show the source of the file
associated with the frame.
</p>
<p>
Click on the traceback header to switch back and forth between the
rendered version of the traceback and a plaintext copy-paste-friendly
version of the traceback.
</p>
<p>
URL to recover this traceback page: <a href="{{ url }}">{{ url }}</a>
</p>
</div>
<div class="footer">
Brought to you by <strong class="arthur">DONT PANIC</strong>, your
friendly Werkzeug powered traceback interpreter.
</div>
</div>
<!--
{{ plaintext_cs }}
-->
<script type="text/javascript">
var TRACEBACK = {{ traceback_id }},
DEBUGGER_TOKEN = "{{ token }}",
CONSOLE_MODE = {{ console }},
EVALEX = {{ evalex }},
DEBUG_TOOLBAR_STATIC_PATH = "{{ static_path }}",
DEBUG_TOOLBAR_ROOT_PATH = "{{ root_path }}";
</script>
<script data-main="{{ static_path }}/js/debugger"
src="{{ static_path }}/js/require.js"></script>
================================================
FILE: aiohttp_debugtoolbar/panels/templates/versions.jinja2
================================================
<h4>Platform</h4>
<div>{{ platform }}</div>
<h4>aiohttp</h4>
<div>{{ aiohttp_version }}</div>
<h4>Packages</h4>
<table class="table table-striped">
<thead>
<tr>
<th>Package Name</th>
<th>Version</th>
<th>Dependencies</th>
</tr>
</thead>
<tbody>
{% for package in packages %}
<tr class="{{ loop.index%2 and 'pDebugEven' or 'pDebugOdd' }}">
<td><a href="{{ package['url'] }}">{{ package['name'] }}</a></td>
<td>{{ package['version'] }}</td>
<td>
{{ package['dependencies']|join(', ') }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
================================================
FILE: aiohttp_debugtoolbar/panels/traceback.py
================================================
import re
from .base import DebugPanel
from ..tbtools.tbtools import Traceback
from ..utils import APP_KEY, ROOT_ROUTE_NAME, STATIC_ROUTE_NAME, escape
__all__ = ["TracebackPanel"]
class TracebackPanel(DebugPanel):
name = "Traceback"
template = "traceback.jinja2"
title = "Traceback"
nav_title = title
def __init__(self, request):
super().__init__(request)
self.exc_history = request.app[APP_KEY]["exc_history"]
@property
def has_content(self):
if self._request.get("pdbt_tb"):
return True
return False
async def process_response(self, response):
if not self.has_content:
return
traceback = self._request["pdbt_tb"]
exc = escape(traceback.exception)
summary = Traceback.render_summary(
traceback, self._request.app, include_title=False
)
token = self.request.app[APP_KEY]["pdtb_token"]
url = "" # self.request.route_url(EXC_ROUTE_NAME, _query=qs)
evalex = self.exc_history.eval_exc
self.data = {
"evalex": evalex and "true" or "false",
"console": "false",
"lodgeit_url": None,
"title": exc,
"exception": exc,
"exception_type": escape(traceback.exception_type),
"summary": summary,
"plaintext": traceback.plaintext,
"plaintext_cs": re.sub("-{2,}", "-", traceback.plaintext),
"traceback_id": traceback.id,
"token": token,
"url": url,
}
def render_content(self, request):
return super().render_content(request)
def render_vars(self, request):
static_path = self._request.app.router[STATIC_ROUTE_NAME].canonical
root_path = self.request.app.router[ROOT_ROUTE_NAME].url_for()
return {"static_path": static_path, "root_path": root_path}
================================================
FILE: aiohttp_debugtoolbar/panels/versions.py
================================================
import platform
import sys
from importlib.metadata import Distribution, version
from operator import itemgetter
from typing import ClassVar, Dict, List, Optional, TypedDict
from .base import DebugPanel
__all__ = ("VersionDebugPanel",)
aiohttp_version = version("aiohttp")
class _Package(TypedDict):
version: str
lowername: str
name: str
dependencies: List[str]
url: Optional[str]
class VersionDebugPanel(DebugPanel):
"""
Panel that displays the Python version, the aiohttp version, and the
versions of other software on your PYTHONPATH.
"""
name = "Version"
has_content = True
template = "versions.jinja2"
title = "Versions"
nav_title = title
packages: ClassVar[Optional[List[Dict[str, str]]]] = None
def __init__(self, request):
super().__init__(request)
self.data = {
"platform": self.get_platform(),
"packages": self.get_packages(),
"aiohttp_version": aiohttp_version,
}
@classmethod
def get_packages(cls) -> List[Dict[str, str]]:
if VersionDebugPanel.packages:
return VersionDebugPanel.packages
packages: List[_Package] = []
for distribution in Distribution.discover():
name = distribution.metadata["Name"]
dependencies = [d for d in distribution.requires or ()]
url = distribution.metadata.get("Home-page")
packages.append(
{
"version": distribution.version,
"lowername": name.lower(),
"name": name,
"dependencies": dependencies,
"url": url,
}
)
VersionDebugPanel.packages = sorted(packages, key=itemgetter("lowername")) # type: ignore[arg-type]
return VersionDebugPanel.packages
def _get_platform_name(self):
return platform.platform()
def get_platform(self):
return f"Python {sys.version} on {self._get_platform_name()}"
================================================
FILE: aiohttp_debugtoolbar/py.typed
================================================
================================================
FILE: aiohttp_debugtoolbar/static/css/dashboard.css
================================================
/*
* Base structure
*/
/* Move down content because we have a fixed navbar that is 50px tall */
body {
padding-top: 70px;
}
a {
color: #e28d29;
}
a:hover {
color: #c56b00;
}
.navbar-collapse {
border-color: #e28d29;
}
/*
.navbar-inner {
background-color: #dd7c0d;
background-image: linear-gradient(left, #dd7c0d, #dbc1a4;
background-image: -moz-linear-gradient(left, #dd7c0d, #dbc1a4;
background-image: -ms-linear-gradient(left, #dd7c0d, #dbc1a4;
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#dd7c0d), to(#dbc1a4);
background-image: -webkit-linear-gradient(left, #dd7c0d, #dbc1a4;
background-image: -o-linear-gradient(left, #dd7c0d, #dbc1a4;
}
*/
.navbar-inverse {
background: #dd7c0d; /* Old browsers */
background: -moz-linear-gradient(left, #dd7c0d 0%, #c99662 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, right top, color-stop(0%,#dd7c0d), color-stop(100%,#c99662)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(left, #dd7c0d 0%,#c99662 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(left, #dd7c0d 0%,#c99662 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(left, #dd7c0d 0%,#c99662 100%); /* IE10+ */
background: linear-gradient(to right, #dd7c0d 0%,#c99662 100%); /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#dd7c0d', endColorstr='#c99662',GradientType=1 ); /* IE6-9 */
}
.navbar-inverse .navbar-brand, .navbar-inverse .navbar-nav > li > a {
color: #fff;
}
.navbar-inverse .navbar-nav > .active > a,
.navbar-inverse .navbar-nav > .active > a:hover,
.navbar-inverse .navbar-nav > .active > a:focus,
.navbar-inverse .navbar-nav > .open > a,
.navbar-inverse .navbar-nav > .open > a:hover,
.navbar-inverse .navbar-nav > .open > a:focus,
.navbar-inverse .navbar-nav > li.active > a,
.navbar-inverse .navbar-nav > li.active:hover > a {
background-color: #c56b00;
}
.navbar-brand > img {
position: absolute;
top: 10px;
left: 10px;
width: 35px;
height: 35px;
}
.navbar-brand {
padding-left: 50px;
}
/*
* Global add-ons
*/
.sub-header {
padding-bottom: 10px;
border-bottom: 1px solid #eee;
}
/*
* Sidebar
*/
/* Hide for mobile, show later */
.sidebar {
display: none;
}
@media (min-width: 768px) {
.navbar-nav {
float: right!important;
}
.sidebar {
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: 1000;
display: block;
padding: 70px 20px 20px;
background-color: #eee;
border-right: 1px solid #eee;
overflow-y: scroll;
}
}
/* Sidebar navigation */
.nav-sidebar {
margin-left: -20px;
margin-right: -21px; /* 20px padding + 1px border */
margin-bottom: 20px;
}
.nav-sidebar > li > h4, .nav-sidebar > li > a {
padding-left: 20px;
padding-right: 20px;
width: 100%;
}
.nav-sidebar > li > a {
color: #555;
}
.nav-sidebar > .active > a {
color: #fff;
background: #999;
}
.nav-sidebar > .active:hover > a {
background: #999;
}
/*
* Main content
*/
.main {
padding: 0px 20px 20px 20px;
}
@media (min-width: 768px) {
.main {
padding-left: 40px;
padding-right: 40px;
}
}
.main .page-header {
margin-top: 0;
}
/*
* Placeholder dashboard ideas
*/
.placeholders {
margin-bottom: 30px;
text-align: center;
}
.placeholders h4 {
margin-bottom: 0;
}
.placeholder {
margin-bottom: 20px;
}
.placeholder img {
border-radius: 50%;
}
ul#requests li a {
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
display: inline-block;
max-width: 300px;
}
/* override twitter bootstrap's tooltip styles */
.tooltip, .tooltip-inner {
max-width: 100%;
}
.tooltip {
word-wrap: break-word;
word-break: break-all;
}
================================================
FILE: aiohttp_debugtoolbar/static/css/debugger.css
================================================
/* TODO: cleanup unused styles */
input { background-color: #fff; margin: 0; text-align: left;
outline: none !important; }
pre, code, table.source,
textarea { font-family: Consolas, "andale mono", "lucida console", monospace; font-size: 14px; }
div.debugger { text-align: left; padding: 12px; margin: auto;
background-color: white; }
h1 { margin: 0 0 0.3em 0; }
div.detail p { margin: 0 0 8px 13px; font-size: 14px; }
div.detail pre.errormsg { word-wrap: break-word; }
div.explanation { margin: 20px 13px; font-size: 15px; color: #555; }
div.footer { font-size: 13px; text-align: right; margin: 30px 0;
color: #999999; }
h2 { margin: 1.3em 0 0.0 0; padding: 9px;
background: #e28d29; color: #000000; }
h2.traceback, h3.traceback {
color: #ffffff;
border-top-right-radius: 4px;
border-top-left-radius: 4px;
}
h2 small, h3 small { font-style: normal; color: #ffffff; font-weight: normal; }
div.traceback {
border-bottom-left-radius: 4px;
border-bottom-right-radius: 1px;
}
div.traceback, div.plain { border: 1px solid #ddd; margin: 0 0 1em 0; padding: 10px; }
div.plain p { margin: 0; }
div.plain textarea,
div.plain pre { margin: 10px 0 0 0; padding: 4px;
background-color: #eeeeee; border: 1px solid #dddddd; }
div.plain textarea { width: 99%; height: 300px; }
div.traceback h3 { margin: 0; }
div.traceback ul { list-style: none; margin: 0; padding: 0; }
div.traceback h4 { font-size: 13px; font-weight: normal; margin: 5px 0; }
div.traceback pre { margin: 0; padding: 5px 0 3px 5px;
background-color: #f5f5f5;}
div.traceback pre,
div.box table.source { white-space: pre-wrap; /* css-3 should we be so lucky... */
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
white-space: -pre-wrap; /* Opera 4-6 ?? */
white-space: -o-pre-wrap; /* Opera 7 ?? */
word-wrap: break-word; /* Internet Explorer 5.5+ */
_white-space: pre; /* IE only hack to re-specify in
addition to word-wrap */ }
div.box h2 { color: #ffffff; }
div.traceback pre:hover { background-color: #eeeeee; color: black; cursor: pointer; }
div.traceback blockquote { margin: 1em 0 0 0; padding: 0; }
div.traceback pre:hover img { display: block; }
div.traceback cite.filename { font-style: normal; color: #666666; }
pre.console { border: 1px solid #ccc; background: white!important;
color: black; padding: 5px!important;
margin: 3px 0 0 0!important; cursor: default!important;
overflow: auto; }
pre.console form { color: #555; }
pre.console input { background-color: transparent; color: #555;
width: 90%; font-family: Consolas, "andale mono", "lucida console", monospace; font-size: 14px;
border: none!important; }
span.string { color: #30799B; }
span.number { color: #9C1A1C; }
span.help { color: #3A7734; }
span.object { color: #485F6E; }
pre.console div.traceback,
pre.console div.box { margin: 5px; white-space: normal;
border: 1px solid #dddddd; padding: 5px;
font-family: sans-serif; }
pre.console div.box h3,
pre.console div.traceback h3 { margin: -5px -5px 5px -5px; padding: 5px;
background: #e28d29; color: #ffffff; }
pre.console div.traceback pre:hover { cursor: default; background: #eeeeee; }
pre.console div.traceback pre.syntaxerror { background: #eeeeee; border: none;
margin: 0px 0px 0px 0px;
padding: 10px; border-top: 1px solid #dddddd; }
pre.console div.noframe-traceback pre.syntaxerror { margin-top: 0px; border: none; }
pre.console div.box pre.repr { padding: 0; margin: 0; background-color: white; border: none; }
pre.console div.box table { margin-top: 6px; }
pre.console div.box pre { border: none; }
pre.console div.box pre.help { background-color: white; }
pre.console div.box pre.help:hover { cursor: default; }
pre.console table tr { vertical-align: top; }
pre.console table th { white-space: nowrap; }
div.console { border: 1px solid #dddddd; padding: 4px; background-color: #f5f5f5; }
div.box table.source { border-collapse: collapse; width: 100%; background: #f5f5f5;
font-size: 12px;
}
div.box table.source td { border-top: 1px solid #dddddd; padding: 4px 0 4px 10px; }
div.box table.source td.lineno { color: #999; padding-right: 10px; width: 1px; }
div.box table.source tr.in-frame { background-color: white; }
div.box table.source tr.current { background-color: #dddddd; color: #e5762b; }
div.sourceview { overflow: auto; border: 1px solid #ccc; }
div.traceback .btn { margin: 1px 4px 1px 0; }
div.traceback span, div.explanation span { margin: 2px; }
div.sourceview span.current {
display: inline-block;
width: 100%;
background-color: #ddd;
}
td.value {
word-break: break-all;
word-wrap: break-word;
}
================================================
FILE: aiohttp_debugtoolbar/static/css/prism.css
================================================
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+git+python+sql&plugins=line-highlight+line-numbers */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"],
pre[class*="language-"] {
color: black;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
direction: ltr;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection,
code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection,
code[class*="language-"]::selection, code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"],
pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre) > code[class*="language-"],
pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment,
.token.prolog,
.token.doctype,
.token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property,
.token.tag,
.token.boolean,
.token.number,
.token.constant,
.token.symbol,
.token.deleted {
color: #905;
}
.token.selector,
.token.attr-name,
.token.string,
.token.char,
.token.builtin,
.token.inserted {
color: #690;
}
.token.operator,
.token.entity,
.token.url,
.language-css .token.string,
.style .token.string {
color: #a67f59;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule,
.token.attr-value,
.token.keyword {
color: #07a;
}
.token.function {
color: #DD4A68;
}
.token.regex,
.token.important,
.token.variable {
color: #e90;
}
.token.important,
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
pre[data-line] {
position: relative;
padding: 1em 0 1em 3em;
}
.line-highlight {
position: absolute;
left: 0;
right: 0;
padding: inherit 0;
margin-top: 1em; /* Same as .prism’s padding-top */
background: hsla(24, 20%, 50%,.08);
background: -moz-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
background: -webkit-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
background: -o-linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
background: linear-gradient(left, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
pointer-events: none;
line-height: inherit;
white-space: pre;
}
.line-highlight:before,
.line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
min-width: 1em;
padding: 0 .5em;
background-color: hsla(24, 20%, 50%,.4);
color: hsl(24, 20%, 95%);
font: bold 65%/1.5 sans-serif;
text-align: center;
vertical-align: .3em;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px white;
}
.line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
}
pre.line-numbers {
position: relative;
padding-left: 3.8em;
counter-reset: linenumber;
}
pre.line-numbers > code {
position: relative;
}
.line-numbers .line-numbers-rows {
position: absolute;
pointer-events: none;
top: 0;
font-size: 100%;
left: -3.8em;
width: 3em; /* works for line-numbers below 1000 lines */
letter-spacing: -1px;
border-right: 1px solid #999;
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
.line-numbers-rows > span {
pointer-events: none;
display: block;
counter-increment: linenumber;
}
.line-numbers-rows > span:before {
content: counter(linenumber);
color: #999;
display: block;
padding-right: 0.8em;
text-align: right;
}
================================================
FILE: aiohttp_debugtoolbar/static/css/toolbar.css
================================================
._200 {
background-color: #468847;
}
._500 {
background-color: #b94a48;
}
._404{
background-color: #3a87ad;
}
.switch {
font-size: 10px;
display: block;
color: white;
height: 16px;
width: 16px;
cursor: pointer;
}
.switch.active {
background-image: url(../img/tick.png);
}
.switch.inactive{
background-image: url(../img/tick-red.png);
}
li.nav-label {
position: relative;
display: block;
padding: 10px 15px 10px 0px;
}
li.nav-label strong {
font-size: 150%;
}
a.active {
background: #fff;
}
#pDebug #pDebugToolbarHandle {
position:fixed;
border:1px solid #e28d29;
top: 25%;
right:0;
z-index:100000000;
}
@media print {
#pDebug {
display: none;
}
}
#pDebug a#pShowToolBarButton {
display:block;
height:40px;
width:40px;
border-right:none;
border-bottom:1px solid #fff;
border-top:1px solid #fff;
border-left:1px solid #fff;
color:#fff;
font-size:10px;
font-weight:bold;
text-decoration:none;
text-align:center;
text-indent:-999999px;
background-color:#e28d29;
background-size:40px 40px;
background-image:url(../img/aiohttp.svg);
background-position: left center;
background-repead: no-repeat;
opacity:0.8;
filter:alpha(opacity=80);
}
#pDebug a#pShowToolBarButton:hover {
background-color:#e28d29;
padding-right:2px;
border-top-color:#fff;
border-left-color:#fff;
border-bottom-color:#fff;
opacity:1.0;
}
/* tablesorter */
.header { cursor: pointer; position: relative; }
.header:before { position: absolute; right: 0; bottom: 40%; content: '▲'; font-size: 10px; color: #bbb; }
.header:after { position: absolute; right: 0; bottom: 20%; content: '▼'; font-size: 10px; color: #bbb; }
.headerSortUp:before { content: ''; }
.headerSortUp:after { color: inherit; }
.headerSortDown:before { color: inherit; }
.headerSortDown:after { content: ''; }
================================================
FILE: aiohttp_debugtoolbar/static/css/toolbar_button.css
================================================
#pDebug #pDebugToolbarHandle {
position:fixed;
border:2px solid #e28d29;
top: 25%;
right:0;
z-index:100000000;
-webkit-border-top-left-radius: 20px;
-webkit-border-bottom-left-radius: 20px;
-moz-border-radius-topleft: 20px;
-moz-border-radius-bottomleft: 20px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
#pDebug a#pShowToolBarButton {
display:block;
height:40px;
width:50px;
border-right:none;
border-bottom:1px solid #fff;
border-top:1px solid #fff;
border-left:1px solid #fff;
color:#fff;
font-size:10px;
font-weight:bold;
text-decoration:none;
text-align:center;
text-indent:-999999px;
background-color:#fff;
background-size:40px 40px;
background-image:url(../img/aiohttp.svg);
background-position: left center;
background-repeat: no-repeat;
opacity:0.8;
filter:alpha(opacity=80);
-webkit-border-top-left-radius: 20px;
-webkit-border-bottom-left-radius: 20px;
-moz-border-radius-topleft: 20px;
-moz-border-radius-bottomleft: 20px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
#pDebug a#pShowToolBarButton:hover {
background-color:#fff;
border-top-color:#fff;
border-left-color:#fff;
border-bottom-color:#fff;
border-right:5px solid #ffc17a;
opacity:1.0;
-webkit-border-top-left-radius: 20px;
-webkit-border-bottom-left-radius: 20px;
-moz-border-radius-topleft: 20px;
-moz-border-radius-bottomleft: 20px;
border-top-left-radius: 20px;
border-bottom-left-radius: 20px;
}
================================================
FILE: aiohttp_debugtoolbar/static/font/FONT_LICENSE
================================================
-------------------------------
UBUNTU FONT LICENCE Version 1.0
-------------------------------
PREAMBLE
This licence allows the licensed fonts to be used, studied, modified and
redistributed freely. The fonts, including any derivative works, can be
bundled, embedded, and redistributed provided the terms of this licence
are met. The fonts and derivatives, however, cannot be released under
any other licence. The requirement for fonts to remain under this
licence does not require any document created using the fonts or their
derivatives to be published under this licence, as long as the primary
purpose of the document is not to be a vehicle for the distribution of
the fonts.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this licence and clearly marked as such. This may
include source files, build scripts and documentation.
"Original Version" refers to the collection of Font Software components
as received under this licence.
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to
a new environment.
"Copyright Holder(s)" refers to all individuals and companies who have a
copyright ownership of the Font Software.
"Substantially Changed" refers to Modified Versions which can be easily
identified as dissimilar to the Font Software by users of the Font
Software comparing the Original Version with the Modified Version.
To "Propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification and with or without charging
a redistribution fee), making available to the public, and in some
countries other activities as well.
PERMISSION & CONDITIONS
This licence does not grant any rights under trademark law and all such
rights are reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of the Font Software, to propagate the Font Software, subject to
the below conditions:
1) Each copy of the Font Software must contain the above copyright
notice and this licence. These can be included either as stand-alone
text files, human-readable headers or in the appropriate machine-
readable metadata fields within text or binary files as long as those
fields can be easily viewed by the user.
2) The font name complies with the following:
(a) The Original Version must retain its name, unmodified.
(b) Modified Versions which are Substantially Changed must be renamed to
avoid use of the name of the Original Version or similar names entirely.
(c) Modified Versions which are not Substantially Changed must be
renamed to both (i) retain the name of the Original Version and (ii) add
additional naming elements to distinguish the Modified Version from the
Original Version. The name of such Modified Versions must be the name of
the Original Version, with "derivative X" where X represents the name of
the new work, appended to that name.
3) The name(s) of the Copyright Holder(s) and any contributor to the
Font Software shall not be used to promote, endorse or advertise any
Modified Version, except (i) as required by this licence, (ii) to
acknowledge the contribution(s) of the Copyright Holder(s) or (iii) with
their explicit written permission.
4) The Font Software, modified or unmodified, in part or in whole, must
be distributed entirely under this licence, and must not be distributed
under any other licence. The requirement for fonts to remain under this
licence does not affect any document created using the Font Software,
except any version of the Font Software extracted from a document
created using the Font Software may only be distributed under this
licence.
TERMINATION
This licence becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER
DEALINGS IN THE FONT SOFTWARE.
================================================
FILE: aiohttp_debugtoolbar/static/js/README.rst
================================================
A note on the included libraries
================================
The following libraries have been patched to prevent conflicts with the
applications that include this toolbar. If these libraries are upgraded they
must be re-patched.
- require.js
- jquery-1.7.2.min.js
================================================
FILE: aiohttp_debugtoolbar/static/js/debugger.js
================================================
pyramid_debugtoolbar_require.config({
paths: {
"jquery": "jquery-1.10.2.min",
"toolbar": "toolbar"
}
});
pyramid_debugtoolbar_require([
"jquery",
"toolbar"], function($, tablesorter, toolbar) {
$(function() {
var sourceView = null;
/**
* if we are in console mode, show the console.
*/
if (window.CONSOLE_MODE && window.EVALEX) {
openShell(null, $('div.console div.inner').empty(), 0);
}
$('div.traceback div.frame').each(function() {
var
target = $('pre', this)
.click(function() {
sourceButton.click();
}),
consoleNode = null, source = null,
frameID = this.id.substring(6);
/**
* Add an interactive console to the frames
*/
if (EVALEX)
$('<button class="btn btn-xs btn-default pull-right">' +
'<span class="glyphicon glyphicon-console pull-right" ' +
'aria-hidden="true"></span></button>')
.attr('title', 'Open an interactive python shell in this frame')
.click(function() {
consoleNode = openShell(consoleNode, target, frameID);
return false;
})
.prependTo(target);
/**
* Show sourcecode
*/
var sourceButton = $('<button class="btn btn-xs btn-default pull-right">' +
'<span class="glyphicon glyphicon-file pull-right" ' +
'aria-hidden="true"></span></button>')
.attr('title', 'Display the sourcecode for this frame')
.click(function () {
if (!sourceView)
$('h2', sourceView =
$('<div class="box"><h2>View Source</h2><div class="sourceview">' +
'<pre></pre></div>')
.insertBefore('div.explanation'))
.css('cursor', 'pointer')
.click(function () {
sourceView.slideUp('fast');
});
$.get(window.DEBUG_TOOLBAR_ROOT_PATH + '/source',
{frm: frameID, token: window.DEBUGGER_TOKEN}, function (data) {
var dataLine;
var inFrame = data.inFrame;
inFrame[0]++;
if (inFrame !== null && inFrame[0] !== inFrame[1]) {
dataLine = '' + inFrame[0] + '-' + (inFrame[1]);
//if (data.line !== inFrame[0] && data.line !== inFrame[1]) {
dataLine += (',' + data.line);
//}
} else {
dataLine = '' + data.line
}
var code = '<pre data-line="' + dataLine + '"><code id="pDebugTracebackSrc"' +
'class="language-python">'
+ data.source + '</code></pre>';
$('pre', sourceView)
.replaceWith(code);
Prism.highlightElement(document.querySelector('#pDebugTracebackSrc'));
if (!sourceView.is(':visible'))
sourceView.slideDown('fast', function () {
focusSourceBlock();
});
else
focusSourceBlock();
});
return false;
})
.prependTo(target);
});
/**
* toggle traceback types on click.
*/
$('h2.traceback').click(function() {
$(this).next().slideToggle('fast');
$('div.plain').slideToggle('fast');
}).css('cursor', 'pointer');
$('div.plain').hide();
/**
* Add extra info (this is here so that only users with JavaScript
* enabled see it.)
*/
$('span.nojavascript')
.removeClass('nojavascript')
.html('<p>To switch between the interactive traceback and the plaintext ' +
'one, you can click on the "Traceback" headline. From the text ' +
'traceback you can also create a paste of it. ' + (!window.EVALEX ? '' :
'For code execution mouse-over the frame you want to debug and ' +
'click on the console icon on the right side.' +
'<p>You can execute arbitrary Python code in the stack frames and ' +
'there are some extra helpers available for introspection:' +
'<ul><li><code>dump()</code> shows all variables in the frame' +
'<li><code>dump(obj)</code> dumps all that\'s known about the object</ul>'));
/**
* Add the pastebin feature
*/
$('div.plain form')
.submit(function() {
var label = $('input[type="submit"]', this);
var old_val = label.val();
label.val('submitting...');
$.ajax({
dataType: 'json',
url: window.DEBUG_TOOLBAR_ROOT_PATH + '/paste',
data: {tb: window.TRACEBACK, token: window.DEBUGGER_TOKEN},
success: function(data) {
$('div.plain span.pastemessage')
.removeClass('pastemessage')
.text('Paste created: ')
.append($('<a>#' + data.id + '</a>').attr('href', data.url));
},
error: function() {
alert('Error: Could not submit paste. No network connection?');
label.val(old_val);
}
});
return false;
});
// if we have javascript we submit by ajax anyways, so no need for the
// not scaling textarea.
var plainTraceback = $('div.plain textarea');
plainTraceback.replaceWith($('<pre>').text(plainTraceback.text()));
/**
* Helper function for shell initialization
*/
function openShell(consoleNode, target, frameID) {
if (consoleNode)
return consoleNode.slideToggle('fast');
consoleNode = $('<pre class="console">')
.appendTo(target.parent())
.hide()
var historyPos = 0, history = [''];
var output = $('<div class="output">[console ready]</div>')
.appendTo(consoleNode);
var form = $('<form>>>> </form>')
.submit(function() {
var cmd = command.val();
$.get(window.DEBUG_TOOLBAR_ROOT_PATH + '/execute', {
cmd: cmd, frm: frameID, token:window.DEBUGGER_TOKEN}, function(data) {
var tmp = $('<div>').html(data);
output.append(tmp);
command.focus();
consoleNode.scrollTop(command.position().top);
var old = history.pop();
history.push(cmd);
if (typeof old != 'undefined')
history.push(old);
historyPos = history.length - 1;
});
command.val('');
return false;
}).
appendTo(consoleNode);
var command = $('<input type="text">')
.appendTo(form)
.keydown(function(e) {
if (e.charCode == 100 && e.ctrlKey) {
output.text('--- screen cleared ---');
return false;
}
else if (e.charCode == 0 && (e.keyCode == 38 || e.keyCode == 40)) {
if (e.keyCode == 38 && historyPos > 0)
historyPos--;
else if (e.keyCode == 40 && historyPos < history.length)
historyPos++;
command.val(history[historyPos]);
return false;
}
});
return consoleNode.slideDown('fast', function() {
command.focus();
});
}
/**
* Focus the current block in the source view.
*/
function focusSourceBlock() {
var tmp, line = $('pre code .line-highlight');
for (var i = 0; i < 7; i++) {
tmp = line.prev();
if (!(tmp && tmp.is('.in-frame')))
break;
line = tmp;
}
var container = $('div.sourceview');
$('html, body').scrollTop(line.offset().top);
}
});
$.noConflict(true);
});
================================================
FILE: aiohttp_debugtoolbar/static/js/jquery.cookie.js
================================================
/*!
* jQuery Cookie Plugin v1.3.1
* https://github.com/carhartl/jquery-cookie
*
* Copyright 2013 Klaus Hartl
* Released under the MIT license
*/
(function (factory) {
if (typeof define === 'function' && define.amd) {
// AMD. Register as anonymous module.
define(['jquery'], factory);
} else {
// Browser globals.
factory(jQuery);
}
}(function ($) {
var pluses = /\+/g;
function raw(s) {
return s;
}
function decoded(s) {
return decodeURIComponent(s.replace(pluses, ' '));
}
function converted(s) {
if (s.indexOf('"') === 0) {
// This is a quoted cookie as according to RFC2068, unescape
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
}
try {
return config.json ? JSON.parse(s) : s;
} catch(er) {}
}
var config = $.cookie = function (key, value, options) {
// write
if (value !== undefined) {
options = $.extend({}, config.defaults, options);
if (typeof options.expires === 'number') {
var days = options.expires, t = options.expires = new Date();
t.setDate(t.getDate() + days);
}
value = config.json ? JSON.stringify(value) : String(value);
return (document.cookie = [
config.raw ? key : encodeURIComponent(key),
'=',
config.raw ? value : encodeURIComponent(value),
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
options.path ? '; path=' + options.path : '',
options.domain ? '; domain=' + options.domain : '',
options.secure ? '; secure' : ''
].join(''));
}
// read
var decode = config.raw ? raw : decoded;
var cookies = document.cookie.split('; ');
var result = key ? undefined : {};
for (var i = 0, l = cookies.length; i < l; i++) {
var parts = cookies[i].split('=');
var name = decode(parts.shift());
var cookie = decode(parts.join('='));
if (key && key === name) {
result = converted(cookie);
break;
}
if (!key) {
result[name] = converted(cookie);
}
}
return result;
};
config.defaults = {};
$.removeCookie = function (key, options) {
if ($.cookie(key) !== undefined) {
// Must not alter options, thus extending a fresh object...
$.cookie(key, '', $.extend({}, options, { expires: -1 }));
return true;
}
return false;
};
}));
================================================
FILE: aiohttp_debugtoolbar/static/js/prism.js
================================================
/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+git+python+sql&plugins=line-highlight+line-numbers */
var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(){var e=/\blang(?:uage)?-(?!\*)(\w+)\b/i,t=_self.Prism={util:{encode:function(e){return e instanceof n?new n(e.type,t.util.encode(e.content),e.alias):"Array"===t.util.type(e)?e.map(t.util.encode):e.replace(/&/g,"&").replace(/</g,"<").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).match(/\[object (\w+)\]/)[1]},clone:function(e){var n=t.util.type(e);switch(n){case"Object":var a={};for(var r in e)e.hasOwnProperty(r)&&(a[r]=t.util.clone(e[r]));return a;case"Array":return e.map&&e.map(function(e){return t.util.clone(e)})}return e}},languages:{extend:function(e,n){var a=t.util.clone(t.languages[e]);for(var r in n)a[r]=n[r];return a},insertBefore:function(e,n,a,r){r=r||t.languages;var l=r[e];if(2==arguments.length){a=arguments[1];for(var i in a)a.hasOwnProperty(i)&&(l[i]=a[i]);return l}var o={};for(var s in l)if(l.hasOwnProperty(s)){if(s==n)for(var i in a)a.hasOwnProperty(i)&&(o[i]=a[i]);o[s]=l[s]}return t.languages.DFS(t.languages,function(t,n){n===r[e]&&t!=e&&(this[t]=o)}),r[e]=o},DFS:function(e,n,a){for(var r in e)e.hasOwnProperty(r)&&(n.call(e,r,e[r],a||r),"Object"===t.util.type(e[r])?t.languages.DFS(e[r],n):"Array"===t.util.type(e[r])&&t.languages.DFS(e[r],n,r))}},plugins:{},highlightAll:function(e,n){for(var a,r=document.querySelectorAll('code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'),l=0;a=r[l++];)t.highlightElement(a,e===!0,n)},highlightElement:function(n,a,r){for(var l,i,o=n;o&&!e.test(o.className);)o=o.parentNode;o&&(l=(o.className.match(e)||[,""])[1],i=t.languages[l]),n.className=n.className.replace(e,"").replace(/\s+/g," ")+" language-"+l,o=n.parentNode,/pre/i.test(o.nodeName)&&(o.className=o.className.replace(e,"").replace(/\s+/g," ")+" language-"+l);var s=n.textContent,u={element:n,language:l,grammar:i,code:s};if(!s||!i)return t.hooks.run("complete",u),void 0;if(t.hooks.run("before-highlight",u),a&&_self.Worker){var g=new Worker(t.filename);g.onmessage=function(e){u.highlightedCode=e.data,t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(u.element),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},g.postMessage(JSON.stringify({language:u.language,code:u.code,immediateClose:!0}))}else u.highlightedCode=t.highlight(u.code,u.grammar,u.language),t.hooks.run("before-insert",u),u.element.innerHTML=u.highlightedCode,r&&r.call(n),t.hooks.run("after-highlight",u),t.hooks.run("complete",u)},highlight:function(e,a,r){var l=t.tokenize(e,a);return n.stringify(t.util.encode(l),r)},tokenize:function(e,n){var a=t.Token,r=[e],l=n.rest;if(l){for(var i in l)n[i]=l[i];delete n.rest}e:for(var i in n)if(n.hasOwnProperty(i)&&n[i]){var o=n[i];o="Array"===t.util.type(o)?o:[o];for(var s=0;s<o.length;++s){var u=o[s],g=u.inside,c=!!u.lookbehind,f=0,h=u.alias;u=u.pattern||u;for(var p=0;p<r.length;p++){var d=r[p];if(r.length>e.length)break e;if(!(d instanceof a)){u.lastIndex=0;var m=u.exec(d);if(m){c&&(f=m[1].length);var y=m.index-1+f,m=m[0].slice(f),v=m.length,k=y+v,b=d.slice(0,y+1),w=d.slice(k+1),P=[p,1];b&&P.push(b);var A=new a(i,g?t.tokenize(m,g):m,h);P.push(A),w&&P.push(w),Array.prototype.splice.apply(r,P)}}}}}return r},hooks:{all:{},add:function(e,n){var a=t.hooks.all;a[e]=a[e]||[],a[e].push(n)},run:function(e,n){var a=t.hooks.all[e];if(a&&a.length)for(var r,l=0;r=a[l++];)r(n)}}},n=t.Token=function(e,t,n){this.type=e,this.content=t,this.alias=n};if(n.stringify=function(e,a,r){if("string"==typeof e)return e;if("Array"===t.util.type(e))return e.map(function(t){return n.stringify(t,a,e)}).join("");var l={type:e.type,content:n.stringify(e.content,a,r),tag:"span",classes:["token",e.type],attributes:{},language:a,parent:r};if("comment"==l.type&&(l.attributes.spellcheck="true"),e.alias){var i="Array"===t.util.type(e.alias)?e.alias:[e.alias];Array.prototype.push.apply(l.classes,i)}t.hooks.run("wrap",l);var o="";for(var s in l.attributes)o+=(o?" ":"")+s+'="'+(l.attributes[s]||"")+'"';return"<"+l.tag+' class="'+l.classes.join(" ")+'" '+o+">"+l.content+"</"+l.tag+">"},!_self.document)return _self.addEventListener?(_self.addEventListener("message",function(e){var n=JSON.parse(e.data),a=n.language,r=n.code,l=n.immediateClose;_self.postMessage(t.highlight(r,t.languages[a],a)),l&&_self.close()},!1),_self.Prism):_self.Prism;var a=document.getElementsByTagName("script");return a=a[a.length-1],a&&(t.filename=a.src,document.addEventListener&&!a.hasAttribute("data-manual")&&document.addEventListener("DOMContentLoaded",t.highlightAll)),_self.Prism}();"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
Prism.languages.markup={comment:/<!--[\w\W]*?-->/,prolog:/<\?[\w\W]+?\?>/,doctype:/<!DOCTYPE[\w\W]+?>/,cdata:/<!\[CDATA\[[\w\W]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=.$<]+(?:\s+[^\s>\/=]+(?:=(?:("|')(?:\\\1|\\?(?!\1)[\w\W])*\1|[^\s'">=]+))?)*\s*\/?>/i,inside:{tag:{pattern:/^<\/?[^\s>\/]+/i,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"attr-value":{pattern:/=(?:('|")[\w\W]*?(\1)|[^\s>]+)/i,inside:{punctuation:/[=>"']/}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:/&#?[\da-z]{1,8};/i},Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&/,"&"))}),Prism.languages.xml=Prism.languages.markup,Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup;
Prism.languages.css={comment:/\/\*[\w\W]*?\*\//,atrule:{pattern:/@[\w-]+?.*?(;|(?=\s*\{))/i,inside:{rule:/@[\w-]+/}},url:/url\((?:(["'])(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1|.*?)\)/i,selector:/[^\{\}\s][^\{\};]*?(?=\s*\{)/,string:/("|')(\\(?:\r\n|[\w\W])|(?!\1)[^\\\r\n])*\1/,property:/(\b|\B)[\w-]+(?=\s*:)/i,important:/\B!important\b/i,"function":/[-a-z0-9]+(?=\()/i,punctuation:/[(){};:]/},Prism.languages.css.atrule.inside.rest=Prism.util.clone(Prism.languages.css),Prism.languages.markup&&(Prism.languages.insertBefore("markup","tag",{style:{pattern:/(<style[\w\W]*?>)[\w\W]*?(?=<\/style>)/i,lookbehind:!0,inside:Prism.languages.css,alias:"language-css"}}),Prism.languages.insertBefore("inside","attr-value",{"style-attr":{pattern:/\s*style=("|').*?\1/i,inside:{"attr-name":{pattern:/^\s*style/i,inside:Prism.languages.markup.tag.inside},punctuation:/^\s*=\s*['"]|['"]\s*$/,"attr-value":{pattern:/.+/i,inside:Prism.languages.css}},alias:"language-css"}},Prism.languages.markup.tag));
Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\w\W]*?\*\//,lookbehind:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0}],string:/(["'])(\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,"class-name":{pattern:/((?:\b(?:class|interface|extends|implements|trait|instanceof|new)\s+)|(?:catch\s+\())[a-z0-9_\.\\]+/i,lookbehind:!0,inside:{punctuation:/(\.|\\)/}},keyword:/\b(if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,"boolean":/\b(true|false)\b/,"function":/[a-z0-9_]+(?=\()/i,number:/\b-?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)\b/i,operator:/--?|\+\+?|!=?=?|<=?|>=?|==?=?|&&?|\|\|?|\?|\*|\/|~|\^|%/,punctuation:/[{}[\];(),.:]/};
Prism.languages.javascript=Prism.languages.extend("clike",{keyword:/\b(as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/,number:/\b-?(0x[\dA-Fa-f]+|0b[01]+|0o[0-7]+|\d*\.?\d+([Ee][+-]?\d+)?|NaN|Infinity)\b/,"function":/[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*(?=\()/i}),Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/(^|[^\/])\/(?!\/)(\[.+?]|\\.|[^\/\\\r\n])+\/[gimyu]{0,5}(?=\s*($|[\r\n,.;})]))/,lookbehind:!0}}),Prism.languages.insertBefore("javascript","class-name",{"template-string":{pattern:/`(?:\\`|\\?[^`])*`/,inside:{interpolation:{pattern:/\$\{[^}]+\}/,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&Prism.languages.insertBefore("markup","tag",{script:{pattern:/(<script[\w\W]*?>)[\w\W]*?(?=<\/script>)/i,lookbehind:!0,inside:Prism.languages.javascript,alias:"language-javascript"}}),Prism.languages.js=Prism.languages.javascript;
Prism.languages.git={comment:/^#.*/m,deleted:/^[-–].*/m,inserted:/^\+.*/m,string:/("|')(\\?.)*?\1/m,command:{pattern:/^.*\$ git .*$/m,inside:{parameter:/\s(--|-)\w+/m}},coord:/^@@.*@@$/m,commit_sha1:/^commit \w{40}$/m};
Prism.languages.python={"triple-quoted-string":{pattern:/"""[\s\S]+?"""|'''[\s\S]+?'''/,alias:"string"},comment:{pattern:/(^|[^\\])#.*/,lookbehind:!0},string:/("|')(?:\\?.)*?\1/,"function":{pattern:/((?:^|\s)def[ \t]+)[a-zA-Z_][a-zA-Z0-9_]*(?=\()/g,lookbehind:!0},"class-name":{pattern:/(\bclass\s+)[a-z0-9_]+/i,lookbehind:!0},keyword:/\b(?:as|assert|async|await|break|class|continue|def|del|elif|else|except|exec|finally|for|from|global|if|import|in|is|lambda|pass|print|raise|return|try|while|with|yield)\b/,"boolean":/\b(?:True|False)\b/,number:/\b-?(?:0[bo])?(?:(?:\d|0x[\da-f])[\da-f]*\.?\d*|\.\d+)(?:e[+-]?\d+)?j?\b/i,operator:/[-+%=]=?|!=|\*\*?=?|\/\/?=?|<[<=>]?|>[=>]?|[&|^~]|\b(?:or|and|not)\b/,punctuation:/[{}[\];(),.:]/};
Prism.languages.sql={comment:{pattern:/(^|[^\\])(?:\/\*[\w\W]*?\*\/|(?:--|\/\/|#).*)/,lookbehind:!0},string:{pattern:/(^|[^@\\])("|')(?:\\?[\s\S])*?\2/,lookbehind:!0},variable:/@[\w.$]+|@("|'|`)(?:\\?[\s\S])+?\1/,"function":/\b(?:COUNT|SUM|AVG|MIN|MAX|FIRST|LAST|UCASE|LCASE|MID|LEN|ROUND|NOW|FORMAT)(?=\s*\()/i,keyword:/\b(?:ACTION|ADD|AFTER|ALGORITHM|ALL|ALTER|ANALYZE|ANY|APPLY|AS|ASC|AUTHORIZATION|BACKUP|BDB|BEGIN|BERKELEYDB|BIGINT|BINARY|BIT|BLOB|BOOL|BOOLEAN|BREAK|BROWSE|BTREE|BULK|BY|CALL|CASCADED?|CASE|CHAIN|CHAR VARYING|CHARACTER (?:SET|VARYING)|CHARSET|CHECK|CHECKPOINT|CLOSE|CLUSTERED|COALESCE|COLLATE|COLUMN|COLUMNS|COMMENT|COMMIT|COMMITTED|COMPUTE|CONNECT|CONSISTENT|CONSTRAINT|CONTAINS|CONTAINSTABLE|CONTINUE|CONVERT|CREATE|CROSS|CURRENT(?:_DATE|_TIME|_TIMESTAMP|_USER)?|CURSOR|DATA(?:BASES?)?|DATETIME|DBCC|DEALLOCATE|DEC|DECIMAL|DECLARE|DEFAULT|DEFINER|DELAYED|DELETE|DENY|DESC|DESCRIBE|DETERMINISTIC|DISABLE|DISCARD|DISK|DISTINCT|DISTINCTROW|DISTRIBUTED|DO|DOUBLE(?: PRECISION)?|DROP|DUMMY|DUMP(?:FILE)?|DUPLICATE KEY|ELSE|ENABLE|ENCLOSED BY|END|ENGINE|ENUM|ERRLVL|ERRORS|ESCAPE(?:D BY)?|EXCEPT|EXEC(?:UTE)?|EXISTS|EXIT|EXPLAIN|EXTENDED|FETCH|FIELDS|FILE|FILLFACTOR|FIRST|FIXED|FLOAT|FOLLOWING|FOR(?: EACH ROW)?|FORCE|FOREIGN|FREETEXT(?:TABLE)?|FROM|FULL|FUNCTION|GEOMETRY(?:COLLECTION)?|GLOBAL|GOTO|GRANT|GROUP|HANDLER|HASH|HAVING|HOLDLOCK|IDENTITY(?:_INSERT|COL)?|IF|IGNORE|IMPORT|INDEX|INFILE|INNER|INNODB|INOUT|INSERT|INT|INTEGER|INTERSECT|INTO|INVOKER|ISOLATION LEVEL|JOIN|KEYS?|KILL|LANGUAGE SQL|LAST|LEFT|LIMIT|LINENO|LINES|LINESTRING|LOAD|LOCAL|LOCK|LONG(?:BLOB|TEXT)|MATCH(?:ED)?|MEDIUM(?:BLOB|INT|TEXT)|MERGE|MIDDLEINT|MODIFIES SQL DATA|MODIFY|MULTI(?:LINESTRING|POINT|POLYGON)|NATIONAL(?: CHAR VARYING| CHARACTER(?: VARYING)?| VARCHAR)?|NATURAL|NCHAR(?: VARCHAR)?|NEXT|NO(?: SQL|CHECK|CYCLE)?|NONCLUSTERED|NULLIF|NUMERIC|OFF?|OFFSETS?|ON|OPEN(?:DATASOURCE|QUERY|ROWSET)?|OPTIMIZE|OPTION(?:ALLY)?|ORDER|OUT(?:ER|FILE)?|OVER|PARTIAL|PARTITION|PERCENT|PIVOT|PLAN|POINT|POLYGON|PRECEDING|PRECISION|PREV|PRIMARY|PRINT|PRIVILEGES|PROC(?:EDURE)?|PUBLIC|PURGE|QUICK|RAISERROR|READ(?:S SQL DATA|TEXT)?|REAL|RECONFIGURE|REFERENCES|RELEASE|RENAME|REPEATABLE|REPLICATION|REQUIRE|RESTORE|RESTRICT|RETURNS?|REVOKE|RIGHT|ROLLBACK|ROUTINE|ROW(?:COUNT|GUIDCOL|S)?|RTREE|RULE|SAVE(?:POINT)?|SCHEMA|SELECT|SERIAL(?:IZABLE)?|SESSION(?:_USER)?|SET(?:USER)?|SHARE MODE|SHOW|SHUTDOWN|SIMPLE|SMALLINT|SNAPSHOT|SOME|SONAME|START(?:ING BY)?|STATISTICS|STATUS|STRIPED|SYSTEM_USER|TABLES?|TABLESPACE|TEMP(?:ORARY|TABLE)?|TERMINATED BY|TEXT(?:SIZE)?|THEN|TIMESTAMP|TINY(?:BLOB|INT|TEXT)|TOP?|TRAN(?:SACTIONS?)?|TRIGGER|TRUNCATE|TSEQUAL|TYPES?|UNBOUNDED|UNCOMMITTED|UNDEFINED|UNION|UNIQUE|UNPIVOT|UPDATE(?:TEXT)?|USAGE|USE|USER|USING|VALUES?|VAR(?:BINARY|CHAR|CHARACTER|YING)|VIEW|WAITFOR|WARNINGS|WHEN|WHERE|WHILE|WITH(?: ROLLUP|IN)?|WORK|WRITE(?:TEXT)?)\b/i,"boolean":/\b(?:TRUE|FALSE|NULL)\b/i,number:/\b-?(?:0x)?\d*\.?[\da-f]+\b/,operator:/[-+*\/=%^~]|&&?|\|?\||!=?|<(?:=>?|<|>)?|>[>=]?|\b(?:AND|BETWEEN|IN|LIKE|NOT|OR|IS|DIV|REGEXP|RLIKE|SOUNDS LIKE|XOR)\b/i,punctuation:/[;[\]()`,.]/};
!function(){function e(e,t){return Array.prototype.slice.call((t||document).querySelectorAll(e))}function t(e,t){return t=" "+t+" ",(" "+e.className+" ").replace(/[\n\t]/g," ").indexOf(t)>-1}function n(e,n,i){for(var o,a=n.replace(/\s+/g,"").split(","),l=+e.getAttribute("data-line-offset")||0,d=r()?parseInt:parseFloat,c=d(getComputedStyle(e).lineHeight),s=0;o=a[s++];){o=o.split("-");var u=+o[0],m=+o[1]||u,h=document.createElement("div");h.textContent=Array(m-u+2).join(" \n"),h.className=(i||"")+" line-highlight",t(e,"line-numbers")||(h.setAttribute("data-start",u),m>u&&h.setAttribute("data-end",m)),h.style.top=(u-l-1)*c+"px",t(e,"line-numbers")?e.appendChild(h):(e.querySelector("code")||e).appendChild(h)}}function i(){var t=location.hash.slice(1);e(".temporary.line-highlight").forEach(function(e){e.parentNode.removeChild(e)});var i=(t.match(/\.([\d,-]+)$/)||[,""])[1];if(i&&!document.getElementById(t)){var r=t.slice(0,t.lastIndexOf(".")),o=document.getElementById(r);o&&(o.hasAttribute("data-line")||o.setAttribute("data-line",""),n(o,i,"temporary "),document.querySelector(".temporary.line-highlight").scrollIntoView())}}if("undefined"!=typeof self&&self.Prism&&self.document&&document.querySelector){var r=function(){var e;return function(){if("undefined"==typeof e){var t=document.createElement("div");t.style.fontSize="13px",t.style.lineHeight="1.5",t.style.padding=0,t.style.border=0,t.innerHTML=" <br /> ",document.body.appendChild(t),e=38===t.offsetHeight,document.body.removeChild(t)}return e}}(),o=0;Prism.hooks.add("complete",function(t){var r=t.element.parentNode,a=r&&r.getAttribute("data-line");r&&a&&/pre/i.test(r.nodeName)&&(clearTimeout(o),e(".line-highlight",r).forEach(function(e){e.parentNode.removeChild(e)}),n(r,a),o=setTimeout(i,1))}),window.addEventListener&&window.addEventListener("hashchange",i)}}();
!function(){"undefined"!=typeof self&&self.Prism&&self.document&&Prism.hooks.add("complete",function(e){if(e.code){var t=e.element.parentNode,s=/\s*\bline-numbers\b\s*/;if(t&&/pre/i.test(t.nodeName)&&(s.test(t.className)||s.test(e.element.className))&&!e.element.querySelector(".line-numbers-rows")){s.test(e.element.className)&&(e.element.className=e.element.className.replace(s,"")),s.test(t.className)||(t.className+=" line-numbers");var n,a=e.code.match(/\n(?!$)/g),l=a?a.length+1:1,m=new Array(l+1);m=m.join("<span></span>"),n=document.createElement("span"),n.className="line-numbers-rows",n.innerHTML=m,t.hasAttribute("data-start")&&(t.style.counterReset="linenumber "+(parseInt(t.getAttribute("data-start"),10)-1)),e.element.appendChild(n)}}})}();
================================================
FILE: aiohttp_debugtoolbar/static/js/r.js
================================================
/**
* @license r.js 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
/*
* This is a bootstrap script to allow running RequireJS in the command line
* in either a Java/Rhino or Node environment. It is modified by the top-level
* dist.js file to inject other files to completely enable this file. It is
* the shell of the r.js file.
*/
/*jslint strict: false, evil: true, nomen: false */
/*global readFile: true, process: false, Packages: false, print: false,
console: false, java: false, module: false */
var requirejs, require, define;
(function (console, args, readFileFunc) {
var fileName, env, fs, vm, path, exec, rhinoContext, dir, nodeRequire,
nodeDefine, exists, reqMain, loadedOptimizedLib,
version = '1.0.7',
jsSuffixRegExp = /\.js$/,
commandOption = '',
useLibLoaded = {},
//Used by jslib/rhino/args.js
rhinoArgs = args,
readFile = typeof readFileFunc !== 'undefined' ? readFileFunc : null;
function showHelp() {
console.log('See https://github.com/jrburke/r.js for usage.');
}
if (typeof Packages !== 'undefined') {
env = 'rhino';
fileName = args[0];
if (fileName && fileName.indexOf('-') === 0) {
commandOption = fileName.substring(1);
fileName = args[1];
}
//Set up execution context.
rhinoContext = Packages.org.mozilla.javascript.ContextFactory.getGlobal().enterContext();
exec = function (string, name) {
return rhinoContext.evaluateString(this, string, name, 0, null);
};
exists = function (fileName) {
return (new java.io.File(fileName)).exists();
};
//Define a console.log for easier logging. Don't
//get fancy though.
if (typeof console === 'undefined') {
console = {
log: function () {
print.apply(undefined, arguments);
}
};
}
} else if (typeof process !== 'undefined') {
env = 'node';
//Get the fs module via Node's require before it
//gets replaced. Used in require/node.js
fs = require('fs');
vm = require('vm');
path = require('path');
nodeRequire = require;
nodeDefine = define;
reqMain = require.main;
//Temporarily hide require and define to allow require.js to define
//them.
require = undefined;
define = undefined;
readFile = function (path) {
return fs.readFileSync(path, 'utf8');
};
exec = function (string, name) {
return vm.runInThisContext(this.requirejsVars.require.makeNodeWrapper(string),
name ? fs.realpathSync(name) : '');
};
exists = function (fileName) {
return path.existsSync(fileName);
};
fileName = process.argv[2];
if (fileName && fileName.indexOf('-') === 0) {
commandOption = fileName.substring(1);
fileName = process.argv[3];
}
}
/** vim: et:ts=4:sw=4:sts=4
* @license RequireJS 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/requirejs for details
*/
/*jslint strict: false, plusplus: false, sub: true */
/*global window, navigator, document, importScripts, jQuery, setTimeout, opera */
(function () {
//Change this version number for each release.
var version = "1.0.7",
commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,
cjsRequireRegExp = /require\(\s*["']([^'"\s]+)["']\s*\)/g,
currDirRegExp = /^\.\//,
jsSuffixRegExp = /\.js$/,
ostring = Object.prototype.toString,
ap = Array.prototype,
aps = ap.slice,
apsp = ap.splice,
isBrowser = !!(typeof window !== "undefined" && navigator && document),
isWebWorker = !isBrowser && typeof importScripts !== "undefined",
//PS3 indicates loaded and complete, but need to wait for complete
//specifically. Sequence is "loading", "loaded", execution,
// then "complete". The UA check is unfortunate, but not sure how
//to feature test w/o causing perf issues.
readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ?
/^complete$/ : /^(complete|loaded)$/,
defContextName = "_",
//Oh the tragedy, detecting opera. See the usage of isOpera for reason.
isOpera = typeof opera !== "undefined" && opera.toString() === "[object Opera]",
empty = {},
contexts = {},
globalDefQueue = [],
interactiveScript = null,
checkLoadedDepth = 0,
useInteractive = false,
reservedDependencies = {
require: true,
module: true,
exports: true
},
req, cfg = {}, currentlyAddingScript, s, head, baseElement, scripts, script,
src, subPath, mainScript, dataMain, globalI, ctx, jQueryCheck, checkLoadedTimeoutId;
function isFunction(it) {
return ostring.call(it) === "[object Function]";
}
function isArray(it) {
return ostring.call(it) === "[object Array]";
}
/**
* Simple function to mix in properties from source into target,
* but only if target does not already have a property of the same name.
* This is not robust in IE for transferring methods that match
* Object.prototype names, but the uses of mixin here seem unlikely to
* trigger a problem related to that.
*/
function mixin(target, source, force) {
for (var prop in source) {
if (!(prop in empty) && (!(prop in target) || force)) {
target[prop] = source[prop];
}
}
return req;
}
/**
* Constructs an error with a pointer to an URL with more information.
* @param {String} id the error ID that maps to an ID on a web page.
* @param {String} message human readable error.
* @param {Error} [err] the original error, if there is one.
*
* @returns {Error}
*/
function makeError(id, msg, err) {
var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id);
if (err) {
e.originalError = err;
}
return e;
}
/**
* Used to set up package paths from a packagePaths or packages config object.
* @param {Object} pkgs the object to store the new package config
* @param {Array} currentPackages an array of packages to configure
* @param {String} [dir] a prefix dir to use.
*/
function configurePackageDir(pkgs, currentPackages, dir) {
var i, location, pkgObj;
for (i = 0; (pkgObj = currentPackages[i]); i++) {
pkgObj = typeof pkgObj === "string" ? { name: pkgObj } : pkgObj;
location = pkgObj.location;
//Add dir to the path, but avoid paths that start with a slash
//or have a colon (indicates a protocol)
if (dir && (!location || (location.indexOf("/") !== 0 && location.indexOf(":") === -1))) {
location = dir + "/" + (location || pkgObj.name);
}
//Create a brand new object on pkgs, since currentPackages can
//be passed in again, and config.pkgs is the internal transformed
//state for all package configs.
pkgs[pkgObj.name] = {
name: pkgObj.name,
location: location || pkgObj.name,
//Remove leading dot in main, so main paths are normalized,
//and remove any trailing .js, since different package
//envs have different conventions: some use a module name,
//some use a file name.
main: (pkgObj.main || "main")
.replace(currDirRegExp, '')
.replace(jsSuffixRegExp, '')
};
}
}
/**
* jQuery 1.4.3-1.5.x use a readyWait/ready() pairing to hold DOM
* ready callbacks, but jQuery 1.6 supports a holdReady() API instead.
* At some point remove the readyWait/ready() support and just stick
* with using holdReady.
*/
function jQueryHoldReady($, shouldHold) {
if ($.holdReady) {
$.holdReady(shouldHold);
} else if (shouldHold) {
$.readyWait += 1;
} else {
$.ready(true);
}
}
if (typeof define !== "undefined") {
//If a define is already in play via another AMD loader,
//do not overwrite.
return;
}
if (typeof requirejs !== "undefined") {
if (isFunction(requirejs)) {
//Do not overwrite and existing requirejs instance.
return;
} else {
cfg = requirejs;
requirejs = undefined;
}
}
//Allow for a require config object
if (typeof require !== "undefined" && !isFunction(require)) {
//assume it is a config object.
cfg = require;
require = undefined;
}
/**
* Creates a new context for use in require and define calls.
* Handle most of the heavy lifting. Do not want to use an object
* with prototype here to avoid using "this" in require, in case it
* needs to be used in more super secure envs that do not want this.
* Also there should not be that many contexts in the page. Usually just
* one for the default context, but could be extra for multiversion cases
* or if a package needs a special context for a dependency that conflicts
* with the standard context.
*/
function newContext(contextName) {
var context, resume,
config = {
waitSeconds: 7,
baseUrl: "./",
paths: {},
pkgs: {},
catchError: {}
},
defQueue = [],
specified = {
"require": true,
"exports": true,
"module": true
},
urlMap = {},
defined = {},
loaded = {},
waiting = {},
waitAry = [],
urlFetched = {},
managerCounter = 0,
managerCallbacks = {},
plugins = {},
//Used to indicate which modules in a build scenario
//need to be full executed.
needFullExec = {},
fullExec = {},
resumeDepth = 0;
/**
* Trims the . and .. from an array of path segments.
* It will keep a leading path segment if a .. will become
* the first path segment, to help with module name lookups,
* which act like paths, but can be remapped. But the end result,
* all paths that use this function should look normalized.
* NOTE: this method MODIFIES the input array.
* @param {Array} ary the array of path segments.
*/
function trimDots(ary) {
var i, part;
for (i = 0; (part = ary[i]); i++) {
if (part === ".") {
ary.splice(i, 1);
i -= 1;
} else if (part === "..") {
if (i === 1 && (ary[2] === '..' || ary[0] === '..')) {
//End of the line. Keep at least one non-dot
//path segment at the front so it can be mapped
//correctly to disk. Otherwise, there is likely
//no path mapping for a path starting with '..'.
//This can still fail, but catches the most reasonable
//uses of ..
break;
} else if (i > 0) {
ary.splice(i - 1, 2);
i -= 2;
}
}
}
}
/**
* Given a relative module name, like ./something, normalize it to
* a real name that can be mapped to a path.
* @param {String} name the relative name
* @param {String} baseName a real name that the name arg is relative
* to.
* @returns {String} normalized name
*/
function normalize(name, baseName) {
var pkgName, pkgConfig;
//Adjust any relative paths.
if (name && name.charAt(0) === ".") {
//If have a base name, try to normalize against it,
//otherwise, assume it is a top-level require that will
//be relative to baseUrl in the end.
if (baseName) {
if (config.pkgs[baseName]) {
//If the baseName is a package name, then just treat it as one
//name to concat the name with.
baseName = [baseName];
} else {
//Convert baseName to array, and lop off the last part,
//so that . matches that "directory" and not name of the baseName's
//module. For instance, baseName of "one/two/three", maps to
//"one/two/three.js", but we want the directory, "one/two" for
//this normalization.
baseName = baseName.split("/");
baseName = baseName.slice(0, baseName.length - 1);
}
name = baseName.concat(name.split("/"));
trimDots(name);
//Some use of packages may use a . path to reference the
//"main" module name, so normalize for that.
pkgConfig = config.pkgs[(pkgName = name[0])];
name = name.join("/");
if (pkgConfig && name === pkgName + '/' + pkgConfig.main) {
name = pkgName;
}
} else if (name.indexOf("./") === 0) {
// No baseName, so this is ID is resolved relative
// to baseUrl, pull off the leading dot.
name = name.substring(2);
}
}
return name;
}
/**
* Creates a module mapping that includes plugin prefix, module
* name, and path. If parentModuleMap is provided it will
* also normalize the name via require.normalize()
*
* @param {String} name the module name
* @param {String} [parentModuleMap] parent module map
* for the module name, used to resolve relative names.
*
* @returns {Object}
*/
function makeModuleMap(name, parentModuleMap) {
var index = name ? name.indexOf("!") : -1,
prefix = null,
parentName = parentModuleMap ? parentModuleMap.name : null,
originalName = name,
normalizedName, url, pluginModule;
if (index !== -1) {
prefix = name.substring(0, index);
name = name.substring(index + 1, name.length);
}
if (prefix) {
prefix = normalize(prefix, parentName);
}
//Account for relative paths if there is a base name.
if (name) {
if (prefix) {
pluginModule = defined[prefix];
if (pluginModule && pluginModule.normalize) {
//Plugin is loaded, use its normalize method.
normalizedName = pluginModule.normalize(name, function (name) {
return normalize(name, parentName);
});
} else {
normalizedName = normalize(name, parentName);
}
} else {
//A regular module.
normalizedName = normalize(name, parentName);
url = urlMap[normalizedName];
if (!url) {
//Calculate url for the module, if it has a name.
//Use name here since nameToUrl also calls normalize,
//and for relative names that are outside the baseUrl
//this causes havoc. Was thinking of just removing
//parentModuleMap to avoid extra normalization, but
//normalize() still does a dot removal because of
//issue #142, so just pass in name here and redo
//the normalization. Paths outside baseUrl are just
//messy to support.
url = context.nameToUrl(name, null, parentModuleMap);
//Store the URL mapping for later.
urlMap[normalizedName] = url;
}
}
}
return {
prefix: prefix,
name: normalizedName,
parentMap: parentModuleMap,
url: url,
originalName: originalName,
fullName: prefix ? prefix + "!" + (normalizedName || '') : normalizedName
};
}
/**
* Determine if priority loading is done. If so clear the priorityWait
*/
function isPriorityDone() {
var priorityDone = true,
priorityWait = config.priorityWait,
priorityName, i;
if (priorityWait) {
for (i = 0; (priorityName = priorityWait[i]); i++) {
if (!loaded[priorityName]) {
priorityDone = false;
break;
}
}
if (priorityDone) {
delete config.priorityWait;
}
}
return priorityDone;
}
function makeContextModuleFunc(func, relModuleMap, enableBuildCallback) {
return function () {
//A version of a require function that passes a moduleName
//value for items that may need to
//look up paths relative to the moduleName
var args = aps.call(arguments, 0), lastArg;
if (enableBuildCallback &&
isFunction((lastArg = args[args.length - 1]))) {
lastArg.__requireJsBuild = true;
}
args.push(relModuleMap);
return func.apply(null, args);
};
}
/**
* Helper function that creates a require function object to give to
* modules that ask for it as a dependency. It needs to be specific
* per module because of the implication of path mappings that may
* need to be relative to the module name.
*/
function makeRequire(relModuleMap, enableBuildCallback, altRequire) {
var modRequire = makeContextModuleFunc(altRequire || context.require, relModuleMap, enableBuildCallback);
mixin(modRequire, {
nameToUrl: makeContextModuleFunc(context.nameToUrl, relModuleMap),
toUrl: makeContextModuleFunc(context.toUrl, relModuleMap),
defined: makeContextModuleFunc(context.requireDefined, relModuleMap),
specified: makeContextModuleFunc(context.requireSpecified, relModuleMap),
isBrowser: req.isBrowser
});
return modRequire;
}
/*
* Queues a dependency for checking after the loader is out of a
* "paused" state, for example while a script file is being loaded
* in the browser, where it may have many modules defined in it.
*/
function queueDependency(manager) {
context.paused.push(manager);
}
function execManager(manager) {
var i, ret, err, errFile, errModuleTree,
cb = manager.callback,
map = manager.map,
fullName = map.fullName,
args = manager.deps,
listeners = manager.listeners,
cjsModule;
//Call the callback to define the module, if necessary.
if (cb && isFunction(cb)) {
if (config.catchError.define) {
try {
ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
} catch (e) {
err = e;
}
} else {
ret = req.execCb(fullName, manager.callback, args, defined[fullName]);
}
if (fullName) {
//If setting exports via "module" is in play,
//favor that over return value and exports. After that,
//favor a non-undefined return value over exports use.
cjsModule = manager.cjsModule;
if (cjsModule &&
cjsModule.exports !== undefined &&
//Make sure it is not already the exports value
cjsModule.exports !== defined[fullName]) {
ret = defined[fullName] = manager.cjsModule.exports;
} else if (ret === undefined && manager.usingExports) {
//exports already set the defined value.
ret = defined[fullName];
} else {
//Use the return value from the function.
defined[fullName] = ret;
//If this module needed full execution in a build
//environment, mark that now.
if (needFullExec[fullName]) {
fullExec[fullName] = true;
}
}
}
} else if (fullName) {
//May just be an object definition for the module. Only
//worry about defining if have a module name.
ret = defined[fullName] = cb;
//If this module needed full execution in a build
//environment, mark that now.
if (needFullExec[fullName]) {
fullExec[fullName] = true;
}
}
//Clean up waiting. Do this before error calls, and before
//calling back listeners, so that bookkeeping is correct
//in the event of an error and error is reported in correct order,
//since the listeners will likely have errors if the
//onError function does not throw.
if (waiting[manager.id]) {
delete waiting[manager.id];
manager.isDone = true;
context.waitCount -= 1;
if (context.waitCount === 0) {
//Clear the wait array used for cycles.
waitAry = [];
}
}
//Do not need to track manager callback now that it is defined.
delete managerCallbacks[fullName];
//Allow instrumentation like the optimizer to know the order
//of modules executed and their dependencies.
if (req.onResourceLoad && !manager.placeholder) {
req.onResourceLoad(context, map, manager.depArray);
}
if (err) {
errFile = (fullName ? makeModuleMap(fullName).url : '') ||
err.fileName || err.sourceURL;
errModuleTree = err.moduleTree;
err = makeError('defineerror', 'Error evaluating ' +
'module "' + fullName + '" at location "' +
errFile + '":\n' +
err + '\nfileName:' + errFile +
'\nlineNumber: ' + (err.lineNumber || err.line), err);
err.moduleName = fullName;
err.moduleTree = errModuleTree;
return req.onError(err);
}
//Let listeners know of this manager's value.
for (i = 0; (cb = listeners[i]); i++) {
cb(ret);
}
return undefined;
}
/**
* Helper that creates a callack function that is called when a dependency
* is ready, and sets the i-th dependency for the manager as the
* value passed to the callback generated by this function.
*/
function makeArgCallback(manager, i) {
return function (value) {
//Only do the work if it has not been done
//already for a dependency. Cycle breaking
//logic in forceExec could mean this function
//is called more than once for a given dependency.
if (!manager.depDone[i]) {
manager.depDone[i] = true;
manager.deps[i] = value;
manager.depCount -= 1;
if (!manager.depCount) {
//All done, execute!
execManager(manager);
}
}
};
}
function callPlugin(pluginName, depManager) {
var map = depManager.map,
fullName = map.fullName,
name = map.name,
plugin = plugins[pluginName] ||
(plugins[pluginName] = defined[pluginName]),
load;
//No need to continue if the manager is already
//in the process of loading.
if (depManager.loading) {
return;
}
depManager.loading = true;
load = function (ret) {
depManager.callback = function () {
return ret;
};
execManager(depManager);
loaded[depManager.id] = true;
//The loading of this plugin
//might have placed other things
//in the paused queue. In particular,
//a loader plugin that depends on
//a different plugin loaded resource.
resume();
};
//Allow plugins to load other code without having to know the
//context or how to "complete" the load.
load.fromText = function (moduleName, text) {
/*jslint evil: true */
var hasInteractive = useInteractive;
//Indicate a the module is in process of loading.
loaded[moduleName] = false;
context.scriptCount += 1;
//Indicate this is not a "real" module, so do not track it
//for builds, it does not map to a real file.
context.fake[moduleName] = true;
//Turn off interactive script matching for IE for any define
//calls in the text, then turn it back on at the end.
if (hasInteractive) {
useInteractive = false;
}
req.exec(text);
if (hasInteractive) {
useInteractive = true;
}
//Support anonymous modules.
context.completeLoad(moduleName);
};
//No need to continue if the plugin value has already been
//defined by a build.
if (fullName in defined) {
load(defined[fullName]);
} else {
//Use parentName here since the plugin's name is not reliable,
//could be some weird string with no path that actually wants to
//reference the parentName's path.
plugin.load(name, makeRequire(map.parentMap, true, function (deps, cb) {
var moduleDeps = [],
i, dep, depMap;
//Convert deps to full names and hold on to them
//for reference later, when figuring out if they
//are blocked by a circular dependency.
for (i = 0; (dep = deps[i]); i++) {
depMap = makeModuleMap(dep, map.parentMap);
deps[i] = depMap.fullName;
if (!depMap.prefix) {
moduleDeps.push(deps[i]);
}
}
depManager.moduleDeps = (depManager.moduleDeps || []).concat(moduleDeps);
return context.require(deps, cb);
}), load, config);
}
}
/**
* Adds the manager to the waiting queue. Only fully
* resolved items should be in the waiting queue.
*/
function addWait(manager) {
if (!waiting[manager.id]) {
waiting[manager.id] = manager;
waitAry.push(manager);
context.waitCount += 1;
}
}
/**
* Function added to every manager object. Created out here
* to avoid new function creation for each manager instance.
*/
function managerAdd(cb) {
this.listeners.push(cb);
}
function getManager(map, shouldQueue) {
var fullName = map.fullName,
prefix = map.prefix,
plugin = prefix ? plugins[prefix] ||
(plugins[prefix] = defined[prefix]) : null,
manager, created, pluginManager, prefixMap;
if (fullName) {
manager = managerCallbacks[fullName];
}
if (!manager) {
created = true;
manager = {
//ID is just the full name, but if it is a plugin resource
//for a plugin that has not been loaded,
//then add an ID counter to it.
id: (prefix && !plugin ?
(managerCounter++) + '__p@:' : '') +
(fullName || '__r@' + (managerCounter++)),
map: map,
depCount: 0,
depDone: [],
depCallbacks: [],
deps: [],
listeners: [],
add: managerAdd
};
specified[manager.id] = true;
//Only track the manager/reuse it if this is a non-plugin
//resource. Also only track plugin resources once
//the plugin has been loaded, and so the fullName is the
//true normalized value.
if (fullName && (!prefix || plugins[prefix])) {
managerCallbacks[fullName] = manager;
}
}
//If there is a plugin needed, but it is not loaded,
//first load the plugin, then continue on.
if (prefix && !plugin) {
prefixMap = makeModuleMap(prefix);
//Clear out defined and urlFetched if the plugin was previously
//loaded/defined, but not as full module (as in a build
//situation). However, only do this work if the plugin is in
//defined but does not have a module export value.
if (prefix in defined && !defined[prefix]) {
delete defined[prefix];
delete urlFetched[prefixMap.url];
}
pluginManager = getManager(prefixMap, true);
pluginManager.add(function (plugin) {
//Create a new manager for the normalized
//resource ID and have it call this manager when
//done.
var newMap = makeModuleMap(map.originalName, map.parentMap),
normalizedManager = getManager(newMap, true);
//Indicate this manager is a placeholder for the real,
//normalized thing. Important for when trying to map
//modules and dependencies, for instance, in a build.
manager.placeholder = true;
normalizedManager.add(function (resource) {
manager.callback = function () {
return resource;
};
execManager(manager);
});
});
} else if (created && shouldQueue) {
//Indicate the resource is not loaded yet if it is to be
//queued.
loaded[manager.id] = false;
queueDependency(manager);
addWait(manager);
}
return manager;
}
function main(inName, depArray, callback, relModuleMap) {
var moduleMap = makeModuleMap(inName, relModuleMap),
name = moduleMap.name,
fullName = moduleMap.fullName,
manager = getManager(moduleMap),
id = manager.id,
deps = manager.deps,
i, depArg, depName, depPrefix, cjsMod;
if (fullName) {
//If module already defined for context, or already loaded,
//then leave. Also leave if jQuery is registering but it does
//not match the desired version number in the config.
if (fullName in defined || loaded[id] === true ||
(fullName === "jquery" && config.jQuery &&
config.jQuery !== callback().fn.jquery)) {
return;
}
//Set specified/loaded here for modules that are also loaded
//as part of a layer, where onScriptLoad is not fired
//for those cases. Do this after the inline define and
//dependency tracing is done.
specified[id] = true;
loaded[id] = true;
//If module is jQuery set up delaying its dom ready listeners.
if (fullName === "jquery" && callback) {
jQueryCheck(callback());
}
}
//Attach real depArray and callback to the manager. Do this
//only if the module has not been defined already, so do this after
//the fullName checks above. IE can call main() more than once
//for a module.
manager.depArray = depArray;
manager.callback = callback;
//Add the dependencies to the deps field, and register for callbacks
//on the dependencies.
for (i = 0; i < depArray.length; i++) {
depArg = depArray[i];
//There could be cases like in IE, where a trailing comma will
//introduce a null dependency, so only treat a real dependency
//value as a dependency.
if (depArg) {
//Split the dependency name into plugin and name parts
depArg = makeModuleMap(depArg, (name ? moduleMap : relModuleMap));
depName = depArg.fullName;
depPrefix = depArg.prefix;
//Fix the name in depArray to be just the name, since
//that is how it will be called back later.
depArray[i] = depName;
//Fast path CommonJS standard dependencies.
if (depName === "require") {
deps[i] = makeRequire(moduleMap);
} else if (depName === "exports") {
//CommonJS module spec 1.1
deps[i] = defined[fullName] = {};
manager.usingExports = true;
} else if (depName === "module") {
//CommonJS module spec 1.1
manager.cjsModule = cjsMod = deps[i] = {
id: name,
uri: name ? context.nameToUrl(name, null, relModuleMap) : undefined,
exports: defined[fullName]
};
} else if (depName in defined && !(depName in waiting) &&
(!(fullName in needFullExec) ||
(fullName in needFullExec && fullExec[depName]))) {
//Module already defined, and not in a build situation
//where the module is a something that needs full
//execution and this dependency has not been fully
//executed. See r.js's requirePatch.js for more info
//on fullExec.
deps[i] = defined[depName];
} else {
//Mark this dependency as needing full exec if
//the current module needs full exec.
if (fullName in needFullExec) {
needFullExec[depName] = true;
//Reset state so fully executed code will get
//picked up correctly.
delete defined[depName];
urlFetched[depArg.url] = false;
}
//Either a resource that is not loaded yet, or a plugin
//resource for either a plugin that has not
//loaded yet.
manager.depCount += 1;
manager.depCallbacks[i] = makeArgCallback(manager, i);
getManager(depArg, true).add(manager.depCallbacks[i]);
}
}
}
//Do not bother tracking the manager if it is all done.
if (!manager.depCount) {
//All done, execute!
execManager(manager);
} else {
addWait(manager);
}
}
/**
* Convenience method to call main for a define call that was put on
* hold in the defQueue.
*/
function callDefMain(args) {
main.apply(null, args);
}
/**
* jQuery 1.4.3+ supports ways to hold off calling
* calling jQuery ready callbacks until all scripts are loaded. Be sure
* to track it if the capability exists.. Also, since jQuery 1.4.3 does
* not register as a module, need to do some global inference checking.
* Even if it does register as a module, not guaranteed to be the precise
* name of the global. If a jQuery is tracked for this context, then go
* ahead and register it as a module too, if not already in process.
*/
jQueryCheck = function (jqCandidate) {
if (!context.jQuery) {
var $ = jqCandidate || (typeof jQuery !== "undefined" ? jQuery : null);
if ($) {
//If a specific version of jQuery is wanted, make sure to only
//use this jQuery if it matches.
if (config.jQuery && $.fn.jquery !== config.jQuery) {
return;
}
if ("holdReady" in $ || "readyWait" in $) {
context.jQuery = $;
//Manually create a "jquery" module entry if not one already
//or in process. Note this could trigger an attempt at
//a second jQuery registration, but does no harm since
//the first one wins, and it is the same value anyway.
callDefMain(["jquery", [], function () {
return jQuery;
}]);
//Ask jQuery to hold DOM ready callbacks.
if (context.scriptCount) {
jQueryHoldReady($, true);
context.jQueryIncremented = true;
}
}
}
}
};
function findCycle(manager, traced) {
var fullName = manager.map.fullName,
depArray = manager.depArray,
fullyLoaded = true,
i, depName, depManager, result;
if (manager.isDone || !fullName || !loaded[fullName]) {
return result;
}
//Found the cycle.
if (traced[fullName]) {
return manager;
}
traced[fullName] = true;
//Trace through the dependencies.
if (depArray) {
for (i = 0; i < depArray.length; i++) {
//Some array members may be null, like if a trailing comma
//IE, so do the explicit [i] access and check if it has a value.
depName = depArray[i];
if (!loaded[depName] && !reservedDependencies[depName]) {
fullyLoaded = false;
break;
}
depManager = waiting[depName];
if (depManager && !depManager.isDone && loaded[depName]) {
result = findCycle(depManager, traced);
if (result) {
break;
}
}
}
if (!fullyLoaded) {
//Discard the cycle that was found, since it cannot
//be forced yet. Also clear this module from traced.
result = undefined;
delete traced[fullName];
}
}
return result;
}
function forceExec(manager, traced) {
var fullName = manager.map.fullName,
depArray = manager.depArray,
i, depName, depManager, prefix, prefixManager, value;
if (manager.isDone || !fullName || !loaded[fullName]) {
return undefined;
}
if (fullName) {
if (traced[fullName]) {
return defined[fullName];
}
traced[fullName] = true;
}
//Trace through the dependencies.
if (depArray) {
for (i = 0; i < depArray.length; i++) {
//Some array members may be null, like if a trailing comma
//IE, so do the explicit [i] access and check if it has a value.
depName = depArray[i];
if (depName) {
//First, make sure if it is a plugin resource that the
//plugin is not blocked.
prefix = makeModuleMap(depName).prefix;
if (prefix && (prefixManager = waiting[prefix])) {
forceExec(prefixManager, traced);
}
depManager = waiting[depName];
if (depManager && !depManager.isDone && loaded[depName]) {
value = forceExec(depManager, traced);
manager.depCallbacks[i](value);
}
}
}
}
return defined[fullName];
}
/**
* Checks if all modules for a context are loaded, and if so, evaluates the
* new ones in right dependency order.
*
* @private
*/
function checkLoaded() {
var waitInterval = config.waitSeconds * 1000,
//It is possible to disable the wait interval by using waitSeconds of 0.
expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(),
noLoads = "", hasLoadedProp = false, stillLoading = false,
cycleDeps = [],
i, prop, err, manager, cycleManager, moduleDeps;
//If there are items still in the paused queue processing wait.
//This is particularly important in the sync case where each paused
//item is processed right away but there may be more waiting.
if (context.pausedCount > 0) {
return undefined;
}
//Determine if priority loading is done. If so clear the priority. If
//not, then do not check
if (config.priorityWait) {
if (isPriorityDone()) {
//Call resume, since it could have
//some waiting dependencies to trace.
resume();
} else {
return undefined;
}
}
//See if anything is still in flight.
for (prop in loaded) {
if (!(prop in empty)) {
hasLoadedProp = true;
if (!loaded[prop]) {
if (expired) {
noLoads += prop + " ";
} else {
stillLoading = true;
if (prop.indexOf('!') === -1) {
//No reason to keep looking for unfinished
//loading. If the only stillLoading is a
//plugin resource though, keep going,
//because it may be that a plugin resource
//is waiting on a non-plugin cycle.
cycleDeps = [];
break;
} else {
moduleDeps = managerCallbacks[prop] && managerCallbacks[prop].moduleDeps;
if (moduleDeps) {
cycleDeps.push.apply(cycleDeps, moduleDeps);
}
}
}
}
}
}
//Check for exit conditions.
if (!hasLoadedProp && !context.waitCount) {
//If the loaded object had no items, then the rest of
//the work below does not need to be done.
return undefined;
}
if (expired && noLoads) {
//If wait time expired, throw error of unloaded modules.
err = makeError("timeout", "Load timeout for modules: " + noLoads);
err.requireType = "timeout";
err.requireModules = noLoads;
err.contextName = context.contextName;
return req.onError(err);
}
//If still loading but a plugin is waiting on a regular module cycle
//break the cycle.
if (stillLoading && cycleDeps.length) {
for (i = 0; (manager = waiting[cycleDeps[i]]); i++) {
if ((cycleManager = findCycle(manager, {}))) {
forceExec(cycleManager, {});
break;
}
}
}
//If still waiting on loads, and the waiting load is something
//other than a plugin resource, or there are still outstanding
//scripts, then just try back later.
if (!expired && (stillLoading || context.scriptCount)) {
//Something is still waiting to load. Wait for it, but only
//if a timeout is not already in effect.
if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) {
checkLoadedTimeoutId = setTimeout(function () {
checkLoadedTimeoutId = 0;
checkLoaded();
}, 50);
}
return undefined;
}
//If still have items in the waiting cue, but all modules have
//been loaded, then it means there are some circular dependencies
//that need to be broken.
//However, as a waiting thing is fired, then it can add items to
//the waiting cue, and those items should not be fired yet, so
//make sure to redo the checkLoaded call after breaking a single
//cycle, if nothing else loaded then this logic will pick it up
//again.
if (context.waitCount) {
//Cycle through the waitAry, and call items in sequence.
for (i = 0; (manager = waitAry[i]); i++) {
forceExec(manager, {});
}
//If anything got placed in the paused queue, run it down.
if (context.paused.length) {
resume();
}
//Only allow this recursion to a certain depth. Only
//triggered by errors in calling a module in which its
//modules waiting on it cannot finish loading, or some circular
//dependencies that then may add more dependencies.
//The value of 5 is a bit arbitrary. Hopefully just one extra
//pass, or two for the case of circular dependencies generating
//more work that gets resolved in the sync node case.
if (checkLoadedDepth < 5) {
checkLoadedDepth += 1;
checkLoaded();
}
}
checkLoadedDepth = 0;
//Check for DOM ready, and nothing is waiting across contexts.
req.checkReadyState();
return undefined;
}
/**
* Resumes tracing of dependencies and then checks if everything is loaded.
*/
resume = function () {
var manager, map, url, i, p, args, fullName;
//Any defined modules in the global queue, intake them now.
context.takeGlobalQueue();
resumeDepth += 1;
if (context.scriptCount <= 0) {
//Synchronous envs will push the number below zero with the
//decrement above, be sure to set it back to zero for good measure.
//require() calls that also do not end up loading scripts could
//push the number negative too.
context.scriptCount = 0;
}
//Make sure any remaining defQueue items get properly processed.
while (defQueue.length) {
args = defQueue.shift();
if (args[0] === null) {
return req.onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1]));
} else {
callDefMain(args);
}
}
//Skip the resume of paused dependencies
//if current context is in priority wait.
if (!config.priorityWait || isPriorityDone()) {
while (context.paused.length) {
p = context.paused;
context.pausedCount += p.length;
//Reset paused list
context.paused = [];
for (i = 0; (manager = p[i]); i++) {
map = manager.map;
url = map.url;
fullName = map.fullName;
//If the manager is for a plugin managed resource,
//ask the plugin to load it now.
if (map.prefix) {
callPlugin(map.prefix, manager);
} else {
//Regular dependency.
if (!urlFetched[url] && !loaded[fullName]) {
req.load(context, fullName, url);
//Mark the URL as fetched, but only if it is
//not an empty: URL, used by the optimizer.
//In that case we need to be sure to call
//load() for each module that is mapped to
//empty: so that dependencies are satisfied
//correctly.
if (url.indexOf('empty:') !== 0) {
urlFetched[url] = true;
}
}
}
}
//Move the start time for timeout forward.
context.startTime = (new Date()).getTime();
context.pausedCount -= p.length;
}
}
//Only check if loaded when resume depth is 1. It is likely that
//it is only greater than 1 in sync environments where a factory
//function also then calls the callback-style require. In those
//cases, the checkLoaded should not occur until the resume
//depth is back at the top level.
if (resumeDepth === 1) {
checkLoaded();
}
resumeDepth -= 1;
return undefined;
};
//Define the context object. Many of these fields are on here
//just to make debugging easier.
context = {
contextName: contextName,
config: config,
defQueue: defQueue,
waiting: waiting,
waitCount: 0,
specified: specified,
loaded: loaded,
urlMap: urlMap,
urlFetched: urlFetched,
scriptCount: 0,
defined: defined,
paused: [],
pausedCount: 0,
plugins: plugins,
needFullExec: needFullExec,
fake: {},
fullExec: fullExec,
managerCallbacks: managerCallbacks,
makeModuleMap: makeModuleMap,
normalize: normalize,
/**
* Set a configuration for the context.
* @param {Object} cfg config object to integrate.
*/
configure: function (cfg) {
var paths, prop, packages, pkgs, packagePaths, requireWait;
//Make sure the baseUrl ends in a slash.
if (cfg.baseUrl) {
if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== "/") {
cfg.baseUrl += "/";
}
}
//Save off the paths and packages since they require special processing,
//they are additive.
paths = config.paths;
packages = config.packages;
pkgs = config.pkgs;
//Mix in the config values, favoring the new values over
//existing ones in context.config.
mixin(config, cfg, true);
//Adjust paths if necessary.
if (cfg.paths) {
for (prop in cfg.paths) {
if (!(prop in empty)) {
paths[prop] = cfg.paths[prop];
}
}
config.paths = paths;
}
packagePaths = cfg.packagePaths;
if (packagePaths || cfg.packages) {
//Convert packagePaths into a packages config.
if (packagePaths) {
for (prop in packagePaths) {
if (!(prop in empty)) {
configurePackageDir(pkgs, packagePaths[prop], prop);
}
}
}
//Adjust packages if necessary.
if (cfg.packages) {
configurePackageDir(pkgs, cfg.packages);
}
//Done with modifications, assing packages back to context config
config.pkgs = pkgs;
}
//If priority loading is in effect, trigger the loads now
if (cfg.priority) {
//Hold on to requireWait value, and reset it after done
requireWait = context.requireWait;
//Allow tracing some require calls to allow the fetching
//of the priority config.
context.requireWait = false;
//But first, call resume to register any defined modules that may
//be in a data-main built file before the priority config
//call.
resume();
context.require(cfg.priority);
//Trigger a resume right away, for the case when
//the script with the priority load is done as part
//of a data-main call. In that case the normal resume
//call will not happen because the scriptCount will be
//at 1, since the script for data-main is being processed.
resume();
//Restore previous state.
context.requireWait = requireWait;
config.priorityWait = cfg.priority;
}
//If a deps array or a config callback is specified, then call
//require with those args. This is useful when require is defined as a
//config object before require.js is loaded.
if (cfg.deps || cfg.callback) {
context.require(cfg.deps || [], cfg.callback);
}
},
requireDefined: function (moduleName, relModuleMap) {
return makeModuleMap(moduleName, relModuleMap).fullName in defined;
},
requireSpecified: function (moduleName, relModuleMap) {
return makeModuleMap(moduleName, relModuleMap).fullName in specified;
},
require: function (deps, callback, relModuleMap) {
var moduleName, fullName, moduleMap;
if (typeof deps === "string") {
if (isFunction(callback)) {
//Invalid call
return req.onError(makeError("requireargs", "Invalid require call"));
}
//Synchronous access to one module. If require.get is
//available (as in the Node adapter), prefer that.
//In this case deps is the moduleName and callback is
//the relModuleMap
if (req.get) {
return req.get(context, deps, callback);
}
//Just return the module wanted. In this scenario, the
//second arg (if passed) is just the relModuleMap.
moduleName = deps;
relModuleMap = callback;
//Normalize module name, if it contains . or ..
moduleMap = makeModuleMap(moduleName, relModuleMap);
fullName = moduleMap.fullName;
if (!(fullName in defined)) {
return req.onError(makeError("notloaded", "Module name '" +
moduleMap.fullName +
"' has not been loaded yet for context: " +
contextName));
}
return defined[fullName];
}
//Call main but only if there are dependencies or
//a callback to call.
if (deps && deps.length || callback) {
main(null, deps, callback, relModuleMap);
}
//If the require call does not trigger anything new to load,
//then resume the dependency processing.
if (!context.requireWait) {
while (!context.scriptCount && context.paused.length) {
resume();
}
}
return context.require;
},
/**
* Internal method to transfer globalQueue items to this context's
* defQueue.
*/
takeGlobalQueue: function () {
//Push all the globalDefQueue items into the context's defQueue
if (globalDefQueue.length) {
//Array splice in the values since the context code has a
//local var ref to defQueue, so cannot just reassign the one
//on context.
apsp.apply(context.defQueue,
[context.defQueue.length - 1, 0].concat(globalDefQueue));
globalDefQueue = [];
}
},
/**
* Internal method used by environment adapters to complete a load event.
* A load event could be a script load or just a load pass from a synchronous
* load call.
* @param {String} moduleName the name of the module to potentially complete.
*/
completeLoad: function (moduleName) {
var args;
context.takeGlobalQueue();
while (defQueue.length) {
args = defQueue.shift();
if (args[0] === null) {
args[0] = moduleName;
break;
} else if (args[0] === moduleName) {
//Found matching define call for this script!
break;
} else {
//Some other named define call, most likely the result
//of a build layer that included many define calls.
callDefMain(args);
args = null;
}
}
if (args) {
callDefMain(args);
} else {
//A script that does not call define(), so just simulate
//the call for it. Special exception for jQuery dynamic load.
callDefMain([moduleName, [],
moduleName === "jquery" && typeof jQuery !== "undefined" ?
function () {
return jQuery;
} : null]);
}
//Doing this scriptCount decrement branching because sync envs
//need to decrement after resume, otherwise it looks like
//loading is complete after the first dependency is fetched.
//For browsers, it works fine to decrement after, but it means
//the checkLoaded setTimeout 50 ms cost is taken. To avoid
//that cost, decrement beforehand.
if (req.isAsync) {
context.scriptCount -= 1;
}
resume();
if (!req.isAsync) {
context.scriptCount -= 1;
}
},
/**
* Converts a module name + .extension into an URL path.
* *Requires* the use of a module name. It does not support using
* plain URLs like nameToUrl.
*/
toUrl: function (moduleNamePlusExt, relModuleMap) {
var index = moduleNamePlusExt.lastIndexOf("."),
ext = null;
if (index !== -1) {
ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length);
moduleNamePlusExt = moduleNamePlusExt.substring(0, index);
}
return context.nameToUrl(moduleNamePlusExt, ext, relModuleMap);
},
/**
* Converts a module name to a file path. Supports cases where
* moduleName may actually be just an URL.
*/
nameToUrl: function (moduleName, ext, relModuleMap) {
var paths, pkgs, pkg, pkgPath, syms, i, parentModule, url,
config = context.config;
//Normalize module name if have a base relative module name to work from.
moduleName = normalize(moduleName, relModuleMap && relModuleMap.fullName);
//If a colon is in the URL, it indicates a protocol is used and it is just
//an URL to a file, or if it starts with a slash or ends with .js, it is just a plain file.
//The slash is important for protocol-less URLs as well as full paths.
if (req.jsExtRegExp.test(moduleName)) {
//Just a plain path, not module name lookup, so just return it.
//Add extension if it is included. This is a bit wonky, only non-.js things pass
//an extension, this method probably needs to be reworked.
url = moduleName + (ext ? ext : "");
} else {
//A module that needs to be converted to a path.
paths = config.paths;
pkgs = config.pkgs;
syms = moduleName.split("/");
//For each module name segment, see if there is a path
//registered for it. Start with most specific name
//and work up from it.
for (i = syms.length; i > 0; i--) {
parentModule = syms.slice(0, i).join("/");
if (paths[parentModule]) {
syms.splice(0, i, paths[parentModule]);
break;
} else if ((pkg = pkgs[parentModule])) {
//If module name is just the package name, then looking
//for the main module.
if (moduleName === pkg.name) {
pkgPath = pkg.location + '/' + pkg.main;
} else {
pkgPath = pkg.location;
}
gitextract_uy8tz9g5/
├── .codecov.yml
├── .coveragerc
├── .flake8
├── .github/
│ ├── dependabot.yml
│ └── workflows/
│ ├── auto-merge.yml
│ ├── ci.yml
│ └── codeql.yml
├── .gitignore
├── .mypy.ini
├── .pre-commit-config.yaml
├── CHANGES.rst
├── LICENSE
├── MANIFEST.in
├── Makefile
├── README.rst
├── aiohttp_debugtoolbar/
│ ├── __init__.py
│ ├── main.py
│ ├── middlewares.py
│ ├── panels/
│ │ ├── __init__.py
│ │ ├── base.py
│ │ ├── headers.py
│ │ ├── logger.py
│ │ ├── middlewares.py
│ │ ├── performance.py
│ │ ├── request_vars.py
│ │ ├── routes.py
│ │ ├── settings.py
│ │ ├── templates/
│ │ │ ├── headers.jinja2
│ │ │ ├── logger.jinja2
│ │ │ ├── middlewares.jinja2
│ │ │ ├── performance.jinja2
│ │ │ ├── request_vars.jinja2
│ │ │ ├── routes.jinja2
│ │ │ ├── settings.jinja2
│ │ │ ├── sqlalchemy_explain.jinja2
│ │ │ ├── sqlalchemy_select.jinja2
│ │ │ ├── traceback.jinja2
│ │ │ └── versions.jinja2
│ │ ├── traceback.py
│ │ └── versions.py
│ ├── py.typed
│ ├── static/
│ │ ├── css/
│ │ │ ├── dashboard.css
│ │ │ ├── debugger.css
│ │ │ ├── prism.css
│ │ │ ├── toolbar.css
│ │ │ └── toolbar_button.css
│ │ ├── font/
│ │ │ └── FONT_LICENSE
│ │ └── js/
│ │ ├── README.rst
│ │ ├── debugger.js
│ │ ├── jquery.cookie.js
│ │ ├── prism.js
│ │ ├── r.js
│ │ ├── require.js
│ │ ├── tests.html
│ │ └── toolbar.js
│ ├── tbtools/
│ │ ├── __init__.py
│ │ ├── console.py
│ │ ├── repr.py
│ │ └── tbtools.py
│ ├── templates/
│ │ ├── console.jinja2
│ │ ├── exception.jinja2
│ │ ├── exception_summary.jinja2
│ │ ├── global_tab.jinja2
│ │ ├── history_tab.jinja2
│ │ ├── redirect.jinja2
│ │ ├── settings_tab.jinja2
│ │ └── toolbar.jinja2
│ ├── toolbar.py
│ ├── utils.py
│ └── views.py
├── demo/
│ ├── README.rst
│ ├── demo.py
│ ├── static/
│ │ ├── main.js
│ │ └── require-1.0.6.js
│ └── templates/
│ ├── ajax.jinja2
│ ├── error.jinja2
│ └── index.jinja2
├── examples/
│ ├── extra_panels/
│ │ ├── extra_pgsql.py
│ │ ├── extra_redis.py
│ │ ├── extra_tpl/
│ │ │ ├── request_pgsql.jinja2
│ │ │ └── request_redis.jinja2
│ │ └── server.py
│ └── simple.py
├── pytest.ini
├── requirements-dev.txt
├── requirements.txt
├── setup.py
└── tests/
├── conftest.py
├── pep492/
│ └── test_await.py
├── test_debug.py
├── test_exception_views.py
├── test_imports.py
├── test_middleware.py
├── test_panel.py
├── test_panels_versions.py
├── test_server_push.py
├── test_utils.py
└── tpl/
└── test.jinja2
SYMBOL INDEX (290 symbols across 42 files)
FILE: aiohttp_debugtoolbar/main.py
class _AppDetails (line 40) | class _AppDetails(TypedDict):
function setup (line 47) | def setup(
FILE: aiohttp_debugtoolbar/middlewares.py
function middleware (line 24) | async def middleware(request: web.Request, handler: Handler) -> web.Stre...
FILE: aiohttp_debugtoolbar/panels/base.py
class DebugPanel (line 6) | class DebugPanel(ABC):
method request (line 71) | def request(self):
method __init__ (line 75) | def __init__(self, request):
method render_content (line 84) | def render_content(self, request):
method dom_id (line 100) | def dom_id(self):
method process_response (line 105) | async def process_response(self, response): # noqa: B027
method wrap_handler (line 111) | def wrap_handler(self, handler, context_switcher):
method render_vars (line 133) | def render_vars(self, request):
FILE: aiohttp_debugtoolbar/panels/headers.py
class HeaderDebugPanel (line 6) | class HeaderDebugPanel(DebugPanel):
method __init__ (line 17) | def __init__(self, request):
method process_response (line 21) | async def process_response(self, response):
FILE: aiohttp_debugtoolbar/panels/logger.py
class RequestTrackingHandler (line 9) | class RequestTrackingHandler(logging.Handler):
method __init__ (line 10) | def __init__(self, *args, **kwargs):
method records (line 15) | def records(self):
method emit (line 18) | def emit(self, record):
class LoggingPanel (line 22) | class LoggingPanel(DebugPanel):
method __init__ (line 28) | def __init__(self, request):
method _install_handler (line 32) | def _install_handler(self):
method _uninstall_handler (line 35) | def _uninstall_handler(self):
method wrap_handler (line 38) | def wrap_handler(self, handler, context_switcher):
method process_response (line 43) | async def process_response(self, response):
method has_content (line 59) | def has_content(self):
method nav_subtitle (line 65) | def nav_subtitle(self):
FILE: aiohttp_debugtoolbar/panels/middlewares.py
class MiddlewaresDebugPanel (line 7) | class MiddlewaresDebugPanel(DebugPanel):
method __init__ (line 18) | def __init__(self, request):
method populate (line 26) | def populate(self, request):
method render_vars (line 36) | def render_vars(self, request):
FILE: aiohttp_debugtoolbar/panels/performance.py
class PerformanceDebugPanel (line 16) | class PerformanceDebugPanel(DebugPanel):
method __init__ (line 34) | def __init__(self, request):
method _wrap_timer_handler (line 38) | def _wrap_timer_handler(self, handler):
method _wrap_profile_handler (line 68) | def _wrap_profile_handler(self, handler):
method wrap_handler (line 127) | def wrap_handler(self, handler, context_switcher):
method nav_subtitle (line 133) | def nav_subtitle(self):
method _elapsed_ru (line 136) | def _elapsed_ru(self, name):
method process_response (line 139) | async def process_response(self, response):
FILE: aiohttp_debugtoolbar/panels/request_vars.py
class RequestVarsDebugPanel (line 8) | class RequestVarsDebugPanel(DebugPanel):
method __init__ (line 20) | def __init__(self, request):
method process_response (line 23) | async def process_response(self, response):
FILE: aiohttp_debugtoolbar/panels/routes.py
class RoutesDebugPanel (line 8) | class RoutesDebugPanel(DebugPanel):
method __init__ (line 19) | def __init__(self, request):
method populate (line 23) | def populate(self, request):
FILE: aiohttp_debugtoolbar/panels/settings.py
class SettingsDebugPanel (line 9) | class SettingsDebugPanel(DebugPanel):
method __init__ (line 20) | def __init__(self, request):
FILE: aiohttp_debugtoolbar/panels/traceback.py
class TracebackPanel (line 10) | class TracebackPanel(DebugPanel):
method __init__ (line 16) | def __init__(self, request):
method has_content (line 21) | def has_content(self):
method process_response (line 26) | async def process_response(self, response):
method render_content (line 54) | def render_content(self, request):
method render_vars (line 57) | def render_vars(self, request):
FILE: aiohttp_debugtoolbar/panels/versions.py
class _Package (line 14) | class _Package(TypedDict):
class VersionDebugPanel (line 22) | class VersionDebugPanel(DebugPanel):
method __init__ (line 35) | def __init__(self, request):
method get_packages (line 44) | def get_packages(cls) -> List[Dict[str, str]]:
method _get_platform_name (line 67) | def _get_platform_name(self):
method get_platform (line 70) | def get_platform(self):
FILE: aiohttp_debugtoolbar/static/js/debugger.js
function openShell (line 155) | function openShell(consoleNode, target, frameID) {
function focusSourceBlock (line 209) | function focusSourceBlock() {
FILE: aiohttp_debugtoolbar/static/js/jquery.cookie.js
function raw (line 20) | function raw(s) {
function decoded (line 24) | function decoded(s) {
function converted (line 28) | function converted(s) {
FILE: aiohttp_debugtoolbar/static/js/prism.js
function e (line 10) | function e(e,t){return Array.prototype.slice.call((t||document).querySel...
function t (line 10) | function t(e,t){return t=" "+t+" ",(" "+e.className+" ").replace(/[\n\t]...
function n (line 10) | function n(e,n,i){for(var o,a=n.replace(/\s+/g,"").split(","),l=+e.getAt...
function i (line 10) | function i(){var t=location.hash.slice(1);e(".temporary.line-highlight")...
FILE: aiohttp_debugtoolbar/static/js/r.js
function showHelp (line 31) | function showHelp() {
function isFunction (line 149) | function isFunction(it) {
function isArray (line 153) | function isArray(it) {
function mixin (line 164) | function mixin(target, source, force) {
function makeError (line 181) | function makeError(id, msg, err) {
function configurePackageDir (line 195) | function configurePackageDir(pkgs, currentPackages, dir) {
function jQueryHoldReady (line 231) | function jQueryHoldReady($, shouldHold) {
function newContext (line 274) | function newContext(contextName) {
function getInteractiveScript (line 1762) | function getInteractiveScript() {
function loadLib (line 2311) | function loadLib() {
function setBaseUrl (line 9671) | function setBaseUrl(fileName) {
FILE: aiohttp_debugtoolbar/static/js/require.js
function J (line 13) | function J(a){return N.call(a)==="[object Function]"}
function F (line 13) | function F(a){return N.call(a)==="[object Array]"}
function Z (line 13) | function Z(a,c,l){for(var j in c)if(!(j in K)&&(!(j in a)||l))a[j]=c[j];...
function O (line 13) | function O(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a...
function $ (line 13) | function $(a,c,d){var j,k,s;for(j=0;s=c[j];j++){s=typeof s==="string"?{n...
function U (line 14) | function U(a,c){a.holdReady?a.holdReady(c):c?a.readyWait+=1:a.ready(!0)}
function fa (line 14) | function fa(a){function c(b,f){var g,m;if(b&&b.charAt(0)===".")if(f){q.p...
function ja (line 30) | function ja(){var a,c,d;if(B&&B.readyState==="interactive")return B;a=do...
FILE: aiohttp_debugtoolbar/static/js/toolbar.js
function toggle_content (line 4) | function toggle_content(elem) {
function toggle_active (line 12) | function toggle_active(elem) {
FILE: aiohttp_debugtoolbar/tbtools/__init__.py
function text_ (line 2) | def text_(s, encoding="latin-1", errors="strict"):
FILE: aiohttp_debugtoolbar/tbtools/console.py
class HTMLStringO (line 19) | class HTMLStringO:
method __init__ (line 22) | def __init__(self):
method isatty (line 25) | def isatty(self):
method close (line 28) | def close(self):
method flush (line 31) | def flush(self):
method seek (line 34) | def seek(self, n, mode=0):
method readline (line 37) | def readline(self):
method reset (line 44) | def reset(self):
method _write (line 49) | def _write(self, x):
method write (line 54) | def write(self, x):
method writelines (line 57) | def writelines(self, x):
class ThreadedStream (line 61) | class ThreadedStream:
method push (line 65) | def push():
method fetch (line 71) | def fetch():
method displayhook (line 79) | def displayhook(obj):
method __setattr__ (line 90) | def __setattr__(self, name, value):
method __dir__ (line 93) | def __dir__(self):
method __getattribute__ (line 96) | def __getattribute__(self, name):
method __repr__ (line 105) | def __repr__(self):
class _ConsoleLoader (line 114) | class _ConsoleLoader:
method __init__ (line 115) | def __init__(self):
method register (line 118) | def register(self, code, source):
method get_source_by_code (line 125) | def get_source_by_code(self, code):
function _wrap_compiler (line 132) | def _wrap_compiler(console):
class _InteractiveConsole (line 143) | class _InteractiveConsole(code.InteractiveInterpreter):
method __init__ (line 144) | def __init__(self, app, globals, locals):
method runsource (line 155) | def runsource(self, source):
method runcode (line 173) | def runcode(self, code):
method showtraceback (line 179) | def showtraceback(self, exc):
method showsyntaxerror (line 185) | def showsyntaxerror(self, filename=None):
method write (line 192) | def write(self, data):
class Console (line 196) | class Console:
method __init__ (line 199) | def __init__(self, app, globals=None, locals=None):
method eval (line 207) | def eval(self, code):
class _ConsoleFrame (line 216) | class _ConsoleFrame:
method __init__ (line 221) | def __init__(self, namespace, app):
FILE: aiohttp_debugtoolbar/tbtools/repr.py
function debug_repr (line 43) | def debug_repr(obj):
function dump (line 48) | def dump(obj=missing):
class _Helper (line 60) | class _Helper:
method __repr__ (line 65) | def __repr__(self):
method __call__ (line 68) | def __call__(self, topic=None):
function _add_subclass_info (line 89) | def _add_subclass_info(inner, obj, bases):
class DebugReprGenerator (line 103) | class DebugReprGenerator:
method __init__ (line 104) | def __init__(self):
method _proxy (line 107) | def _proxy(self, left, right, base, obj, recursive):
method regex_repr (line 126) | def regex_repr(self, obj):
method py3_text_repr (line 131) | def py3_text_repr(self, obj, limit=70):
method py3_binary_repr (line 143) | def py3_binary_repr(self, obj, limit=70):
method dict_repr (line 156) | def dict_repr(self, d, recursive):
method object_repr (line 171) | def object_repr(self, obj):
method dispatch_repr (line 177) | def dispatch_repr(self, obj, recursive):
method fallback_repr (line 202) | def fallback_repr(self):
method repr (line 211) | def repr(self, obj):
method dump_object (line 225) | def dump_object(self, obj):
method dump_locals (line 245) | def dump_locals(self, d):
method render_object_dump (line 249) | def render_object_dump(self, items, title, repr=None):
FILE: aiohttp_debugtoolbar/tbtools/tbtools.py
function get_current_traceback (line 54) | def get_current_traceback(
function get_traceback (line 73) | def get_traceback(
class Traceback (line 89) | class Traceback:
method __init__ (line 92) | def __init__(self, exc_type, exc_value, tb, app):
method filter_hidden_frames (line 112) | def filter_hidden_frames(self):
method is_syntax_error (line 148) | def is_syntax_error(self):
method exception (line 153) | def exception(self):
method log (line 158) | def log(self, logfile=None):
method render_summary (line 172) | def render_summary(self, app, include_title=True):
method render_full (line 208) | def render_full(self, request, lodgeit_url=None):
method generate_plaintext_traceback (line 238) | def generate_plaintext_traceback(self):
method plaintext (line 250) | def plaintext(self):
class Frame (line 256) | class Frame:
method __init__ (line 259) | def __init__(self, exc_type, exc_value, tb, app):
method render (line 288) | def render(self):
method get_in_frame_range (line 298) | def get_in_frame_range(self):
method eval (line 316) | def eval(self, code, mode="single"):
method sourcelines (line 327) | def sourcelines(self):
method current_line (line 376) | def current_line(self):
method console (line 383) | def console(self):
FILE: aiohttp_debugtoolbar/toolbar.py
class DebugToolbar (line 10) | class DebugToolbar:
method __init__ (line 11) | def __init__(self, request, panel_classes, global_panel_classes):
method json (line 35) | def json(self):
method process_response (line 43) | async def process_response(self, request, response):
method inject (line 52) | def inject(self, request, response):
FILE: aiohttp_debugtoolbar/utils.py
function hexlify (line 24) | def hexlify(value):
class ToolbarStorage (line 32) | class ToolbarStorage(deque):
method __init__ (line 35) | def __init__(self, max_elem):
method get (line 38) | def get(self, request_id, default=None):
method put (line 42) | def put(self, request_id, request):
method last (line 45) | def last(self, num_items):
class ExceptionHistory (line 50) | class ExceptionHistory:
method __init__ (line 51) | def __init__(self):
class _Config (line 57) | class _Config(TypedDict):
class AppState (line 72) | class AppState(TypedDict):
function addr_in (line 83) | def addr_in(addr, hosts):
function replace_insensitive (line 90) | def replace_insensitive(string, target, replacement):
function render (line 104) | def render(template_name, app, context, *, app_key=TEMPLATE_KEY, **kw):
function common_segment_count (line 113) | def common_segment_count(path, value):
function format_fname (line 125) | def format_fname(value, _sys_path=None):
function escape (line 148) | def escape(s, quote=False):
class ContextSwitcher (line 174) | class ContextSwitcher:
method __init__ (line 181) | def __init__(self):
method add_context_in (line 185) | def add_context_in(self, callback):
method add_context_out (line 190) | def add_context_out(self, callback):
method __call__ (line 195) | def __call__(self, expr):
class _Coro (line 250) | class _Coro:
method __init__ (line 253) | def __init__(self, it):
method __await__ (line 256) | def __await__(self):
FILE: aiohttp_debugtoolbar/views.py
function request_view (line 11) | async def request_view(request):
class ExceptionDebugView (line 49) | class ExceptionDebugView:
method _validate_token (line 50) | def _validate_token(self, request):
method _exception_history (line 61) | def _exception_history(self, request):
method _get_frame (line 64) | def _get_frame(self, request):
method _get_tb (line 70) | async def _get_tb(self, request):
method _get_cmd (line 80) | async def _get_cmd(self, request):
method exception (line 88) | async def exception(self, request):
method source (line 97) | async def source(self, request):
method execute (line 116) | async def execute(self, request):
function sse (line 158) | async def sse(request):
FILE: demo/demo.py
function index (line 15) | async def index(request):
function exception (line 23) | async def exception(request):
function ajax (line 29) | async def ajax(request):
function redirect (line 35) | async def redirect(request):
function jinja2_exception (line 41) | async def jinja2_exception(request):
function init (line 45) | async def init():
FILE: demo/static/require-1.0.6.js
function J (line 7) | function J(a){return N.call(a)==="[object Function]"}
function F (line 7) | function F(a){return N.call(a)==="[object Array]"}
function Z (line 7) | function Z(a,c,l){for(var j in c)if(!(j in K)&&(!(j in a)||l))a[j]=c[j];...
function O (line 7) | function O(a,c,d){a=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+a...
function $ (line 7) | function $(a,c,d){var j,k,s;for(j=0;s=c[j];j++){s=typeof s==="string"?{n...
function U (line 8) | function U(a,c){a.holdReady?a.holdReady(c):c?a.readyWait+=1:a.ready(!0)}
function fa (line 8) | function fa(a){function c(b,f){var g,m;if(b&&b.charAt(0)===".")if(f){q.p...
function ja (line 24) | function ja(){var a,c,d;if(B&&B.readyState==="interactive")return B;a=do...
FILE: examples/extra_panels/extra_pgsql.py
class RequestHandler (line 12) | class RequestHandler:
method __init__ (line 13) | def __init__(self):
method queries (line 20) | def queries(self):
method total_time (line 24) | def total_time(self):
method _wrapper (line 27) | def _wrapper(self, func):
method on (line 61) | def on(self):
method off (line 64) | def off(self):
class RequestPgDebugPanel (line 68) | class RequestPgDebugPanel(DebugPanel):
method __init__ (line 78) | def __init__(self, request):
method has_content (line 83) | def has_content(self):
method process_response (line 88) | async def process_response(self, response):
method _install_handler (line 100) | def _install_handler(self):
method _uninstall_handler (line 103) | def _uninstall_handler(self):
method wrap_handler (line 106) | def wrap_handler(self, handler, context_switcher):
FILE: examples/extra_panels/extra_redis.py
class RequestHandler (line 12) | class RequestHandler:
method __init__ (line 13) | def __init__(self):
method queries (line 20) | def queries(self):
method total_time (line 24) | def total_time(self):
method _wrapper (line 27) | def _wrapper(self, func):
method on (line 62) | def on(self):
method off (line 65) | def off(self):
class RequestRedisDebugPanel (line 69) | class RequestRedisDebugPanel(DebugPanel):
method __init__ (line 79) | def __init__(self, request):
method has_content (line 84) | def has_content(self):
method process_response (line 89) | async def process_response(self, response):
method _install_handler (line 101) | def _install_handler(self):
method _uninstall_handler (line 104) | def _uninstall_handler(self):
method wrap_handler (line 107) | def wrap_handler(self, handler, context_switcher):
FILE: examples/extra_panels/server.py
function basic_handler (line 29) | async def basic_handler(request):
function exception_handler (line 56) | async def exception_handler(request):
function close_pg (line 60) | async def close_pg(app):
function close_redis (line 65) | async def close_redis(app):
function init (line 70) | async def init():
FILE: examples/simple.py
function basic_handler (line 9) | def basic_handler(request):
function exception_handler (line 17) | async def exception_handler(request):
function init (line 21) | async def init():
FILE: setup.py
function read (line 15) | def read(fname):
FILE: tests/conftest.py
function create_server (line 12) | def create_server(unused_tcp_port_factory):
FILE: tests/pep492/test_await.py
function test_handler_is_native_coroutine (line 4) | async def test_handler_is_native_coroutine(create_server, aiohttp_client):
FILE: tests/test_debug.py
function test_debug_repr (line 22) | def test_debug_repr():
function test_object_dumping (line 99) | def test_object_dumping():
function test_debug_dump (line 128) | def test_debug_dump():
function test_debug_help (line 147) | def test_debug_help():
function test_alternate_debug_path (line 161) | async def test_alternate_debug_path(create_server, aiohttp_client):
FILE: tests/test_exception_views.py
function test_view_source (line 4) | async def test_view_source(create_server, aiohttp_client):
function test_view_execute (line 29) | async def test_view_execute(create_server, aiohttp_client):
function test_view_exception (line 68) | async def test_view_exception(create_server, aiohttp_client):
FILE: tests/test_imports.py
function test_import_time (line 13) | def test_import_time(pytester: pytest.Pytester) -> None:
FILE: tests/test_middleware.py
function test_render_toolbar_page (line 11) | async def test_render_toolbar_page(create_server, aiohttp_client):
function test_render_with_exception (line 37) | async def test_render_with_exception(create_server, aiohttp_client):
function test_intercept_redirect (line 51) | async def test_intercept_redirect(create_server, aiohttp_client):
function test_no_location_no_intercept (line 65) | async def test_no_location_no_intercept(create_server, aiohttp_client):
function test_intercept_redirects_disabled (line 80) | async def test_intercept_redirects_disabled(create_server, aiohttp_client):
function test_toolbar_not_enabled (line 94) | async def test_toolbar_not_enabled(create_server, aiohttp_client):
function test_toolbar_content_type_json (line 116) | async def test_toolbar_content_type_json(create_server, aiohttp_client):
function test_do_not_intercept_exceptions (line 133) | async def test_do_not_intercept_exceptions(create_server, aiohttp_client):
function test_setup_not_called_exception (line 147) | async def test_setup_not_called_exception():
function test_setup_only_adds_middleware_if_not_already_added (line 153) | async def test_setup_only_adds_middleware_if_not_already_added():
function test_process_stream_response (line 159) | async def test_process_stream_response(create_server, aiohttp_client):
function test_performance_panel_with_handler (line 178) | async def test_performance_panel_with_handler(create_server, aiohttp_cli...
function test_performance_panel_with_cbv (line 190) | async def test_performance_panel_with_cbv(create_server, aiohttp_client):
function test_request_history (line 203) | async def test_request_history(create_server, aiohttp_client):
FILE: tests/test_panel.py
function test_request_vars_panel (line 9) | async def test_request_vars_panel(create_server, aiohttp_client):
function test_extra_panel (line 33) | async def test_extra_panel(create_server, aiohttp_client):
FILE: tests/test_panels_versions.py
function test_packages (line 8) | async def test_packages():
FILE: tests/test_server_push.py
function test_sse (line 6) | async def test_sse(create_server, aiohttp_client):
FILE: tests/test_utils.py
function test_escape (line 7) | def test_escape():
function test_format_fname (line 15) | def test_format_fname():
function test_module_file_path (line 28) | def test_module_file_path():
function test_no_matching_sys_path (line 46) | def test_no_matching_sys_path():
function test_addr_in (line 56) | def test_addr_in():
Condensed preview — 98 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (690K chars).
[
{
"path": ".codecov.yml",
"chars": 59,
"preview": "codecov:\n branch: master\n notify:\n after_n_builds: 10\n"
},
{
"path": ".coveragerc",
"chars": 84,
"preview": "[run]\nbranch = True\nsource = aiohttp_debugtoolbar, tests\nomit = site-packages, .tox\n"
},
{
"path": ".flake8",
"chars": 733,
"preview": "[flake8]\nenable-extensions = G\nmax-doc-length = 90\nmax-line-length = 90\nselect = A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T"
},
{
"path": ".github/dependabot.yml",
"chars": 202,
"preview": "version: 2\nupdates:\n - package-ecosystem: pip\n directory: \"/\"\n schedule:\n interval: daily\n\n - package-ecosy"
},
{
"path": ".github/workflows/auto-merge.yml",
"chars": 608,
"preview": "name: Dependabot auto-merge\non: pull_request_target\n\npermissions:\n pull-requests: write\n contents: write\n\njobs:\n depe"
},
{
"path": ".github/workflows/ci.yml",
"chars": 3236,
"preview": "name: CI\n\non:\n push:\n branches:\n - master\n - '[0-9].[0-9]+' # matches to backport branches, e.g. 3.6\n "
},
{
"path": ".github/workflows/codeql.yml",
"chars": 837,
"preview": "name: \"CodeQL\"\n\non:\n push:\n branches: [ \"master\" ]\n pull_request:\n branches: [ \"master\" ]\n schedule:\n - cron"
},
{
"path": ".gitignore",
"chars": 819,
"preview": "># Byte-compiled / optimized / DLL files\n__pycache__/\n*.py[cod]\n\n# C extensions\n*.so\n\n# Distribution / packaging\n.Python"
},
{
"path": ".mypy.ini",
"chars": 651,
"preview": "[mypy]\nfiles = aiohttp_debugtoolbar, demo, examples, tests\n#check_untyped_defs = True\nfollow_imports_for_stubs = True\n#d"
},
{
"path": ".pre-commit-config.yaml",
"chars": 1752,
"preview": "repos:\n- repo: https://github.com/pre-commit/pre-commit-hooks\n rev: 'v4.4.0'\n hooks:\n - id: check-merge-conflict\n- re"
},
{
"path": "CHANGES.rst",
"chars": 2802,
"preview": "=======\nCHANGES\n=======\n\n.. towncrier release notes start\n\n0.6.1 (2023-11-19)\n==================\n\n- Filtered out request"
},
{
"path": "LICENSE",
"chars": 11315,
"preview": "Apache License\n Version 2.0, January 2004\n http://www.apache.org/licens"
},
{
"path": "MANIFEST.in",
"chars": 109,
"preview": "include LICENSE\ninclude CHANGES.rst\ninclude README.rst\ngraft aiohttp_debugtoolbar\nglobal-exclude *.pyc *.swp\n"
},
{
"path": "Makefile",
"chars": 851,
"preview": "# Some simple testing tasks (sorry, UNIX only).\n\nflake:\n\tflake8 --exclude=pep492 aiohttp_debugtoolbar tests\n\ntest: flake"
},
{
"path": "README.rst",
"chars": 5143,
"preview": "aiohttp-debugtoolbar\n====================\n.. image:: https://travis-ci.org/aio-libs/aiohttp-debugtoolbar.svg?branch=mast"
},
{
"path": "aiohttp_debugtoolbar/__init__.py",
"chars": 156,
"preview": "from .main import setup\nfrom .middlewares import middleware\nfrom .utils import APP_KEY\n\n__version__ = \"0.6.1\"\n\n__all__ ="
},
{
"path": "aiohttp_debugtoolbar/main.py",
"chars": 4438,
"preview": "import secrets\nfrom pathlib import Path\nfrom typing import Iterable, Literal, Sequence, Type, TypedDict, Union\n\nimport a"
},
{
"path": "aiohttp_debugtoolbar/middlewares.py",
"chars": 6694,
"preview": "import sys\n\nimport aiohttp_jinja2\nfrom aiohttp import web\nfrom aiohttp.typedefs import Handler\nfrom aiohttp.web_exceptio"
},
{
"path": "aiohttp_debugtoolbar/panels/__init__.py",
"chars": 804,
"preview": "from .headers import HeaderDebugPanel as HeaderDebugPanel\nfrom .logger import LoggingPanel as LoggingPanel\nfrom .middlew"
},
{
"path": "aiohttp_debugtoolbar/panels/base.py",
"chars": 5149,
"preview": "from abc import ABC\n\nfrom ..utils import render\n\n\nclass DebugPanel(ABC):\n \"\"\"Base class for debug panels.\n\n A new "
},
{
"path": "aiohttp_debugtoolbar/panels/headers.py",
"chars": 717,
"preview": "from .base import DebugPanel\n\n__all__ = [\"HeaderDebugPanel\"]\n\n\nclass HeaderDebugPanel(DebugPanel):\n \"\"\"\n A panel t"
},
{
"path": "aiohttp_debugtoolbar/panels/logger.py",
"chars": 1884,
"preview": "import datetime\nimport logging\nfrom collections import deque\n\nfrom .base import DebugPanel\nfrom ..utils import format_fn"
},
{
"path": "aiohttp_debugtoolbar/panels/middlewares.py",
"chars": 1123,
"preview": "from .base import DebugPanel\nfrom ..utils import STATIC_ROUTE_NAME\n\n__all__ = [\"MiddlewaresDebugPanel\"]\n\n\nclass Middlewa"
},
{
"path": "aiohttp_debugtoolbar/panels/performance.py",
"chars": 6412,
"preview": "import cProfile as profile\nimport pstats\nimport time\n\ntry:\n import resource\nexcept ImportError: # Fails on Windows\n "
},
{
"path": "aiohttp_debugtoolbar/panels/request_vars.py",
"chars": 1326,
"preview": "from pprint import saferepr\n\nfrom .base import DebugPanel\n\n__all__ = [\"RequestVarsDebugPanel\"]\n\n\nclass RequestVarsDebugP"
},
{
"path": "aiohttp_debugtoolbar/panels/routes.py",
"chars": 924,
"preview": "import inspect\n\nfrom .base import DebugPanel\n\n__all__ = [\"RoutesDebugPanel\"]\n\n\nclass RoutesDebugPanel(DebugPanel):\n \""
},
{
"path": "aiohttp_debugtoolbar/panels/settings.py",
"chars": 951,
"preview": "from operator import itemgetter\n\nfrom .base import DebugPanel\nfrom ..utils import APP_KEY\n\n__all__ = [\"SettingsDebugPane"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/headers.jinja2",
"chars": 1057,
"preview": "<h4>Request Headers</h4>\n<table class=\"table table-striped\">\n <colgroup>\n <col style=\"width:20%\"/>\n <co"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/logger.jinja2",
"chars": 753,
"preview": "{% if records %}:\n <table class=\"table table-striped table-condensed\">\n <thead>\n <tr>\n "
},
{
"path": "aiohttp_debugtoolbar/panels/templates/middlewares.jinja2",
"chars": 444,
"preview": "<table class=\"table table-striped\">\n <thead>\n <tr>\n <th>Order (from server to application)</th>\n "
},
{
"path": "aiohttp_debugtoolbar/panels/templates/performance.jinja2",
"chars": 1774,
"preview": "{% if timing_rows %}\n<table class=\"table table-striped\">\n <colgroup>\n <col style=\"width:20%\"/>\n <col/>\n"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/request_vars.jinja2",
"chars": 2854,
"preview": "<h4>Cookie Variables</h4>\n{% if cookies %}\n<table class=\"table table-striped\">\n <colgroup>\n <col style=\"width:"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/routes.jinja2",
"chars": 1564,
"preview": "<table class=\"table table-striped\">\n <thead>\n <tr>\n <th>Route Name</th>\n <th>Method</th>"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/settings.jinja2",
"chars": 404,
"preview": "<table class=\"table table-striped\">\n <thead>\n <tr>\n <th>Key</th>\n <th>Value</th>\n "
},
{
"path": "aiohttp_debugtoolbar/panels/templates/sqlalchemy_explain.jinja2",
"chars": 1271,
"preview": "<div class=\"modal-header\">\n<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n<h3 id"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/sqlalchemy_select.jinja2",
"chars": 1345,
"preview": "<div class=\"modal-header\">\n<button type=\"button\" class=\"close\" data-dismiss=\"modal\" aria-hidden=\"true\">×</button>\n <h"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/traceback.jinja2",
"chars": 2760,
"preview": " <div class=\"debugger\">\n\n <h1>{{ exception_type }}</h1>\n <div class=\"detail\">\n <pre class= \"errormsg\">{{ e"
},
{
"path": "aiohttp_debugtoolbar/panels/templates/versions.jinja2",
"chars": 722,
"preview": "<h4>Platform</h4>\n<div>{{ platform }}</div>\n<h4>aiohttp</h4>\n<div>{{ aiohttp_version }}</div>\n\n<h4>Packages</h4>\n\n<table"
},
{
"path": "aiohttp_debugtoolbar/panels/traceback.py",
"chars": 1906,
"preview": "import re\n\nfrom .base import DebugPanel\nfrom ..tbtools.tbtools import Traceback\nfrom ..utils import APP_KEY, ROOT_ROUTE_"
},
{
"path": "aiohttp_debugtoolbar/panels/versions.py",
"chars": 2044,
"preview": "import platform\nimport sys\nfrom importlib.metadata import Distribution, version\nfrom operator import itemgetter\nfrom typ"
},
{
"path": "aiohttp_debugtoolbar/py.typed",
"chars": 0,
"preview": ""
},
{
"path": "aiohttp_debugtoolbar/static/css/dashboard.css",
"chars": 3782,
"preview": "/*\n * Base structure\n */\n\n/* Move down content because we have a fixed navbar that is 50px tall */\nbody {\n padding-top:"
},
{
"path": "aiohttp_debugtoolbar/static/css/debugger.css",
"chars": 5137,
"preview": "/* TODO: cleanup unused styles */\ninput { background-color: #fff; margin: 0; text-align: left;\n out"
},
{
"path": "aiohttp_debugtoolbar/static/css/prism.css",
"chars": 4264,
"preview": "/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+git+python+sql&plugins=line-highl"
},
{
"path": "aiohttp_debugtoolbar/static/css/toolbar.css",
"chars": 1954,
"preview": "._200 {\n background-color: #468847;\n}\n._500 {\n background-color: #b94a48;\n}\n._404{\n background-color: #3a87ad;\n"
},
{
"path": "aiohttp_debugtoolbar/static/css/toolbar_button.css",
"chars": 1471,
"preview": "\n#pDebug #pDebugToolbarHandle {\n\tposition:fixed;\n\tborder:2px solid #e28d29;\n\ttop: 25%;\n\tright:0;\n\tz-index:100000000;\n\n\t-"
},
{
"path": "aiohttp_debugtoolbar/static/font/FONT_LICENSE",
"chars": 4673,
"preview": "-------------------------------\nUBUNTU FONT LICENCE Version 1.0\n-------------------------------\n\nPREAMBLE\nThis licence a"
},
{
"path": "aiohttp_debugtoolbar/static/js/README.rst",
"chars": 272,
"preview": "A note on the included libraries\n================================\n\nThe following libraries have been patched to prevent "
},
{
"path": "aiohttp_debugtoolbar/static/js/debugger.js",
"chars": 7665,
"preview": "pyramid_debugtoolbar_require.config({\n paths: {\n \"jquery\": \"jquery-1.10.2.min\",\n \"toolbar\": \"toolbar\"\n }\n});\n\npy"
},
{
"path": "aiohttp_debugtoolbar/static/js/jquery.cookie.js",
"chars": 2320,
"preview": "/*!\n * jQuery Cookie Plugin v1.3.1\n * https://github.com/carhartl/jquery-cookie\n *\n * Copyright 2013 Klaus Hartl\n * Rele"
},
{
"path": "aiohttp_debugtoolbar/static/js/prism.js",
"chars": 15325,
"preview": "/* http://prismjs.com/download.html?themes=prism&languages=markup+css+clike+javascript+git+python+sql&plugins=line-highl"
},
{
"path": "aiohttp_debugtoolbar/static/js/r.js",
"chars": 397341,
"preview": "/**\n * @license r.js 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n * Available via the MIT or"
},
{
"path": "aiohttp_debugtoolbar/static/js/require.js",
"chars": 14015,
"preview": "/*\n RequireJS 1.0.7 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n Available via the MIT or new BSD "
},
{
"path": "aiohttp_debugtoolbar/static/js/tests.html",
"chars": 693,
"preview": "<!DOCTYPE html>\n<html>\n<head>\n\t<meta charset=\"utf-8\">\n\t<title>QUnit Tests for the Pyramid Debug Toolbar</title>\n\t<link r"
},
{
"path": "aiohttp_debugtoolbar/static/js/toolbar.js",
"chars": 1752,
"preview": "var COOKIE_NAME_ACTIVE = 'pdtb_active';\n\n\nfunction toggle_content(elem) {\n if (elem.is(':visible')) {\n elem.hide();\n"
},
{
"path": "aiohttp_debugtoolbar/tbtools/__init__.py",
"chars": 178,
"preview": "# TODO: remove somehow\ndef text_(s, encoding=\"latin-1\", errors=\"strict\"):\n if isinstance(s, bytes):\n return s."
},
{
"path": "aiohttp_debugtoolbar/tbtools/console.py",
"chars": 5809,
"preview": "\"\"\"werkzeug.debug.console\n\nInteractive console support.\n\n:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more"
},
{
"path": "aiohttp_debugtoolbar/tbtools/repr.py",
"chars": 8567,
"preview": "\"\"\"werkzeug.debug.repr\n\nThis module implements object representations for debugging purposes.\nUnlike the default repr th"
},
{
"path": "aiohttp_debugtoolbar/tbtools/tbtools.py",
"chars": 12984,
"preview": "\"\"\"werkzeug.debug.tbtools\n\nThis module provides various traceback related utility functions.\n\n:copyright: (c) 2011 by th"
},
{
"path": "aiohttp_debugtoolbar/templates/console.jinja2",
"chars": 1192,
"preview": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n \"http://www.w3.org/TR/html4/loose.dtd\">\n<html>\n <head>"
},
{
"path": "aiohttp_debugtoolbar/templates/exception.jinja2",
"chars": 3734,
"preview": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\"\n \"http://www.w3.org/TR/html4/loose.dtd\">\n\n<html>\n <head"
},
{
"path": "aiohttp_debugtoolbar/templates/exception_summary.jinja2",
"chars": 103,
"preview": "<div class=\"{{ classes }}\">\n {{ title }}\n <ul>{{ frames|safe }}</ul>\n {{ description|safe }}\n</div>\n"
},
{
"path": "aiohttp_debugtoolbar/templates/global_tab.jinja2",
"chars": 1615,
"preview": "<div class=\"container\">\n <div class=\"pDebugSideBar\">\n <div class=\"pDebugPanels\">\n <ul class=\"nav nav-tabs\">\n "
},
{
"path": "aiohttp_debugtoolbar/templates/history_tab.jinja2",
"chars": 2012,
"preview": "<div class=\"row\">\n <div class=\"col-sm-3 col-md-2 sidebar\">\n <div class=\"pDebugRequests\">\n <ul id=\"r"
},
{
"path": "aiohttp_debugtoolbar/templates/redirect.jinja2",
"chars": 646,
"preview": "<html>\n <head>\n <title>Redirect intercepted</title>\n </head>\n <body>\n <h1>Redirect ({{ redirect_c"
},
{
"path": "aiohttp_debugtoolbar/templates/settings_tab.jinja2",
"chars": 552,
"preview": "<div class=\"row-fluid\">\n<div class=\"span12\">\n<div class=\"container\">\n\n<h3>Settings</h3>\n\n<p>Some aiohttp debug toolbar p"
},
{
"path": "aiohttp_debugtoolbar/templates/toolbar.jinja2",
"chars": 5257,
"preview": "<!doctype html>\n<html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\" />\n <title>Aiohttp Debug Toolbar</title>\n\n <li"
},
{
"path": "aiohttp_debugtoolbar/toolbar.py",
"chars": 3348,
"preview": "from urllib.parse import unquote as url_unquote\n\nfrom aiohttp.web import Response\n\nfrom .utils import APP_KEY, STATIC_RO"
},
{
"path": "aiohttp_debugtoolbar/utils.py",
"chars": 7678,
"preview": "import binascii\nimport ipaddress\nimport os\nimport sys\nfrom collections import deque\nfrom itertools import islice\nfrom ty"
},
{
"path": "aiohttp_debugtoolbar/views.py",
"chars": 6295,
"preview": "import json\n\nimport aiohttp_jinja2\nfrom aiohttp import web\n\n# from .tbtools.console import _ConsoleFrame\nfrom .utils imp"
},
{
"path": "demo/README.rst",
"chars": 550,
"preview": "Play With Demo\n--------------\n\n\n1) clone repository::\n\n $ git clone git@github.com:aio-libs/aiohttp_debugtoolbar.git\n"
},
{
"path": "demo/demo.py",
"chars": 1889,
"preview": "import logging\nfrom pathlib import Path\n\nimport aiohttp_jinja2\nimport jinja2\nfrom aiohttp import web\n\nimport aiohttp_deb"
},
{
"path": "demo/static/main.js",
"chars": 199,
"preview": "\nrequire.config({\n paths: {\n \"jquery\": \"jquery-1.7.2.min\",\n }\n});\n\nrequire([\"jquery\"], function($) {\n $(function()"
},
{
"path": "demo/static/require-1.0.6.js",
"chars": 13540,
"preview": "/*\n RequireJS 1.0.6 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.\n Available via the MIT or new BSD "
},
{
"path": "demo/templates/ajax.jinja2",
"chars": 562,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <title>AJAX Test</title>\n <script src=\"http://code.jquery.com/jquery-1."
},
{
"path": "demo/templates/error.jinja2",
"chars": 128,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <title>{{ title }}</title>\n </head>\n <body>\n {{ 1/0 }}\n </body>\n"
},
{
"path": "demo/templates/index.jinja2",
"chars": 561,
"preview": "<!DOCTYPE html>\n<html>\n <head>\n <title>{{ title }}</title>\n <script data-main=\"/static/main.js\" src=\"/static/requ"
},
{
"path": "examples/extra_panels/extra_pgsql.py",
"chars": 2880,
"preview": "import functools\nimport inspect\nimport time\n\nfrom aiopg.cursor import Cursor\n\nfrom aiohttp_debugtoolbar.panels.base impo"
},
{
"path": "examples/extra_panels/extra_redis.py",
"chars": 2941,
"preview": "import functools\nimport inspect\nimport time\n\nfrom aioredis import Redis\n\nfrom aiohttp_debugtoolbar.panels.base import De"
},
{
"path": "examples/extra_panels/extra_tpl/request_pgsql.jinja2",
"chars": 1338,
"preview": "{% if timing_rows %}\n<table class=\"table table-striped\">\n <colgroup>\n <col style=\"width:20%\"/>\n <col/>\n"
},
{
"path": "examples/extra_panels/extra_tpl/request_redis.jinja2",
"chars": 1476,
"preview": "{% if timing_rows %}\n<table class=\"table table-striped\">\n <colgroup>\n <col style=\"width:20%\"/>\n <col/>\n"
},
{
"path": "examples/extra_panels/server.py",
"chars": 3325,
"preview": "import pathlib\nimport sys\n\nimport aiohttp_jinja2\nimport jinja2\nfrom aiohttp import web\n\nimport aiohttp_debugtoolbar\n\ntry"
},
{
"path": "examples/simple.py",
"chars": 1272,
"preview": "import aiohttp_jinja2\nimport jinja2\nfrom aiohttp import web\n\nimport aiohttp_debugtoolbar\n\n\n@aiohttp_jinja2.template(\"ind"
},
{
"path": "pytest.ini",
"chars": 401,
"preview": "[pytest]\naddopts =\n # show 10 slowest invocations:\n --durations=10\n # a bit of verbosity doesn't hurt:\n -v\n "
},
{
"path": "requirements-dev.txt",
"chars": 34,
"preview": "-r requirements.txt\n\nmypy==1.19.1\n"
},
{
"path": "requirements.txt",
"chars": 249,
"preview": "-e .\n\naiohttp==3.13.3\naiohttp-jinja2==1.6\naioredis==2.0.1\ncoverage==7.10.6\ndocutils==0.22.4\njinja2==3.1.6\nmultidict==6.7"
},
{
"path": "setup.py",
"chars": 1501,
"preview": "import re\nfrom pathlib import Path\n\nfrom setuptools import find_packages, setup\n\nROOT_DIR = Path(__file__).parent\n\nconte"
},
{
"path": "tests/conftest.py",
"chars": 616,
"preview": "import aiohttp_jinja2\nimport jinja2\nimport pytest\nfrom aiohttp import web\n\nfrom aiohttp_debugtoolbar import setup\n\npytes"
},
{
"path": "tests/pep492/test_await.py",
"chars": 518,
"preview": "from aiohttp import web\n\n\nasync def test_handler_is_native_coroutine(create_server, aiohttp_client):\n async def handl"
},
{
"path": "tests/test_debug.py",
"chars": 5483,
"preview": "\"\"\"werkzeug.debug test\n\n:copyright: (c) 2011 by the Werkzeug Team, see AUTHORS for more details.\n:license: BSD license.\n"
},
{
"path": "tests/test_exception_views.py",
"chars": 2915,
"preview": "from aiohttp_debugtoolbar import APP_KEY\n\n\nasync def test_view_source(create_server, aiohttp_client):\n async def hand"
},
{
"path": "tests/test_imports.py",
"chars": 963,
"preview": "import platform\nimport sys\n\nimport pytest\n\n\n@pytest.mark.skipif(\n not sys.platform.startswith(\"linux\")\n or platfor"
},
{
"path": "tests/test_middleware.py",
"chars": 7263,
"preview": "import asyncio\n\nimport aiohttp_jinja2\nimport pytest\nfrom aiohttp import web\nfrom aiohttp.test_utils import make_mocked_r"
},
{
"path": "tests/test_panel.py",
"chars": 2369,
"preview": "import pathlib\n\nimport aiohttp_jinja2\n\nfrom aiohttp_debugtoolbar.panels.base import DebugPanel\nfrom aiohttp_debugtoolbar"
},
{
"path": "tests/test_panels_versions.py",
"chars": 538,
"preview": "from unittest.mock import create_autospec\n\nfrom aiohttp import web\n\nfrom aiohttp_debugtoolbar.panels import VersionDebug"
},
{
"path": "tests/test_server_push.py",
"chars": 1176,
"preview": "import json\n\nfrom aiohttp_debugtoolbar import APP_KEY\n\n\nasync def test_sse(create_server, aiohttp_client):\n async def"
},
{
"path": "tests/test_utils.py",
"chars": 1645,
"preview": "import os\nimport sys\n\nfrom aiohttp_debugtoolbar.utils import addr_in, escape, format_fname\n\n\ndef test_escape():\n asse"
},
{
"path": "tests/tpl/test.jinja2",
"chars": 54,
"preview": "<p class=\"aioExtraPanelTemplate\">{{ panel_test }}</p>\n"
}
]
About this extraction
This page contains the full source code of the aio-libs/aiohttp-debugtoolbar GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 98 files (640.3 KB), approximately 153.2k tokens, and a symbol index with 290 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.