content
stringlengths
1
103k
path
stringlengths
8
216
filename
stringlengths
2
179
language
stringclasses
15 values
size_bytes
int64
2
189k
quality_score
float64
0.5
0.95
complexity
float64
0
1
documentation_ratio
float64
0
1
repository
stringclasses
5 values
stars
int64
0
1k
created_date
stringdate
2023-07-10 19:21:08
2025-07-09 19:11:45
license
stringclasses
4 values
is_test
bool
2 classes
file_hash
stringlengths
32
32
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\parentpoller.cpython-313.pyc
parentpoller.cpython-313.pyc
Other
5,174
0.95
0.029851
0
vue-tools
499
2024-09-07T11:20:22.116048
BSD-3-Clause
false
d1a8701e0e7306cbb1f1eb9110d13788
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\pickleutil.cpython-313.pyc
pickleutil.cpython-313.pyc
Other
19,943
0.95
0.120301
0.016129
react-lib
49
2025-02-03T02:45:37.278006
GPL-3.0
false
5b762592e43be9b47ce384e5e8817050
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\serialize.cpython-313.pyc
serialize.cpython-313.pyc
Other
8,141
0.95
0.039216
0
python-kit
867
2025-03-26T00:24:58.973009
Apache-2.0
false
56252286c0d01e086817afa75a9d82a9
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\trio_runner.cpython-313.pyc
trio_runner.cpython-313.pyc
Other
4,722
0.95
0.029412
0
react-lib
320
2024-01-08T19:40:37.281363
GPL-3.0
false
6700d3344ccd3f8f9a9ab90c4f67be3e
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\zmqshell.cpython-313.pyc
zmqshell.cpython-313.pyc
Other
26,609
0.95
0.079882
0
node-utils
909
2025-06-09T08:05:55.088514
MIT
false
83bc5c7fea375b24811f8a75a62f9864
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\_eventloop_macos.cpython-313.pyc
_eventloop_macos.cpython-313.pyc
Other
5,639
0.8
0.040541
0
vue-tools
784
2025-06-19T05:05:26.055556
Apache-2.0
false
dccbeb9ab28865ba2df3c17c91de0c3b
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\_version.cpython-313.pyc
_version.cpython-313.pyc
Other
988
0.7
0
0
node-utils
852
2024-09-17T15:23:10.978268
BSD-3-Clause
false
b45398661c765c25e01b46391b01bcdf
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
363
0.7
0
0
vue-tools
437
2024-12-30T01:41:07.867404
GPL-3.0
false
f051ec244ec28d6279c10c7963dcaa91
\n\n
.venv\Lib\site-packages\ipykernel\__pycache__\__main__.cpython-313.pyc
__main__.cpython-313.pyc
Other
401
0.7
0.25
0
vue-tools
14
2025-04-29T06:49:03.167694
Apache-2.0
false
583c324b5aee875a92cb505a907f8929
pip\n
.venv\Lib\site-packages\ipykernel-6.29.5.dist-info\INSTALLER
INSTALLER
Other
4
0.5
0
0
react-lib
462
2025-04-17T13:18:23.213070
MIT
false
365c9bfeb7d89244f2ce01c1de44cb85
Metadata-Version: 2.3\nName: ipykernel\nVersion: 6.29.5\nSummary: IPython Kernel for Jupyter\nProject-URL: Homepage, https://ipython.org\nProject-URL: Documentation, https://ipykernel.readthedocs.io\nProject-URL: Funding, https://numfocus.org/donate\nProject-URL: Source, https://github.com/ipython/ipykernel\nProject-URL: Tracker, https://github.com/ipython/ipykernel/issues\nAuthor-email: IPython Development Team <ipython-dev@scipy.org>\nLicense: BSD 3-Clause License\n \n Copyright (c) 2015, IPython Development Team\n \n All rights reserved.\n \n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are met:\n \n 1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n \n 2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n \n 3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n \n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\n AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\nLicense-File: LICENSE\nKeywords: Interactive,Interpreter,Shell,Web\nClassifier: Intended Audience :: Developers\nClassifier: Intended Audience :: Science/Research\nClassifier: Intended Audience :: System Administrators\nClassifier: License :: OSI Approved :: BSD License\nClassifier: Programming Language :: Python\nClassifier: Programming Language :: Python :: 3\nRequires-Python: >=3.8\nRequires-Dist: appnope; platform_system == 'Darwin'\nRequires-Dist: comm>=0.1.1\nRequires-Dist: debugpy>=1.6.5\nRequires-Dist: ipython>=7.23.1\nRequires-Dist: jupyter-client>=6.1.12\nRequires-Dist: jupyter-core!=5.0.*,>=4.12\nRequires-Dist: matplotlib-inline>=0.1\nRequires-Dist: nest-asyncio\nRequires-Dist: packaging\nRequires-Dist: psutil\nRequires-Dist: pyzmq>=24\nRequires-Dist: tornado>=6.1\nRequires-Dist: traitlets>=5.4.0\nProvides-Extra: cov\nRequires-Dist: coverage[toml]; extra == 'cov'\nRequires-Dist: curio; extra == 'cov'\nRequires-Dist: matplotlib; extra == 'cov'\nRequires-Dist: pytest-cov; extra == 'cov'\nRequires-Dist: trio; extra == 'cov'\nProvides-Extra: docs\nRequires-Dist: myst-parser; extra == 'docs'\nRequires-Dist: pydata-sphinx-theme; extra == 'docs'\nRequires-Dist: sphinx; extra == 'docs'\nRequires-Dist: sphinx-autodoc-typehints; extra == 'docs'\nRequires-Dist: sphinxcontrib-github-alt; extra == 'docs'\nRequires-Dist: sphinxcontrib-spelling; extra == 'docs'\nRequires-Dist: trio; extra == 'docs'\nProvides-Extra: pyqt5\nRequires-Dist: pyqt5; extra == 'pyqt5'\nProvides-Extra: pyside6\nRequires-Dist: pyside6; extra == 'pyside6'\nProvides-Extra: test\nRequires-Dist: flaky; extra == 'test'\nRequires-Dist: ipyparallel; extra == 'test'\nRequires-Dist: pre-commit; extra == 'test'\nRequires-Dist: pytest-asyncio>=0.23.5; extra == 'test'\nRequires-Dist: pytest-cov; extra == 'test'\nRequires-Dist: pytest-timeout; extra == 'test'\nRequires-Dist: pytest>=7.0; extra == 'test'\nDescription-Content-Type: text/markdown\n\n# IPython Kernel for Jupyter\n\n[![Build Status](https://github.com/ipython/ipykernel/actions/workflows/ci.yml/badge.svg?query=branch%3Amain++)](https://github.com/ipython/ipykernel/actions/workflows/ci.yml/badge.svg?query=branch%3Amain++)\n[![Documentation Status](https://readthedocs.org/projects/ipykernel/badge/?version=latest)](http://ipykernel.readthedocs.io/en/latest/?badge=latest)\n\nThis package provides the IPython kernel for Jupyter.\n\n## Installation from source\n\n1. `git clone`\n1. `cd ipykernel`\n1. `pip install -e ".[test]"`\n\nAfter that, all normal `ipython` commands will use this newly-installed version of the kernel.\n\n## Running tests\n\nFollow the instructions from `Installation from source`.\n\nand then from the root directory\n\n```bash\npytest\n```\n\n## Running tests with coverage\n\nFollow the instructions from `Installation from source`.\n\nand then from the root directory\n\n```bash\npytest -vv -s --cov ipykernel --cov-branch --cov-report term-missing:skip-covered --durations 10\n```\n\n## About the IPython Development Team\n\nThe IPython Development Team is the set of all contributors to the IPython project.\nThis includes all of the IPython subprojects.\n\nThe core team that coordinates development on GitHub can be found here:\nhttps://github.com/ipython/.\n\n## Our Copyright Policy\n\nIPython uses a shared copyright model. Each contributor maintains copyright\nover their contributions to IPython. But, it is important to note that these\ncontributions are typically only changes to the repositories. Thus, the IPython\nsource code, in its entirety is not the copyright of any single person or\ninstitution. Instead, it is the collective copyright of the entire IPython\nDevelopment Team. If individual contributors want to maintain a record of what\nchanges/contributions they have specific copyright on, they should indicate\ntheir copyright in the commit message of the change, when they commit the\nchange to one of the IPython repositories.\n\nWith this in mind, the following banner should be used in any source code file\nto indicate the copyright and license terms:\n\n```\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n```\n
.venv\Lib\site-packages\ipykernel-6.29.5.dist-info\METADATA
METADATA
Other
6,274
0.95
0.019737
0.064516
awesome-app
558
2024-06-08T13:22:19.502970
GPL-3.0
false
da6233ebdb6faed02b4b41dc35684858
../../share/jupyter/kernels/python3/kernel.json,sha256=69y5qspxusKKSbKfpYw86C4_UFV01AU6NtRuUi9t-kI,193\n../../share/jupyter/kernels/python3/logo-32x32.png,sha256=4ytcKCBy1xeIe2DacxeP3TWmXcPK6sunoCblpCVcyZc,1084\n../../share/jupyter/kernels/python3/logo-64x64.png,sha256=XJBjtDbO3wVnSA_kh-zg0UeeqVRfMQy6k_oYTMurKQ0,2180\n../../share/jupyter/kernels/python3/logo-svg.svg,sha256=uuyGYqFGHCyswya1TScnyy8c4HugLQD1uCbQNRBPZJ8,9605\n__pycache__/ipykernel_launcher.cpython-313.pyc,,\nipykernel-6.29.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4\nipykernel-6.29.5.dist-info/METADATA,sha256=iLNqkwieT-DRjjYdZ6JtkPzvWW4zBrfMrBU9R5pGvvA,6274\nipykernel-6.29.5.dist-info/RECORD,,\nipykernel-6.29.5.dist-info/WHEEL,sha256=1yFddiXMmvYK7QYTqtRNtX66WJ0Mz8PYEiEUoOUUxRY,87\nipykernel-6.29.5.dist-info/licenses/LICENSE,sha256=NuwpyHH3o4LN4wHLpHaYGRzzJ8P5X_XCQAZeld3oC_0,1533\nipykernel/__init__.py,sha256=kk-QWpKS_WnCbslt1hAhz47muGijsDQqj75oxIbimkU,161\nipykernel/__main__.py,sha256=zXFpgUfV-S2apJ5JV9n805QH8RQWkre6g5eaNfDwU-M,142\nipykernel/__pycache__/__init__.cpython-313.pyc,,\nipykernel/__pycache__/__main__.cpython-313.pyc,,\nipykernel/__pycache__/_eventloop_macos.cpython-313.pyc,,\nipykernel/__pycache__/_version.cpython-313.pyc,,\nipykernel/__pycache__/compiler.cpython-313.pyc,,\nipykernel/__pycache__/connect.cpython-313.pyc,,\nipykernel/__pycache__/control.cpython-313.pyc,,\nipykernel/__pycache__/datapub.cpython-313.pyc,,\nipykernel/__pycache__/debugger.cpython-313.pyc,,\nipykernel/__pycache__/displayhook.cpython-313.pyc,,\nipykernel/__pycache__/embed.cpython-313.pyc,,\nipykernel/__pycache__/eventloops.cpython-313.pyc,,\nipykernel/__pycache__/heartbeat.cpython-313.pyc,,\nipykernel/__pycache__/iostream.cpython-313.pyc,,\nipykernel/__pycache__/ipkernel.cpython-313.pyc,,\nipykernel/__pycache__/jsonutil.cpython-313.pyc,,\nipykernel/__pycache__/kernelapp.cpython-313.pyc,,\nipykernel/__pycache__/kernelbase.cpython-313.pyc,,\nipykernel/__pycache__/kernelspec.cpython-313.pyc,,\nipykernel/__pycache__/log.cpython-313.pyc,,\nipykernel/__pycache__/parentpoller.cpython-313.pyc,,\nipykernel/__pycache__/pickleutil.cpython-313.pyc,,\nipykernel/__pycache__/serialize.cpython-313.pyc,,\nipykernel/__pycache__/trio_runner.cpython-313.pyc,,\nipykernel/__pycache__/zmqshell.cpython-313.pyc,,\nipykernel/_eventloop_macos.py,sha256=7oxrFAcW2wPQc3YKtmHc4rRtg3ZMely1OIFjZQ7jJgs,4550\nipykernel/_version.py,sha256=W31e4Qpez73C3__34018-SYE7LklKPDumuG7MmxTw4s,632\nipykernel/comm/__init__.py,sha256=BqmYOrTRM3hAMvp7r7UKH0fwX2WQzR7YZELBwmcpj5Y,91\nipykernel/comm/__pycache__/__init__.cpython-313.pyc,,\nipykernel/comm/__pycache__/comm.cpython-313.pyc,,\nipykernel/comm/__pycache__/manager.cpython-313.pyc,,\nipykernel/comm/comm.py,sha256=uJSCFK0BlEYNn8sPd6jkqu9VGydxLR3FrwZj4NdGJas,3218\nipykernel/comm/manager.py,sha256=WEw-HnATldktdQ5mTzi9MQHlYnXBVc74vQezhpPeelg,2086\nipykernel/compiler.py,sha256=0eCYkReEiIH-lVvmd1rEcB2XDnlUdNs3QNSn-WUxRuU,2874\nipykernel/connect.py,sha256=40pvykVhIZc8pmDrIsr7dcV2JYr-g9A7tqqzAdSldhU,4104\nipykernel/control.py,sha256=TcL-3xMuFUytO2pqH23r0gEvbCjtpIcrg0BzBh8hT1k,814\nipykernel/datapub.py,sha256=IZNzFQlD5PyHw40UV0tYPhRrdobUU8bL_8q0Qpd_kHQ,2292\nipykernel/debugger.py,sha256=-HdTR31ckuC2BDrDPIt0K-HVrpLFJikVyZqBzdUugi0,27106\nipykernel/displayhook.py,sha256=ecjrm5stOUQvrvczmFNkTkkiY7wlltzS6rSl9ay-L9M,3148\nipykernel/embed.py,sha256=_irOk785de1eqzsCH79qnSW0QFOolRFHfQhFUIzz0Dw,2084\nipykernel/eventloops.py,sha256=qGIeIJ0bIfsiLSD24HxwpKOiz_vOP4AkOXjZSodPY1E,19406\nipykernel/gui/__init__.py,sha256=8HapLY_ZoePEfwubASLykl3ihkoIHZQeUgrLhdaP1Uw,578\nipykernel/gui/__pycache__/__init__.cpython-313.pyc,,\nipykernel/gui/__pycache__/gtk3embed.cpython-313.pyc,,\nipykernel/gui/__pycache__/gtkembed.cpython-313.pyc,,\nipykernel/gui/gtk3embed.py,sha256=tYUjcRofSC_ydYq69jTpaOAoNtzAY92HvfcRGXUgA3U,3433\nipykernel/gui/gtkembed.py,sha256=pDSNrh6nhWBRUneZ6A4hkwvEq5hzTvTlKMB2dBGqF5k,3329\nipykernel/heartbeat.py,sha256=yGaz1LmxLAFpSCRtKzRVXFaJEZddPuYPh7GUTFCsHJ8,4500\nipykernel/inprocess/__init__.py,sha256=CJ6UeFe2xf6tkXC-mYggI_qs2X3thf-GJ_2CDZxTOIM,197\nipykernel/inprocess/__pycache__/__init__.cpython-313.pyc,,\nipykernel/inprocess/__pycache__/blocking.cpython-313.pyc,,\nipykernel/inprocess/__pycache__/channels.cpython-313.pyc,,\nipykernel/inprocess/__pycache__/client.cpython-313.pyc,,\nipykernel/inprocess/__pycache__/constants.cpython-313.pyc,,\nipykernel/inprocess/__pycache__/ipkernel.cpython-313.pyc,,\nipykernel/inprocess/__pycache__/manager.cpython-313.pyc,,\nipykernel/inprocess/__pycache__/socket.cpython-313.pyc,,\nipykernel/inprocess/blocking.py,sha256=2F1GNsZyop8kBa-dKDC5UvxgZR6U0MekcM074rLySRo,3689\nipykernel/inprocess/channels.py,sha256=9VPdsfnoetyxTlBKDJr2SJReRAYUoqY4Ia8Rl60ppRU,3018\nipykernel/inprocess/client.py,sha256=4mq5e3cn11zKNQi23NRGbijBGFJWsljjm6FR9xHab60,8355\nipykernel/inprocess/constants.py,sha256=vVmvzyUipkCsCLtYwdq-AY6Fbj7LDzoCXY2E2melvuU,303\nipykernel/inprocess/ipkernel.py,sha256=KPbgitIOyUncQGwlV3xrXdowaTzA8ITj4ZU7i2GZul4,7335\nipykernel/inprocess/manager.py,sha256=-B31z9CZOk8zeJ_MTpVPiq6mP-0g1jK8LubYB_WT-ns,3054\nipykernel/inprocess/socket.py,sha256=GoZAosmgzy2qk9brULnhpfTzvc8k15G70eXUPdQdsZQ,1382\nipykernel/iostream.py,sha256=LBPNXRiCFuROKwhLNp5RFhwICy5eMYBp8I16-NYQ6LA,27073\nipykernel/ipkernel.py,sha256=3_lLFO7uWJPa6J07LSLiFmuwRfQStUNzVf-n_sLX11c,29539\nipykernel/jsonutil.py,sha256=DlA10WJQG0BpgtYz0iQqem6xiVd9gOQVNoXnAuLCZgc,5035\nipykernel/kernelapp.py,sha256=86QmDkWThjHMCYy9ECFwqT6sF3osodjgi9hHwIMNNuI,29071\nipykernel/kernelbase.py,sha256=cWFfhFanwcuRp-r3Ye7EAOAu4WMaj4MMfrgwPlNkCec,50075\nipykernel/kernelspec.py,sha256=EJdidc57UlJR2Ybanw2YGRan_u6p5d9LDRshGlY-8k0,9808\nipykernel/log.py,sha256=3LnoDg_lv66Bi6k5qfD2peF3kbWowr7V1EZxt9qkKF0,843\nipykernel/parentpoller.py,sha256=tjTV6APx3IW8IeLuUkEBacACrjg-YX422COs9GYzoVU,4277\nipykernel/pickleutil.py,sha256=VGIIbivFWs1ePwt-23-UJpkn_F5kZ9U95-l6_B0KAJ4,13294\nipykernel/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0\nipykernel/pylab/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0\nipykernel/pylab/__pycache__/__init__.cpython-313.pyc,,\nipykernel/pylab/__pycache__/backend_inline.cpython-313.pyc,,\nipykernel/pylab/__pycache__/config.cpython-313.pyc,,\nipykernel/pylab/backend_inline.py,sha256=dPGejOmu-KAiKg8eg9Klzrs3yzl4YnZRK4TLFCJktOI,468\nipykernel/pylab/config.py,sha256=1XbNXDYA9fXxejhUD82qyoSZP21jmglT17bWwmgK0hw,385\nipykernel/resources/logo-32x32.png,sha256=4ytcKCBy1xeIe2DacxeP3TWmXcPK6sunoCblpCVcyZc,1084\nipykernel/resources/logo-64x64.png,sha256=XJBjtDbO3wVnSA_kh-zg0UeeqVRfMQy6k_oYTMurKQ0,2180\nipykernel/resources/logo-svg.svg,sha256=uuyGYqFGHCyswya1TScnyy8c4HugLQD1uCbQNRBPZJ8,9605\nipykernel/serialize.py,sha256=rqj3lnQDokcl9h2EOubpW9c2R1re0q3Zeh9s-_CdCtk,6324\nipykernel/trio_runner.py,sha256=xwMrtPFavrF8Scb8yDxiiC1YyN8gS5mGlBbP4yWYEsE,2476\nipykernel/zmqshell.py,sha256=WkAn_LWsrhsOZ_gOutKodbQQkEeVFYHtwGU2MYdkPYA,24471\nipykernel_launcher.py,sha256=-e63UZjDeYNngw3Mf-wx-5EyROM0GhuWOWD233pJhaA,512\n
.venv\Lib\site-packages\ipykernel-6.29.5.dist-info\RECORD
RECORD
Other
7,000
0.7
0
0
awesome-app
431
2024-05-03T19:05:32.300664
GPL-3.0
false
676b1580de1914044225acc1d64a7129
Wheel-Version: 1.0\nGenerator: hatchling 1.25.0\nRoot-Is-Purelib: true\nTag: py3-none-any\n
.venv\Lib\site-packages\ipykernel-6.29.5.dist-info\WHEEL
WHEEL
Other
87
0.5
0
0
awesome-app
435
2023-10-10T22:01:38.063241
BSD-3-Clause
false
52adfa0c417902ee8f0c3d1ca2372ac3
BSD 3-Clause License\n\nCopyright (c) 2015, IPython Development Team\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n3. Neither the name of the copyright holder nor the names of its\n contributors may be used to endorse or promote products derived from\n this software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n
.venv\Lib\site-packages\ipykernel-6.29.5.dist-info\licenses\LICENSE
LICENSE
Other
1,533
0.7
0
0
python-kit
994
2023-12-17T11:32:59.469618
GPL-3.0
false
159b7ae0b4f7071ca9f0295354f6a49e
"""Public API for display tools in IPython."""\n\n# -----------------------------------------------------------------------------\n# Copyright (C) 2012 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n# -----------------------------------------------------------------------------\n\n# -----------------------------------------------------------------------------\n# Imports\n# -----------------------------------------------------------------------------\n\nfrom IPython.core.display_functions import *\nfrom IPython.core.display import (\n display_pretty as display_pretty,\n display_html as display_html,\n display_markdown as display_markdown,\n display_svg as display_svg,\n display_png as display_png,\n display_jpeg as display_jpeg,\n display_latex as display_latex,\n display_json as display_json,\n display_javascript as display_javascript,\n display_pdf as display_pdf,\n DisplayObject as DisplayObject,\n TextDisplayObject as TextDisplayObject,\n Pretty as Pretty,\n HTML as HTML,\n Markdown as Markdown,\n Math as Math,\n Latex as Latex,\n SVG as SVG,\n ProgressBar as ProgressBar,\n JSON as JSON,\n GeoJSON as GeoJSON,\n Javascript as Javascript,\n Image as Image,\n Video as Video,\n)\nfrom IPython.lib.display import *\n
.venv\Lib\site-packages\IPython\display.py
display.py
Python
1,392
0.95
0.02439
0.236842
vue-tools
336
2024-04-02T03:00:59.489375
BSD-3-Clause
false
9dbf9e712529c1bc827afdded04ef6c6
"""Find files and directories which IPython uses.\n"""\nimport os.path\nimport tempfile\nfrom warnings import warn\n\nimport IPython\nfrom IPython.utils.importstring import import_item\nfrom IPython.utils.path import (\n get_home_dir,\n get_xdg_dir,\n get_xdg_cache_dir,\n compress_user,\n _writable_dir,\n ensure_dir_exists,\n)\n\n\ndef get_ipython_dir() -> str:\n """Get the IPython directory for this platform and user.\n\n This uses the logic in `get_home_dir` to find the home directory\n and then adds .ipython to the end of the path.\n """\n\n env = os.environ\n pjoin = os.path.join\n\n\n ipdir_def = '.ipython'\n\n home_dir = get_home_dir()\n xdg_dir = get_xdg_dir()\n\n ipdir = env.get("IPYTHONDIR", None)\n if ipdir is None:\n # not set explicitly, use ~/.ipython\n ipdir = pjoin(home_dir, ipdir_def)\n if xdg_dir:\n # Several IPython versions (up to 1.x) defaulted to .config/ipython\n # on Linux. We have decided to go back to using .ipython everywhere\n xdg_ipdir = pjoin(xdg_dir, 'ipython')\n\n if _writable_dir(xdg_ipdir):\n cu = compress_user\n if os.path.exists(ipdir):\n warn(('Ignoring {0} in favour of {1}. Remove {0} to '\n 'get rid of this message').format(cu(xdg_ipdir), cu(ipdir)))\n elif os.path.islink(xdg_ipdir):\n warn(('{0} is deprecated. Move link to {1} to '\n 'get rid of this message').format(cu(xdg_ipdir), cu(ipdir)))\n else:\n ipdir = xdg_ipdir\n\n ipdir = os.path.normpath(os.path.expanduser(ipdir))\n\n if os.path.exists(ipdir) and not _writable_dir(ipdir):\n # ipdir exists, but is not writable\n warn("IPython dir '{0}' is not a writable location,"\n " using a temp directory.".format(ipdir))\n ipdir = tempfile.mkdtemp()\n elif not os.path.exists(ipdir):\n parent = os.path.dirname(ipdir)\n if not _writable_dir(parent):\n # ipdir does not exist and parent isn't writable\n warn("IPython parent '{0}' is not a writable location,"\n " using a temp directory.".format(parent))\n ipdir = tempfile.mkdtemp()\n else:\n os.makedirs(ipdir, exist_ok=True)\n assert isinstance(ipdir, str), "all path manipulation should be str(unicode), but are not."\n return ipdir\n\n\ndef get_ipython_cache_dir() -> str:\n """Get the cache directory it is created if it does not exist."""\n xdgdir = get_xdg_cache_dir()\n if xdgdir is None:\n return get_ipython_dir()\n ipdir = os.path.join(xdgdir, "ipython")\n if not os.path.exists(ipdir) and _writable_dir(xdgdir):\n ensure_dir_exists(ipdir)\n elif not _writable_dir(xdgdir):\n return get_ipython_dir()\n\n return ipdir\n\n\ndef get_ipython_package_dir() -> str:\n """Get the base directory where IPython itself is installed."""\n ipdir = os.path.dirname(IPython.__file__)\n assert isinstance(ipdir, str)\n return ipdir\n\n\ndef get_ipython_module_path(module_str):\n """Find the path to an IPython module in this version of IPython.\n\n This will always find the version of the module that is in this importable\n IPython package. This will always return the path to the ``.py``\n version of the module.\n """\n if module_str == 'IPython':\n return os.path.join(get_ipython_package_dir(), '__init__.py')\n mod = import_item(module_str)\n the_path = mod.__file__.replace('.pyc', '.py')\n the_path = the_path.replace('.pyo', '.py')\n return the_path\n\n\ndef locate_profile(profile='default'):\n """Find the path to the folder associated with a given profile.\n\n I.e. find $IPYTHONDIR/profile_whatever.\n """\n from IPython.core.profiledir import ProfileDir, ProfileDirError\n try:\n pd = ProfileDir.find_profile_dir_by_name(get_ipython_dir(), profile)\n except ProfileDirError as e:\n # IOError makes more sense when people are expecting a path\n raise IOError("Couldn't find profile %r" % profile) from e\n return pd.location\n
.venv\Lib\site-packages\IPython\paths.py
paths.py
Python
4,126
0.95
0.139344
0.060606
vue-tools
515
2023-10-04T12:14:49.465383
MIT
false
6c2c99dd9a35d8b441b7514a51d8d41f
# PYTHON_ARGCOMPLETE_OK\n"""\nIPython: tools for interactive and parallel computing in Python.\n\nhttps://ipython.org\n"""\n#-----------------------------------------------------------------------------\n# Copyright (c) 2008-2011, IPython Development Team.\n# Copyright (c) 2001-2007, Fernando Perez <fernando.perez@colorado.edu>\n# Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>\n# Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\nimport sys\nimport warnings\n\n#-----------------------------------------------------------------------------\n# Setup everything\n#-----------------------------------------------------------------------------\n\n# Don't forget to also update setup.py when this changes!\nif sys.version_info < (3, 11):\n raise ImportError(\n """\nIPython 8.31+ supports Python 3.11 and above, following SPEC0\nIPython 8.19+ supports Python 3.10 and above, following SPEC0.\nIPython 8.13+ supports Python 3.9 and above, following NEP 29.\nIPython 8.0-8.12 supports Python 3.8 and above, following NEP 29.\nWhen using Python 2.7, please install IPython 5.x LTS Long Term Support version.\nPython 3.3 and 3.4 were supported up to IPython 6.x.\nPython 3.5 was supported with IPython 7.0 to 7.9.\nPython 3.6 was supported with IPython up to 7.16.\nPython 3.7 was still supported with the 7.x branch.\n\nSee IPython `README.rst` file for more information:\n\n https://github.com/ipython/ipython/blob/main/README.rst\n\n"""\n )\n\n#-----------------------------------------------------------------------------\n# Setup the top level names\n#-----------------------------------------------------------------------------\n\nfrom .core.getipython import get_ipython\nfrom .core import release\nfrom .core.application import Application\nfrom .terminal.embed import embed\n\nfrom .core.interactiveshell import InteractiveShell\nfrom .utils.sysinfo import sys_info\nfrom .utils.frame import extract_module_locals\n\n__all__ = ["start_ipython", "embed", "embed_kernel"]\n\n# Release data\n__author__ = '%s <%s>' % (release.author, release.author_email)\n__license__ = release.license\n__version__ = release.version\nversion_info = release.version_info\n# list of CVEs that should have been patched in this release.\n# this is informational and should not be relied upon.\n__patched_cves__ = {"CVE-2022-21699", "CVE-2023-24816"}\n\n\ndef embed_kernel(module=None, local_ns=None, **kwargs):\n """Embed and start an IPython kernel in a given scope.\n\n If you don't want the kernel to initialize the namespace\n from the scope of the surrounding function,\n and/or you want to load full IPython configuration,\n you probably want `IPython.start_kernel()` instead.\n\n This is a deprecated alias for `ipykernel.embed.embed_kernel()`,\n to be removed in the future.\n You should import directly from `ipykernel.embed`; this wrapper\n fails anyway if you don't have `ipykernel` package installed.\n\n Parameters\n ----------\n module : types.ModuleType, optional\n The module to load into IPython globals (default: caller)\n local_ns : dict, optional\n The namespace to load into IPython user namespace (default: caller)\n **kwargs : various, optional\n Further keyword args are relayed to the IPKernelApp constructor,\n such as `config`, a traitlets :class:`Config` object (see :ref:`configure_start_ipython`),\n allowing configuration of the kernel. Will only have an effect\n on the first embed_kernel call for a given process.\n """\n\n warnings.warn(\n "import embed_kernel from ipykernel.embed directly (since 2013)."\n " Importing from IPython will be removed in the future",\n DeprecationWarning,\n stacklevel=2,\n )\n\n (caller_module, caller_locals) = extract_module_locals(1)\n if module is None:\n module = caller_module\n if local_ns is None:\n local_ns = dict(**caller_locals)\n \n # Only import .zmq when we really need it\n from ipykernel.embed import embed_kernel as real_embed_kernel\n real_embed_kernel(module=module, local_ns=local_ns, **kwargs)\n\ndef start_ipython(argv=None, **kwargs):\n """Launch a normal IPython instance (as opposed to embedded)\n\n `IPython.embed()` puts a shell in a particular calling scope,\n such as a function or method for debugging purposes,\n which is often not desirable.\n\n `start_ipython()` does full, regular IPython initialization,\n including loading startup files, configuration, etc.\n much of which is skipped by `embed()`.\n\n This is a public API method, and will survive implementation changes.\n\n Parameters\n ----------\n argv : list or None, optional\n If unspecified or None, IPython will parse command-line options from sys.argv.\n To prevent any command-line parsing, pass an empty list: `argv=[]`.\n user_ns : dict, optional\n specify this dictionary to initialize the IPython user namespace with particular values.\n **kwargs : various, optional\n Any other kwargs will be passed to the Application constructor,\n such as `config`, a traitlets :class:`Config` object (see :ref:`configure_start_ipython`),\n allowing configuration of the instance (see :ref:`terminal_options`).\n """\n from IPython.terminal.ipapp import launch_new_instance\n return launch_new_instance(argv=argv, **kwargs)\n
.venv\Lib\site-packages\IPython\__init__.py
__init__.py
Python
5,704
0.95
0.104167
0.228814
node-utils
664
2024-02-07T18:04:18.917847
Apache-2.0
false
55f4da566fa17aebcee6749ec2d8e1a1
# PYTHON_ARGCOMPLETE_OK\n# encoding: utf-8\n"""Terminal-based IPython entry point."""\n# -----------------------------------------------------------------------------\n# Copyright (c) 2012, IPython Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n# -----------------------------------------------------------------------------\n\nfrom IPython import start_ipython\n\nstart_ipython()\n
.venv\Lib\site-packages\IPython\__main__.py
__main__.py
Python
489
0.95
0
0.75
react-lib
870
2024-10-15T07:25:05.902426
GPL-3.0
false
b922ffbc400bdac3e441e37ea053e12b
"""\nA context manager for managing things injected into :mod:`builtins`.\n"""\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\nimport builtins as builtin_mod\n\nfrom traitlets.config.configurable import Configurable\n\nfrom traitlets import Instance\n\n\nclass __BuiltinUndefined:\n pass\n\n\nBuiltinUndefined = __BuiltinUndefined()\n\n\nclass __HideBuiltin:\n pass\n\n\nHideBuiltin = __HideBuiltin()\n\n\nclass BuiltinTrap(Configurable):\n\n shell = Instance('IPython.core.interactiveshell.InteractiveShellABC',\n allow_none=True)\n\n def __init__(self, shell=None):\n super(BuiltinTrap, self).__init__(shell=shell, config=None)\n self._orig_builtins = {}\n # We define this to track if a single BuiltinTrap is nested.\n # Only turn off the trap when the outermost call to __exit__ is made.\n self._nested_level = 0\n self.shell = shell\n # builtins we always add - if set to HideBuiltin, they will just\n # be removed instead of being replaced by something else\n self.auto_builtins = {'exit': HideBuiltin,\n 'quit': HideBuiltin,\n 'get_ipython': self.shell.get_ipython,\n }\n\n def __enter__(self):\n if self._nested_level == 0:\n self.activate()\n self._nested_level += 1\n # I return self, so callers can use add_builtin in a with clause.\n return self\n\n def __exit__(self, type, value, traceback):\n if self._nested_level == 1:\n self.deactivate()\n self._nested_level -= 1\n # Returning False will cause exceptions to propagate\n return False\n\n def add_builtin(self, key, value):\n """Add a builtin and save the original."""\n bdict = builtin_mod.__dict__\n orig = bdict.get(key, BuiltinUndefined)\n if value is HideBuiltin:\n if orig is not BuiltinUndefined: #same as 'key in bdict'\n self._orig_builtins[key] = orig\n del bdict[key]\n else:\n self._orig_builtins[key] = orig\n bdict[key] = value\n\n def remove_builtin(self, key, orig):\n """Remove an added builtin and re-set the original."""\n if orig is BuiltinUndefined:\n del builtin_mod.__dict__[key]\n else:\n builtin_mod.__dict__[key] = orig\n\n def activate(self):\n """Store ipython references in the __builtin__ namespace."""\n\n add_builtin = self.add_builtin\n for name, func in self.auto_builtins.items():\n add_builtin(name, func)\n\n def deactivate(self):\n """Remove any builtins which might have been added by add_builtins, or\n restore overwritten ones to their previous values."""\n remove_builtin = self.remove_builtin\n for key, val in self._orig_builtins.items():\n remove_builtin(key, val)\n self._orig_builtins.clear()\n self._builtins_added = False\n
.venv\Lib\site-packages\IPython\core\builtin_trap.py
builtin_trap.py
Python
3,006
0.95
0.215054
0.111111
awesome-app
534
2024-02-25T16:56:21.247196
MIT
false
061e98184fef851d038e03fa1d3e3b5f
"""Compiler tools with improved interactive support.\n\nProvides compilation machinery similar to codeop, but with caching support so\nwe can provide interactive tracebacks.\n\nAuthors\n-------\n* Robert Kern\n* Fernando Perez\n* Thomas Kluyver\n"""\n\n# Note: though it might be more natural to name this module 'compiler', that\n# name is in the stdlib and name collisions with the stdlib tend to produce\n# weird problems (often with third-party tools).\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2010-2011 The IPython Development Team.\n#\n# Distributed under the terms of the BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# Stdlib imports\nimport __future__\nfrom ast import PyCF_ONLY_AST\nimport codeop\nimport functools\nimport hashlib\nimport linecache\nimport operator\nimport time\nfrom contextlib import contextmanager\n\n#-----------------------------------------------------------------------------\n# Constants\n#-----------------------------------------------------------------------------\n\n# Roughly equal to PyCF_MASK | PyCF_MASK_OBSOLETE as defined in pythonrun.h,\n# this is used as a bitmask to extract future-related code flags.\nPyCF_MASK = functools.reduce(operator.or_,\n (getattr(__future__, fname).compiler_flag\n for fname in __future__.all_feature_names))\n\n#-----------------------------------------------------------------------------\n# Local utilities\n#-----------------------------------------------------------------------------\n\ndef code_name(code, number=0):\n """ Compute a (probably) unique name for code for caching.\n\n This now expects code to be unicode.\n """\n hash_digest = hashlib.sha1(code.encode("utf-8")).hexdigest()\n # Include the number and 12 characters of the hash in the name. It's\n # pretty much impossible that in a single session we'll have collisions\n # even with truncated hashes, and the full one makes tracebacks too long\n return '<ipython-input-{0}-{1}>'.format(number, hash_digest[:12])\n\n#-----------------------------------------------------------------------------\n# Classes and functions\n#-----------------------------------------------------------------------------\n\nclass CachingCompiler(codeop.Compile):\n """A compiler that caches code compiled from interactive statements.\n """\n\n def __init__(self):\n codeop.Compile.__init__(self)\n\n # Caching a dictionary { filename: execution_count } for nicely\n # rendered tracebacks. The filename corresponds to the filename\n # argument used for the builtins.compile function.\n self._filename_map = {}\n\n def ast_parse(self, source, filename='<unknown>', symbol='exec'):\n """Parse code to an AST with the current compiler flags active.\n\n Arguments are exactly the same as ast.parse (in the standard library),\n and are passed to the built-in compile function."""\n return compile(source, filename, symbol, self.flags | PyCF_ONLY_AST, 1)\n\n def reset_compiler_flags(self):\n """Reset compiler flags to default state."""\n # This value is copied from codeop.Compile.__init__, so if that ever\n # changes, it will need to be updated.\n self.flags = codeop.PyCF_DONT_IMPLY_DEDENT\n\n @property\n def compiler_flags(self):\n """Flags currently active in the compilation process.\n """\n return self.flags\n\n def get_code_name(self, raw_code, transformed_code, number):\n """Compute filename given the code, and the cell number.\n\n Parameters\n ----------\n raw_code : str\n The raw cell code.\n transformed_code : str\n The executable Python source code to cache and compile.\n number : int\n A number which forms part of the code's name. Used for the execution\n counter.\n\n Returns\n -------\n The computed filename.\n """\n return code_name(transformed_code, number)\n\n def format_code_name(self, name):\n """Return a user-friendly label and name for a code block.\n\n Parameters\n ----------\n name : str\n The name for the code block returned from get_code_name\n\n Returns\n -------\n A (label, name) pair that can be used in tracebacks, or None if the default formatting should be used.\n """\n if name in self._filename_map:\n return "Cell", "In[%s]" % self._filename_map[name]\n\n def cache(self, transformed_code, number=0, raw_code=None):\n """Make a name for a block of code, and cache the code.\n\n Parameters\n ----------\n transformed_code : str\n The executable Python source code to cache and compile.\n number : int\n A number which forms part of the code's name. Used for the execution\n counter.\n raw_code : str\n The raw code before transformation, if None, set to `transformed_code`.\n\n Returns\n -------\n The name of the cached code (as a string). Pass this as the filename\n argument to compilation, so that tracebacks are correctly hooked up.\n """\n if raw_code is None:\n raw_code = transformed_code\n\n name = self.get_code_name(raw_code, transformed_code, number)\n\n # Save the execution count\n self._filename_map[name] = number\n\n # Since Python 2.5, setting mtime to `None` means the lines will\n # never be removed by `linecache.checkcache`. This means all the\n # monkeypatching has *never* been necessary, since this code was\n # only added in 2010, at which point IPython had already stopped\n # supporting Python 2.4.\n #\n # Note that `linecache.clearcache` and `linecache.updatecache` may\n # still remove our code from the cache, but those show explicit\n # intent, and we should not try to interfere. Normally the former\n # is never called except when out of memory, and the latter is only\n # called for lines *not* in the cache.\n entry = (\n len(transformed_code),\n None,\n [line + "\n" for line in transformed_code.splitlines()],\n name,\n )\n linecache.cache[name] = entry\n return name\n\n @contextmanager\n def extra_flags(self, flags):\n ## bits that we'll set to 1\n turn_on_bits = ~self.flags & flags\n\n\n self.flags = self.flags | flags\n try:\n yield\n finally:\n # turn off only the bits we turned on so that something like\n # __future__ that set flags stays.\n self.flags &= ~turn_on_bits\n
.venv\Lib\site-packages\IPython\core\compilerop.py
compilerop.py
Python
6,990
0.95
0.161458
0.322785
node-utils
255
2024-04-01T14:34:13.485336
BSD-3-Clause
false
7b631f6142f0e8d56499b4b7c3399ee5
# encoding: utf-8\n"""Implementations for various useful completers.\n\nThese are all loaded by default by IPython.\n"""\n#-----------------------------------------------------------------------------\n# Copyright (C) 2010-2011 The IPython Development Team.\n#\n# Distributed under the terms of the BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# Stdlib imports\nimport glob\nimport inspect\nimport os\nimport re\nimport sys\nfrom importlib import import_module\nfrom importlib.machinery import all_suffixes\n\n\n# Third-party imports\nfrom time import time\nfrom zipimport import zipimporter\n\n# Our own imports\nfrom .completer import expand_user, compress_user\nfrom .error import TryNext\nfrom ..utils._process_common import arg_split\n\n# FIXME: this should be pulled in with the right call via the component system\nfrom IPython import get_ipython\n\nfrom typing import List\n\n#-----------------------------------------------------------------------------\n# Globals and constants\n#-----------------------------------------------------------------------------\n_suffixes = all_suffixes()\n\n# Time in seconds after which the rootmodules will be stored permanently in the\n# ipython ip.db database (kept in the user's .ipython dir).\nTIMEOUT_STORAGE = 2\n\n# Time in seconds after which we give up\nTIMEOUT_GIVEUP = 20\n\n# Regular expression for the python import statement\nimport_re = re.compile(r'(?P<name>[^\W\d]\w*?)'\n r'(?P<package>[/\\]__init__)?'\n r'(?P<suffix>%s)$' %\n r'|'.join(re.escape(s) for s in _suffixes))\n\n# RE for the ipython %run command (python + ipython scripts)\nmagic_run_re = re.compile(r'.*(\.ipy|\.ipynb|\.py[w]?)$')\n\n#-----------------------------------------------------------------------------\n# Local utilities\n#-----------------------------------------------------------------------------\n\n\ndef module_list(path: str) -> List[str]:\n """\n Return the list containing the names of the modules available in the given\n folder.\n """\n # sys.path has the cwd as an empty string, but isdir/listdir need it as '.'\n if path == '':\n path = '.'\n\n # A few local constants to be used in loops below\n pjoin = os.path.join\n\n if os.path.isdir(path):\n # Build a list of all files in the directory and all files\n # in its subdirectories. For performance reasons, do not\n # recurse more than one level into subdirectories.\n files: List[str] = []\n for root, dirs, nondirs in os.walk(path, followlinks=True):\n subdir = root[len(path)+1:]\n if subdir:\n files.extend(pjoin(subdir, f) for f in nondirs)\n dirs[:] = [] # Do not recurse into additional subdirectories.\n else:\n files.extend(nondirs)\n\n else:\n try:\n files = list(zipimporter(path)._files.keys()) # type: ignore\n except Exception:\n files = []\n\n # Build a list of modules which match the import_re regex.\n modules = []\n for f in files:\n m = import_re.match(f)\n if m:\n modules.append(m.group('name'))\n return list(set(modules))\n\n\ndef get_root_modules():\n """\n Returns a list containing the names of all the modules available in the\n folders of the pythonpath.\n\n ip.db['rootmodules_cache'] maps sys.path entries to list of modules.\n """\n ip = get_ipython()\n if ip is None:\n # No global shell instance to store cached list of modules.\n # Don't try to scan for modules every time.\n return list(sys.builtin_module_names)\n\n if getattr(ip.db, "_mock", False):\n rootmodules_cache = {}\n else:\n rootmodules_cache = ip.db.get("rootmodules_cache", {})\n rootmodules = list(sys.builtin_module_names)\n start_time = time()\n store = False\n for path in sys.path:\n try:\n modules = rootmodules_cache[path]\n except KeyError:\n modules = module_list(path)\n try:\n modules.remove('__init__')\n except ValueError:\n pass\n if path not in ('', '.'): # cwd modules should not be cached\n rootmodules_cache[path] = modules\n if time() - start_time > TIMEOUT_STORAGE and not store:\n store = True\n print("\nCaching the list of root modules, please wait!")\n print("(This will only be done once - type '%rehashx' to "\n "reset cache!)\n")\n sys.stdout.flush()\n if time() - start_time > TIMEOUT_GIVEUP:\n print("This is taking too long, we give up.\n")\n return []\n rootmodules.extend(modules)\n if store:\n ip.db['rootmodules_cache'] = rootmodules_cache\n rootmodules = list(set(rootmodules))\n return rootmodules\n\n\ndef is_importable(module, attr: str, only_modules) -> bool:\n if only_modules:\n try:\n mod = getattr(module, attr)\n except ModuleNotFoundError:\n # See gh-14434\n return False\n return inspect.ismodule(mod)\n else:\n return not(attr[:2] == '__' and attr[-2:] == '__')\n\ndef is_possible_submodule(module, attr):\n try:\n obj = getattr(module, attr)\n except AttributeError:\n # Is possibly an unimported submodule\n return True\n except TypeError:\n # https://github.com/ipython/ipython/issues/9678\n return False\n return inspect.ismodule(obj)\n\n\ndef try_import(mod: str, only_modules=False) -> List[str]:\n """\n Try to import given module and return list of potential completions.\n """\n mod = mod.rstrip('.')\n try:\n m = import_module(mod)\n except:\n return []\n\n m_is_init = '__init__' in (getattr(m, '__file__', '') or '')\n\n completions = []\n if (not hasattr(m, '__file__')) or (not only_modules) or m_is_init:\n completions.extend( [attr for attr in dir(m) if\n is_importable(m, attr, only_modules)])\n\n m_all = getattr(m, "__all__", [])\n if only_modules:\n completions.extend(attr for attr in m_all if is_possible_submodule(m, attr))\n else:\n completions.extend(m_all)\n\n if m_is_init:\n file_ = m.__file__\n file_path = os.path.dirname(file_) # type: ignore\n if file_path is not None:\n completions.extend(module_list(file_path))\n completions_set = {c for c in completions if isinstance(c, str)}\n completions_set.discard('__init__')\n return list(completions_set)\n\n\n#-----------------------------------------------------------------------------\n# Completion-related functions.\n#-----------------------------------------------------------------------------\n\ndef quick_completer(cmd, completions):\n r""" Easily create a trivial completer for a command.\n\n Takes either a list of completions, or all completions in string (that will\n be split on whitespace).\n\n Example::\n\n [d:\ipython]|1> import ipy_completers\n [d:\ipython]|2> ipy_completers.quick_completer('foo', ['bar','baz'])\n [d:\ipython]|3> foo b<TAB>\n bar baz\n [d:\ipython]|3> foo ba\n """\n\n if isinstance(completions, str):\n completions = completions.split()\n\n def do_complete(self, event):\n return completions\n\n get_ipython().set_hook('complete_command',do_complete, str_key = cmd)\n\ndef module_completion(line):\n """\n Returns a list containing the completion possibilities for an import line.\n\n The line looks like this :\n 'import xml.d'\n 'from xml.dom import'\n """\n\n words = line.split(' ')\n nwords = len(words)\n\n # from whatever <tab> -> 'import '\n if nwords == 3 and words[0] == 'from':\n return ['import ']\n\n # 'from xy<tab>' or 'import xy<tab>'\n if nwords < 3 and (words[0] in {'%aimport', 'import', 'from'}) :\n if nwords == 1:\n return get_root_modules()\n mod = words[1].split('.')\n if len(mod) < 2:\n return get_root_modules()\n completion_list = try_import('.'.join(mod[:-1]), True)\n return ['.'.join(mod[:-1] + [el]) for el in completion_list]\n\n # 'from xyz import abc<tab>'\n if nwords >= 3 and words[0] == 'from':\n mod = words[1]\n return try_import(mod)\n\n#-----------------------------------------------------------------------------\n# Completers\n#-----------------------------------------------------------------------------\n# These all have the func(self, event) signature to be used as custom\n# completers\n\ndef module_completer(self,event):\n """Give completions after user has typed 'import ...' or 'from ...'"""\n\n # This works in all versions of python. While 2.5 has\n # pkgutil.walk_packages(), that particular routine is fairly dangerous,\n # since it imports *EVERYTHING* on sys.path. That is: a) very slow b) full\n # of possibly problematic side effects.\n # This search the folders in the sys.path for available modules.\n\n return module_completion(event.line)\n\n# FIXME: there's a lot of logic common to the run, cd and builtin file\n# completers, that is currently reimplemented in each.\n\ndef magic_run_completer(self, event):\n """Complete files that end in .py or .ipy or .ipynb for the %run command.\n """\n comps = arg_split(event.line, strict=False)\n # relpath should be the current token that we need to complete.\n if (len(comps) > 1) and (not event.line.endswith(' ')):\n relpath = comps[-1].strip("'\"")\n else:\n relpath = ''\n\n #print("\nev=", event) # dbg\n #print("rp=", relpath) # dbg\n #print('comps=', comps) # dbg\n\n lglob = glob.glob\n isdir = os.path.isdir\n relpath, tilde_expand, tilde_val = expand_user(relpath)\n\n # Find if the user has already typed the first filename, after which we\n # should complete on all files, since after the first one other files may\n # be arguments to the input script.\n\n if any(magic_run_re.match(c) for c in comps):\n matches = [f.replace('\\','/') + ('/' if isdir(f) else '')\n for f in lglob(relpath+'*')]\n else:\n dirs = [f.replace('\\','/') + "/" for f in lglob(relpath+'*') if isdir(f)]\n pys = [f.replace('\\','/')\n for f in lglob(relpath+'*.py') + lglob(relpath+'*.ipy') +\n lglob(relpath+'*.ipynb') + lglob(relpath + '*.pyw')]\n\n matches = dirs + pys\n\n #print('run comp:', dirs+pys) # dbg\n return [compress_user(p, tilde_expand, tilde_val) for p in matches]\n\n\ndef cd_completer(self, event):\n """Completer function for cd, which only returns directories."""\n ip = get_ipython()\n relpath = event.symbol\n\n #print(event) # dbg\n if event.line.endswith('-b') or ' -b ' in event.line:\n # return only bookmark completions\n bkms = self.db.get('bookmarks', None)\n if bkms:\n return bkms.keys()\n else:\n return []\n\n if event.symbol == '-':\n width_dh = str(len(str(len(ip.user_ns['_dh']) + 1)))\n # jump in directory history by number\n fmt = '-%0' + width_dh +'d [%s]'\n ents = [ fmt % (i,s) for i,s in enumerate(ip.user_ns['_dh'])]\n if len(ents) > 1:\n return ents\n return []\n\n if event.symbol.startswith('--'):\n return ["--" + os.path.basename(d) for d in ip.user_ns['_dh']]\n\n # Expand ~ in path and normalize directory separators.\n relpath, tilde_expand, tilde_val = expand_user(relpath)\n relpath = relpath.replace('\\','/')\n\n found = []\n for d in [f.replace('\\','/') + '/' for f in glob.glob(relpath+'*')\n if os.path.isdir(f)]:\n if ' ' in d:\n # we don't want to deal with any of that, complex code\n # for this is elsewhere\n raise TryNext\n\n found.append(d)\n\n if not found:\n if os.path.isdir(relpath):\n return [compress_user(relpath, tilde_expand, tilde_val)]\n\n # if no completions so far, try bookmarks\n bks = self.db.get('bookmarks',{})\n bkmatches = [s for s in bks if s.startswith(event.symbol)]\n if bkmatches:\n return bkmatches\n\n raise TryNext\n\n return [compress_user(p, tilde_expand, tilde_val) for p in found]\n\ndef reset_completer(self, event):\n "A completer for %reset magic"\n return '-f -s in out array dhist'.split()\n
.venv\Lib\site-packages\IPython\core\completerlib.py
completerlib.py
Python
12,641
0.95
0.243455
0.226537
react-lib
853
2025-06-03T13:21:36.105001
GPL-3.0
false
d00dba8fbfa7f3260db75d856b14cdbc
"""An interface for publishing rich data to frontends.\n\nThere are two components of the display system:\n\n* Display formatters, which take a Python object and compute the\n representation of the object in various formats (text, HTML, SVG, etc.).\n* The display publisher that is used to send the representation data to the\n various frontends.\n\nThis module defines the logic display publishing. The display publisher uses\nthe ``display_data`` message type that is defined in the IPython messaging\nspec.\n"""\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nimport sys\n\nfrom traitlets.config.configurable import Configurable\nfrom traitlets import List\n\n# This used to be defined here - it is imported for backwards compatibility\nfrom .display_functions import publish_display_data\nfrom .history import HistoryOutput\n\nimport typing as t\n\n# -----------------------------------------------------------------------------\n# Main payload class\n# -----------------------------------------------------------------------------\n\n_sentinel = object()\n\n\nclass DisplayPublisher(Configurable):\n """A traited class that publishes display data to frontends.\n\n Instances of this class are created by the main IPython object and should\n be accessed there.\n """\n\n def __init__(self, shell=None, *args, **kwargs):\n self.shell = shell\n self._is_publishing = False\n super().__init__(*args, **kwargs)\n\n def _validate_data(self, data, metadata=None):\n """Validate the display data.\n\n Parameters\n ----------\n data : dict\n The formata data dictionary.\n metadata : dict\n Any metadata for the data.\n """\n\n if not isinstance(data, dict):\n raise TypeError("data must be a dict, got: %r" % data)\n if metadata is not None:\n if not isinstance(metadata, dict):\n raise TypeError("metadata must be a dict, got: %r" % data)\n\n # use * to indicate transient, update are keyword-only\n def publish(\n self,\n data,\n metadata=None,\n source=_sentinel,\n *,\n transient=None,\n update=False,\n **kwargs,\n ) -> None:\n """Publish data and metadata to all frontends.\n\n See the ``display_data`` message in the messaging documentation for\n more details about this message type.\n\n The following MIME types are currently implemented:\n\n * text/plain\n * text/html\n * text/markdown\n * text/latex\n * application/json\n * application/javascript\n * image/png\n * image/jpeg\n * image/svg+xml\n\n Parameters\n ----------\n data : dict\n A dictionary having keys that are valid MIME types (like\n 'text/plain' or 'image/svg+xml') and values that are the data for\n that MIME type. The data itself must be a JSON'able data\n structure. Minimally all data should have the 'text/plain' data,\n which can be displayed by all frontends. If more than the plain\n text is given, it is up to the frontend to decide which\n representation to use.\n metadata : dict\n A dictionary for metadata related to the data. This can contain\n arbitrary key, value pairs that frontends can use to interpret\n the data. Metadata specific to each mime-type can be specified\n in the metadata dict with the same mime-type keys as\n the data itself.\n source : str, deprecated\n Unused.\n transient : dict, keyword-only\n A dictionary for transient data.\n Data in this dictionary should not be persisted as part of saving this output.\n Examples include 'display_id'.\n update : bool, keyword-only, default: False\n If True, only update existing outputs with the same display_id,\n rather than creating a new output.\n """\n\n if source is not _sentinel:\n import warnings\n\n warnings.warn(\n "The 'source' parameter is deprecated since IPython 3.0 and will be ignored "\n "(this warning is present since 9.0). `source` parameter will be removed in the future.",\n DeprecationWarning,\n stacklevel=2,\n )\n\n handlers: t.Dict = {}\n if self.shell is not None:\n handlers = getattr(self.shell, "mime_renderers", {})\n\n outputs = self.shell.history_manager.outputs\n\n outputs[self.shell.execution_count].append(\n HistoryOutput(output_type="display_data", bundle=data)\n )\n\n for mime, handler in handlers.items():\n if mime in data:\n handler(data[mime], metadata.get(mime, None))\n return\n\n self._is_publishing = True\n if "text/plain" in data:\n print(data["text/plain"])\n self._is_publishing = False\n\n @property\n def is_publishing(self):\n return self._is_publishing\n\n def clear_output(self, wait=False):\n """Clear the output of the cell receiving output."""\n print("\033[2K\r", end="")\n sys.stdout.flush()\n print("\033[2K\r", end="")\n sys.stderr.flush()\n\n\nclass CapturingDisplayPublisher(DisplayPublisher):\n """A DisplayPublisher that stores"""\n\n outputs: List = List()\n\n def publish(\n self, data, metadata=None, source=None, *, transient=None, update=False\n ):\n self.outputs.append(\n {\n "data": data,\n "metadata": metadata,\n "transient": transient,\n "update": update,\n }\n )\n\n def clear_output(self, wait=False):\n super(CapturingDisplayPublisher, self).clear_output(wait)\n\n # empty the list, *do not* reassign a new list\n self.outputs.clear()\n
.venv\Lib\site-packages\IPython\core\displaypub.py
displaypub.py
Python
5,946
0.95
0.147541
0.143836
python-kit
192
2025-02-20T10:14:12.612419
GPL-3.0
false
4d07312021350adf12832b4933afdb41
"""Top-level display functions for displaying object in different formats."""\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\n\nfrom binascii import b2a_hex\nimport os\nimport sys\nimport warnings\n\n__all__ = ['display', 'clear_output', 'publish_display_data', 'update_display', 'DisplayHandle']\n\n#-----------------------------------------------------------------------------\n# utility functions\n#-----------------------------------------------------------------------------\n\n\ndef _merge(d1, d2):\n """Like update, but merges sub-dicts instead of clobbering at the top level.\n\n Updates d1 in-place\n """\n\n if not isinstance(d2, dict) or not isinstance(d1, dict):\n return d2\n for key, value in d2.items():\n d1[key] = _merge(d1.get(key), value)\n return d1\n\n\n#-----------------------------------------------------------------------------\n# Main functions\n#-----------------------------------------------------------------------------\n\n# use * to indicate transient is keyword-only\ndef publish_display_data(data, metadata=None, *, transient=None, **kwargs):\n """Publish data and metadata to all frontends.\n\n See the ``display_data`` message in the messaging documentation for\n more details about this message type.\n\n Keys of data and metadata can be any mime-type.\n\n Parameters\n ----------\n data : dict\n A dictionary having keys that are valid MIME types (like\n 'text/plain' or 'image/svg+xml') and values that are the data for\n that MIME type. The data itself must be a JSON'able data\n structure. Minimally all data should have the 'text/plain' data,\n which can be displayed by all frontends. If more than the plain\n text is given, it is up to the frontend to decide which\n representation to use.\n metadata : dict\n A dictionary for metadata related to the data. This can contain\n arbitrary key, value pairs that frontends can use to interpret\n the data. mime-type keys matching those in data can be used\n to specify metadata about particular representations.\n transient : dict, keyword-only\n A dictionary of transient data, such as display_id.\n """\n from IPython.core.interactiveshell import InteractiveShell\n\n display_pub = InteractiveShell.instance().display_pub\n\n # only pass transient if supplied,\n # to avoid errors with older ipykernel.\n # TODO: We could check for ipykernel version and provide a detailed upgrade message.\n if transient:\n kwargs['transient'] = transient\n\n display_pub.publish(\n data=data,\n metadata=metadata,\n **kwargs\n )\n\n\ndef _new_id():\n """Generate a new random text id with urandom"""\n return b2a_hex(os.urandom(16)).decode('ascii')\n\n\ndef display(\n *objs,\n include=None,\n exclude=None,\n metadata=None,\n transient=None,\n display_id=None,\n raw=False,\n clear=False,\n **kwargs,\n):\n """Display a Python object in all frontends.\n\n By default all representations will be computed and sent to the frontends.\n Frontends can decide which representation is used and how.\n\n In terminal IPython this will be similar to using :func:`print`, for use in richer\n frontends see Jupyter notebook examples with rich display logic.\n\n Parameters\n ----------\n *objs : object\n The Python objects to display.\n raw : bool, optional\n Are the objects to be displayed already mimetype-keyed dicts of raw display data,\n or Python objects that need to be formatted before display? [default: False]\n include : list, tuple or set, optional\n A list of format type strings (MIME types) to include in the\n format data dict. If this is set *only* the format types included\n in this list will be computed.\n exclude : list, tuple or set, optional\n A list of format type strings (MIME types) to exclude in the format\n data dict. If this is set all format types will be computed,\n except for those included in this argument.\n metadata : dict, optional\n A dictionary of metadata to associate with the output.\n mime-type keys in this dictionary will be associated with the individual\n representation formats, if they exist.\n transient : dict, optional\n A dictionary of transient data to associate with the output.\n Data in this dict should not be persisted to files (e.g. notebooks).\n display_id : str, bool optional\n Set an id for the display.\n This id can be used for updating this display area later via update_display.\n If given as `True`, generate a new `display_id`\n clear : bool, optional\n Should the output area be cleared before displaying anything? If True,\n this will wait for additional output before clearing. [default: False]\n **kwargs : additional keyword-args, optional\n Additional keyword-arguments are passed through to the display publisher.\n\n Returns\n -------\n handle: DisplayHandle\n Returns a handle on updatable displays for use with :func:`update_display`,\n if `display_id` is given. Returns :any:`None` if no `display_id` is given\n (default).\n\n Examples\n --------\n >>> class Json(object):\n ... def __init__(self, json):\n ... self.json = json\n ... def _repr_pretty_(self, pp, cycle):\n ... import json\n ... pp.text(json.dumps(self.json, indent=2))\n ... def __repr__(self):\n ... return str(self.json)\n ...\n\n >>> d = Json({1:2, 3: {4:5}})\n\n >>> print(d)\n {1: 2, 3: {4: 5}}\n\n >>> display(d)\n {\n "1": 2,\n "3": {\n "4": 5\n }\n }\n\n >>> def int_formatter(integer, pp, cycle):\n ... pp.text('I'*integer)\n\n >>> plain = get_ipython().display_formatter.formatters['text/plain']\n >>> plain.for_type(int, int_formatter)\n <function _repr_pprint at 0x...>\n >>> display(7-5)\n II\n\n >>> del plain.type_printers[int]\n >>> display(7-5)\n 2\n\n See Also\n --------\n :func:`update_display`\n\n Notes\n -----\n In Python, objects can declare their textual representation using the\n `__repr__` method. IPython expands on this idea and allows objects to declare\n other, rich representations including:\n\n - HTML\n - JSON\n - PNG\n - JPEG\n - SVG\n - LaTeX\n\n A single object can declare some or all of these representations; all are\n handled by IPython's display system.\n\n The main idea of the first approach is that you have to implement special\n display methods when you define your class, one for each representation you\n want to use. Here is a list of the names of the special methods and the\n values they must return:\n\n - `_repr_html_`: return raw HTML as a string, or a tuple (see below).\n - `_repr_json_`: return a JSONable dict, or a tuple (see below).\n - `_repr_jpeg_`: return raw JPEG data, or a tuple (see below).\n - `_repr_png_`: return raw PNG data, or a tuple (see below).\n - `_repr_svg_`: return raw SVG data as a string, or a tuple (see below).\n - `_repr_latex_`: return LaTeX commands in a string surrounded by "$",\n or a tuple (see below).\n - `_repr_mimebundle_`: return a full mimebundle containing the mapping\n from all mimetypes to data.\n Use this for any mime-type not listed above.\n\n The above functions may also return the object's metadata alonside the\n data. If the metadata is available, the functions will return a tuple\n containing the data and metadata, in that order. If there is no metadata\n available, then the functions will return the data only.\n\n When you are directly writing your own classes, you can adapt them for\n display in IPython by following the above approach. But in practice, you\n often need to work with existing classes that you can't easily modify.\n\n You can refer to the documentation on integrating with the display system in\n order to register custom formatters for already existing types\n (:ref:`integrating_rich_display`).\n\n .. versionadded:: 5.4 display available without import\n .. versionadded:: 6.1 display available without import\n\n Since IPython 5.4 and 6.1 :func:`display` is automatically made available to\n the user without import. If you are using display in a document that might\n be used in a pure python context or with older version of IPython, use the\n following import at the top of your file::\n\n from IPython.display import display\n\n """\n from IPython.core.interactiveshell import InteractiveShell\n\n if not InteractiveShell.initialized():\n # Directly print objects.\n print(*objs)\n return\n\n if transient is None:\n transient = {}\n if metadata is None:\n metadata={}\n if display_id:\n if display_id is True:\n display_id = _new_id()\n transient['display_id'] = display_id\n if kwargs.get('update') and 'display_id' not in transient:\n raise TypeError('display_id required for update_display')\n if transient:\n kwargs['transient'] = transient\n\n if not objs and display_id:\n # if given no objects, but still a request for a display_id,\n # we assume the user wants to insert an empty output that\n # can be updated later\n objs = [{}]\n raw = True\n\n if not raw:\n format = InteractiveShell.instance().display_formatter.format\n\n if clear:\n clear_output(wait=True)\n\n for obj in objs:\n if raw:\n publish_display_data(data=obj, metadata=metadata, **kwargs)\n else:\n format_dict, md_dict = format(obj, include=include, exclude=exclude)\n if not format_dict:\n # nothing to display (e.g. _ipython_display_ took over)\n continue\n if metadata:\n # kwarg-specified metadata gets precedence\n _merge(md_dict, metadata)\n publish_display_data(data=format_dict, metadata=md_dict, **kwargs)\n if display_id:\n return DisplayHandle(display_id)\n\n\n# use * for keyword-only display_id arg\ndef update_display(obj, *, display_id, **kwargs):\n """Update an existing display by id\n\n Parameters\n ----------\n obj\n The object with which to update the display\n display_id : keyword-only\n The id of the display to update\n\n See Also\n --------\n :func:`display`\n """\n kwargs['update'] = True\n display(obj, display_id=display_id, **kwargs)\n\n\nclass DisplayHandle:\n """A handle on an updatable display\n\n Call `.update(obj)` to display a new object.\n\n Call `.display(obj`) to add a new instance of this display,\n and update existing instances.\n\n See Also\n --------\n\n :func:`display`, :func:`update_display`\n\n """\n\n def __init__(self, display_id=None):\n if display_id is None:\n display_id = _new_id()\n self.display_id = display_id\n\n def __repr__(self):\n return "<%s display_id=%s>" % (self.__class__.__name__, self.display_id)\n\n def display(self, obj, **kwargs):\n """Make a new display with my id, updating existing instances.\n\n Parameters\n ----------\n obj\n object to display\n **kwargs\n additional keyword arguments passed to display\n """\n display(obj, display_id=self.display_id, **kwargs)\n\n def update(self, obj, **kwargs):\n """Update existing displays with my id\n\n Parameters\n ----------\n obj\n object to display\n **kwargs\n additional keyword arguments passed to update_display\n """\n update_display(obj, display_id=self.display_id, **kwargs)\n\n\ndef clear_output(wait=False):\n """Clear the output of the current cell receiving output.\n\n Parameters\n ----------\n wait : bool [default: false]\n Wait to clear the output until new output is available to replace it."""\n from IPython.core.interactiveshell import InteractiveShell\n if InteractiveShell.initialized():\n InteractiveShell.instance().display_pub.clear_output(wait)\n else:\n print('\033[2K\r', end='')\n sys.stdout.flush()\n print('\033[2K\r', end='')\n sys.stderr.flush()\n
.venv\Lib\site-packages\IPython\core\display_functions.py
display_functions.py
Python
12,407
0.95
0.16442
0.086957
awesome-app
465
2025-05-11T19:21:53.659474
BSD-3-Clause
false
581a9f8cff0788eb8efec19d0b622358
# encoding: utf-8\n"""\nA context manager for handling sys.displayhook.\n\nAuthors:\n\n* Robert Kern\n* Brian Granger\n"""\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2008-2011 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\nimport sys\n\nfrom traitlets.config.configurable import Configurable\nfrom traitlets import Any\n\n#-----------------------------------------------------------------------------\n# Classes and functions\n#-----------------------------------------------------------------------------\n\n\nclass DisplayTrap(Configurable):\n """Object to manage sys.displayhook.\n\n This came from IPython.core.kernel.display_hook, but is simplified\n (no callbacks or formatters) until more of the core is refactored.\n """\n\n hook = Any()\n\n def __init__(self, hook=None):\n super(DisplayTrap, self).__init__(hook=hook, config=None)\n self.old_hook = None\n # We define this to track if a single BuiltinTrap is nested.\n # Only turn off the trap when the outermost call to __exit__ is made.\n self._nested_level = 0\n\n def __enter__(self):\n if self._nested_level == 0:\n self.set()\n self._nested_level += 1\n return self\n\n def __exit__(self, type, value, traceback):\n if self._nested_level == 1:\n self.unset()\n self._nested_level -= 1\n # Returning False will cause exceptions to propagate\n return False\n\n @property\n def is_active(self) -> bool:\n return self._nested_level != 0\n\n def set(self):\n """Set the hook."""\n if sys.displayhook is not self.hook:\n self.old_hook = sys.displayhook\n sys.displayhook = self.hook\n\n def unset(self):\n """Unset the hook."""\n sys.displayhook = self.old_hook\n\n
.venv\Lib\site-packages\IPython\core\display_trap.py
display_trap.py
Python
2,185
0.95
0.162162
0.321429
react-lib
104
2025-03-10T02:34:08.643883
MIT
false
23599a560709ad08e9b3048c125cb00f
# encoding: utf-8\n"""\nGlobal exception classes for IPython.core.\n\nAuthors:\n\n* Brian Granger\n* Fernando Perez\n* Min Ragan-Kelley\n\nNotes\n-----\n"""\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2008 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Exception classes\n#-----------------------------------------------------------------------------\n\nclass IPythonCoreError(Exception):\n pass\n\n\nclass TryNext(IPythonCoreError):\n """Try next hook exception.\n\n Raise this in your hook function to indicate that the next hook handler\n should be used to handle the operation.\n """\n\nclass UsageError(IPythonCoreError):\n """Error in magic function arguments, etc.\n\n Something that probably won't warrant a full traceback, but should\n nevertheless interrupt a macro / batch file.\n """\n\nclass StdinNotImplementedError(IPythonCoreError, NotImplementedError):\n """raw_input was requested in a context where it is not supported\n\n For use in IPython kernels, where only some frontends may support\n stdin requests.\n """\n\nclass InputRejected(Exception):\n """Input rejected by ast transformer.\n\n Raise this in your NodeTransformer to indicate that InteractiveShell should\n not execute the supplied input.\n """\n
.venv\Lib\site-packages\IPython\core\error.py
error.py
Python
1,734
0.95
0.133333
0.363636
react-lib
244
2024-02-26T01:13:21.774575
Apache-2.0
false
bd75540d5f4c4881106e7870f9140985
"""Infrastructure for registering and firing callbacks on application events.\n\nUnlike :mod:`IPython.core.hooks`, which lets end users set single functions to\nbe called at specific times, or a collection of alternative methods to try,\ncallbacks are designed to be used by extension authors. A number of callbacks\ncan be registered for the same event without needing to be aware of one another.\n\nThe functions defined in this module are no-ops indicating the names of available\nevents and the arguments which will be passed to them.\n\n.. note::\n\n This API is experimental in IPython 2.0, and may be revised in future versions.\n"""\n\n\nclass EventManager:\n """Manage a collection of events and a sequence of callbacks for each.\n \n This is attached to :class:`~IPython.core.interactiveshell.InteractiveShell`\n instances as an ``events`` attribute.\n \n .. note::\n\n This API is experimental in IPython 2.0, and may be revised in future versions.\n """\n\n def __init__(self, shell, available_events, print_on_error=True):\n """Initialise the :class:`CallbackManager`.\n\n Parameters\n ----------\n shell\n The :class:`~IPython.core.interactiveshell.InteractiveShell` instance\n available_events\n An iterable of names for callback events.\n print_on_error:\n A boolean flag to set whether the EventManager will print a warning which a event errors.\n """\n self.shell = shell\n self.callbacks = {n:[] for n in available_events}\n self.print_on_error = print_on_error\n \n def register(self, event, function):\n """Register a new event callback.\n\n Parameters\n ----------\n event : str\n The event for which to register this callback.\n function : callable\n A function to be called on the given event. It should take the same\n parameters as the appropriate callback prototype.\n\n Raises\n ------\n TypeError\n If ``function`` is not callable.\n KeyError\n If ``event`` is not one of the known events.\n """\n if not callable(function):\n raise TypeError('Need a callable, got %r' % function)\n if function not in self.callbacks[event]:\n self.callbacks[event].append(function)\n \n def unregister(self, event, function):\n """Remove a callback from the given event."""\n if function in self.callbacks[event]:\n return self.callbacks[event].remove(function)\n\n raise ValueError('Function {!r} is not registered as a {} callback'.format(function, event))\n\n def trigger(self, event, *args, **kwargs):\n """Call callbacks for ``event``.\n\n Any additional arguments are passed to all callbacks registered for this\n event. Exceptions raised by callbacks are caught, and a message printed.\n """\n for func in self.callbacks[event][:]:\n try:\n func(*args, **kwargs)\n except (Exception, KeyboardInterrupt):\n if self.print_on_error:\n print(\n "Error in callback {} (for {}), with arguments args {},kwargs {}:".format(\n func, event, args, kwargs\n )\n )\n self.shell.showtraceback()\n\n# event_name -> prototype mapping\navailable_events = {}\n\ndef _define_event(callback_function):\n available_events[callback_function.__name__] = callback_function\n return callback_function\n\n# ------------------------------------------------------------------------------\n# Callback prototypes\n#\n# No-op functions which describe the names of available events and the\n# signatures of callbacks for those events.\n# ------------------------------------------------------------------------------\n\n@_define_event\ndef pre_execute():\n """Fires before code is executed in response to user/frontend action.\n\n This includes comm and widget messages and silent execution, as well as user\n code cells.\n """\n pass\n\n@_define_event\ndef pre_run_cell(info):\n """Fires before user-entered code runs.\n\n Parameters\n ----------\n info : :class:`~IPython.core.interactiveshell.ExecutionInfo`\n An object containing information used for the code execution.\n """\n pass\n\n@_define_event\ndef post_execute():\n """Fires after code is executed in response to user/frontend action.\n\n This includes comm and widget messages and silent execution, as well as user\n code cells.\n """\n pass\n\n@_define_event\ndef post_run_cell(result):\n """Fires after user-entered code runs.\n\n Parameters\n ----------\n result : :class:`~IPython.core.interactiveshell.ExecutionResult`\n The object which will be returned as the execution result.\n """\n pass\n\n@_define_event\ndef shell_initialized(ip):\n """Fires after initialisation of :class:`~IPython.core.interactiveshell.InteractiveShell`.\n\n This is before extensions and startup scripts are loaded, so it can only be\n set by subclassing.\n\n Parameters\n ----------\n ip : :class:`~IPython.core.interactiveshell.InteractiveShell`\n The newly initialised shell.\n """\n pass\n
.venv\Lib\site-packages\IPython\core\events.py
events.py
Python
5,243
0.95
0.303797
0.055556
react-lib
665
2023-08-16T17:38:51.681652
MIT
false
2a228247f28dd37d45599904ec5f6c5f
# encoding: utf-8\n"""A class for managing IPython extensions."""\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nimport os\nimport os.path\nimport sys\nfrom importlib import import_module, reload\n\nfrom traitlets.config.configurable import Configurable\nfrom IPython.utils.path import ensure_dir_exists\nfrom traitlets import Instance\n\n\n#-----------------------------------------------------------------------------\n# Main class\n#-----------------------------------------------------------------------------\n\nBUILTINS_EXTS = {"storemagic": False, "autoreload": False}\n\n\nclass ExtensionManager(Configurable):\n """A class to manage IPython extensions.\n\n An IPython extension is an importable Python module that has\n a function with the signature::\n\n def load_ipython_extension(ipython):\n # Do things with ipython\n\n This function is called after your extension is imported and the\n currently active :class:`InteractiveShell` instance is passed as\n the only argument. You can do anything you want with IPython at\n that point, including defining new magic and aliases, adding new\n components, etc.\n\n You can also optionally define an :func:`unload_ipython_extension(ipython)`\n function, which will be called if the user unloads or reloads the extension.\n The extension manager will only call :func:`load_ipython_extension` again\n if the extension is reloaded.\n\n You can put your extension modules anywhere you want, as long as\n they can be imported by Python's standard import mechanism.\n """\n\n shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)\n\n def __init__(self, shell=None, **kwargs):\n super(ExtensionManager, self).__init__(shell=shell, **kwargs)\n self.loaded = set()\n\n def load_extension(self, module_str: str):\n """Load an IPython extension by its module name.\n\n Returns the string "already loaded" if the extension is already loaded,\n "no load function" if the module doesn't have a load_ipython_extension\n function, or None if it succeeded.\n """\n try:\n return self._load_extension(module_str)\n except ModuleNotFoundError:\n if module_str in BUILTINS_EXTS:\n BUILTINS_EXTS[module_str] = True\n return self._load_extension("IPython.extensions." + module_str)\n raise\n\n def _load_extension(self, module_str: str):\n if module_str in self.loaded:\n return "already loaded"\n\n assert self.shell is not None\n\n with self.shell.builtin_trap:\n if module_str not in sys.modules:\n mod = import_module(module_str)\n mod = sys.modules[module_str]\n if self._call_load_ipython_extension(mod):\n self.loaded.add(module_str)\n else:\n return "no load function"\n\n def unload_extension(self, module_str: str):\n """Unload an IPython extension by its module name.\n\n This function looks up the extension's name in ``sys.modules`` and\n simply calls ``mod.unload_ipython_extension(self)``.\n\n Returns the string "no unload function" if the extension doesn't define\n a function to unload itself, "not loaded" if the extension isn't loaded,\n otherwise None.\n """\n if BUILTINS_EXTS.get(module_str, False) is True:\n module_str = "IPython.extensions." + module_str\n if module_str not in self.loaded:\n return "not loaded"\n\n if module_str in sys.modules:\n mod = sys.modules[module_str]\n if self._call_unload_ipython_extension(mod):\n self.loaded.discard(module_str)\n else:\n return "no unload function"\n\n def reload_extension(self, module_str: str):\n """Reload an IPython extension by calling reload.\n\n If the module has not been loaded before,\n :meth:`InteractiveShell.load_extension` is called. Otherwise\n :func:`reload` is called and then the :func:`load_ipython_extension`\n function of the module, if it exists is called.\n """\n\n if BUILTINS_EXTS.get(module_str, False) is True:\n module_str = "IPython.extensions." + module_str\n\n if (module_str in self.loaded) and (module_str in sys.modules):\n self.unload_extension(module_str)\n mod = sys.modules[module_str]\n reload(mod)\n if self._call_load_ipython_extension(mod):\n self.loaded.add(module_str)\n else:\n self.load_extension(module_str)\n\n def _call_load_ipython_extension(self, mod):\n if hasattr(mod, 'load_ipython_extension'):\n mod.load_ipython_extension(self.shell)\n return True\n\n def _call_unload_ipython_extension(self, mod):\n if hasattr(mod, 'unload_ipython_extension'):\n mod.unload_ipython_extension(self.shell)\n return True\n
.venv\Lib\site-packages\IPython\core\extensions.py
extensions.py
Python
5,020
0.95
0.348148
0.066667
node-utils
934
2025-05-03T21:24:18.001101
Apache-2.0
false
c19f377aa27b3f6f77a63ed37e69d7d8
"""Simple function to call to get the current InteractiveShell instance\n"""\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2013 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Classes and functions\n#-----------------------------------------------------------------------------\n\n\ndef get_ipython():\n """Get the global InteractiveShell instance.\n\n Returns None if no InteractiveShell instance is registered.\n """\n from IPython.core.interactiveshell import InteractiveShell\n if InteractiveShell.initialized():\n return InteractiveShell.instance()\n
.venv\Lib\site-packages\IPython\core\getipython.py
getipython.py
Python
894
0.95
0.173913
0.5
react-lib
587
2024-09-05T01:35:23.455759
MIT
false
c7b273446f885ebba53c8366e24384ce
# encoding: utf-8\n\n# DO NOT EDIT THIS FILE BY HAND.\n\n# To update this file, run the script /tools/gen_latex_symbols.py using Python 3\n\n# This file is autogenerated from the file:\n# https://raw.githubusercontent.com/JuliaLang/julia/master/stdlib/REPL/src/latex_symbols.jl\n# This original list is filtered to remove any unicode characters that are not valid\n# Python identifiers.\n\nlatex_symbols = {\n "\\euler": "ℯ",\n "\\ohm": "Ω",\n "\\^a": "ᵃ",\n "\\^b": "ᵇ",\n "\\^c": "ᶜ",\n "\\^d": "ᵈ",\n "\\^e": "ᵉ",\n "\\^f": "ᶠ",\n "\\^g": "ᵍ",\n "\\^h": "ʰ",\n "\\^i": "ⁱ",\n "\\^j": "ʲ",\n "\\^k": "ᵏ",\n "\\^l": "ˡ",\n "\\^m": "ᵐ",\n "\\^n": "ⁿ",\n "\\^o": "ᵒ",\n "\\^p": "ᵖ",\n "\\^r": "ʳ",\n "\\^s": "ˢ",\n "\\^t": "ᵗ",\n "\\^u": "ᵘ",\n "\\^v": "ᵛ",\n "\\^w": "ʷ",\n "\\^x": "ˣ",\n "\\^y": "ʸ",\n "\\^z": "ᶻ",\n "\\^A": "ᴬ",\n "\\^B": "ᴮ",\n "\\^D": "ᴰ",\n "\\^E": "ᴱ",\n "\\^G": "ᴳ",\n "\\^H": "ᴴ",\n "\\^I": "ᴵ",\n "\\^J": "ᴶ",\n "\\^K": "ᴷ",\n "\\^L": "ᴸ",\n "\\^M": "ᴹ",\n "\\^N": "ᴺ",\n "\\^O": "ᴼ",\n "\\^P": "ᴾ",\n "\\^R": "ᴿ",\n "\\^T": "ᵀ",\n "\\^U": "ᵁ",\n "\\^V": "ⱽ",\n "\\^W": "ᵂ",\n "\\^alpha": "ᵅ",\n "\\^beta": "ᵝ",\n "\\^gamma": "ᵞ",\n "\\^delta": "ᵟ",\n "\\^epsilon": "ᵋ",\n "\\^theta": "ᶿ",\n "\\^iota": "ᶥ",\n "\\^phi": "ᵠ",\n "\\^chi": "ᵡ",\n "\\^ltphi": "ᶲ",\n "\\^uparrow": "ꜛ",\n "\\^downarrow": "ꜜ",\n "\\^!": "ꜝ",\n "\\_a": "ₐ",\n "\\_e": "ₑ",\n "\\_h": "ₕ",\n "\\_i": "ᵢ",\n "\\_j": "ⱼ",\n "\\_k": "ₖ",\n "\\_l": "ₗ",\n "\\_m": "ₘ",\n "\\_n": "ₙ",\n "\\_o": "ₒ",\n "\\_p": "ₚ",\n "\\_r": "ᵣ",\n "\\_s": "ₛ",\n "\\_t": "ₜ",\n "\\_u": "ᵤ",\n "\\_v": "ᵥ",\n "\\_x": "ₓ",\n "\\_schwa": "ₔ",\n "\\_beta": "ᵦ",\n "\\_gamma": "ᵧ",\n "\\_rho": "ᵨ",\n "\\_phi": "ᵩ",\n "\\_chi": "ᵪ",\n "\\hbar": "ħ",\n "\\sout": "̶",\n "\\ordfeminine": "ª",\n "\\cdotp": "·",\n "\\ordmasculine": "º",\n "\\AA": "Å",\n "\\AE": "Æ",\n "\\DH": "Ð",\n "\\O": "Ø",\n "\\TH": "Þ",\n "\\ss": "ß",\n "\\aa": "å",\n "\\ae": "æ",\n "\\eth": "ð",\n "\\dh": "ð",\n "\\o": "ø",\n "\\th": "þ",\n "\\DJ": "Đ",\n "\\dj": "đ",\n "\\imath": "ı",\n "\\jmath": "ȷ",\n "\\L": "Ł",\n "\\l": "ł",\n "\\NG": "Ŋ",\n "\\ng": "ŋ",\n "\\OE": "Œ",\n "\\oe": "œ",\n "\\hvlig": "ƕ",\n "\\nrleg": "ƞ",\n "\\doublepipe": "ǂ",\n "\\trna": "ɐ",\n "\\trnsa": "ɒ",\n "\\openo": "ɔ",\n "\\rtld": "ɖ",\n "\\schwa": "ə",\n "\\varepsilon": "ε",\n "\\pgamma": "ɣ",\n "\\pbgam": "ɤ",\n "\\trnh": "ɥ",\n "\\btdl": "ɬ",\n "\\rtll": "ɭ",\n "\\trnm": "ɯ",\n "\\trnmlr": "ɰ",\n "\\ltlmr": "ɱ",\n "\\ltln": "ɲ",\n "\\rtln": "ɳ",\n "\\clomeg": "ɷ",\n "\\ltphi": "ɸ",\n "\\trnr": "ɹ",\n "\\trnrl": "ɺ",\n "\\rttrnr": "ɻ",\n "\\rl": "ɼ",\n "\\rtlr": "ɽ",\n "\\fhr": "ɾ",\n "\\rtls": "ʂ",\n "\\esh": "ʃ",\n "\\trnt": "ʇ",\n "\\rtlt": "ʈ",\n "\\pupsil": "ʊ",\n "\\pscrv": "ʋ",\n "\\invv": "ʌ",\n "\\invw": "ʍ",\n "\\trny": "ʎ",\n "\\rtlz": "ʐ",\n "\\yogh": "ʒ",\n "\\glst": "ʔ",\n "\\reglst": "ʕ",\n "\\inglst": "ʖ",\n "\\turnk": "ʞ",\n "\\dyogh": "ʤ",\n "\\tesh": "ʧ",\n "\\rasp": "ʼ",\n "\\verts": "ˈ",\n "\\verti": "ˌ",\n "\\lmrk": "ː",\n "\\hlmrk": "ˑ",\n "\\grave": "̀",\n "\\acute": "́",\n "\\hat": "̂",\n "\\tilde": "̃",\n "\\bar": "̄",\n "\\breve": "̆",\n "\\dot": "̇",\n "\\ddot": "̈",\n "\\ocirc": "̊",\n "\\H": "̋",\n "\\check": "̌",\n "\\palh": "̡",\n "\\rh": "̢",\n "\\c": "̧",\n "\\k": "̨",\n "\\sbbrg": "̪",\n "\\strike": "̶",\n "\\Alpha": "Α",\n "\\Beta": "Β",\n "\\Gamma": "Γ",\n "\\Delta": "Δ",\n "\\Epsilon": "Ε",\n "\\Zeta": "Ζ",\n "\\Eta": "Η",\n "\\Theta": "Θ",\n "\\Iota": "Ι",\n "\\Kappa": "Κ",\n "\\Lambda": "Λ",\n "\\Xi": "Ξ",\n "\\Pi": "Π",\n "\\Rho": "Ρ",\n "\\Sigma": "Σ",\n "\\Tau": "Τ",\n "\\Upsilon": "Υ",\n "\\Phi": "Φ",\n "\\Chi": "Χ",\n "\\Psi": "Ψ",\n "\\Omega": "Ω",\n "\\alpha": "α",\n "\\beta": "β",\n "\\gamma": "γ",\n "\\delta": "δ",\n "\\zeta": "ζ",\n "\\eta": "η",\n "\\theta": "θ",\n "\\iota": "ι",\n "\\kappa": "κ",\n "\\lambda": "λ",\n "\\mu": "μ",\n "\\nu": "ν",\n "\\xi": "ξ",\n "\\pi": "π",\n "\\rho": "ρ",\n "\\varsigma": "ς",\n "\\sigma": "σ",\n "\\tau": "τ",\n "\\upsilon": "υ",\n "\\varphi": "φ",\n "\\chi": "χ",\n "\\psi": "ψ",\n "\\omega": "ω",\n "\\vartheta": "ϑ",\n "\\phi": "ϕ",\n "\\varpi": "ϖ",\n "\\Stigma": "Ϛ",\n "\\Digamma": "Ϝ",\n "\\digamma": "ϝ",\n "\\Koppa": "Ϟ",\n "\\Sampi": "Ϡ",\n "\\varkappa": "ϰ",\n "\\varrho": "ϱ",\n "\\varTheta": "ϴ",\n "\\epsilon": "ϵ",\n "\\dddot": "⃛",\n "\\ddddot": "⃜",\n "\\hslash": "ℏ",\n "\\Im": "ℑ",\n "\\ell": "ℓ",\n "\\wp": "℘",\n "\\Re": "ℜ",\n "\\aleph": "ℵ",\n "\\beth": "ℶ",\n "\\gimel": "ℷ",\n "\\daleth": "ℸ",\n "\\bbPi": "ℿ",\n "\\Zbar": "Ƶ",\n "\\overbar": "̅",\n "\\ovhook": "̉",\n "\\candra": "̐",\n "\\oturnedcomma": "̒",\n "\\ocommatopright": "̕",\n "\\droang": "̚",\n "\\wideutilde": "̰",\n "\\not": "̸",\n "\\Mu": "Μ",\n "\\Nu": "Ν",\n "\\Omicron": "Ο",\n "\\omicron": "ο",\n "\\varbeta": "ϐ",\n "\\oldKoppa": "Ϙ",\n "\\oldkoppa": "ϙ",\n "\\stigma": "ϛ",\n "\\koppa": "ϟ",\n "\\sampi": "ϡ",\n "\\tieconcat": "⁀",\n "\\leftharpoonaccent": "⃐",\n "\\rightharpoonaccent": "⃑",\n "\\vertoverlay": "⃒",\n "\\overleftarrow": "⃖",\n "\\vec": "⃗",\n "\\overleftrightarrow": "⃡",\n "\\annuity": "⃧",\n "\\threeunderdot": "⃨",\n "\\widebridgeabove": "⃩",\n "\\bbC": "ℂ",\n "\\eulermascheroni": "ℇ",\n "\\scrg": "ℊ",\n "\\scrH": "ℋ",\n "\\frakH": "ℌ",\n "\\bbH": "ℍ",\n "\\planck": "ℎ",\n "\\scrI": "ℐ",\n "\\scrL": "ℒ",\n "\\bbN": "ℕ",\n "\\bbP": "ℙ",\n "\\bbQ": "ℚ",\n "\\scrR": "ℛ",\n "\\bbR": "ℝ",\n "\\bbZ": "ℤ",\n "\\frakZ": "ℨ",\n "\\Angstrom": "Å",\n "\\scrB": "ℬ",\n "\\frakC": "ℭ",\n "\\scre": "ℯ",\n "\\scrE": "ℰ",\n "\\scrF": "ℱ",\n "\\Finv": "Ⅎ",\n "\\scrM": "ℳ",\n "\\scro": "ℴ",\n "\\bbgamma": "ℽ",\n "\\bbGamma": "ℾ",\n "\\bbiD": "ⅅ",\n "\\bbid": "ⅆ",\n "\\bbie": "ⅇ",\n "\\bbii": "ⅈ",\n "\\bbij": "ⅉ",\n "\\bfA": "𝐀",\n "\\bfB": "𝐁",\n "\\bfC": "𝐂",\n "\\bfD": "𝐃",\n "\\bfE": "𝐄",\n "\\bfF": "𝐅",\n "\\bfG": "𝐆",\n "\\bfH": "𝐇",\n "\\bfI": "𝐈",\n "\\bfJ": "𝐉",\n "\\bfK": "𝐊",\n "\\bfL": "𝐋",\n "\\bfM": "𝐌",\n "\\bfN": "𝐍",\n "\\bfO": "𝐎",\n "\\bfP": "𝐏",\n "\\bfQ": "𝐐",\n "\\bfR": "𝐑",\n "\\bfS": "𝐒",\n "\\bfT": "𝐓",\n "\\bfU": "𝐔",\n "\\bfV": "𝐕",\n "\\bfW": "𝐖",\n "\\bfX": "𝐗",\n "\\bfY": "𝐘",\n "\\bfZ": "𝐙",\n "\\bfa": "𝐚",\n "\\bfb": "𝐛",\n "\\bfc": "𝐜",\n "\\bfd": "𝐝",\n "\\bfe": "𝐞",\n "\\bff": "𝐟",\n "\\bfg": "𝐠",\n "\\bfh": "𝐡",\n "\\bfi": "𝐢",\n "\\bfj": "𝐣",\n "\\bfk": "𝐤",\n "\\bfl": "𝐥",\n "\\bfm": "𝐦",\n "\\bfn": "𝐧",\n "\\bfo": "𝐨",\n "\\bfp": "𝐩",\n "\\bfq": "𝐪",\n "\\bfr": "𝐫",\n "\\bfs": "𝐬",\n "\\bft": "𝐭",\n "\\bfu": "𝐮",\n "\\bfv": "𝐯",\n "\\bfw": "𝐰",\n "\\bfx": "𝐱",\n "\\bfy": "𝐲",\n "\\bfz": "𝐳",\n "\\itA": "𝐴",\n "\\itB": "𝐵",\n "\\itC": "𝐶",\n "\\itD": "𝐷",\n "\\itE": "𝐸",\n "\\itF": "𝐹",\n "\\itG": "𝐺",\n "\\itH": "𝐻",\n "\\itI": "𝐼",\n "\\itJ": "𝐽",\n "\\itK": "𝐾",\n "\\itL": "𝐿",\n "\\itM": "𝑀",\n "\\itN": "𝑁",\n "\\itO": "𝑂",\n "\\itP": "𝑃",\n "\\itQ": "𝑄",\n "\\itR": "𝑅",\n "\\itS": "𝑆",\n "\\itT": "𝑇",\n "\\itU": "𝑈",\n "\\itV": "𝑉",\n "\\itW": "𝑊",\n "\\itX": "𝑋",\n "\\itY": "𝑌",\n "\\itZ": "𝑍",\n "\\ita": "𝑎",\n "\\itb": "𝑏",\n "\\itc": "𝑐",\n "\\itd": "𝑑",\n "\\ite": "𝑒",\n "\\itf": "𝑓",\n "\\itg": "𝑔",\n "\\ith": "ℎ",\n "\\iti": "𝑖",\n "\\itj": "𝑗",\n "\\itk": "𝑘",\n "\\itl": "𝑙",\n "\\itm": "𝑚",\n "\\itn": "𝑛",\n "\\ito": "𝑜",\n "\\itp": "𝑝",\n "\\itq": "𝑞",\n "\\itr": "𝑟",\n "\\its": "𝑠",\n "\\itt": "𝑡",\n "\\itu": "𝑢",\n "\\itv": "𝑣",\n "\\itw": "𝑤",\n "\\itx": "𝑥",\n "\\ity": "𝑦",\n "\\itz": "𝑧",\n "\\biA": "𝑨",\n "\\biB": "𝑩",\n "\\biC": "𝑪",\n "\\biD": "𝑫",\n "\\biE": "𝑬",\n "\\biF": "𝑭",\n "\\biG": "𝑮",\n "\\biH": "𝑯",\n "\\biI": "𝑰",\n "\\biJ": "𝑱",\n "\\biK": "𝑲",\n "\\biL": "𝑳",\n "\\biM": "𝑴",\n "\\biN": "𝑵",\n "\\biO": "𝑶",\n "\\biP": "𝑷",\n "\\biQ": "𝑸",\n "\\biR": "𝑹",\n "\\biS": "𝑺",\n "\\biT": "𝑻",\n "\\biU": "𝑼",\n "\\biV": "𝑽",\n "\\biW": "𝑾",\n "\\biX": "𝑿",\n "\\biY": "𝒀",\n "\\biZ": "𝒁",\n "\\bia": "𝒂",\n "\\bib": "𝒃",\n "\\bic": "𝒄",\n "\\bid": "𝒅",\n "\\bie": "𝒆",\n "\\bif": "𝒇",\n "\\big": "𝒈",\n "\\bih": "𝒉",\n "\\bii": "𝒊",\n "\\bij": "𝒋",\n "\\bik": "𝒌",\n "\\bil": "𝒍",\n "\\bim": "𝒎",\n "\\bin": "𝒏",\n "\\bio": "𝒐",\n "\\bip": "𝒑",\n "\\biq": "𝒒",\n "\\bir": "𝒓",\n "\\bis": "𝒔",\n "\\bit": "𝒕",\n "\\biu": "𝒖",\n "\\biv": "𝒗",\n "\\biw": "𝒘",\n "\\bix": "𝒙",\n "\\biy": "𝒚",\n "\\biz": "𝒛",\n "\\scrA": "𝒜",\n "\\scrC": "𝒞",\n "\\scrD": "𝒟",\n "\\scrG": "𝒢",\n "\\scrJ": "𝒥",\n "\\scrK": "𝒦",\n "\\scrN": "𝒩",\n "\\scrO": "𝒪",\n "\\scrP": "𝒫",\n "\\scrQ": "𝒬",\n "\\scrS": "𝒮",\n "\\scrT": "𝒯",\n "\\scrU": "𝒰",\n "\\scrV": "𝒱",\n "\\scrW": "𝒲",\n "\\scrX": "𝒳",\n "\\scrY": "𝒴",\n "\\scrZ": "𝒵",\n "\\scra": "𝒶",\n "\\scrb": "𝒷",\n "\\scrc": "𝒸",\n "\\scrd": "𝒹",\n "\\scrf": "𝒻",\n "\\scrh": "𝒽",\n "\\scri": "𝒾",\n "\\scrj": "𝒿",\n "\\scrk": "𝓀",\n "\\scrm": "𝓂",\n "\\scrn": "𝓃",\n "\\scrp": "𝓅",\n "\\scrq": "𝓆",\n "\\scrr": "𝓇",\n "\\scrs": "𝓈",\n "\\scrt": "𝓉",\n "\\scru": "𝓊",\n "\\scrv": "𝓋",\n "\\scrw": "𝓌",\n "\\scrx": "𝓍",\n "\\scry": "𝓎",\n "\\scrz": "𝓏",\n "\\bscrA": "𝓐",\n "\\bscrB": "𝓑",\n "\\bscrC": "𝓒",\n "\\bscrD": "𝓓",\n "\\bscrE": "𝓔",\n "\\bscrF": "𝓕",\n "\\bscrG": "𝓖",\n "\\bscrH": "𝓗",\n "\\bscrI": "𝓘",\n "\\bscrJ": "𝓙",\n "\\bscrK": "𝓚",\n "\\bscrL": "𝓛",\n "\\bscrM": "𝓜",\n "\\bscrN": "𝓝",\n "\\bscrO": "𝓞",\n "\\bscrP": "𝓟",\n "\\bscrQ": "𝓠",\n "\\bscrR": "𝓡",\n "\\bscrS": "𝓢",\n "\\bscrT": "𝓣",\n "\\bscrU": "𝓤",\n "\\bscrV": "𝓥",\n "\\bscrW": "𝓦",\n "\\bscrX": "𝓧",\n "\\bscrY": "𝓨",\n "\\bscrZ": "𝓩",\n "\\bscra": "𝓪",\n "\\bscrb": "𝓫",\n "\\bscrc": "𝓬",\n "\\bscrd": "𝓭",\n "\\bscre": "𝓮",\n "\\bscrf": "𝓯",\n "\\bscrg": "𝓰",\n "\\bscrh": "𝓱",\n "\\bscri": "𝓲",\n "\\bscrj": "𝓳",\n "\\bscrk": "𝓴",\n "\\bscrl": "𝓵",\n "\\bscrm": "𝓶",\n "\\bscrn": "𝓷",\n "\\bscro": "𝓸",\n "\\bscrp": "𝓹",\n "\\bscrq": "𝓺",\n "\\bscrr": "𝓻",\n "\\bscrs": "𝓼",\n "\\bscrt": "𝓽",\n "\\bscru": "𝓾",\n "\\bscrv": "𝓿",\n "\\bscrw": "𝔀",\n "\\bscrx": "𝔁",\n "\\bscry": "𝔂",\n "\\bscrz": "𝔃",\n "\\frakA": "𝔄",\n "\\frakB": "𝔅",\n "\\frakD": "𝔇",\n "\\frakE": "𝔈",\n "\\frakF": "𝔉",\n "\\frakG": "𝔊",\n "\\frakI": "ℑ",\n "\\frakJ": "𝔍",\n "\\frakK": "𝔎",\n "\\frakL": "𝔏",\n "\\frakM": "𝔐",\n "\\frakN": "𝔑",\n "\\frakO": "𝔒",\n "\\frakP": "𝔓",\n "\\frakQ": "𝔔",\n "\\frakR": "ℜ",\n "\\frakS": "𝔖",\n "\\frakT": "𝔗",\n "\\frakU": "𝔘",\n "\\frakV": "𝔙",\n "\\frakW": "𝔚",\n "\\frakX": "𝔛",\n "\\frakY": "𝔜",\n "\\fraka": "𝔞",\n "\\frakb": "𝔟",\n "\\frakc": "𝔠",\n "\\frakd": "𝔡",\n "\\frake": "𝔢",\n "\\frakf": "𝔣",\n "\\frakg": "𝔤",\n "\\frakh": "𝔥",\n "\\fraki": "𝔦",\n "\\frakj": "𝔧",\n "\\frakk": "𝔨",\n "\\frakl": "𝔩",\n "\\frakm": "𝔪",\n "\\frakn": "𝔫",\n "\\frako": "𝔬",\n "\\frakp": "𝔭",\n "\\frakq": "𝔮",\n "\\frakr": "𝔯",\n "\\fraks": "𝔰",\n "\\frakt": "𝔱",\n "\\fraku": "𝔲",\n "\\frakv": "𝔳",\n "\\frakw": "𝔴",\n "\\frakx": "𝔵",\n "\\fraky": "𝔶",\n "\\frakz": "𝔷",\n "\\bbA": "𝔸",\n "\\bbB": "𝔹",\n "\\bbD": "𝔻",\n "\\bbE": "𝔼",\n "\\bbF": "𝔽",\n "\\bbG": "𝔾",\n "\\bbI": "𝕀",\n "\\bbJ": "𝕁",\n "\\bbK": "𝕂",\n "\\bbL": "𝕃",\n "\\bbM": "𝕄",\n "\\bbO": "𝕆",\n "\\bbS": "𝕊",\n "\\bbT": "𝕋",\n "\\bbU": "𝕌",\n "\\bbV": "𝕍",\n "\\bbW": "𝕎",\n "\\bbX": "𝕏",\n "\\bbY": "𝕐",\n "\\bba": "𝕒",\n "\\bbb": "𝕓",\n "\\bbc": "𝕔",\n "\\bbd": "𝕕",\n "\\bbe": "𝕖",\n "\\bbf": "𝕗",\n "\\bbg": "𝕘",\n "\\bbh": "𝕙",\n "\\bbi": "𝕚",\n "\\bbj": "𝕛",\n "\\bbk": "𝕜",\n "\\bbl": "𝕝",\n "\\bbm": "𝕞",\n "\\bbn": "𝕟",\n "\\bbo": "𝕠",\n "\\bbp": "𝕡",\n "\\bbq": "𝕢",\n "\\bbr": "𝕣",\n "\\bbs": "𝕤",\n "\\bbt": "𝕥",\n "\\bbu": "𝕦",\n "\\bbv": "𝕧",\n "\\bbw": "𝕨",\n "\\bbx": "𝕩",\n "\\bby": "𝕪",\n "\\bbz": "𝕫",\n "\\bfrakA": "𝕬",\n "\\bfrakB": "𝕭",\n "\\bfrakC": "𝕮",\n "\\bfrakD": "𝕯",\n "\\bfrakE": "𝕰",\n "\\bfrakF": "𝕱",\n "\\bfrakG": "𝕲",\n "\\bfrakH": "𝕳",\n "\\bfrakI": "𝕴",\n "\\bfrakJ": "𝕵",\n "\\bfrakK": "𝕶",\n "\\bfrakL": "𝕷",\n "\\bfrakM": "𝕸",\n "\\bfrakN": "𝕹",\n "\\bfrakO": "𝕺",\n "\\bfrakP": "𝕻",\n "\\bfrakQ": "𝕼",\n "\\bfrakR": "𝕽",\n "\\bfrakS": "𝕾",\n "\\bfrakT": "𝕿",\n "\\bfrakU": "𝖀",\n "\\bfrakV": "𝖁",\n "\\bfrakW": "𝖂",\n "\\bfrakX": "𝖃",\n "\\bfrakY": "𝖄",\n "\\bfrakZ": "𝖅",\n "\\bfraka": "𝖆",\n "\\bfrakb": "𝖇",\n "\\bfrakc": "𝖈",\n "\\bfrakd": "𝖉",\n "\\bfrake": "𝖊",\n "\\bfrakf": "𝖋",\n "\\bfrakg": "𝖌",\n "\\bfrakh": "𝖍",\n "\\bfraki": "𝖎",\n "\\bfrakj": "𝖏",\n "\\bfrakk": "𝖐",\n "\\bfrakl": "𝖑",\n "\\bfrakm": "𝖒",\n "\\bfrakn": "𝖓",\n "\\bfrako": "𝖔",\n "\\bfrakp": "𝖕",\n "\\bfrakq": "𝖖",\n "\\bfrakr": "𝖗",\n "\\bfraks": "𝖘",\n "\\bfrakt": "𝖙",\n "\\bfraku": "𝖚",\n "\\bfrakv": "𝖛",\n "\\bfrakw": "𝖜",\n "\\bfrakx": "𝖝",\n "\\bfraky": "𝖞",\n "\\bfrakz": "𝖟",\n "\\sansA": "𝖠",\n "\\sansB": "𝖡",\n "\\sansC": "𝖢",\n "\\sansD": "𝖣",\n "\\sansE": "𝖤",\n "\\sansF": "𝖥",\n "\\sansG": "𝖦",\n "\\sansH": "𝖧",\n "\\sansI": "𝖨",\n "\\sansJ": "𝖩",\n "\\sansK": "𝖪",\n "\\sansL": "𝖫",\n "\\sansM": "𝖬",\n "\\sansN": "𝖭",\n "\\sansO": "𝖮",\n "\\sansP": "𝖯",\n "\\sansQ": "𝖰",\n "\\sansR": "𝖱",\n "\\sansS": "𝖲",\n "\\sansT": "𝖳",\n "\\sansU": "𝖴",\n "\\sansV": "𝖵",\n "\\sansW": "𝖶",\n "\\sansX": "𝖷",\n "\\sansY": "𝖸",\n "\\sansZ": "𝖹",\n "\\sansa": "𝖺",\n "\\sansb": "𝖻",\n "\\sansc": "𝖼",\n "\\sansd": "𝖽",\n "\\sanse": "𝖾",\n "\\sansf": "𝖿",\n "\\sansg": "𝗀",\n "\\sansh": "𝗁",\n "\\sansi": "𝗂",\n "\\sansj": "𝗃",\n "\\sansk": "𝗄",\n "\\sansl": "𝗅",\n "\\sansm": "𝗆",\n "\\sansn": "𝗇",\n "\\sanso": "𝗈",\n "\\sansp": "𝗉",\n "\\sansq": "𝗊",\n "\\sansr": "𝗋",\n "\\sanss": "𝗌",\n "\\sanst": "𝗍",\n "\\sansu": "𝗎",\n "\\sansv": "𝗏",\n "\\sansw": "𝗐",\n "\\sansx": "𝗑",\n "\\sansy": "𝗒",\n "\\sansz": "𝗓",\n "\\bsansA": "𝗔",\n "\\bsansB": "𝗕",\n "\\bsansC": "𝗖",\n "\\bsansD": "𝗗",\n "\\bsansE": "𝗘",\n "\\bsansF": "𝗙",\n "\\bsansG": "𝗚",\n "\\bsansH": "𝗛",\n "\\bsansI": "𝗜",\n "\\bsansJ": "𝗝",\n "\\bsansK": "𝗞",\n "\\bsansL": "𝗟",\n "\\bsansM": "𝗠",\n "\\bsansN": "𝗡",\n "\\bsansO": "𝗢",\n "\\bsansP": "𝗣",\n "\\bsansQ": "𝗤",\n "\\bsansR": "𝗥",\n "\\bsansS": "𝗦",\n "\\bsansT": "𝗧",\n "\\bsansU": "𝗨",\n "\\bsansV": "𝗩",\n "\\bsansW": "𝗪",\n "\\bsansX": "𝗫",\n "\\bsansY": "𝗬",\n "\\bsansZ": "𝗭",\n "\\bsansa": "𝗮",\n "\\bsansb": "𝗯",\n "\\bsansc": "𝗰",\n "\\bsansd": "𝗱",\n "\\bsanse": "𝗲",\n "\\bsansf": "𝗳",\n "\\bsansg": "𝗴",\n "\\bsansh": "𝗵",\n "\\bsansi": "𝗶",\n "\\bsansj": "𝗷",\n "\\bsansk": "𝗸",\n "\\bsansl": "𝗹",\n "\\bsansm": "𝗺",\n "\\bsansn": "𝗻",\n "\\bsanso": "𝗼",\n "\\bsansp": "𝗽",\n "\\bsansq": "𝗾",\n "\\bsansr": "𝗿",\n "\\bsanss": "𝘀",\n "\\bsanst": "𝘁",\n "\\bsansu": "𝘂",\n "\\bsansv": "𝘃",\n "\\bsansw": "𝘄",\n "\\bsansx": "𝘅",\n "\\bsansy": "𝘆",\n "\\bsansz": "𝘇",\n "\\isansA": "𝘈",\n "\\isansB": "𝘉",\n "\\isansC": "𝘊",\n "\\isansD": "𝘋",\n "\\isansE": "𝘌",\n "\\isansF": "𝘍",\n "\\isansG": "𝘎",\n "\\isansH": "𝘏",\n "\\isansI": "𝘐",\n "\\isansJ": "𝘑",\n "\\isansK": "𝘒",\n "\\isansL": "𝘓",\n "\\isansM": "𝘔",\n "\\isansN": "𝘕",\n "\\isansO": "𝘖",\n "\\isansP": "𝘗",\n "\\isansQ": "𝘘",\n "\\isansR": "𝘙",\n "\\isansS": "𝘚",\n "\\isansT": "𝘛",\n "\\isansU": "𝘜",\n "\\isansV": "𝘝",\n "\\isansW": "𝘞",\n "\\isansX": "𝘟",\n "\\isansY": "𝘠",\n "\\isansZ": "𝘡",\n "\\isansa": "𝘢",\n "\\isansb": "𝘣",\n "\\isansc": "𝘤",\n "\\isansd": "𝘥",\n "\\isanse": "𝘦",\n "\\isansf": "𝘧",\n "\\isansg": "𝘨",\n "\\isansh": "𝘩",\n "\\isansi": "𝘪",\n "\\isansj": "𝘫",\n "\\isansk": "𝘬",\n "\\isansl": "𝘭",\n "\\isansm": "𝘮",\n "\\isansn": "𝘯",\n "\\isanso": "𝘰",\n "\\isansp": "𝘱",\n "\\isansq": "𝘲",\n "\\isansr": "𝘳",\n "\\isanss": "𝘴",\n "\\isanst": "𝘵",\n "\\isansu": "𝘶",\n "\\isansv": "𝘷",\n "\\isansw": "𝘸",\n "\\isansx": "𝘹",\n "\\isansy": "𝘺",\n "\\isansz": "𝘻",\n "\\bisansA": "𝘼",\n "\\bisansB": "𝘽",\n "\\bisansC": "𝘾",\n "\\bisansD": "𝘿",\n "\\bisansE": "𝙀",\n "\\bisansF": "𝙁",\n "\\bisansG": "𝙂",\n "\\bisansH": "𝙃",\n "\\bisansI": "𝙄",\n "\\bisansJ": "𝙅",\n "\\bisansK": "𝙆",\n "\\bisansL": "𝙇",\n "\\bisansM": "𝙈",\n "\\bisansN": "𝙉",\n "\\bisansO": "𝙊",\n "\\bisansP": "𝙋",\n "\\bisansQ": "𝙌",\n "\\bisansR": "𝙍",\n "\\bisansS": "𝙎",\n "\\bisansT": "𝙏",\n "\\bisansU": "𝙐",\n "\\bisansV": "𝙑",\n "\\bisansW": "𝙒",\n "\\bisansX": "𝙓",\n "\\bisansY": "𝙔",\n "\\bisansZ": "𝙕",\n "\\bisansa": "𝙖",\n "\\bisansb": "𝙗",\n "\\bisansc": "𝙘",\n "\\bisansd": "𝙙",\n "\\bisanse": "𝙚",\n "\\bisansf": "𝙛",\n "\\bisansg": "𝙜",\n "\\bisansh": "𝙝",\n "\\bisansi": "𝙞",\n "\\bisansj": "𝙟",\n "\\bisansk": "𝙠",\n "\\bisansl": "𝙡",\n "\\bisansm": "𝙢",\n "\\bisansn": "𝙣",\n "\\bisanso": "𝙤",\n "\\bisansp": "𝙥",\n "\\bisansq": "𝙦",\n "\\bisansr": "𝙧",\n "\\bisanss": "𝙨",\n "\\bisanst": "𝙩",\n "\\bisansu": "𝙪",\n "\\bisansv": "𝙫",\n "\\bisansw": "𝙬",\n "\\bisansx": "𝙭",\n "\\bisansy": "𝙮",\n "\\bisansz": "𝙯",\n "\\ttA": "𝙰",\n "\\ttB": "𝙱",\n "\\ttC": "𝙲",\n "\\ttD": "𝙳",\n "\\ttE": "𝙴",\n "\\ttF": "𝙵",\n "\\ttG": "𝙶",\n "\\ttH": "𝙷",\n "\\ttI": "𝙸",\n "\\ttJ": "𝙹",\n "\\ttK": "𝙺",\n "\\ttL": "𝙻",\n "\\ttM": "𝙼",\n "\\ttN": "𝙽",\n "\\ttO": "𝙾",\n "\\ttP": "𝙿",\n "\\ttQ": "𝚀",\n "\\ttR": "𝚁",\n "\\ttS": "𝚂",\n "\\ttT": "𝚃",\n "\\ttU": "𝚄",\n "\\ttV": "𝚅",\n "\\ttW": "𝚆",\n "\\ttX": "𝚇",\n "\\ttY": "𝚈",\n "\\ttZ": "𝚉",\n "\\tta": "𝚊",\n "\\ttb": "𝚋",\n "\\ttc": "𝚌",\n "\\ttd": "𝚍",\n "\\tte": "𝚎",\n "\\ttf": "𝚏",\n "\\ttg": "𝚐",\n "\\tth": "𝚑",\n "\\tti": "𝚒",\n "\\ttj": "𝚓",\n "\\ttk": "𝚔",\n "\\ttl": "𝚕",\n "\\ttm": "𝚖",\n "\\ttn": "𝚗",\n "\\tto": "𝚘",\n "\\ttp": "𝚙",\n "\\ttq": "𝚚",\n "\\ttr": "𝚛",\n "\\tts": "𝚜",\n "\\ttt": "𝚝",\n "\\ttu": "𝚞",\n "\\ttv": "𝚟",\n "\\ttw": "𝚠",\n "\\ttx": "𝚡",\n "\\tty": "𝚢",\n "\\ttz": "𝚣",\n "\\bfAlpha": "𝚨",\n "\\bfBeta": "𝚩",\n "\\bfGamma": "𝚪",\n "\\bfDelta": "𝚫",\n "\\bfEpsilon": "𝚬",\n "\\bfZeta": "𝚭",\n "\\bfEta": "𝚮",\n "\\bfTheta": "𝚯",\n "\\bfIota": "𝚰",\n "\\bfKappa": "𝚱",\n "\\bfLambda": "𝚲",\n "\\bfMu": "𝚳",\n "\\bfNu": "𝚴",\n "\\bfXi": "𝚵",\n "\\bfOmicron": "𝚶",\n "\\bfPi": "𝚷",\n "\\bfRho": "𝚸",\n "\\bfvarTheta": "𝚹",\n "\\bfSigma": "𝚺",\n "\\bfTau": "𝚻",\n "\\bfUpsilon": "𝚼",\n "\\bfPhi": "𝚽",\n "\\bfChi": "𝚾",\n "\\bfPsi": "𝚿",\n "\\bfOmega": "𝛀",\n "\\bfalpha": "𝛂",\n "\\bfbeta": "𝛃",\n "\\bfgamma": "𝛄",\n "\\bfdelta": "𝛅",\n "\\bfvarepsilon": "𝛆",\n "\\bfzeta": "𝛇",\n "\\bfeta": "𝛈",\n "\\bftheta": "𝛉",\n "\\bfiota": "𝛊",\n "\\bfkappa": "𝛋",\n "\\bflambda": "𝛌",\n "\\bfmu": "𝛍",\n "\\bfnu": "𝛎",\n "\\bfxi": "𝛏",\n "\\bfomicron": "𝛐",\n "\\bfpi": "𝛑",\n "\\bfrho": "𝛒",\n "\\bfvarsigma": "𝛓",\n "\\bfsigma": "𝛔",\n "\\bftau": "𝛕",\n "\\bfupsilon": "𝛖",\n "\\bfvarphi": "𝛗",\n "\\bfchi": "𝛘",\n "\\bfpsi": "𝛙",\n "\\bfomega": "𝛚",\n "\\bfepsilon": "𝛜",\n "\\bfvartheta": "𝛝",\n "\\bfvarkappa": "𝛞",\n "\\bfphi": "𝛟",\n "\\bfvarrho": "𝛠",\n "\\bfvarpi": "𝛡",\n "\\itAlpha": "𝛢",\n "\\itBeta": "𝛣",\n "\\itGamma": "𝛤",\n "\\itDelta": "𝛥",\n "\\itEpsilon": "𝛦",\n "\\itZeta": "𝛧",\n "\\itEta": "𝛨",\n "\\itTheta": "𝛩",\n "\\itIota": "𝛪",\n "\\itKappa": "𝛫",\n "\\itLambda": "𝛬",\n "\\itMu": "𝛭",\n "\\itNu": "𝛮",\n "\\itXi": "𝛯",\n "\\itOmicron": "𝛰",\n "\\itPi": "𝛱",\n "\\itRho": "𝛲",\n "\\itvarTheta": "𝛳",\n "\\itSigma": "𝛴",\n "\\itTau": "𝛵",\n "\\itUpsilon": "𝛶",\n "\\itPhi": "𝛷",\n "\\itChi": "𝛸",\n "\\itPsi": "𝛹",\n "\\itOmega": "𝛺",\n "\\italpha": "𝛼",\n "\\itbeta": "𝛽",\n "\\itgamma": "𝛾",\n "\\itdelta": "𝛿",\n "\\itvarepsilon": "𝜀",\n "\\itzeta": "𝜁",\n "\\iteta": "𝜂",\n "\\ittheta": "𝜃",\n "\\itiota": "𝜄",\n "\\itkappa": "𝜅",\n "\\itlambda": "𝜆",\n "\\itmu": "𝜇",\n "\\itnu": "𝜈",\n "\\itxi": "𝜉",\n "\\itomicron": "𝜊",\n "\\itpi": "𝜋",\n "\\itrho": "𝜌",\n "\\itvarsigma": "𝜍",\n "\\itsigma": "𝜎",\n "\\ittau": "𝜏",\n "\\itupsilon": "𝜐",\n "\\itvarphi": "𝜑",\n "\\itchi": "𝜒",\n "\\itpsi": "𝜓",\n "\\itomega": "𝜔",\n "\\itepsilon": "𝜖",\n "\\itvartheta": "𝜗",\n "\\itvarkappa": "𝜘",\n "\\itphi": "𝜙",\n "\\itvarrho": "𝜚",\n "\\itvarpi": "𝜛",\n "\\biAlpha": "𝜜",\n "\\biBeta": "𝜝",\n "\\biGamma": "𝜞",\n "\\biDelta": "𝜟",\n "\\biEpsilon": "𝜠",\n "\\biZeta": "𝜡",\n "\\biEta": "𝜢",\n "\\biTheta": "𝜣",\n "\\biIota": "𝜤",\n "\\biKappa": "𝜥",\n "\\biLambda": "𝜦",\n "\\biMu": "𝜧",\n "\\biNu": "𝜨",\n "\\biXi": "𝜩",\n "\\biOmicron": "𝜪",\n "\\biPi": "𝜫",\n "\\biRho": "𝜬",\n "\\bivarTheta": "𝜭",\n "\\biSigma": "𝜮",\n "\\biTau": "𝜯",\n "\\biUpsilon": "𝜰",\n "\\biPhi": "𝜱",\n "\\biChi": "𝜲",\n "\\biPsi": "𝜳",\n "\\biOmega": "𝜴",\n "\\bialpha": "𝜶",\n "\\bibeta": "𝜷",\n "\\bigamma": "𝜸",\n "\\bidelta": "𝜹",\n "\\bivarepsilon": "𝜺",\n "\\bizeta": "𝜻",\n "\\bieta": "𝜼",\n "\\bitheta": "𝜽",\n "\\biiota": "𝜾",\n "\\bikappa": "𝜿",\n "\\bilambda": "𝝀",\n "\\bimu": "𝝁",\n "\\binu": "𝝂",\n "\\bixi": "𝝃",\n "\\biomicron": "𝝄",\n "\\bipi": "𝝅",\n "\\birho": "𝝆",\n "\\bivarsigma": "𝝇",\n "\\bisigma": "𝝈",\n "\\bitau": "𝝉",\n "\\biupsilon": "𝝊",\n "\\bivarphi": "𝝋",\n "\\bichi": "𝝌",\n "\\bipsi": "𝝍",\n "\\biomega": "𝝎",\n "\\biepsilon": "𝝐",\n "\\bivartheta": "𝝑",\n "\\bivarkappa": "𝝒",\n "\\biphi": "𝝓",\n "\\bivarrho": "𝝔",\n "\\bivarpi": "𝝕",\n "\\bsansAlpha": "𝝖",\n "\\bsansBeta": "𝝗",\n "\\bsansGamma": "𝝘",\n "\\bsansDelta": "𝝙",\n "\\bsansEpsilon": "𝝚",\n "\\bsansZeta": "𝝛",\n "\\bsansEta": "𝝜",\n "\\bsansTheta": "𝝝",\n "\\bsansIota": "𝝞",\n "\\bsansKappa": "𝝟",\n "\\bsansLambda": "𝝠",\n "\\bsansMu": "𝝡",\n "\\bsansNu": "𝝢",\n "\\bsansXi": "𝝣",\n "\\bsansOmicron": "𝝤",\n "\\bsansPi": "𝝥",\n "\\bsansRho": "𝝦",\n "\\bsansvarTheta": "𝝧",\n "\\bsansSigma": "𝝨",\n "\\bsansTau": "𝝩",\n "\\bsansUpsilon": "𝝪",\n "\\bsansPhi": "𝝫",\n "\\bsansChi": "𝝬",\n "\\bsansPsi": "𝝭",\n "\\bsansOmega": "𝝮",\n "\\bsansalpha": "𝝰",\n "\\bsansbeta": "𝝱",\n "\\bsansgamma": "𝝲",\n "\\bsansdelta": "𝝳",\n "\\bsansvarepsilon": "𝝴",\n "\\bsanszeta": "𝝵",\n "\\bsanseta": "𝝶",\n "\\bsanstheta": "𝝷",\n "\\bsansiota": "𝝸",\n "\\bsanskappa": "𝝹",\n "\\bsanslambda": "𝝺",\n "\\bsansmu": "𝝻",\n "\\bsansnu": "𝝼",\n "\\bsansxi": "𝝽",\n "\\bsansomicron": "𝝾",\n "\\bsanspi": "𝝿",\n "\\bsansrho": "𝞀",\n "\\bsansvarsigma": "𝞁",\n "\\bsanssigma": "𝞂",\n "\\bsanstau": "𝞃",\n "\\bsansupsilon": "𝞄",\n "\\bsansvarphi": "𝞅",\n "\\bsanschi": "𝞆",\n "\\bsanspsi": "𝞇",\n "\\bsansomega": "𝞈",\n "\\bsansepsilon": "𝞊",\n "\\bsansvartheta": "𝞋",\n "\\bsansvarkappa": "𝞌",\n "\\bsansphi": "𝞍",\n "\\bsansvarrho": "𝞎",\n "\\bsansvarpi": "𝞏",\n "\\bisansAlpha": "𝞐",\n "\\bisansBeta": "𝞑",\n "\\bisansGamma": "𝞒",\n "\\bisansDelta": "𝞓",\n "\\bisansEpsilon": "𝞔",\n "\\bisansZeta": "𝞕",\n "\\bisansEta": "𝞖",\n "\\bisansTheta": "𝞗",\n "\\bisansIota": "𝞘",\n "\\bisansKappa": "𝞙",\n "\\bisansLambda": "𝞚",\n "\\bisansMu": "𝞛",\n "\\bisansNu": "𝞜",\n "\\bisansXi": "𝞝",\n "\\bisansOmicron": "𝞞",\n "\\bisansPi": "𝞟",\n "\\bisansRho": "𝞠",\n "\\bisansvarTheta": "𝞡",\n "\\bisansSigma": "𝞢",\n "\\bisansTau": "𝞣",\n "\\bisansUpsilon": "𝞤",\n "\\bisansPhi": "𝞥",\n "\\bisansChi": "𝞦",\n "\\bisansPsi": "𝞧",\n "\\bisansOmega": "𝞨",\n "\\bisansalpha": "𝞪",\n "\\bisansbeta": "𝞫",\n "\\bisansgamma": "𝞬",\n "\\bisansdelta": "𝞭",\n "\\bisansvarepsilon": "𝞮",\n "\\bisanszeta": "𝞯",\n "\\bisanseta": "𝞰",\n "\\bisanstheta": "𝞱",\n "\\bisansiota": "𝞲",\n "\\bisanskappa": "𝞳",\n "\\bisanslambda": "𝞴",\n "\\bisansmu": "𝞵",\n "\\bisansnu": "𝞶",\n "\\bisansxi": "𝞷",\n "\\bisansomicron": "𝞸",\n "\\bisanspi": "𝞹",\n "\\bisansrho": "𝞺",\n "\\bisansvarsigma": "𝞻",\n "\\bisanssigma": "𝞼",\n "\\bisanstau": "𝞽",\n "\\bisansupsilon": "𝞾",\n "\\bisansvarphi": "𝞿",\n "\\bisanschi": "𝟀",\n "\\bisanspsi": "𝟁",\n "\\bisansomega": "𝟂",\n "\\bisansepsilon": "𝟄",\n "\\bisansvartheta": "𝟅",\n "\\bisansvarkappa": "𝟆",\n "\\bisansphi": "𝟇",\n "\\bisansvarrho": "𝟈",\n "\\bisansvarpi": "𝟉",\n "\\bfzero": "𝟎",\n "\\bfone": "𝟏",\n "\\bftwo": "𝟐",\n "\\bfthree": "𝟑",\n "\\bffour": "𝟒",\n "\\bffive": "𝟓",\n "\\bfsix": "𝟔",\n "\\bfseven": "𝟕",\n "\\bfeight": "𝟖",\n "\\bfnine": "𝟗",\n "\\bbzero": "𝟘",\n "\\bbone": "𝟙",\n "\\bbtwo": "𝟚",\n "\\bbthree": "𝟛",\n "\\bbfour": "𝟜",\n "\\bbfive": "𝟝",\n "\\bbsix": "𝟞",\n "\\bbseven": "𝟟",\n "\\bbeight": "𝟠",\n "\\bbnine": "𝟡",\n "\\sanszero": "𝟢",\n "\\sansone": "𝟣",\n "\\sanstwo": "𝟤",\n "\\sansthree": "𝟥",\n "\\sansfour": "𝟦",\n "\\sansfive": "𝟧",\n "\\sanssix": "𝟨",\n "\\sansseven": "𝟩",\n "\\sanseight": "𝟪",\n "\\sansnine": "𝟫",\n "\\bsanszero": "𝟬",\n "\\bsansone": "𝟭",\n "\\bsanstwo": "𝟮",\n "\\bsansthree": "𝟯",\n "\\bsansfour": "𝟰",\n "\\bsansfive": "𝟱",\n "\\bsanssix": "𝟲",\n "\\bsansseven": "𝟳",\n "\\bsanseight": "𝟴",\n "\\bsansnine": "𝟵",\n "\\ttzero": "𝟶",\n "\\ttone": "𝟷",\n "\\tttwo": "𝟸",\n "\\ttthree": "𝟹",\n "\\ttfour": "𝟺",\n "\\ttfive": "𝟻",\n "\\ttsix": "𝟼",\n "\\ttseven": "𝟽",\n "\\tteight": "𝟾",\n "\\ttnine": "𝟿",\n "\\underbar": "̲",\n "\\underleftrightarrow": "͍",\n}\n\n\nreverse_latex_symbol = {v: k for k, v in latex_symbols.items()}\n
.venv\Lib\site-packages\IPython\core\latex_symbols.py
latex_symbols.py
Python
30,127
0.8
0.000766
0.005385
vue-tools
500
2024-04-15T11:34:26.169526
Apache-2.0
false
747dbbdc885104d1394e4b67b758a122
"""Logger class for IPython's logging facilities.\n"""\n\n#*****************************************************************************\n# Copyright (C) 2001 Janko Hauser <jhauser@zscout.de> and\n# Copyright (C) 2001-2006 Fernando Perez <fperez@colorado.edu>\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#*****************************************************************************\n\n#****************************************************************************\n# Modules and globals\n\n# Python standard modules\nimport glob\nimport io\nimport logging\nimport os\nimport time\n\n\n# prevent jedi/parso's debug messages pipe into interactiveshell\nlogging.getLogger("parso").setLevel(logging.WARNING)\n\n#****************************************************************************\n# FIXME: This class isn't a mixin anymore, but it still needs attributes from\n# ipython and does input cache management. Finish cleanup later...\n\nclass Logger:\n """A Logfile class with different policies for file creation"""\n\n def __init__(self, home_dir, logfname='Logger.log', loghead=u'',\n logmode='over'):\n\n # this is the full ipython instance, we need some attributes from it\n # which won't exist until later. What a mess, clean up later...\n self.home_dir = home_dir\n\n self.logfname = logfname\n self.loghead = loghead\n self.logmode = logmode\n self.logfile = None\n\n # Whether to log raw or processed input\n self.log_raw_input = False\n\n # whether to also log output\n self.log_output = False\n\n # whether to put timestamps before each log entry\n self.timestamp = False\n\n # activity control flags\n self.log_active = False\n\n # logmode is a validated property\n def _set_mode(self,mode):\n if mode not in ['append','backup','global','over','rotate']:\n raise ValueError('invalid log mode %s given' % mode)\n self._logmode = mode\n\n def _get_mode(self):\n return self._logmode\n\n logmode = property(_get_mode,_set_mode)\n\n def logstart(self, logfname=None, loghead=None, logmode=None,\n log_output=False, timestamp=False, log_raw_input=False):\n """Generate a new log-file with a default header.\n\n Raises RuntimeError if the log has already been started"""\n\n if self.logfile is not None:\n raise RuntimeError('Log file is already active: %s' %\n self.logfname)\n\n # The parameters can override constructor defaults\n if logfname is not None: self.logfname = logfname\n if loghead is not None: self.loghead = loghead\n if logmode is not None: self.logmode = logmode\n\n # Parameters not part of the constructor\n self.timestamp = timestamp\n self.log_output = log_output\n self.log_raw_input = log_raw_input\n\n # init depending on the log mode requested\n isfile = os.path.isfile\n logmode = self.logmode\n\n if logmode == 'append':\n self.logfile = io.open(self.logfname, 'a', encoding='utf-8')\n\n elif logmode == 'backup':\n if isfile(self.logfname):\n backup_logname = self.logfname+'~'\n # Manually remove any old backup, since os.rename may fail\n # under Windows.\n if isfile(backup_logname):\n os.remove(backup_logname)\n os.rename(self.logfname,backup_logname)\n self.logfile = io.open(self.logfname, 'w', encoding='utf-8')\n\n elif logmode == 'global':\n self.logfname = os.path.join(self.home_dir,self.logfname)\n self.logfile = io.open(self.logfname, 'a', encoding='utf-8')\n\n elif logmode == 'over':\n if isfile(self.logfname):\n os.remove(self.logfname)\n self.logfile = io.open(self.logfname,'w', encoding='utf-8')\n\n elif logmode == 'rotate':\n if isfile(self.logfname):\n if isfile(self.logfname+'.001~'):\n old = glob.glob(self.logfname+'.*~')\n old.sort()\n old.reverse()\n for f in old:\n root, ext = os.path.splitext(f)\n num = int(ext[1:-1])+1\n os.rename(f, root+'.'+repr(num).zfill(3)+'~')\n os.rename(self.logfname, self.logfname+'.001~')\n self.logfile = io.open(self.logfname, 'w', encoding='utf-8')\n\n if logmode != 'append':\n self.logfile.write(self.loghead)\n\n self.logfile.flush()\n self.log_active = True\n\n def switch_log(self,val):\n """Switch logging on/off. val should be ONLY a boolean."""\n\n if val not in [False,True,0,1]:\n raise ValueError('Call switch_log ONLY with a boolean argument, '\n 'not with: %s' % val)\n\n label = {0:'OFF',1:'ON',False:'OFF',True:'ON'}\n\n if self.logfile is None:\n print("""\nLogging hasn't been started yet (use logstart for that).\n\n%logon/%logoff are for temporarily starting and stopping logging for a logfile\nwhich already exists. But you must first start the logging process with\n%logstart (optionally giving a logfile name).""")\n\n else:\n if self.log_active == val:\n print('Logging is already',label[val])\n else:\n print('Switching logging',label[val])\n self.log_active = not self.log_active\n self.log_active_out = self.log_active\n\n def logstate(self):\n """Print a status message about the logger."""\n if self.logfile is None:\n print('Logging has not been activated.')\n else:\n state = self.log_active and 'active' or 'temporarily suspended'\n print('Filename :', self.logfname)\n print('Mode :', self.logmode)\n print('Output logging :', self.log_output)\n print('Raw input log :', self.log_raw_input)\n print('Timestamping :', self.timestamp)\n print('State :', state)\n\n def log(self, line_mod, line_ori):\n """Write the sources to a log.\n\n Inputs:\n\n - line_mod: possibly modified input, such as the transformations made\n by input prefilters or input handlers of various kinds. This should\n always be valid Python.\n\n - line_ori: unmodified input line from the user. This is not\n necessarily valid Python.\n """\n\n # Write the log line, but decide which one according to the\n # log_raw_input flag, set when the log is started.\n if self.log_raw_input:\n self.log_write(line_ori)\n else:\n self.log_write(line_mod)\n\n def log_write(self, data, kind='input'):\n """Write data to the log file, if active"""\n\n # print('data: %r' % data) # dbg\n if self.log_active and data:\n write = self.logfile.write\n if kind=='input':\n if self.timestamp:\n write(time.strftime('# %a, %d %b %Y %H:%M:%S\n', time.localtime()))\n write(data)\n elif kind=='output' and self.log_output:\n odata = u'\n'.join([u'#[Out]# %s' % s\n for s in data.splitlines()])\n write(u'%s\n' % odata)\n try:\n self.logfile.flush()\n except OSError:\n print("Failed to flush the log file.")\n print(\n f"Please check that {self.logfname} exists and have the right permissions."\n )\n print(\n "Also consider turning off the log with `%logstop` to avoid this warning."\n )\n\n def logstop(self):\n """Fully stop logging and close log file.\n\n In order to start logging again, a new logstart() call needs to be\n made, possibly (though not necessarily) with a new filename, mode and\n other options."""\n\n if self.logfile is not None:\n self.logfile.close()\n self.logfile = None\n else:\n print("Logging hadn't been started.")\n self.log_active = False\n\n # For backwards compatibility, in case anyone was using this.\n close_log = logstop\n
.venv\Lib\site-packages\IPython\core\logger.py
logger.py
Python
8,436
0.95
0.190476
0.163934
react-lib
377
2023-12-11T06:12:45.498784
Apache-2.0
false
8a0cf025ef50eced6e3118f186a7f6bd
"""Support for interactive macros in IPython"""\n\n#*****************************************************************************\n# Copyright (C) 2001-2005 Fernando Perez <fperez@colorado.edu>\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#*****************************************************************************\n\nimport re\n\nfrom IPython.utils.encoding import DEFAULT_ENCODING\n\ncoding_declaration = re.compile(r"#\s*coding[:=]\s*([-\w.]+)")\n\nclass Macro:\n """Simple class to store the value of macros as strings.\n\n Macro is just a callable that executes a string of IPython\n input when called.\n """\n\n def __init__(self,code):\n """store the macro value, as a single string which can be executed"""\n lines = []\n enc = None\n for line in code.splitlines():\n coding_match = coding_declaration.match(line)\n if coding_match:\n enc = coding_match.group(1)\n else:\n lines.append(line)\n code = "\n".join(lines)\n if isinstance(code, bytes):\n code = code.decode(enc or DEFAULT_ENCODING)\n self.value = code + '\n'\n \n def __str__(self):\n return self.value\n\n def __repr__(self):\n return 'IPython.macro.Macro(%s)' % repr(self.value)\n \n def __getstate__(self):\n """ needed for safe pickling via %store """\n return {'value': self.value}\n \n def __add__(self, other):\n if isinstance(other, Macro):\n return Macro(self.value + other.value)\n elif isinstance(other, str):\n return Macro(self.value + other)\n raise TypeError\n
.venv\Lib\site-packages\IPython\core\macro.py
macro.py
Python
1,726
0.95
0.245283
0.142857
vue-tools
270
2024-04-04T01:16:44.362444
GPL-3.0
false
561067e488c9887cd6957e76d94aebef
# -*- coding: utf-8 -*-\n"""Payload system for IPython.\n\nAuthors:\n\n* Fernando Perez\n* Brian Granger\n"""\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2008-2011 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\nfrom traitlets.config.configurable import Configurable\nfrom traitlets import List\n\n#-----------------------------------------------------------------------------\n# Main payload class\n#-----------------------------------------------------------------------------\n\nclass PayloadManager(Configurable):\n _payload: List = List([])\n\n def write_payload(self, data, single=True):\n """Include or update the specified `data` payload in the PayloadManager.\n\n If a previous payload with the same source exists and `single` is True,\n it will be overwritten with the new one.\n """\n\n if not isinstance(data, dict):\n raise TypeError('Each payload write must be a dict, got: %r' % data)\n\n if single and 'source' in data:\n source = data['source']\n for i, pl in enumerate(self._payload):\n if 'source' in pl and pl['source'] == source:\n self._payload[i] = data\n return\n\n self._payload.append(data)\n\n def read_payload(self):\n return self._payload\n\n def clear_payload(self):\n self._payload = []\n
.venv\Lib\site-packages\IPython\core\payload.py
payload.py
Python
1,763
0.95
0.185185
0.375
node-utils
333
2024-10-13T18:03:41.953346
Apache-2.0
false
4f28b4db0a11f9aa8300d5c36bafe042
"""A payload based version of page."""\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nimport warnings\nfrom IPython.core.getipython import get_ipython\n\n# see https://github.com/ipython/ipykernel/issues/1304\n# this should be moved to ipykernel and removed in the long run.\n\n\ndef page(strng, start=0, screen_lines=0, pager_cmd=None):\n """Print a string, piping through a pager.\n\n This version ignores the screen_lines and pager_cmd arguments and uses\n IPython's payload system instead.\n\n Parameters\n ----------\n strng : str or mime-dict\n Text to page, or a mime-type keyed dict of already formatted data.\n start : int\n Starting line at which to place the display.\n """\n\n # Some routines may auto-compute start offsets incorrectly and pass a\n # negative value. Offset to 0 for robustness.\n start = max(0, start)\n shell = get_ipython()\n\n if isinstance(strng, dict):\n data = strng\n else:\n data = {"text/plain": strng}\n payload = dict(\n source="page",\n data=data,\n start=start,\n )\n shell.payload_manager.write_payload(payload)\n
.venv\Lib\site-packages\IPython\core\payloadpage.py
payloadpage.py
Python
1,177
0.95
0.073171
0.1875
node-utils
372
2024-04-20T21:50:59.789943
GPL-3.0
false
71e3e313fc6bdcc21e62f31c328601f7
# encoding: utf-8\n"""\nPrefiltering components.\n\nPrefilters transform user input before it is exec'd by Python. These\ntransforms are used to implement additional syntax such as !ls and %magic.\n"""\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nfrom keyword import iskeyword\nimport re\n\nfrom .autocall import IPyAutocall\nfrom traitlets.config.configurable import Configurable\nfrom .inputtransformer2 import (\n ESC_MAGIC,\n ESC_QUOTE,\n ESC_QUOTE2,\n ESC_PAREN,\n)\nfrom .macro import Macro\nfrom .splitinput import LineInfo\n\nfrom traitlets import (\n List, Integer, Unicode, Bool, Instance, CRegExp\n)\n\n#-----------------------------------------------------------------------------\n# Global utilities, errors and constants\n#-----------------------------------------------------------------------------\n\n\nclass PrefilterError(Exception):\n pass\n\n\n# RegExp to identify potential function names\nre_fun_name = re.compile(r'[^\W\d]([\w.]*) *$')\n\n# RegExp to exclude strings with this start from autocalling. In\n# particular, all binary operators should be excluded, so that if foo is\n# callable, foo OP bar doesn't become foo(OP bar), which is invalid. The\n# characters '!=()' don't need to be checked for, as the checkPythonChars\n# routine explicitly does so, to catch direct calls and rebindings of\n# existing names.\n\n# Warning: the '-' HAS TO BE AT THE END of the first group, otherwise\n# it affects the rest of the group in square brackets.\nre_exclude_auto = re.compile(r'^[,&^\|\*/\+-]'\n r'|^is |^not |^in |^and |^or ')\n\n# try to catch also methods for stuff in lists/tuples/dicts: off\n# (experimental). For this to work, the line_split regexp would need\n# to be modified so it wouldn't break things at '['. That line is\n# nasty enough that I shouldn't change it until I can test it _well_.\n#self.re_fun_name = re.compile (r'[a-zA-Z_]([a-zA-Z0-9_.\[\]]*) ?$')\n\n\n# Handler Check Utilities\ndef is_shadowed(identifier, ip):\n """Is the given identifier defined in one of the namespaces which shadow\n the alias and magic namespaces? Note that an identifier is different\n than ifun, because it can not contain a '.' character."""\n # This is much safer than calling ofind, which can change state\n return (identifier in ip.user_ns \\n or identifier in ip.user_global_ns \\n or identifier in ip.ns_table['builtin']\\n or iskeyword(identifier))\n\n\n#-----------------------------------------------------------------------------\n# Main Prefilter manager\n#-----------------------------------------------------------------------------\n\n\nclass PrefilterManager(Configurable):\n """Main prefilter component.\n\n The IPython prefilter is run on all user input before it is run. The\n prefilter consumes lines of input and produces transformed lines of\n input.\n\n The implementation consists of two phases:\n\n 1. Transformers\n 2. Checkers and handlers\n\n Over time, we plan on deprecating the checkers and handlers and doing\n everything in the transformers.\n\n The transformers are instances of :class:`PrefilterTransformer` and have\n a single method :meth:`transform` that takes a line and returns a\n transformed line. The transformation can be accomplished using any\n tool, but our current ones use regular expressions for speed.\n\n After all the transformers have been run, the line is fed to the checkers,\n which are instances of :class:`PrefilterChecker`. The line is passed to\n the :meth:`check` method, which either returns `None` or a\n :class:`PrefilterHandler` instance. If `None` is returned, the other\n checkers are tried. If an :class:`PrefilterHandler` instance is returned,\n the line is passed to the :meth:`handle` method of the returned\n handler and no further checkers are tried.\n\n Both transformers and checkers have a `priority` attribute, that determines\n the order in which they are called. Smaller priorities are tried first.\n\n Both transformers and checkers also have `enabled` attribute, which is\n a boolean that determines if the instance is used.\n\n Users or developers can change the priority or enabled attribute of\n transformers or checkers, but they must call the :meth:`sort_checkers`\n or :meth:`sort_transformers` method after changing the priority.\n """\n\n multi_line_specials = Bool(True).tag(config=True)\n shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)\n\n def __init__(self, shell=None, **kwargs):\n super(PrefilterManager, self).__init__(shell=shell, **kwargs)\n self.shell = shell\n self._transformers = []\n self.init_handlers()\n self.init_checkers()\n\n #-------------------------------------------------------------------------\n # API for managing transformers\n #-------------------------------------------------------------------------\n\n def sort_transformers(self):\n """Sort the transformers by priority.\n\n This must be called after the priority of a transformer is changed.\n The :meth:`register_transformer` method calls this automatically.\n """\n self._transformers.sort(key=lambda x: x.priority)\n\n @property\n def transformers(self):\n """Return a list of checkers, sorted by priority."""\n return self._transformers\n\n def register_transformer(self, transformer):\n """Register a transformer instance."""\n if transformer not in self._transformers:\n self._transformers.append(transformer)\n self.sort_transformers()\n\n def unregister_transformer(self, transformer):\n """Unregister a transformer instance."""\n if transformer in self._transformers:\n self._transformers.remove(transformer)\n\n #-------------------------------------------------------------------------\n # API for managing checkers\n #-------------------------------------------------------------------------\n\n def init_checkers(self):\n """Create the default checkers."""\n self._checkers = []\n for checker in _default_checkers:\n checker(\n shell=self.shell, prefilter_manager=self, parent=self\n )\n\n def sort_checkers(self):\n """Sort the checkers by priority.\n\n This must be called after the priority of a checker is changed.\n The :meth:`register_checker` method calls this automatically.\n """\n self._checkers.sort(key=lambda x: x.priority)\n\n @property\n def checkers(self):\n """Return a list of checkers, sorted by priority."""\n return self._checkers\n\n def register_checker(self, checker):\n """Register a checker instance."""\n if checker not in self._checkers:\n self._checkers.append(checker)\n self.sort_checkers()\n\n def unregister_checker(self, checker):\n """Unregister a checker instance."""\n if checker in self._checkers:\n self._checkers.remove(checker)\n\n #-------------------------------------------------------------------------\n # API for managing handlers\n #-------------------------------------------------------------------------\n\n def init_handlers(self):\n """Create the default handlers."""\n self._handlers = {}\n self._esc_handlers = {}\n for handler in _default_handlers:\n handler(\n shell=self.shell, prefilter_manager=self, parent=self\n )\n\n @property\n def handlers(self):\n """Return a dict of all the handlers."""\n return self._handlers\n\n def register_handler(self, name, handler, esc_strings):\n """Register a handler instance by name with esc_strings."""\n self._handlers[name] = handler\n for esc_str in esc_strings:\n self._esc_handlers[esc_str] = handler\n\n def unregister_handler(self, name, handler, esc_strings):\n """Unregister a handler instance by name with esc_strings."""\n try:\n del self._handlers[name]\n except KeyError:\n pass\n for esc_str in esc_strings:\n h = self._esc_handlers.get(esc_str)\n if h is handler:\n del self._esc_handlers[esc_str]\n\n def get_handler_by_name(self, name):\n """Get a handler by its name."""\n return self._handlers.get(name)\n\n def get_handler_by_esc(self, esc_str):\n """Get a handler by its escape string."""\n return self._esc_handlers.get(esc_str)\n\n #-------------------------------------------------------------------------\n # Main prefiltering API\n #-------------------------------------------------------------------------\n\n def prefilter_line_info(self, line_info):\n """Prefilter a line that has been converted to a LineInfo object.\n\n This implements the checker/handler part of the prefilter pipe.\n """\n # print("prefilter_line_info: ", line_info)\n handler = self.find_handler(line_info)\n return handler.handle(line_info)\n\n def find_handler(self, line_info):\n """Find a handler for the line_info by trying checkers."""\n for checker in self.checkers:\n if checker.enabled:\n handler = checker.check(line_info)\n if handler:\n return handler\n return self.get_handler_by_name('normal')\n\n def transform_line(self, line, continue_prompt):\n """Calls the enabled transformers in order of increasing priority."""\n for transformer in self.transformers:\n if transformer.enabled:\n line = transformer.transform(line, continue_prompt)\n return line\n\n def prefilter_line(self, line, continue_prompt=False):\n """Prefilter a single input line as text.\n\n This method prefilters a single line of text by calling the\n transformers and then the checkers/handlers.\n """\n\n # print("prefilter_line: ", line, continue_prompt)\n # All handlers *must* return a value, even if it's blank ('').\n\n # save the line away in case we crash, so the post-mortem handler can\n # record it\n self.shell._last_input_line = line\n\n if not line:\n # Return immediately on purely empty lines, so that if the user\n # previously typed some whitespace that started a continuation\n # prompt, he can break out of that loop with just an empty line.\n # This is how the default python prompt works.\n return ''\n\n # At this point, we invoke our transformers.\n if not continue_prompt or (continue_prompt and self.multi_line_specials):\n line = self.transform_line(line, continue_prompt)\n\n # Now we compute line_info for the checkers and handlers\n line_info = LineInfo(line, continue_prompt)\n\n # the input history needs to track even empty lines\n stripped = line.strip()\n\n normal_handler = self.get_handler_by_name('normal')\n if not stripped:\n return normal_handler.handle(line_info)\n\n # special handlers are only allowed for single line statements\n if continue_prompt and not self.multi_line_specials:\n return normal_handler.handle(line_info)\n\n prefiltered = self.prefilter_line_info(line_info)\n # print("prefiltered line: %r" % prefiltered)\n return prefiltered\n\n def prefilter_lines(self, lines, continue_prompt=False):\n """Prefilter multiple input lines of text.\n\n This is the main entry point for prefiltering multiple lines of\n input. This simply calls :meth:`prefilter_line` for each line of\n input.\n\n This covers cases where there are multiple lines in the user entry,\n which is the case when the user goes back to a multiline history\n entry and presses enter.\n """\n llines = lines.rstrip('\n').split('\n')\n # We can get multiple lines in one shot, where multiline input 'blends'\n # into one line, in cases like recalling from the readline history\n # buffer. We need to make sure that in such cases, we correctly\n # communicate downstream which line is first and which are continuation\n # ones.\n if len(llines) > 1:\n out = '\n'.join([self.prefilter_line(line, lnum>0)\n for lnum, line in enumerate(llines) ])\n else:\n out = self.prefilter_line(llines[0], continue_prompt)\n\n return out\n\n#-----------------------------------------------------------------------------\n# Prefilter transformers\n#-----------------------------------------------------------------------------\n\n\nclass PrefilterTransformer(Configurable):\n """Transform a line of user input."""\n\n priority = Integer(100).tag(config=True)\n # Transformers don't currently use shell or prefilter_manager, but as we\n # move away from checkers and handlers, they will need them.\n shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)\n prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager', allow_none=True)\n enabled = Bool(True).tag(config=True)\n\n def __init__(self, shell=None, prefilter_manager=None, **kwargs):\n super(PrefilterTransformer, self).__init__(\n shell=shell, prefilter_manager=prefilter_manager, **kwargs\n )\n self.prefilter_manager.register_transformer(self)\n\n def transform(self, line, continue_prompt):\n """Transform a line, returning the new one."""\n return None\n\n def __repr__(self):\n return "<%s(priority=%r, enabled=%r)>" % (\n self.__class__.__name__, self.priority, self.enabled)\n\n\n#-----------------------------------------------------------------------------\n# Prefilter checkers\n#-----------------------------------------------------------------------------\n\n\nclass PrefilterChecker(Configurable):\n """Inspect an input line and return a handler for that line."""\n\n priority = Integer(100).tag(config=True)\n shell = Instance('IPython.core.interactiveshell.InteractiveShellABC', allow_none=True)\n prefilter_manager = Instance('IPython.core.prefilter.PrefilterManager', allow_none=True)\n enabled = Bool(True).tag(config=True)\n\n def __init__(self, shell=None, prefilter_manager=None, **kwargs):\n super(PrefilterChecker, self).__init__(\n shell=shell, prefilter_manager=prefilter_manager, **kwargs\n )\n self.prefilter_manager.register_checker(self)\n\n def check(self, line_info):\n """Inspect line_info and return a handler instance or None."""\n return None\n\n def __repr__(self):\n return "<%s(priority=%r, enabled=%r)>" % (\n self.__class__.__name__, self.priority, self.enabled)\n\n\nclass EmacsChecker(PrefilterChecker):\n\n priority = Integer(100).tag(config=True)\n enabled = Bool(False).tag(config=True)\n\n def check(self, line_info):\n "Emacs ipython-mode tags certain input lines."\n if line_info.line.endswith('# PYTHON-MODE'):\n return self.prefilter_manager.get_handler_by_name('emacs')\n else:\n return None\n\n\nclass MacroChecker(PrefilterChecker):\n\n priority = Integer(250).tag(config=True)\n\n def check(self, line_info):\n obj = self.shell.user_ns.get(line_info.ifun)\n if isinstance(obj, Macro):\n return self.prefilter_manager.get_handler_by_name('macro')\n else:\n return None\n\n\nclass IPyAutocallChecker(PrefilterChecker):\n\n priority = Integer(300).tag(config=True)\n\n def check(self, line_info):\n "Instances of IPyAutocall in user_ns get autocalled immediately"\n obj = self.shell.user_ns.get(line_info.ifun, None)\n if isinstance(obj, IPyAutocall):\n obj.set_ip(self.shell)\n return self.prefilter_manager.get_handler_by_name('auto')\n else:\n return None\n\n\nclass AssignmentChecker(PrefilterChecker):\n\n priority = Integer(600).tag(config=True)\n\n def check(self, line_info):\n """Check to see if user is assigning to a var for the first time, in\n which case we want to avoid any sort of automagic / autocall games.\n\n This allows users to assign to either alias or magic names true python\n variables (the magic/alias systems always take second seat to true\n python code). E.g. ls='hi', or ls,that=1,2"""\n if line_info.the_rest:\n if line_info.the_rest[0] in '=,':\n return self.prefilter_manager.get_handler_by_name('normal')\n else:\n return None\n\n\nclass AutoMagicChecker(PrefilterChecker):\n\n priority = Integer(700).tag(config=True)\n\n def check(self, line_info):\n """If the ifun is magic, and automagic is on, run it. Note: normal,\n non-auto magic would already have been triggered via '%' in\n check_esc_chars. This just checks for automagic. Also, before\n triggering the magic handler, make sure that there is nothing in the\n user namespace which could shadow it."""\n if not self.shell.automagic or not self.shell.find_magic(line_info.ifun):\n return None\n\n # We have a likely magic method. Make sure we should actually call it.\n if line_info.continue_prompt and not self.prefilter_manager.multi_line_specials:\n return None\n\n head = line_info.ifun.split('.',1)[0]\n if is_shadowed(head, self.shell):\n return None\n\n return self.prefilter_manager.get_handler_by_name('magic')\n\n\nclass PythonOpsChecker(PrefilterChecker):\n\n priority = Integer(900).tag(config=True)\n\n def check(self, line_info):\n """If the 'rest' of the line begins with a function call or pretty much\n any python operator, we should simply execute the line (regardless of\n whether or not there's a possible autocall expansion). This avoids\n spurious (and very confusing) geattr() accesses."""\n if line_info.the_rest and line_info.the_rest[0] in "!=()<>,+*/%^&|":\n return self.prefilter_manager.get_handler_by_name("normal")\n else:\n return None\n\n\nclass AutocallChecker(PrefilterChecker):\n\n priority = Integer(1000).tag(config=True)\n\n function_name_regexp = CRegExp(re_fun_name,\n help="RegExp to identify potential function names."\n ).tag(config=True)\n exclude_regexp = CRegExp(re_exclude_auto,\n help="RegExp to exclude strings with this start from autocalling."\n ).tag(config=True)\n\n def check(self, line_info):\n "Check if the initial word/function is callable and autocall is on."\n if not self.shell.autocall:\n return None\n\n oinfo = line_info.ofind(self.shell) # This can mutate state via getattr\n if not oinfo.found:\n return None\n\n ignored_funs = ['b', 'f', 'r', 'u', 'br', 'rb', 'fr', 'rf']\n ifun = line_info.ifun\n line = line_info.line\n if ifun.lower() in ignored_funs and (line.startswith(ifun + "'") or line.startswith(ifun + '"')):\n return None\n\n if (\n callable(oinfo.obj)\n and (not self.exclude_regexp.match(line_info.the_rest))\n and self.function_name_regexp.match(line_info.ifun)\n and (\n line_info.raw_the_rest.startswith(" ")\n or not line_info.raw_the_rest.strip()\n )\n ):\n return self.prefilter_manager.get_handler_by_name("auto")\n else:\n return None\n\n\n#-----------------------------------------------------------------------------\n# Prefilter handlers\n#-----------------------------------------------------------------------------\n\n\nclass PrefilterHandler(Configurable):\n handler_name = Unicode("normal")\n esc_strings: List = List([])\n shell = Instance(\n "IPython.core.interactiveshell.InteractiveShellABC", allow_none=True\n )\n prefilter_manager = Instance(\n "IPython.core.prefilter.PrefilterManager", allow_none=True\n )\n\n def __init__(self, shell=None, prefilter_manager=None, **kwargs):\n super(PrefilterHandler, self).__init__(\n shell=shell, prefilter_manager=prefilter_manager, **kwargs\n )\n self.prefilter_manager.register_handler(\n self.handler_name,\n self,\n self.esc_strings\n )\n\n def handle(self, line_info):\n # print("normal: ", line_info)\n """Handle normal input lines. Use as a template for handlers."""\n\n # With autoindent on, we need some way to exit the input loop, and I\n # don't want to force the user to have to backspace all the way to\n # clear the line. The rule will be in this case, that either two\n # lines of pure whitespace in a row, or a line of pure whitespace but\n # of a size different to the indent level, will exit the input loop.\n line = line_info.line\n continue_prompt = line_info.continue_prompt\n\n if (continue_prompt and\n self.shell.autoindent and\n line.isspace() and\n 0 < abs(len(line) - self.shell.indent_current_nsp) <= 2):\n line = ''\n\n return line\n\n def __str__(self):\n return "<%s(name=%s)>" % (self.__class__.__name__, self.handler_name)\n\n\nclass MacroHandler(PrefilterHandler):\n handler_name = Unicode("macro")\n\n def handle(self, line_info):\n obj = self.shell.user_ns.get(line_info.ifun)\n pre_space = line_info.pre_whitespace\n line_sep = "\n" + pre_space\n return pre_space + line_sep.join(obj.value.splitlines())\n\n\nclass MagicHandler(PrefilterHandler):\n\n handler_name = Unicode('magic')\n esc_strings = List([ESC_MAGIC])\n\n def handle(self, line_info):\n """Execute magic functions."""\n ifun = line_info.ifun\n the_rest = line_info.the_rest\n #Prepare arguments for get_ipython().run_line_magic(magic_name, magic_args)\n t_arg_s = ifun + " " + the_rest\n t_magic_name, _, t_magic_arg_s = t_arg_s.partition(' ')\n t_magic_name = t_magic_name.lstrip(ESC_MAGIC)\n cmd = '%sget_ipython().run_line_magic(%r, %r)' % (line_info.pre_whitespace, t_magic_name, t_magic_arg_s)\n return cmd\n\n\nclass AutoHandler(PrefilterHandler):\n\n handler_name = Unicode('auto')\n esc_strings = List([ESC_PAREN, ESC_QUOTE, ESC_QUOTE2])\n\n def handle(self, line_info):\n """Handle lines which can be auto-executed, quoting if requested."""\n line = line_info.line\n ifun = line_info.ifun\n the_rest = line_info.the_rest\n esc = line_info.esc\n continue_prompt = line_info.continue_prompt\n obj = line_info.ofind(self.shell).obj\n\n # This should only be active for single-line input!\n if continue_prompt:\n return line\n\n force_auto = isinstance(obj, IPyAutocall)\n\n # User objects sometimes raise exceptions on attribute access other\n # than AttributeError (we've seen it in the past), so it's safest to be\n # ultra-conservative here and catch all.\n try:\n auto_rewrite = obj.rewrite\n except Exception:\n auto_rewrite = True\n\n if esc == ESC_QUOTE:\n # Auto-quote splitting on whitespace\n newcmd = '%s("%s")' % (ifun,'", "'.join(the_rest.split()) )\n elif esc == ESC_QUOTE2:\n # Auto-quote whole string\n newcmd = '%s("%s")' % (ifun,the_rest)\n elif esc == ESC_PAREN:\n newcmd = '%s(%s)' % (ifun,",".join(the_rest.split()))\n else:\n # Auto-paren.\n if force_auto:\n # Don't rewrite if it is already a call.\n do_rewrite = not the_rest.startswith('(')\n else:\n if not the_rest:\n # We only apply it to argument-less calls if the autocall\n # parameter is set to 2.\n do_rewrite = (self.shell.autocall >= 2)\n elif the_rest.startswith('[') and hasattr(obj, '__getitem__'):\n # Don't autocall in this case: item access for an object\n # which is BOTH callable and implements __getitem__.\n do_rewrite = False\n else:\n do_rewrite = True\n\n # Figure out the rewritten command\n if do_rewrite:\n if the_rest.endswith(';'):\n newcmd = '%s(%s);' % (ifun.rstrip(),the_rest[:-1])\n else:\n newcmd = '%s(%s)' % (ifun.rstrip(), the_rest)\n else:\n normal_handler = self.prefilter_manager.get_handler_by_name('normal')\n return normal_handler.handle(line_info)\n\n # Display the rewritten call\n if auto_rewrite:\n self.shell.auto_rewrite_input(newcmd)\n\n return newcmd\n\n\nclass EmacsHandler(PrefilterHandler):\n\n handler_name = Unicode('emacs')\n esc_strings = List([])\n\n def handle(self, line_info):\n """Handle input lines marked by python-mode."""\n\n # Currently, nothing is done. Later more functionality can be added\n # here if needed.\n\n # The input cache shouldn't be updated\n return line_info.line\n\n\n#-----------------------------------------------------------------------------\n# Defaults\n#-----------------------------------------------------------------------------\n\n\n_default_checkers = [\n EmacsChecker,\n MacroChecker,\n IPyAutocallChecker,\n AssignmentChecker,\n AutoMagicChecker,\n PythonOpsChecker,\n AutocallChecker\n]\n\n_default_handlers = [\n PrefilterHandler,\n MacroHandler,\n MagicHandler,\n AutoHandler,\n EmacsHandler\n]\n
.venv\Lib\site-packages\IPython\core\prefilter.py
prefilter.py
Python
25,766
0.95
0.199434
0.173675
react-lib
750
2024-04-14T09:29:03.239799
GPL-3.0
false
969885cbaffc3ce4704043aac926af78
# encoding: utf-8\n"""\nAn application for managing IPython profiles.\n\nTo be invoked as the `ipython profile` subcommand.\n\nAuthors:\n\n* Min RK\n\n"""\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2008 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\nimport os\n\nfrom traitlets.config.application import Application\nfrom IPython.core.application import (\n BaseIPythonApplication, base_flags\n)\nfrom IPython.core.profiledir import ProfileDir\nfrom IPython.utils.importstring import import_item\nfrom IPython.paths import get_ipython_dir, get_ipython_package_dir\nfrom traitlets import Unicode, Bool, Dict, observe\n\n#-----------------------------------------------------------------------------\n# Constants\n#-----------------------------------------------------------------------------\n\ncreate_help = """Create an IPython profile by name\n\nCreate an ipython profile directory by its name or\nprofile directory path. Profile directories contain\nconfiguration, log and security related files and are named\nusing the convention 'profile_<name>'. By default they are\nlocated in your ipython directory. Once created, you will\ncan edit the configuration files in the profile\ndirectory to configure IPython. Most users will create a\nprofile directory by name,\n`ipython profile create myprofile`, which will put the directory\nin `<ipython_dir>/profile_myprofile`.\n"""\nlist_help = """List available IPython profiles\n\nList all available profiles, by profile location, that can\nbe found in the current working directly or in the ipython\ndirectory. Profile directories are named using the convention\n'profile_<profile>'.\n"""\nprofile_help = """Manage IPython profiles\n\nProfile directories contain\nconfiguration, log and security related files and are named\nusing the convention 'profile_<name>'. By default they are\nlocated in your ipython directory. You can create profiles\nwith `ipython profile create <name>`, or see the profiles you\nalready have with `ipython profile list`\n\nTo get started configuring IPython, simply do:\n\n$> ipython profile create\n\nand IPython will create the default profile in <ipython_dir>/profile_default,\nwhere you can edit ipython_config.py to start configuring IPython.\n\n"""\n\n_list_examples = "ipython profile list # list all profiles"\n\n_create_examples = """\nipython profile create foo # create profile foo w/ default config files\nipython profile create foo --reset # restage default config files over current\nipython profile create foo --parallel # also stage parallel config files\n"""\n\n_main_examples = """\nipython profile create -h # show the help string for the create subcommand\nipython profile list -h # show the help string for the list subcommand\n\nipython locate profile foo # print the path to the directory for profile 'foo'\n"""\n\n#-----------------------------------------------------------------------------\n# Profile Application Class (for `ipython profile` subcommand)\n#-----------------------------------------------------------------------------\n\n\ndef list_profiles_in(path):\n """list profiles in a given root directory"""\n profiles = []\n\n # for python 3.6+ rewrite to: with os.scandir(path) as dirlist:\n files = os.scandir(path)\n for f in files:\n if f.is_dir() and f.name.startswith('profile_'):\n profiles.append(f.name.split('_', 1)[-1])\n return profiles\n\n\ndef list_bundled_profiles():\n """list profiles that are bundled with IPython."""\n path = os.path.join(get_ipython_package_dir(), u'core', u'profile')\n profiles = []\n\n # for python 3.6+ rewrite to: with os.scandir(path) as dirlist:\n files = os.scandir(path)\n for profile in files:\n if profile.is_dir() and profile.name != "__pycache__":\n profiles.append(profile.name)\n return profiles\n\n\nclass ProfileLocate(BaseIPythonApplication):\n description = """print the path to an IPython profile dir"""\n \n def parse_command_line(self, argv=None):\n super(ProfileLocate, self).parse_command_line(argv)\n if self.extra_args:\n self.profile = self.extra_args[0]\n \n def start(self):\n print(self.profile_dir.location)\n\n\nclass ProfileList(Application):\n name = u'ipython-profile'\n description = list_help\n examples = _list_examples\n\n aliases = Dict({\n 'ipython-dir' : 'ProfileList.ipython_dir',\n 'log-level' : 'Application.log_level',\n })\n flags = Dict(dict(\n debug = ({'Application' : {'log_level' : 0}},\n "Set Application.log_level to 0, maximizing log output."\n )\n ))\n\n ipython_dir = Unicode(get_ipython_dir(),\n help="""\n The name of the IPython directory. This directory is used for logging\n configuration (through profiles), history storage, etc. The default\n is usually $HOME/.ipython. This options can also be specified through\n the environment variable IPYTHONDIR.\n """\n ).tag(config=True)\n\n\n def _print_profiles(self, profiles):\n """print list of profiles, indented."""\n for profile in profiles:\n print(' %s' % profile)\n\n def list_profile_dirs(self):\n profiles = list_bundled_profiles()\n if profiles:\n print()\n print("Available profiles in IPython:")\n self._print_profiles(profiles)\n print()\n print(" The first request for a bundled profile will copy it")\n print(" into your IPython directory (%s)," % self.ipython_dir)\n print(" where you can customize it.")\n \n profiles = list_profiles_in(self.ipython_dir)\n if profiles:\n print()\n print("Available profiles in %s:" % self.ipython_dir)\n self._print_profiles(profiles)\n \n profiles = list_profiles_in(os.getcwd())\n if profiles:\n print()\n print(\n "Profiles from CWD have been removed for security reason, see CVE-2022-21699:"\n )\n\n print()\n print("To use any of the above profiles, start IPython with:")\n print(" ipython --profile=<name>")\n print()\n\n def start(self):\n self.list_profile_dirs()\n\n\ncreate_flags = {}\ncreate_flags.update(base_flags)\n# don't include '--init' flag, which implies running profile create in other apps\ncreate_flags.pop('init')\ncreate_flags['reset'] = ({'ProfileCreate': {'overwrite' : True}},\n "reset config files in this profile to the defaults.")\ncreate_flags['parallel'] = ({'ProfileCreate': {'parallel' : True}},\n "Include the config files for parallel "\n "computing apps (ipengine, ipcontroller, etc.)")\n\n\nclass ProfileCreate(BaseIPythonApplication):\n name = u'ipython-profile'\n description = create_help\n examples = _create_examples\n auto_create = Bool(True).tag(config=True)\n def _log_format_default(self):\n return "[%(name)s] %(message)s"\n\n def _copy_config_files_default(self):\n return True\n\n parallel = Bool(False,\n help="whether to include parallel computing config files"\n ).tag(config=True)\n\n @observe('parallel')\n def _parallel_changed(self, change):\n parallel_files = [ 'ipcontroller_config.py',\n 'ipengine_config.py',\n 'ipcluster_config.py'\n ]\n if change['new']:\n for cf in parallel_files:\n self.config_files.append(cf)\n else:\n for cf in parallel_files:\n if cf in self.config_files:\n self.config_files.remove(cf)\n\n def parse_command_line(self, argv):\n super(ProfileCreate, self).parse_command_line(argv)\n # accept positional arg as profile name\n if self.extra_args:\n self.profile = self.extra_args[0]\n\n flags = Dict(create_flags)\n\n classes = [ProfileDir]\n \n def _import_app(self, app_path):\n """import an app class"""\n app = None\n name = app_path.rsplit('.', 1)[-1]\n try:\n app = import_item(app_path)\n except ImportError:\n self.log.info("Couldn't import %s, config file will be excluded", name)\n except Exception:\n self.log.warning('Unexpected error importing %s', name, exc_info=True)\n return app\n\n def init_config_files(self):\n super(ProfileCreate, self).init_config_files()\n # use local imports, since these classes may import from here\n from IPython.terminal.ipapp import TerminalIPythonApp\n apps = [TerminalIPythonApp]\n for app_path in (\n 'ipykernel.kernelapp.IPKernelApp',\n ):\n app = self._import_app(app_path)\n if app is not None:\n apps.append(app)\n if self.parallel:\n from ipyparallel.apps.ipcontrollerapp import IPControllerApp\n from ipyparallel.apps.ipengineapp import IPEngineApp\n from ipyparallel.apps.ipclusterapp import IPClusterStart\n apps.extend([\n IPControllerApp,\n IPEngineApp,\n IPClusterStart,\n ])\n for App in apps:\n app = App()\n app.config.update(self.config)\n app.log = self.log\n app.overwrite = self.overwrite\n app.copy_config_files=True\n app.ipython_dir=self.ipython_dir\n app.profile_dir=self.profile_dir\n app.init_config_files()\n\n def stage_default_config_file(self):\n pass\n\n\nclass ProfileApp(Application):\n name = u'ipython profile'\n description = profile_help\n examples = _main_examples\n\n subcommands = Dict(dict(\n create = (ProfileCreate, ProfileCreate.description.splitlines()[0]),\n list = (ProfileList, ProfileList.description.splitlines()[0]),\n locate = (ProfileLocate, ProfileLocate.description.splitlines()[0]),\n ))\n\n def start(self):\n if self.subapp is None:\n print(\n "No subcommand specified. Must specify one of: "\n + ", ".join(map(repr, self.subcommands))\n + ".\n"\n )\n self.print_description()\n self.print_subcommands()\n self.exit(1)\n else:\n return self.subapp.start()\n
.venv\Lib\site-packages\IPython\core\profileapp.py
profileapp.py
Python
10,711
0.95
0.161905
0.086275
awesome-app
246
2025-03-10T12:43:06.753734
GPL-3.0
false
c850165b81809b584778d0250cc7e1fe
# -*- coding: utf-8 -*-\n"""Release data for the IPython project."""\n\n#-----------------------------------------------------------------------------\n# Copyright (c) 2008, IPython Development Team.\n# Copyright (c) 2001, Fernando Perez <fernando.perez@colorado.edu>\n# Copyright (c) 2001, Janko Hauser <jhauser@zscout.de>\n# Copyright (c) 2001, Nathaniel Gray <n8gray@caltech.edu>\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n# IPython version information. An empty _version_extra corresponds to a full\n# release. 'dev' as a _version_extra string means this is a development\n# version\n_version_major = 9\n_version_minor = 4\n_version_patch = 0\n_version_extra = ".dev"\n# _version_extra = "b2"\n_version_extra = "" # Uncomment this for full releases\n\n# Construct full version string from these.\n_ver = [_version_major, _version_minor, _version_patch]\n\n__version__ = '.'.join(map(str, _ver))\nif _version_extra:\n __version__ = __version__ + _version_extra\n\nversion = __version__ # backwards compatibility name\nversion_info = (_version_major, _version_minor, _version_patch, _version_extra)\n\n\nlicense = "BSD-3-Clause"\n\nauthors = {\n "Fernando": ("Fernando Perez", "fperez.net@gmail.com"),\n "M": ("M Bussonnier", "mbussonnier@gmail.com"),\n}\n\nauthor = 'The IPython Development Team'\n\nauthor_email = 'ipython-dev@python.org'\n
.venv\Lib\site-packages\IPython\core\release.py
release.py
Python
1,505
0.8
0.066667
0.457143
awesome-app
731
2025-01-20T09:46:52.624136
BSD-3-Clause
false
d9e69d512073104ff857c2605f3e2ac7
# encoding: utf-8\n"""\nA mixin for :class:`~IPython.core.application.Application` classes that\nlaunch InteractiveShell instances, load extensions, etc.\n"""\n\n# Copyright (c) IPython Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nimport glob\nfrom itertools import chain\nimport os\nimport sys\nimport typing as t\n\nfrom traitlets.config.application import boolean_flag\nfrom traitlets.config.configurable import Configurable\nfrom traitlets.config.loader import Config\nfrom IPython.core.application import SYSTEM_CONFIG_DIRS, ENV_CONFIG_DIRS\nfrom IPython.utils.contexts import preserve_keys\nfrom IPython.utils.path import filefind\nfrom traitlets import (\n Unicode,\n Instance,\n List,\n Bool,\n CaselessStrEnum,\n observe,\n DottedObjectName,\n Undefined,\n)\nfrom IPython.terminal import pt_inputhooks\n\n# -----------------------------------------------------------------------------\n# Aliases and Flags\n# -----------------------------------------------------------------------------\n\ngui_keys = tuple(sorted(pt_inputhooks.backends) + sorted(pt_inputhooks.aliases))\n\nshell_flags = {}\n\naddflag = lambda *args: shell_flags.update(boolean_flag(*args))\naddflag(\n "autoindent",\n "InteractiveShell.autoindent",\n "Turn on autoindenting.",\n "Turn off autoindenting.",\n)\naddflag(\n "automagic",\n "InteractiveShell.automagic",\n """Turn on the auto calling of magic commands. Type %%magic at the\n IPython prompt for more information.""",\n 'Turn off the auto calling of magic commands.'\n)\naddflag('pdb', 'InteractiveShell.pdb',\n "Enable auto calling the pdb debugger after every exception.",\n "Disable auto calling the pdb debugger after every exception."\n)\naddflag('pprint', 'PlainTextFormatter.pprint',\n "Enable auto pretty printing of results.",\n "Disable auto pretty printing of results."\n)\naddflag('color-info', 'InteractiveShell.color_info',\n """IPython can display information about objects via a set of functions,\n and optionally can use colors for this, syntax highlighting\n source code and various other elements. This is on by default, but can cause\n problems with some pagers. If you see such problems, you can disable the\n colours.""",\n "Disable using colors for info related things."\n)\naddflag('ignore-cwd', 'InteractiveShellApp.ignore_cwd',\n "Exclude the current working directory from sys.path",\n "Include the current working directory in sys.path",\n)\nnosep_config = Config()\nnosep_config.InteractiveShell.separate_in = ''\nnosep_config.InteractiveShell.separate_out = ''\nnosep_config.InteractiveShell.separate_out2 = ''\n\nshell_flags['nosep']=(nosep_config, "Eliminate all spacing between prompts.")\nshell_flags['pylab'] = (\n {'InteractiveShellApp' : {'pylab' : 'auto'}},\n """Pre-load matplotlib and numpy for interactive use with\n the default matplotlib backend. The exact options available\n depend on what Matplotlib provides at runtime.""",\n)\nshell_flags['matplotlib'] = (\n {'InteractiveShellApp' : {'matplotlib' : 'auto'}},\n """Configure matplotlib for interactive use with\n the default matplotlib backend. The exact options available\n depend on what Matplotlib provides at runtime.""",\n)\n\n# it's possible we don't want short aliases for *all* of these:\nshell_aliases = dict(\n autocall="InteractiveShell.autocall",\n colors="InteractiveShell.colors",\n theme="InteractiveShell.colors",\n logfile="InteractiveShell.logfile",\n logappend="InteractiveShell.logappend",\n c="InteractiveShellApp.code_to_run",\n m="InteractiveShellApp.module_to_run",\n ext="InteractiveShellApp.extra_extensions",\n gui='InteractiveShellApp.gui',\n pylab='InteractiveShellApp.pylab',\n matplotlib='InteractiveShellApp.matplotlib',\n)\nshell_aliases['cache-size'] = 'InteractiveShell.cache_size'\n\n\n# -----------------------------------------------------------------------------\n# Traitlets\n# -----------------------------------------------------------------------------\n\n\nclass MatplotlibBackendCaselessStrEnum(CaselessStrEnum):\n """An enum of Matplotlib backend strings where the case should be ignored.\n\n Prior to Matplotlib 3.9.0 the list of valid backends is hardcoded in\n pylabtools.backends. After that, Matplotlib manages backends.\n\n The list of valid backends is determined when it is first needed to avoid\n wasting unnecessary initialisation time.\n """\n\n def __init__(\n self: CaselessStrEnum[t.Any],\n default_value: t.Any = Undefined,\n **kwargs: t.Any,\n ) -> None:\n super().__init__(None, default_value=default_value, **kwargs)\n\n def __getattribute__(self, name):\n if name == "values" and object.__getattribute__(self, name) is None:\n from IPython.core.pylabtools import _list_matplotlib_backends_and_gui_loops\n\n self.values = _list_matplotlib_backends_and_gui_loops()\n return object.__getattribute__(self, name)\n\n\n#-----------------------------------------------------------------------------\n# Main classes and functions\n#-----------------------------------------------------------------------------\n\nclass InteractiveShellApp(Configurable):\n """A Mixin for applications that start InteractiveShell instances.\n\n Provides configurables for loading extensions and executing files\n as part of configuring a Shell environment.\n\n The following methods should be called by the :meth:`initialize` method\n of the subclass:\n\n - :meth:`init_path`\n - :meth:`init_shell` (to be implemented by the subclass)\n - :meth:`init_gui_pylab`\n - :meth:`init_extensions`\n - :meth:`init_code`\n """\n extensions = List(Unicode(),\n help="A list of dotted module names of IPython extensions to load."\n ).tag(config=True)\n\n extra_extensions = List(\n DottedObjectName(),\n help="""\n Dotted module name(s) of one or more IPython extensions to load.\n\n For specifying extra extensions to load on the command-line.\n\n .. versionadded:: 7.10\n """,\n ).tag(config=True)\n\n reraise_ipython_extension_failures = Bool(False,\n help="Reraise exceptions encountered loading IPython extensions?",\n ).tag(config=True)\n\n # Extensions that are always loaded (not configurable)\n default_extensions = List(Unicode(), [u'storemagic']).tag(config=False)\n\n hide_initial_ns = Bool(True,\n help="""Should variables loaded at startup (by startup files, exec_lines, etc.)\n be hidden from tools like %who?"""\n ).tag(config=True)\n\n exec_files = List(Unicode(),\n help="""List of files to run at IPython startup."""\n ).tag(config=True)\n exec_PYTHONSTARTUP = Bool(True,\n help="""Run the file referenced by the PYTHONSTARTUP environment\n variable at IPython startup."""\n ).tag(config=True)\n file_to_run = Unicode('',\n help="""A file to be run""").tag(config=True)\n\n exec_lines = List(Unicode(),\n help="""lines of code to run at IPython startup."""\n ).tag(config=True)\n code_to_run = Unicode("", help="Execute the given command string.").tag(config=True)\n module_to_run = Unicode("", help="Run the module as a script.").tag(config=True)\n gui = CaselessStrEnum(\n gui_keys,\n allow_none=True,\n help="Enable GUI event loop integration with any of {0}.".format(gui_keys),\n ).tag(config=True)\n matplotlib = MatplotlibBackendCaselessStrEnum(\n allow_none=True,\n help="""Configure matplotlib for interactive use with\n the default matplotlib backend. The exact options available\n depend on what Matplotlib provides at runtime.""",\n ).tag(config=True)\n pylab = MatplotlibBackendCaselessStrEnum(\n allow_none=True,\n help="""Pre-load matplotlib and numpy for interactive use,\n selecting a particular matplotlib backend and loop integration.\n The exact options available depend on what Matplotlib provides at runtime.\n """,\n ).tag(config=True)\n pylab_import_all = Bool(\n True,\n help="""If true, IPython will populate the user namespace with numpy, pylab, etc.\n and an ``import *`` is done from numpy and pylab, when using pylab mode.\n\n When False, pylab mode should not import any names into the user namespace.\n """,\n ).tag(config=True)\n ignore_cwd = Bool(\n False,\n help="""If True, IPython will not add the current working directory to sys.path.\n When False, the current working directory is added to sys.path, allowing imports\n of modules defined in the current directory."""\n ).tag(config=True)\n shell = Instance('IPython.core.interactiveshell.InteractiveShellABC',\n allow_none=True)\n # whether interact-loop should start\n interact = Bool(True)\n\n user_ns = Instance(dict, args=None, allow_none=True)\n @observe('user_ns')\n def _user_ns_changed(self, change):\n if self.shell is not None:\n self.shell.user_ns = change['new']\n self.shell.init_user_ns()\n\n def init_path(self):\n """Add current working directory, '', to sys.path\n\n Unlike Python's default, we insert before the first `site-packages`\n or `dist-packages` directory,\n so that it is after the standard library.\n\n .. versionchanged:: 7.2\n Try to insert after the standard library, instead of first.\n .. versionchanged:: 8.0\n Allow optionally not including the current directory in sys.path\n """\n if '' in sys.path or self.ignore_cwd:\n return\n for idx, path in enumerate(sys.path):\n parent, last_part = os.path.split(path)\n if last_part in {'site-packages', 'dist-packages'}:\n break\n else:\n # no site-packages or dist-packages found (?!)\n # back to original behavior of inserting at the front\n idx = 0\n sys.path.insert(idx, '')\n\n def init_shell(self):\n raise NotImplementedError("Override in subclasses")\n\n def init_gui_pylab(self):\n """Enable GUI event loop integration, taking pylab into account."""\n enable = False\n shell = self.shell\n if self.pylab:\n enable = lambda key: shell.enable_pylab(key, import_all=self.pylab_import_all)\n key = self.pylab\n elif self.matplotlib:\n enable = shell.enable_matplotlib\n key = self.matplotlib\n elif self.gui:\n enable = shell.enable_gui\n key = self.gui\n\n if not enable:\n return\n\n try:\n r = enable(key)\n except ImportError:\n self.log.warning("Eventloop or matplotlib integration failed. Is matplotlib installed?")\n self.shell.showtraceback()\n return\n except Exception:\n self.log.warning("GUI event loop or pylab initialization failed")\n self.shell.showtraceback()\n return\n\n if isinstance(r, tuple):\n gui, backend = r[:2]\n self.log.info("Enabling GUI event loop integration, "\n "eventloop=%s, matplotlib=%s", gui, backend)\n if key == "auto":\n print("Using matplotlib backend: %s" % backend)\n else:\n gui = r\n self.log.info("Enabling GUI event loop integration, "\n "eventloop=%s", gui)\n\n def init_extensions(self):\n """Load all IPython extensions in IPythonApp.extensions.\n\n This uses the :meth:`ExtensionManager.load_extensions` to load all\n the extensions listed in ``self.extensions``.\n """\n try:\n self.log.debug("Loading IPython extensions...")\n extensions = (\n self.default_extensions + self.extensions + self.extra_extensions\n )\n for ext in extensions:\n try:\n self.log.info("Loading IPython extension: %s", ext)\n self.shell.extension_manager.load_extension(ext)\n except:\n if self.reraise_ipython_extension_failures:\n raise\n msg = ("Error in loading extension: {ext}\n"\n "Check your config files in {location}".format(\n ext=ext,\n location=self.profile_dir.location\n ))\n self.log.warning(msg, exc_info=True)\n except:\n if self.reraise_ipython_extension_failures:\n raise\n self.log.warning("Unknown error in loading extensions:", exc_info=True)\n\n def init_code(self):\n """run the pre-flight code, specified via exec_lines"""\n self._run_startup_files()\n self._run_exec_lines()\n self._run_exec_files()\n\n # Hide variables defined here from %who etc.\n if self.hide_initial_ns:\n self.shell.user_ns_hidden.update(self.shell.user_ns)\n\n # command-line execution (ipython -i script.py, ipython -m module)\n # should *not* be excluded from %whos\n self._run_cmd_line_code()\n self._run_module()\n\n # flush output, so itwon't be attached to the first cell\n sys.stdout.flush()\n sys.stderr.flush()\n self.shell._sys_modules_keys = set(sys.modules.keys())\n\n def _run_exec_lines(self):\n """Run lines of code in IPythonApp.exec_lines in the user's namespace."""\n if not self.exec_lines:\n return\n try:\n self.log.debug("Running code from IPythonApp.exec_lines...")\n for line in self.exec_lines:\n try:\n self.log.info("Running code in user namespace: %s" %\n line)\n self.shell.run_cell(line, store_history=False)\n except:\n self.log.warning("Error in executing line in user "\n "namespace: %s" % line)\n self.shell.showtraceback()\n except:\n self.log.warning("Unknown error in handling IPythonApp.exec_lines:")\n self.shell.showtraceback()\n\n def _exec_file(self, fname, shell_futures=False):\n try:\n full_filename = filefind(fname, [u'.', self.ipython_dir])\n except IOError:\n self.log.warning("File not found: %r"%fname)\n return\n # Make sure that the running script gets a proper sys.argv as if it\n # were run from a system shell.\n save_argv = sys.argv\n sys.argv = [full_filename] + self.extra_args[1:]\n try:\n if os.path.isfile(full_filename):\n self.log.info("Running file in user namespace: %s" %\n full_filename)\n # Ensure that __file__ is always defined to match Python\n # behavior.\n with preserve_keys(self.shell.user_ns, '__file__'):\n self.shell.user_ns['__file__'] = fname\n if full_filename.endswith('.ipy') or full_filename.endswith('.ipynb'):\n self.shell.safe_execfile_ipy(full_filename,\n shell_futures=shell_futures)\n else:\n # default to python, even without extension\n self.shell.safe_execfile(full_filename,\n self.shell.user_ns,\n shell_futures=shell_futures,\n raise_exceptions=True)\n finally:\n sys.argv = save_argv\n\n def _run_startup_files(self):\n """Run files from profile startup directory"""\n startup_dirs = [self.profile_dir.startup_dir] + [\n os.path.join(p, 'startup') for p in chain(ENV_CONFIG_DIRS, SYSTEM_CONFIG_DIRS)\n ]\n startup_files = []\n\n if self.exec_PYTHONSTARTUP and os.environ.get('PYTHONSTARTUP', False) and \\n not (self.file_to_run or self.code_to_run or self.module_to_run):\n python_startup = os.environ['PYTHONSTARTUP']\n self.log.debug("Running PYTHONSTARTUP file %s...", python_startup)\n try:\n self._exec_file(python_startup)\n except:\n self.log.warning("Unknown error in handling PYTHONSTARTUP file %s:", python_startup)\n self.shell.showtraceback()\n for startup_dir in startup_dirs[::-1]:\n startup_files += glob.glob(os.path.join(startup_dir, '*.py'))\n startup_files += glob.glob(os.path.join(startup_dir, '*.ipy'))\n if not startup_files:\n return\n\n self.log.debug("Running startup files from %s...", startup_dir)\n try:\n for fname in sorted(startup_files):\n self._exec_file(fname)\n except:\n self.log.warning("Unknown error in handling startup files:")\n self.shell.showtraceback()\n\n def _run_exec_files(self):\n """Run files from IPythonApp.exec_files"""\n if not self.exec_files:\n return\n\n self.log.debug("Running files in IPythonApp.exec_files...")\n try:\n for fname in self.exec_files:\n self._exec_file(fname)\n except:\n self.log.warning("Unknown error in handling IPythonApp.exec_files:")\n self.shell.showtraceback()\n\n def _run_cmd_line_code(self):\n """Run code or file specified at the command-line"""\n if self.code_to_run:\n line = self.code_to_run\n try:\n self.log.info("Running code given at command line (c=): %s" %\n line)\n self.shell.run_cell(line, store_history=False)\n except:\n self.log.warning("Error in executing line in user namespace: %s" %\n line)\n self.shell.showtraceback()\n if not self.interact:\n self.exit(1)\n\n # Like Python itself, ignore the second if the first of these is present\n elif self.file_to_run:\n fname = self.file_to_run\n if os.path.isdir(fname):\n fname = os.path.join(fname, "__main__.py")\n if not os.path.exists(fname):\n self.log.warning("File '%s' doesn't exist", fname)\n if not self.interact:\n self.exit(2)\n try:\n self._exec_file(fname, shell_futures=True)\n except:\n self.shell.showtraceback(tb_offset=4)\n if not self.interact:\n self.exit(1)\n\n def _run_module(self):\n """Run module specified at the command-line."""\n if self.module_to_run:\n # Make sure that the module gets a proper sys.argv as if it were\n # run using `python -m`.\n save_argv = sys.argv\n sys.argv = [sys.executable] + self.extra_args\n try:\n self.shell.safe_run_module(self.module_to_run,\n self.shell.user_ns)\n finally:\n sys.argv = save_argv\n
.venv\Lib\site-packages\IPython\core\shellapp.py
shellapp.py
Python
19,307
0.95
0.15121
0.068493
vue-tools
982
2024-08-08T18:08:06.475215
Apache-2.0
false
9c116bb50f17a6b1c140447f24b47b05
# encoding: utf-8\n"""\nSimple utility for splitting user input. This is used by both inputsplitter and\nprefilter.\n\nAuthors:\n\n* Brian Granger\n* Fernando Perez\n"""\n\n#-----------------------------------------------------------------------------\n# Copyright (C) 2008-2011 The IPython Development Team\n#\n# Distributed under the terms of the BSD License. The full license is in\n# the file COPYING, distributed as part of this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\nimport re\nimport sys\n\nfrom IPython.utils import py3compat\nfrom IPython.utils.encoding import get_stream_enc\nfrom IPython.core.oinspect import OInfo\n\n#-----------------------------------------------------------------------------\n# Main function\n#-----------------------------------------------------------------------------\n\n# RegExp for splitting line contents into pre-char//first word-method//rest.\n# For clarity, each group in on one line.\n\n# WARNING: update the regexp if the escapes in interactiveshell are changed, as\n# they are hardwired in.\n\n# Although it's not solely driven by the regex, note that:\n# ,;/% only trigger if they are the first character on the line\n# ! and !! trigger if they are first char(s) *or* follow an indent\n# ? triggers as first or last char.\n\nline_split = re.compile(r"""\n ^(\s*) # any leading space\n ([,;/%]|!!?|\?\??)? # escape character or characters\n \s*(%{0,2}[\w\.\*]*) # function/method, possibly with leading %\n # to correctly treat things like '?%magic'\n (.*?$|$) # rest of line\n """, re.VERBOSE)\n\n\ndef split_user_input(line, pattern=None):\n """Split user input into initial whitespace, escape character, function part\n and the rest.\n """\n # We need to ensure that the rest of this routine deals only with unicode\n encoding = get_stream_enc(sys.stdin, 'utf-8')\n line = py3compat.cast_unicode(line, encoding)\n\n if pattern is None:\n pattern = line_split\n match = pattern.match(line)\n if not match:\n # print("match failed for line '%s'" % line)\n try:\n ifun, the_rest = line.split(None,1)\n except ValueError:\n # print("split failed for line '%s'" % line)\n ifun, the_rest = line, u''\n pre = re.match(r'^(\s*)(.*)',line).groups()[0]\n esc = ""\n else:\n pre, esc, ifun, the_rest = match.groups()\n\n # print('line:<%s>' % line) # dbg\n # print('pre <%s> ifun <%s> rest <%s>' % (pre,ifun.strip(),the_rest)) # dbg\n return pre, esc or "", ifun.strip(), the_rest\n\n\nclass LineInfo:\n """A single line of input and associated info.\n\n Includes the following as properties:\n\n line\n The original, raw line\n\n continue_prompt\n Is this line a continuation in a sequence of multiline input?\n\n pre\n Any leading whitespace.\n\n esc\n The escape character(s) in pre or the empty string if there isn't one.\n Note that '!!' and '??' are possible values for esc. Otherwise it will\n always be a single character.\n\n ifun\n The 'function part', which is basically the maximal initial sequence\n of valid python identifiers and the '.' character. This is what is\n checked for alias and magic transformations, used for auto-calling,\n etc. In contrast to Python identifiers, it may start with "%" and contain\n "*".\n\n the_rest\n Everything else on the line.\n\n raw_the_rest\n the_rest without whitespace stripped.\n """\n def __init__(self, line, continue_prompt=False):\n self.line = line\n self.continue_prompt = continue_prompt\n self.pre, self.esc, self.ifun, self.raw_the_rest = split_user_input(line)\n self.the_rest = self.raw_the_rest.lstrip()\n\n self.pre_char = self.pre.strip()\n if self.pre_char:\n self.pre_whitespace = '' # No whitespace allowed before esc chars\n else:\n self.pre_whitespace = self.pre\n\n def ofind(self, ip) -> OInfo:\n """Do a full, attribute-walking lookup of the ifun in the various\n namespaces for the given IPython InteractiveShell instance.\n\n Return a dict with keys: {found, obj, ospace, ismagic}\n\n Note: can cause state changes because of calling getattr, but should\n only be run if autocall is on and if the line hasn't matched any\n other, less dangerous handlers.\n\n Does cache the results of the call, so can be called multiple times\n without worrying about *further* damaging state.\n """\n return ip._ofind(self.ifun)\n\n def __str__(self):\n return "LineInfo [%s|%s|%s|%s]" %(self.pre, self.esc, self.ifun, self.the_rest)\n\n def __repr__(self):\n return "<" + str(self) + ">"\n
.venv\Lib\site-packages\IPython\core\splitinput.py
splitinput.py
Python
5,006
0.95
0.193103
0.256637
vue-tools
729
2024-04-04T01:20:56.316807
BSD-3-Clause
false
d812064f0ab5a79d242e23af8e8fd2c0
import functools\nimport inspect\nimport pydoc\nimport sys\nimport types\nimport warnings\nfrom types import TracebackType\nfrom typing import Any, Callable, Optional, Tuple\n\nimport stack_data\nfrom pygments.token import Token\n\nfrom IPython import get_ipython\nfrom IPython.core import debugger\nfrom IPython.utils import path as util_path\nfrom IPython.utils import py3compat\nfrom IPython.utils.PyColorize import Theme, TokenStream, theme_table\n\n_sentinel = object()\nINDENT_SIZE = 8\n\n\n@functools.lru_cache\ndef count_lines_in_py_file(filename: str) -> int:\n """\n Given a filename, returns the number of lines in the file\n if it ends with the extension ".py". Otherwise, returns 0.\n """\n if not filename.endswith(".py"):\n return 0\n else:\n try:\n with open(filename, "r") as file:\n s = sum(1 for line in file)\n except UnicodeError:\n return 0\n return s\n\n\ndef get_line_number_of_frame(frame: types.FrameType) -> int:\n """\n Given a frame object, returns the total number of lines in the file\n containing the frame's code object, or the number of lines in the\n frame's source code if the file is not available.\n\n Parameters\n ----------\n frame : FrameType\n The frame object whose line number is to be determined.\n\n Returns\n -------\n int\n The total number of lines in the file containing the frame's\n code object, or the number of lines in the frame's source code\n if the file is not available.\n """\n filename = frame.f_code.co_filename\n if filename is None:\n print("No file....")\n lines, first = inspect.getsourcelines(frame)\n return first + len(lines)\n return count_lines_in_py_file(filename)\n\n\ndef _safe_string(value: Any, what: Any, func: Any = str) -> str:\n # Copied from cpython/Lib/traceback.py\n try:\n return func(value)\n except:\n return f"<{what} {func.__name__}() failed>"\n\n\ndef _format_traceback_lines(\n lines: list[stack_data.Line],\n theme: Theme,\n has_colors: bool,\n lvals_toks: list[TokenStream],\n) -> TokenStream:\n """\n Format tracebacks lines with pointing arrow, leading numbers,\n this assumes the stack have been extracted using stackdata.\n\n\n Parameters\n ----------\n lines : list[Line]\n """\n numbers_width = INDENT_SIZE - 1\n tokens: TokenStream = []\n\n for stack_line in lines:\n if stack_line is stack_data.LINE_GAP:\n toks = [(Token.LinenoEm, " (...)")]\n tokens.extend(toks)\n continue\n\n lineno = stack_line.lineno\n line = stack_line.render(pygmented=has_colors).rstrip("\n") + "\n"\n if stack_line.is_current:\n # This is the line with the error\n pad = numbers_width - len(str(lineno))\n toks = [\n (Token.LinenoEm, theme.make_arrow(pad)),\n (Token.LinenoEm, str(lineno)),\n (Token, " "),\n (Token, line),\n ]\n else:\n num = "%*s" % (numbers_width, lineno)\n toks = [\n (Token.LinenoEm, str(num)),\n (Token, " "),\n (Token, line),\n ]\n\n tokens.extend(toks)\n if lvals_toks and stack_line.is_current:\n for lv in lvals_toks:\n tokens.append((Token, " " * INDENT_SIZE))\n tokens.extend(lv)\n tokens.append((Token, "\n"))\n # strip the last newline\n tokens = tokens[:-1]\n\n return tokens\n\n\n# some internal-use functions\ndef text_repr(value: Any) -> str:\n """Hopefully pretty robust repr equivalent."""\n # this is pretty horrible but should always return *something*\n try:\n return pydoc.text.repr(value) # type: ignore[call-arg]\n except KeyboardInterrupt:\n raise\n except:\n try:\n return repr(value)\n except KeyboardInterrupt:\n raise\n except:\n try:\n # all still in an except block so we catch\n # getattr raising\n name = getattr(value, "__name__", None)\n if name:\n # ick, recursion\n return text_repr(name)\n klass = getattr(value, "__class__", None)\n if klass:\n return "%s instance" % text_repr(klass)\n return "UNRECOVERABLE REPR FAILURE"\n except KeyboardInterrupt:\n raise\n except:\n return "UNRECOVERABLE REPR FAILURE"\n\n\ndef eqrepr(value: Any, repr: Callable[[Any], str] = text_repr) -> str:\n return "=%s" % repr(value)\n\n\ndef nullrepr(value: Any, repr: Callable[[Any], str] = text_repr) -> str:\n return ""\n\n\ndef _tokens_filename(\n em: bool,\n file: str | None,\n *,\n lineno: int | None = None,\n) -> TokenStream:\n """\n Format filename lines with custom formatting from caching compiler or `File *.py` by default\n\n Parameters\n ----------\n em: wether bold or not\n file : str\n """\n Normal = Token.NormalEm if em else Token.Normal\n Filename = Token.FilenameEm if em else Token.Filename\n ipinst = get_ipython()\n if (\n ipinst is not None\n and (data := ipinst.compile.format_code_name(file)) is not None\n ):\n label, name = data\n if lineno is None:\n return [\n (Normal, label),\n (Normal, " "),\n (Filename, name),\n ]\n else:\n return [\n (Normal, label),\n (Normal, " "),\n (Filename, name),\n (Filename, f", line {lineno}"),\n ]\n else:\n name = util_path.compress_user(\n py3compat.cast_unicode(file, util_path.fs_encoding)\n )\n if lineno is None:\n return [\n (Normal, "File "),\n (Filename, name),\n ]\n else:\n return [\n (Normal, "File "),\n (Filename, f"{name}:{lineno}"),\n ]\n\n\ndef _simple_format_traceback_lines(\n lnum: int,\n index: int,\n lines: list[tuple[str, tuple[str, bool]]],\n lvals_toks: list[TokenStream],\n theme: Theme,\n) -> TokenStream:\n """\n Format tracebacks lines with pointing arrow, leading numbers\n\n This should be equivalent to _format_traceback_lines, but does not rely on stackdata\n to format the lines\n\n This is due to the fact that stackdata may be slow on super long and complex files.\n\n Parameters\n ==========\n\n lnum: int\n number of the target line of code.\n index: int\n which line in the list should be highlighted.\n lines: list[string]\n lvals_toks: pairs of token type and str\n Values of local variables, already colored, to inject just after the error line.\n """\n for item in lvals_toks:\n assert isinstance(item, list)\n for subit in item:\n assert isinstance(subit[1], str)\n\n numbers_width = INDENT_SIZE - 1\n res_toks: TokenStream = []\n for i, (line, (new_line, err)) in enumerate(lines, lnum - index):\n if not err:\n line = new_line\n\n colored_line = line\n if i == lnum:\n # This is the line with the error\n pad = numbers_width - len(str(i))\n line_toks = [\n (Token.LinenoEm, theme.make_arrow(pad)),\n (Token.LinenoEm, str(lnum)),\n (Token, " "),\n (Token, colored_line),\n ]\n else:\n padding_num = "%*s" % (numbers_width, i)\n\n line_toks = [\n (Token.LinenoEm, padding_num),\n (Token, " "),\n (Token, colored_line),\n ]\n res_toks.extend(line_toks)\n\n if lvals_toks and i == lnum:\n for lv in lvals_toks:\n res_toks.extend(lv)\n # res_toks.extend(lvals_toks)\n return res_toks\n\n\nclass FrameInfo:\n """\n Mirror of stack data's FrameInfo, but so that we can bypass highlighting on\n really long frames.\n """\n\n description: Optional[str]\n filename: Optional[str]\n lineno: int\n # number of context lines to use\n context: Optional[int]\n raw_lines: list[str]\n _sd: stack_data.core.FrameInfo\n frame: Any\n\n @classmethod\n def _from_stack_data_FrameInfo(\n cls, frame_info: stack_data.core.FrameInfo | stack_data.core.RepeatedFrames\n ) -> "FrameInfo":\n return cls(\n getattr(frame_info, "description", None),\n getattr(frame_info, "filename", None), # type: ignore[arg-type]\n getattr(frame_info, "lineno", None), # type: ignore[arg-type]\n getattr(frame_info, "frame", None),\n getattr(frame_info, "code", None),\n sd=frame_info,\n context=None,\n )\n\n def __init__(\n self,\n description: Optional[str],\n filename: str,\n lineno: int,\n frame: Any,\n code: Optional[types.CodeType],\n *,\n sd: Any = None,\n context: int | None = None,\n ):\n assert isinstance(lineno, (int, type(None))), lineno\n self.description = description\n self.filename = filename\n self.lineno = lineno\n self.frame = frame\n self.code = code\n self._sd = sd\n self.context = context\n\n # self.lines = []\n if sd is None:\n try:\n # return a list of source lines and a starting line number\n self.raw_lines = inspect.getsourcelines(frame)[0]\n except OSError:\n self.raw_lines = [\n "'Could not get source, probably due dynamically evaluated source code.'"\n ]\n\n @property\n def variables_in_executing_piece(self) -> list[Any]:\n if self._sd is not None:\n return self._sd.variables_in_executing_piece # type:ignore[misc]\n else:\n return []\n\n @property\n def lines(self) -> list[Any]:\n from executing.executing import NotOneValueFound\n\n assert self._sd is not None\n try:\n return self._sd.lines # type: ignore[misc]\n except NotOneValueFound:\n\n class Dummy:\n lineno = 0\n is_current = False\n\n def render(self, *, pygmented: bool) -> str:\n return "<Error retrieving source code with stack_data see ipython/ipython#13598>"\n\n return [Dummy()]\n\n @property\n def executing(self) -> Any:\n if self._sd is not None:\n return self._sd.executing\n else:\n return None\n\n\nclass TBTools:\n """Basic tools used by all traceback printer classes."""\n\n # Number of frames to skip when reporting tracebacks\n tb_offset = 0\n _theme_name: str\n _old_theme_name: str\n call_pdb: bool\n ostream: Any\n debugger_cls: Any\n pdb: Any\n\n def __init__(\n self,\n color_scheme: Any = _sentinel,\n call_pdb: bool = False,\n ostream: Any = None,\n *,\n debugger_cls: type | None = None,\n theme_name: str = "nocolor",\n ):\n if color_scheme is not _sentinel:\n assert isinstance(color_scheme, str), color_scheme\n warnings.warn(\n "color_scheme is deprecated since IPython 9.0, use theme_name instead, all lowercase",\n DeprecationWarning,\n stacklevel=2,\n )\n theme_name = color_scheme\n if theme_name in ["Linux", "LightBG", "Neutral", "NoColor"]:\n warnings.warn(\n f"Theme names and color schemes are lowercase in IPython 9.0 use {theme_name.lower()} instead",\n DeprecationWarning,\n stacklevel=2,\n )\n theme_name = theme_name.lower()\n # Whether to call the interactive pdb debugger after printing\n # tracebacks or not\n super().__init__()\n self.call_pdb = call_pdb\n\n # Output stream to write to. Note that we store the original value in\n # a private attribute and then make the public ostream a property, so\n # that we can delay accessing sys.stdout until runtime. The way\n # things are written now, the sys.stdout object is dynamically managed\n # so a reference to it should NEVER be stored statically. This\n # property approach confines this detail to a single location, and all\n # subclasses can simply access self.ostream for writing.\n self._ostream = ostream\n\n # Create color table\n self.set_theme_name(theme_name)\n self.debugger_cls = debugger_cls or debugger.Pdb\n\n if call_pdb:\n self.pdb = self.debugger_cls()\n else:\n self.pdb = None\n\n def _get_ostream(self) -> Any:\n """Output stream that exceptions are written to.\n\n Valid values are:\n\n - None: the default, which means that IPython will dynamically resolve\n to sys.stdout. This ensures compatibility with most tools, including\n Windows (where plain stdout doesn't recognize ANSI escapes).\n\n - Any object with 'write' and 'flush' attributes.\n """\n return sys.stdout if self._ostream is None else self._ostream\n\n def _set_ostream(self, val) -> None: # type:ignore[no-untyped-def]\n assert val is None or (hasattr(val, "write") and hasattr(val, "flush"))\n self._ostream = val\n\n ostream = property(_get_ostream, _set_ostream)\n\n @staticmethod\n def _get_chained_exception(exception_value: Any) -> Any:\n cause = getattr(exception_value, "__cause__", None)\n if cause:\n return cause\n if getattr(exception_value, "__suppress_context__", False):\n return None\n return getattr(exception_value, "__context__", None)\n\n def get_parts_of_chained_exception(\n self, evalue: BaseException | None\n ) -> Optional[Tuple[type, BaseException, TracebackType]]:\n chained_evalue = self._get_chained_exception(evalue)\n\n if chained_evalue:\n return (\n chained_evalue.__class__,\n chained_evalue,\n chained_evalue.__traceback__,\n )\n return None\n\n def prepare_chained_exception_message(\n self, cause: BaseException | None\n ) -> list[list[str]]:\n direct_cause = (\n "\nThe above exception was the direct cause of the following exception:\n"\n )\n exception_during_handling = (\n "\nDuring handling of the above exception, another exception occurred:\n"\n )\n\n if cause:\n message = [[direct_cause]]\n else:\n message = [[exception_during_handling]]\n return message\n\n @property\n def has_colors(self) -> bool:\n assert self._theme_name == self._theme_name.lower()\n return self._theme_name != "nocolor"\n\n def set_theme_name(self, name: str) -> None:\n assert name in theme_table\n assert name.lower() == name\n self._theme_name = name\n # Also set colors of debugger\n if hasattr(self, "pdb") and self.pdb is not None:\n self.pdb.set_theme_name(name)\n\n def set_colors(self, name: str) -> None:\n """Shorthand access to the color table scheme selector method."""\n\n # todo emit deprecation\n warnings.warn(\n "set_colors is deprecated since IPython 9.0, use set_theme_name instead",\n DeprecationWarning,\n stacklevel=2,\n )\n self.set_theme_name(name)\n\n def color_toggle(self) -> None:\n """Toggle between the currently active color scheme and nocolor."""\n if self._theme_name == "nocolor":\n self._theme_name = self._old_theme_name\n else:\n self._old_theme_name = self._theme_name\n self._theme_name = "nocolor"\n\n def stb2text(self, stb: list[str]) -> str:\n """Convert a structured traceback (a list) to a string."""\n return "\n".join(stb)\n\n def text(\n self,\n etype: type,\n value: BaseException | None,\n tb: TracebackType | None,\n tb_offset: Optional[int] = None,\n context: int = 5,\n ) -> str:\n """Return formatted traceback.\n\n Subclasses may override this if they add extra arguments.\n """\n tb_list = self.structured_traceback(etype, value, tb, tb_offset, context)\n return self.stb2text(tb_list)\n\n def structured_traceback(\n self,\n etype: type,\n evalue: BaseException | None,\n etb: Optional[TracebackType] = None,\n tb_offset: Optional[int] = None,\n context: int = 5,\n ) -> list[str]:\n """Return a list of traceback frames.\n\n Must be implemented by each class.\n """\n raise NotImplementedError()\n
.venv\Lib\site-packages\IPython\core\tbtools.py
tbtools.py
Python
16,880
0.95
0.146209
0.061053
vue-tools
902
2024-08-08T05:31:50.789540
Apache-2.0
false
e0f2b3db1d5826c7e70f794a40be5067
"""Implementation of magic functions that control various automatic behaviors.\n"""\n#-----------------------------------------------------------------------------\n# Copyright (c) 2012 The IPython Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# Our own packages\nfrom IPython.core.magic import Bunch, Magics, magics_class, line_magic\nfrom IPython.testing.skipdoctest import skip_doctest\nfrom logging import error\n\n#-----------------------------------------------------------------------------\n# Magic implementation classes\n#-----------------------------------------------------------------------------\n\n@magics_class\nclass AutoMagics(Magics):\n """Magics that control various autoX behaviors."""\n\n def __init__(self, shell):\n super(AutoMagics, self).__init__(shell)\n # namespace for holding state we may need\n self._magic_state = Bunch()\n\n @line_magic\n def automagic(self, parameter_s=''):\n """Make magic functions callable without having to type the initial %.\n\n Without arguments toggles on/off (when off, you must call it as\n %automagic, of course). With arguments it sets the value, and you can\n use any of (case insensitive):\n\n - on, 1, True: to activate\n\n - off, 0, False: to deactivate.\n\n Note that magic functions have lowest priority, so if there's a\n variable whose name collides with that of a magic fn, automagic won't\n work for that function (you get the variable instead). However, if you\n delete the variable (del var), the previously shadowed magic function\n becomes visible to automagic again."""\n\n arg = parameter_s.lower()\n mman = self.shell.magics_manager\n if arg in ('on', '1', 'true'):\n val = True\n elif arg in ('off', '0', 'false'):\n val = False\n else:\n val = not mman.auto_magic\n mman.auto_magic = val\n print('\n' + self.shell.magics_manager.auto_status())\n\n @skip_doctest\n @line_magic\n def autocall(self, parameter_s=''):\n """Make functions callable without having to type parentheses.\n\n Usage:\n\n %autocall [mode]\n\n The mode can be one of: 0->Off, 1->Smart, 2->Full. If not given, the\n value is toggled on and off (remembering the previous state).\n\n In more detail, these values mean:\n\n 0 -> fully disabled\n\n 1 -> active, but do not apply if there are no arguments on the line.\n\n In this mode, you get::\n\n In [1]: callable\n Out[1]: <built-in function callable>\n\n In [2]: callable 'hello'\n ------> callable('hello')\n Out[2]: False\n\n 2 -> Active always. Even if no arguments are present, the callable\n object is called::\n\n In [2]: float\n ------> float()\n Out[2]: 0.0\n\n Note that even with autocall off, you can still use '/' at the start of\n a line to treat the first argument on the command line as a function\n and add parentheses to it::\n\n In [8]: /str 43\n ------> str(43)\n Out[8]: '43'\n\n # all-random (note for auto-testing)\n """\n\n valid_modes = {\n 0: "Off",\n 1: "Smart",\n 2: "Full",\n }\n\n def errorMessage() -> str:\n error = "Valid modes: "\n for k, v in valid_modes.items():\n error += str(k) + "->" + v + ", "\n error = error[:-2] # remove tailing `, ` after last element\n return error\n\n if parameter_s:\n if parameter_s not in map(str, valid_modes.keys()):\n error(errorMessage())\n return\n arg = int(parameter_s)\n else:\n arg = 'toggle'\n\n if arg not in (*list(valid_modes.keys()), "toggle"):\n error(errorMessage())\n return\n\n if arg in (valid_modes.keys()):\n self.shell.autocall = arg\n else: # toggle\n if self.shell.autocall:\n self._magic_state.autocall_save = self.shell.autocall\n self.shell.autocall = 0\n else:\n try:\n self.shell.autocall = self._magic_state.autocall_save\n except AttributeError:\n self.shell.autocall = self._magic_state.autocall_save = 1\n\n print("Automatic calling is:", list(valid_modes.values())[self.shell.autocall])\n
.venv\Lib\site-packages\IPython\core\magics\auto.py
auto.py
Python
4,816
0.95
0.166667
0.142857
awesome-app
403
2023-11-29T17:29:34.113434
Apache-2.0
false
3e15b4549b4c29fd3ba42f62041c9d00
"""Implementation of magic functions for the extension machinery.\n"""\n#-----------------------------------------------------------------------------\n# Copyright (c) 2012 The IPython Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n\n# Our own packages\nfrom IPython.core.error import UsageError\nfrom IPython.core.magic import Magics, magics_class, line_magic\n\n#-----------------------------------------------------------------------------\n# Magic implementation classes\n#-----------------------------------------------------------------------------\n\n@magics_class\nclass ExtensionMagics(Magics):\n """Magics to manage the IPython extensions system."""\n\n @line_magic\n def load_ext(self, module_str):\n """Load an IPython extension by its module name."""\n if not module_str:\n raise UsageError('Missing module name.')\n res = self.shell.extension_manager.load_extension(module_str)\n \n if res == 'already loaded':\n print("The %s extension is already loaded. To reload it, use:" % module_str)\n print(" %reload_ext", module_str)\n elif res == 'no load function':\n print("The %s module is not an IPython extension." % module_str)\n\n @line_magic\n def unload_ext(self, module_str):\n """Unload an IPython extension by its module name.\n\n Not all extensions can be unloaded, only those which define an\n ``unload_ipython_extension`` function.\n """\n if not module_str:\n raise UsageError('Missing module name.')\n \n res = self.shell.extension_manager.unload_extension(module_str)\n \n if res == 'no unload function':\n print("The %s extension doesn't define how to unload it." % module_str)\n elif res == "not loaded":\n print("The %s extension is not loaded." % module_str)\n\n @line_magic\n def reload_ext(self, module_str):\n """Reload an IPython extension by its module name."""\n if not module_str:\n raise UsageError('Missing module name.')\n self.shell.extension_manager.reload_extension(module_str)\n
.venv\Lib\site-packages\IPython\core\magics\extension.py
extension.py
Python
2,477
0.95
0.206349
0.27451
vue-tools
766
2023-11-11T20:31:41.633053
GPL-3.0
false
dcf727936799029bea9bef735c94507f
"""Implementation of magic functions for IPython's own logging.\n"""\n#-----------------------------------------------------------------------------\n# Copyright (c) 2012 The IPython Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# Stdlib\nimport os\nimport sys\n\n# Our own packages\nfrom IPython.core.magic import Magics, magics_class, line_magic\nfrom warnings import warn\nfrom traitlets import Bool\n\n#-----------------------------------------------------------------------------\n# Magic implementation classes\n#-----------------------------------------------------------------------------\n\n@magics_class\nclass LoggingMagics(Magics):\n """Magics related to all logging machinery."""\n\n quiet = Bool(False, help=\n """\n Suppress output of log state when logging is enabled\n """\n ).tag(config=True)\n\n @line_magic\n def logstart(self, parameter_s=''):\n """Start logging anywhere in a session.\n\n %logstart [-o|-r|-t|-q] [log_name [log_mode]]\n\n If no name is given, it defaults to a file named 'ipython_log.py' in your\n current directory, in 'rotate' mode (see below).\n\n '%logstart name' saves to file 'name' in 'backup' mode. It saves your\n history up to that point and then continues logging.\n\n %logstart takes a second optional parameter: logging mode. This can be one\n of (note that the modes are given unquoted):\n\n append\n Keep logging at the end of any existing file.\n\n backup\n Rename any existing file to name~ and start name.\n\n global\n Append to a single logfile in your home directory.\n\n over\n Overwrite any existing log.\n\n rotate\n Create rotating logs: name.1~, name.2~, etc.\n\n Options:\n\n -o\n log also IPython's output. In this mode, all commands which\n generate an Out[NN] prompt are recorded to the logfile, right after\n their corresponding input line. The output lines are always\n prepended with a '#[Out]# ' marker, so that the log remains valid\n Python code.\n\n Since this marker is always the same, filtering only the output from\n a log is very easy, using for example a simple awk call::\n\n awk -F'#\\[Out\\]# ' '{if($2) {print $2}}' ipython_log.py\n\n -r\n log 'raw' input. Normally, IPython's logs contain the processed\n input, so that user lines are logged in their final form, converted\n into valid Python. For example, %Exit is logged as\n _ip.run_line_magic("Exit"). If the -r flag is given, all input is logged\n exactly as typed, with no transformations applied.\n\n -t\n put timestamps before each input line logged (these are put in\n comments).\n\n -q\n suppress output of logstate message when logging is invoked\n """\n\n opts,par = self.parse_options(parameter_s,'ortq')\n log_output = 'o' in opts\n log_raw_input = 'r' in opts\n timestamp = 't' in opts\n quiet = 'q' in opts\n\n logger = self.shell.logger\n\n # if no args are given, the defaults set in the logger constructor by\n # ipython remain valid\n if par:\n try:\n logfname,logmode = par.split()\n except:\n logfname = par\n logmode = 'backup'\n else:\n logfname = logger.logfname\n logmode = logger.logmode\n # put logfname into rc struct as if it had been called on the command\n # line, so it ends up saved in the log header Save it in case we need\n # to restore it...\n old_logfile = self.shell.logfile\n if logfname:\n logfname = os.path.expanduser(logfname)\n self.shell.logfile = logfname\n\n loghead = u'# IPython log file\n\n'\n try:\n logger.logstart(logfname, loghead, logmode, log_output, timestamp,\n log_raw_input)\n except:\n self.shell.logfile = old_logfile\n warn("Couldn't start log: %s" % sys.exc_info()[1])\n else:\n # log input history up to this point, optionally interleaving\n # output if requested\n\n if timestamp:\n # disable timestamping for the previous history, since we've\n # lost those already (no time machine here).\n logger.timestamp = False\n\n if log_raw_input:\n input_hist = self.shell.history_manager.input_hist_raw\n else:\n input_hist = self.shell.history_manager.input_hist_parsed\n\n if log_output:\n log_write = logger.log_write\n output_hist = self.shell.history_manager.output_hist\n for n in range(1,len(input_hist)-1):\n log_write(input_hist[n].rstrip() + u'\n')\n if n in output_hist:\n log_write(repr(output_hist[n]),'output')\n else:\n logger.log_write(u'\n'.join(input_hist[1:]))\n logger.log_write(u'\n')\n if timestamp:\n # re-enable timestamping\n logger.timestamp = True\n\n if not (self.quiet or quiet):\n print ('Activating auto-logging. '\n 'Current session state plus future input saved.')\n logger.logstate()\n\n @line_magic\n def logstop(self, parameter_s=''):\n """Fully stop logging and close log file.\n\n In order to start logging again, a new %logstart call needs to be made,\n possibly (though not necessarily) with a new filename, mode and other\n options."""\n self.shell.logger.logstop()\n\n @line_magic\n def logoff(self, parameter_s=''):\n """Temporarily stop logging.\n\n You must have previously started logging."""\n self.shell.logger.switch_log(0)\n\n @line_magic\n def logon(self, parameter_s=''):\n """Restart logging.\n\n This function is for restarting logging which you've temporarily\n stopped with %logoff. For starting logging for the first time, you\n must use the %logstart function, which allows you to specify an\n optional log filename."""\n\n self.shell.logger.switch_log(1)\n\n @line_magic\n def logstate(self, parameter_s=''):\n """Print the status of the logging system."""\n\n self.shell.logger.logstate()\n
.venv\Lib\site-packages\IPython\core\magics\logging.py
logging.py
Python
6,867
0.95
0.14359
0.16129
awesome-app
435
2023-07-22T02:13:50.944510
BSD-3-Clause
false
498579fb4891269faf9c4dfe3e668a25
"""Implementation of namespace-related magic functions.\n"""\n#-----------------------------------------------------------------------------\n# Copyright (c) 2012 The IPython Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# Stdlib\nimport gc\nimport re\nimport sys\n\n# Our own packages\nfrom IPython.core import page\nfrom IPython.core.error import StdinNotImplementedError, UsageError\nfrom IPython.core.magic import Magics, magics_class, line_magic\nfrom IPython.testing.skipdoctest import skip_doctest\nfrom IPython.utils.encoding import DEFAULT_ENCODING\nfrom IPython.utils.openpy import read_py_file\nfrom IPython.utils.path import get_py_filename\n\n#-----------------------------------------------------------------------------\n# Magic implementation classes\n#-----------------------------------------------------------------------------\n\n@magics_class\nclass NamespaceMagics(Magics):\n """Magics to manage various aspects of the user's namespace.\n\n These include listing variables, introspecting into them, etc.\n """\n\n @line_magic\n def pinfo(self, parameter_s='', namespaces=None):\n """Provide detailed information about an object.\n\n '%pinfo object' is just a synonym for object? or ?object."""\n\n # print('pinfo par: <%s>' % parameter_s) # dbg\n # detail_level: 0 -> obj? , 1 -> obj??\n detail_level = 0\n # We need to detect if we got called as 'pinfo pinfo foo', which can\n # happen if the user types 'pinfo foo?' at the cmd line.\n pinfo,qmark1,oname,qmark2 = \\n re.match(r'(pinfo )?(\?*)(.*?)(\??$)',parameter_s).groups()\n if pinfo or qmark1 or qmark2:\n detail_level = 1\n if "*" in oname:\n self.psearch(oname)\n else:\n self.shell._inspect('pinfo', oname, detail_level=detail_level,\n namespaces=namespaces)\n\n @line_magic\n def pinfo2(self, parameter_s='', namespaces=None):\n """Provide extra detailed information about an object.\n\n '%pinfo2 object' is just a synonym for object?? or ??object."""\n self.shell._inspect('pinfo', parameter_s, detail_level=1,\n namespaces=namespaces)\n\n @skip_doctest\n @line_magic\n def pdef(self, parameter_s='', namespaces=None):\n """Print the call signature for any callable object.\n\n If the object is a class, print the constructor information.\n\n Examples\n --------\n ::\n\n In [3]: %pdef urllib.urlopen\n urllib.urlopen(url, data=None, proxies=None)\n """\n self.shell._inspect('pdef',parameter_s, namespaces)\n\n @line_magic\n def pdoc(self, parameter_s='', namespaces=None):\n """Print the docstring for an object.\n\n If the given object is a class, it will print both the class and the\n constructor docstrings."""\n self.shell._inspect('pdoc',parameter_s, namespaces)\n\n @line_magic\n def psource(self, parameter_s='', namespaces=None):\n """Print (or run through pager) the source code for an object."""\n if not parameter_s:\n raise UsageError('Missing object name.')\n self.shell._inspect('psource',parameter_s, namespaces)\n\n @line_magic\n def pfile(self, parameter_s='', namespaces=None):\n """Print (or run through pager) the file where an object is defined.\n\n The file opens at the line where the object definition begins. IPython\n will honor the environment variable PAGER if set, and otherwise will\n do its best to print the file in a convenient form.\n\n If the given argument is not an object currently defined, IPython will\n try to interpret it as a filename (automatically adding a .py extension\n if needed). You can thus use %pfile as a syntax highlighting code\n viewer."""\n\n # first interpret argument as an object name\n out = self.shell._inspect('pfile',parameter_s, namespaces)\n # if not, try the input as a filename\n if out == 'not found':\n try:\n filename = get_py_filename(parameter_s)\n except IOError as msg:\n print(msg)\n return\n page.page(self.shell.pycolorize(read_py_file(filename, skip_encoding_cookie=False)))\n\n @line_magic\n def psearch(self, parameter_s=''):\n """Search for object in namespaces by wildcard.\n\n %psearch [options] PATTERN [OBJECT TYPE]\n\n Note: ? can be used as a synonym for %psearch, at the beginning or at\n the end: both a*? and ?a* are equivalent to '%psearch a*'. Still, the\n rest of the command line must be unchanged (options come first), so\n for example the following forms are equivalent\n\n %psearch -i a* function\n -i a* function?\n ?-i a* function\n\n Arguments:\n\n PATTERN\n\n where PATTERN is a string containing * as a wildcard similar to its\n use in a shell. The pattern is matched in all namespaces on the\n search path. By default objects starting with a single _ are not\n matched, many IPython generated objects have a single\n underscore. The default is case insensitive matching. Matching is\n also done on the attributes of objects and not only on the objects\n in a module.\n\n [OBJECT TYPE]\n\n Is the name of a python type from the types module. The name is\n given in lowercase without the ending type, ex. StringType is\n written string. By adding a type here only objects matching the\n given type are matched. Using all here makes the pattern match all\n types (this is the default).\n\n Options:\n\n -a: makes the pattern match even objects whose names start with a\n single underscore. These names are normally omitted from the\n search.\n\n -i/-c: make the pattern case insensitive/sensitive. If neither of\n these options are given, the default is read from your configuration\n file, with the option ``InteractiveShell.wildcards_case_sensitive``.\n If this option is not specified in your configuration file, IPython's\n internal default is to do a case sensitive search.\n\n -e/-s NAMESPACE: exclude/search a given namespace. The pattern you\n specify can be searched in any of the following namespaces:\n 'builtin', 'user', 'user_global','internal', 'alias', where\n 'builtin' and 'user' are the search defaults. Note that you should\n not use quotes when specifying namespaces.\n\n -l: List all available object types for object matching. This function\n can be used without arguments.\n\n 'Builtin' contains the python module builtin, 'user' contains all\n user data, 'alias' only contain the shell aliases and no python\n objects, 'internal' contains objects used by IPython. The\n 'user_global' namespace is only used by embedded IPython instances,\n and it contains module-level globals. You can add namespaces to the\n search with -s or exclude them with -e (these options can be given\n more than once).\n\n Examples\n --------\n ::\n\n %psearch a* -> objects beginning with an a\n %psearch -e builtin a* -> objects NOT in the builtin space starting in a\n %psearch a* function -> all functions beginning with an a\n %psearch re.e* -> objects beginning with an e in module re\n %psearch r*.e* -> objects that start with e in modules starting in r\n %psearch r*.* string -> all strings in modules beginning with r\n\n Case sensitive search::\n\n %psearch -c a* list all object beginning with lower case a\n\n Show objects beginning with a single _::\n\n %psearch -a _* list objects beginning with a single underscore\n\n List available objects::\n\n %psearch -l list all available object types\n """\n # default namespaces to be searched\n def_search = ['user_local', 'user_global', 'builtin']\n\n # Process options/args\n opts,args = self.parse_options(parameter_s,'cias:e:l',list_all=True)\n opt = opts.get\n shell = self.shell\n psearch = shell.inspector.psearch\n \n # select list object types\n list_types = False\n if 'l' in opts:\n list_types = True\n\n # select case options\n if 'i' in opts:\n ignore_case = True\n elif 'c' in opts:\n ignore_case = False\n else:\n ignore_case = not shell.wildcards_case_sensitive\n\n # Build list of namespaces to search from user options\n def_search.extend(opt('s',[]))\n ns_exclude = ns_exclude=opt('e',[])\n ns_search = [nm for nm in def_search if nm not in ns_exclude]\n\n # Call the actual search\n try:\n psearch(args,shell.ns_table,ns_search,\n show_all=opt('a'),ignore_case=ignore_case, list_types=list_types)\n except:\n shell.showtraceback()\n\n @skip_doctest\n @line_magic\n def who_ls(self, parameter_s=''):\n """Return a sorted list of all interactive variables.\n\n If arguments are given, only variables of types matching these\n arguments are returned.\n\n Examples\n --------\n Define two variables and list them with who_ls::\n\n In [1]: alpha = 123\n\n In [2]: beta = 'test'\n\n In [3]: %who_ls\n Out[3]: ['alpha', 'beta']\n\n In [4]: %who_ls int\n Out[4]: ['alpha']\n\n In [5]: %who_ls str\n Out[5]: ['beta']\n """\n\n user_ns = self.shell.user_ns\n user_ns_hidden = self.shell.user_ns_hidden\n nonmatching = object() # This can never be in user_ns\n out = [ i for i in user_ns\n if not i.startswith('_') \\n and (user_ns[i] is not user_ns_hidden.get(i, nonmatching)) ]\n\n typelist = parameter_s.split()\n if typelist:\n typeset = set(typelist)\n out = [i for i in out if type(user_ns[i]).__name__ in typeset]\n\n out.sort()\n return out\n\n @skip_doctest\n @line_magic\n def who(self, parameter_s=''):\n """Print all interactive variables, with some minimal formatting.\n\n If any arguments are given, only variables whose type matches one of\n these are printed. For example::\n\n %who function str\n\n will only list functions and strings, excluding all other types of\n variables. To find the proper type names, simply use type(var) at a\n command line to see how python prints type names. For example:\n\n ::\n\n In [1]: type('hello')\\\n Out[1]: <type 'str'>\n\n indicates that the type name for strings is 'str'.\n\n ``%who`` always excludes executed names loaded through your configuration\n file and things which are internal to IPython.\n\n This is deliberate, as typically you may load many modules and the\n purpose of %who is to show you only what you've manually defined.\n\n Examples\n --------\n\n Define two variables and list them with who::\n\n In [1]: alpha = 123\n\n In [2]: beta = 'test'\n\n In [3]: %who\n alpha beta\n\n In [4]: %who int\n alpha\n\n In [5]: %who str\n beta\n """\n\n varlist = self.who_ls(parameter_s)\n if not varlist:\n if parameter_s:\n print('No variables match your requested type.')\n else:\n print('Interactive namespace is empty.')\n return\n\n # if we have variables, move on...\n count = 0\n for i in varlist:\n print(i+'\t', end=' ')\n count += 1\n if count > 8:\n count = 0\n print()\n print()\n\n @skip_doctest\n @line_magic\n def whos(self, parameter_s=''):\n """Like %who, but gives some extra information about each variable.\n\n The same type filtering of %who can be applied here.\n\n For all variables, the type is printed. Additionally it prints:\n\n - For {},[],(): their length.\n\n - For numpy arrays, a summary with shape, number of\n elements, typecode and size in memory.\n\n - For objects that have shape attribute, primarily dataframe and series like\n objects, will print the shape.\n\n - Everything else: a string representation, snipping their middle if\n too long.\n\n Examples\n --------\n Define two variables and list them with whos::\n\n In [1]: alpha = 123\n\n In [2]: beta = 'test'\n\n In [3]: df = pd.DataFrame({"a": range(10), "b": range(10,20)})\n\n In [4]: s = df["a"]\n\n In [5]: %whos\n Variable Type Data/Info\n --------------------------------\n alpha int 123\n beta str test\n df DataFrame Shape: (10, 2)\n s Series Shape: (10, )\n """\n\n varnames = self.who_ls(parameter_s)\n if not varnames:\n if parameter_s:\n print('No variables match your requested type.')\n else:\n print('Interactive namespace is empty.')\n return\n\n # if we have variables, move on...\n\n # for these types, show len() instead of data:\n seq_types = ['dict', 'list', 'tuple']\n\n # for numpy arrays, display summary info\n ndarray_type = None\n if 'numpy' in sys.modules:\n try:\n from numpy import ndarray\n except ImportError:\n pass\n else:\n ndarray_type = ndarray.__name__\n\n # Find all variable names and types so we can figure out column sizes\n\n # some types are well known and can be shorter\n abbrevs = {'IPython.core.macro.Macro' : 'Macro'}\n def type_name(v):\n tn = type(v).__name__\n return abbrevs.get(tn,tn)\n\n varlist = [self.shell.user_ns[n] for n in varnames]\n\n typelist = []\n for vv in varlist:\n tt = type_name(vv)\n\n if tt=='instance':\n typelist.append( abbrevs.get(str(vv.__class__),\n str(vv.__class__)))\n else:\n typelist.append(tt)\n\n # column labels and # of spaces as separator\n varlabel = 'Variable'\n typelabel = 'Type'\n datalabel = 'Data/Info'\n colsep = 3\n # variable format strings\n vformat = "{0:<{varwidth}}{1:<{typewidth}}"\n aformat = "%s: %s elems, type `%s`, %s bytes"\n # find the size of the columns to format the output nicely\n varwidth = max(max(map(len,varnames)), len(varlabel)) + colsep\n typewidth = max(max(map(len,typelist)), len(typelabel)) + colsep\n # table header\n print(varlabel.ljust(varwidth) + typelabel.ljust(typewidth) + \\n ' '+datalabel+'\n' + '-'*(varwidth+typewidth+len(datalabel)+1))\n # and the table itself\n kb = 1024\n Mb = 1048576 # kb**2\n for vname,var,vtype in zip(varnames,varlist,typelist):\n print(vformat.format(vname, vtype, varwidth=varwidth, typewidth=typewidth), end=' ')\n if vtype == ndarray_type:\n vshape = str(var.shape).replace(',','').replace(' ','x')[1:-1]\n if vtype==ndarray_type:\n # numpy\n vsize = var.size\n vbytes = vsize*var.itemsize\n vdtype = var.dtype\n\n if vbytes < 100000:\n print(aformat % (vshape, vsize, vdtype, vbytes))\n else:\n print(aformat % (vshape, vsize, vdtype, vbytes), end=' ')\n if vbytes < Mb:\n print('(%s kb)' % (vbytes/kb,))\n else:\n print("(%s Mb)" % (vbytes / Mb,))\n elif hasattr(var, "shape"):\n # Useful for DataFrames and Series\n # Ought to work for both pandas and polars\n print(f"Shape: {var.shape}")\n elif hasattr(var, "__len__"):\n ## types that can be used in len function\n print(var if isinstance(var, str) else f"n={len(var)}")\n else:\n try:\n vstr = str(var)\n except UnicodeEncodeError:\n vstr = var.encode(DEFAULT_ENCODING,\n 'backslashreplace')\n except:\n vstr = "<object with id %d (str() failed)>" % id(var)\n vstr = vstr.replace('\n', '\\n')\n if len(vstr) < 50:\n print(vstr)\n else:\n print(vstr[:25] + "<...>" + vstr[-25:])\n\n @line_magic\n def reset(self, parameter_s=''):\n """Resets the namespace by removing all names defined by the user, if\n called without arguments, or by removing some types of objects, such\n as everything currently in IPython's In[] and Out[] containers (see\n the parameters for details).\n\n Parameters\n ----------\n -f\n force reset without asking for confirmation.\n -s\n 'Soft' reset: Only clears your namespace, leaving history intact.\n References to objects may be kept. By default (without this option),\n we do a 'hard' reset, giving you a new session and removing all\n references to objects from the current session.\n --aggressive\n Try to aggressively remove modules from sys.modules ; this\n may allow you to reimport Python modules that have been updated and\n pick up changes, but can have unintended consequences.\n\n in\n reset input history\n out\n reset output history\n dhist\n reset directory history\n array\n reset only variables that are NumPy arrays\n\n See Also\n --------\n reset_selective : invoked as ``%reset_selective``\n\n Examples\n --------\n ::\n\n In [6]: a = 1\n\n In [7]: a\n Out[7]: 1\n\n In [8]: 'a' in get_ipython().user_ns\n Out[8]: True\n\n In [9]: %reset -f\n\n In [1]: 'a' in get_ipython().user_ns\n Out[1]: False\n\n In [2]: %reset -f in\n Flushing input history\n\n In [3]: %reset -f dhist in\n Flushing directory history\n Flushing input history\n\n Notes\n -----\n Calling this magic from clients that do not implement standard input,\n such as the ipython notebook interface, will reset the namespace\n without confirmation.\n """\n opts, args = self.parse_options(parameter_s, "sf", "aggressive", mode="list")\n if "f" in opts:\n ans = True\n else:\n try:\n ans = self.shell.ask_yes_no(\n "Once deleted, variables cannot be recovered. Proceed (y/[n])?",\n default='n')\n except StdinNotImplementedError:\n ans = True\n if not ans:\n print('Nothing done.')\n return\n\n if 's' in opts: # Soft reset\n user_ns = self.shell.user_ns\n for i in self.who_ls():\n del(user_ns[i])\n elif len(args) == 0: # Hard reset\n self.shell.reset(new_session=False, aggressive=("aggressive" in opts))\n\n # reset in/out/dhist/array: previously extensinions/clearcmd.py\n ip = self.shell\n user_ns = self.shell.user_ns # local lookup, heavily used\n\n for target in args:\n target = target.lower() # make matches case insensitive\n if target == 'out':\n print("Flushing output cache (%d entries)" % len(user_ns['_oh']))\n self.shell.displayhook.flush()\n\n elif target == 'in':\n print("Flushing input history")\n pc = self.shell.displayhook.prompt_count + 1\n for n in range(1, pc):\n key = '_i'+repr(n)\n user_ns.pop(key,None)\n user_ns.update(dict(_i=u'',_ii=u'',_iii=u''))\n hm = ip.history_manager\n # don't delete these, as %save and %macro depending on the\n # length of these lists to be preserved\n hm.input_hist_parsed[:] = [''] * pc\n hm.input_hist_raw[:] = [''] * pc\n # hm has internal machinery for _i,_ii,_iii, clear it out\n hm._i = hm._ii = hm._iii = hm._i00 = u''\n\n elif target == 'array':\n # Support cleaning up numpy arrays\n try:\n from numpy import ndarray\n # This must be done with items and not iteritems because\n # we're going to modify the dict in-place.\n for x,val in list(user_ns.items()):\n if isinstance(val,ndarray):\n del user_ns[x]\n except ImportError:\n print("reset array only works if Numpy is available.")\n\n elif target == 'dhist':\n print("Flushing directory history")\n del user_ns['_dh'][:]\n\n else:\n print("Don't know how to reset ", end=' ')\n print(target + ", please run `%reset?` for details")\n\n gc.collect()\n\n @line_magic\n def reset_selective(self, parameter_s=''):\n """Resets the namespace by removing names defined by the user.\n\n Input/Output history are left around in case you need them.\n\n %reset_selective [-f] regex\n\n No action is taken if regex is not included\n\n Options\n -f : force reset without asking for confirmation.\n\n See Also\n --------\n reset : invoked as ``%reset``\n\n Examples\n --------\n We first fully reset the namespace so your output looks identical to\n this example for pedagogical reasons; in practice you do not need a\n full reset::\n\n In [1]: %reset -f\n\n Now, with a clean namespace we can make a few variables and use\n ``%reset_selective`` to only delete names that match our regexp::\n\n In [2]: a=1; b=2; c=3; b1m=4; b2m=5; b3m=6; b4m=7; b2s=8\n\n In [3]: who_ls\n Out[3]: ['a', 'b', 'b1m', 'b2m', 'b2s', 'b3m', 'b4m', 'c']\n\n In [4]: %reset_selective -f b[2-3]m\n\n In [5]: who_ls\n Out[5]: ['a', 'b', 'b1m', 'b2s', 'b4m', 'c']\n\n In [6]: %reset_selective -f d\n\n In [7]: who_ls\n Out[7]: ['a', 'b', 'b1m', 'b2s', 'b4m', 'c']\n\n In [8]: %reset_selective -f c\n\n In [9]: who_ls\n Out[9]: ['a', 'b', 'b1m', 'b2s', 'b4m']\n\n In [10]: %reset_selective -f b\n\n In [11]: who_ls\n Out[11]: ['a']\n\n Notes\n -----\n Calling this magic from clients that do not implement standard input,\n such as the ipython notebook interface, will reset the namespace\n without confirmation.\n """\n\n opts, regex = self.parse_options(parameter_s,'f')\n\n if 'f' in opts:\n ans = True\n else:\n try:\n ans = self.shell.ask_yes_no(\n "Once deleted, variables cannot be recovered. Proceed (y/[n])? ",\n default='n')\n except StdinNotImplementedError:\n ans = True\n if not ans:\n print('Nothing done.')\n return\n user_ns = self.shell.user_ns\n if not regex:\n print('No regex pattern specified. Nothing done.')\n return\n else:\n try:\n m = re.compile(regex)\n except TypeError as e:\n raise TypeError('regex must be a string or compiled pattern') from e\n for i in self.who_ls():\n if m.search(i):\n del(user_ns[i])\n\n @line_magic\n def xdel(self, parameter_s=''):\n """Delete a variable, trying to clear it from anywhere that\n IPython's machinery has references to it. By default, this uses\n the identity of the named object in the user namespace to remove\n references held under other names. The object is also removed\n from the output history.\n\n Options\n -n : Delete the specified name from all namespaces, without\n checking their identity.\n """\n opts, varname = self.parse_options(parameter_s,'n')\n try:\n self.shell.del_var(varname, ('n' in opts))\n except (NameError, ValueError) as e:\n print(type(e).__name__ +": "+ str(e))\n
.venv\Lib\site-packages\IPython\core\magics\namespace.py
namespace.py
Python
25,446
0.95
0.153103
0.084922
python-kit
607
2023-08-22T17:23:10.106776
BSD-3-Clause
false
677412fe1476832e561948d79af3fe55
"""Implementation of magic functions for matplotlib/pylab support.\n"""\n#-----------------------------------------------------------------------------\n# Copyright (c) 2012 The IPython Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\n# Our own packages\nfrom traitlets.config.application import Application\nfrom IPython.core import magic_arguments\nfrom IPython.core.magic import Magics, magics_class, line_magic\nfrom IPython.testing.skipdoctest import skip_doctest\nfrom warnings import warn\n\n#-----------------------------------------------------------------------------\n# Magic implementation classes\n#-----------------------------------------------------------------------------\n\nmagic_gui_arg = magic_arguments.argument(\n "gui",\n nargs="?",\n help="""Name of the matplotlib backend to use such as 'qt' or 'widget'.\n If given, the corresponding matplotlib backend is used,\n otherwise it will be matplotlib's default\n (which you can set in your matplotlib config file).\n """,\n)\n\n\n@magics_class\nclass PylabMagics(Magics):\n """Magics related to matplotlib's pylab support"""\n\n @skip_doctest\n @line_magic\n @magic_arguments.magic_arguments()\n @magic_arguments.argument('-l', '--list', action='store_true',\n help='Show available matplotlib backends')\n @magic_gui_arg\n def matplotlib(self, line=''):\n """Set up matplotlib to work interactively.\n\n This function lets you activate matplotlib interactive support\n at any point during an IPython session. It does not import anything\n into the interactive namespace.\n\n If you are using the inline matplotlib backend in the IPython Notebook\n you can set which figure formats are enabled using the following::\n\n In [1]: from matplotlib_inline.backend_inline import set_matplotlib_formats\n\n In [2]: set_matplotlib_formats('pdf', 'svg')\n\n The default for inline figures sets `bbox_inches` to 'tight'. This can\n cause discrepancies between the displayed image and the identical\n image created using `savefig`. This behavior can be disabled using the\n `%config` magic::\n\n In [3]: %config InlineBackend.print_figure_kwargs = {'bbox_inches':None}\n\n In addition, see the docstrings of\n `matplotlib_inline.backend_inline.set_matplotlib_formats` and\n `matplotlib_inline.backend_inline.set_matplotlib_close` for more information on\n changing additional behaviors of the inline backend.\n\n Examples\n --------\n To enable the inline backend for usage with the IPython Notebook::\n\n In [1]: %matplotlib inline\n\n In this case, where the matplotlib default is TkAgg::\n\n In [2]: %matplotlib\n Using matplotlib backend: TkAgg\n\n But you can explicitly request a different GUI backend::\n\n In [3]: %matplotlib qt\n\n You can list the available backends using the -l/--list option::\n\n In [4]: %matplotlib --list\n Available matplotlib backends: ['osx', 'qt4', 'qt5', 'gtk3', 'gtk4', 'notebook', 'wx', 'qt', 'nbagg',\n 'gtk', 'tk', 'inline']\n """\n args = magic_arguments.parse_argstring(self.matplotlib, line)\n if args.list:\n from IPython.core.pylabtools import _list_matplotlib_backends_and_gui_loops\n\n print(\n "Available matplotlib backends: %s"\n % _list_matplotlib_backends_and_gui_loops()\n )\n else:\n gui, backend = self.shell.enable_matplotlib(args.gui)\n self._show_matplotlib_backend(args.gui, backend)\n\n @skip_doctest\n @line_magic\n @magic_arguments.magic_arguments()\n @magic_arguments.argument(\n '--no-import-all', action='store_true', default=None,\n help="""Prevent IPython from performing ``import *`` into the interactive namespace.\n\n You can govern the default behavior of this flag with the\n InteractiveShellApp.pylab_import_all configurable.\n """\n )\n @magic_gui_arg\n def pylab(self, line=''):\n """Load numpy and matplotlib to work interactively.\n\n This function lets you activate pylab (matplotlib, numpy and\n interactive support) at any point during an IPython session.\n\n %pylab makes the following imports::\n\n import numpy\n import matplotlib\n from matplotlib import pylab, mlab, pyplot\n np = numpy\n plt = pyplot\n\n from IPython.display import display\n from IPython.core.pylabtools import figsize, getfigs\n\n from pylab import *\n from numpy import *\n\n If you pass `--no-import-all`, the last two `*` imports will be excluded.\n\n See the %matplotlib magic for more details about activating matplotlib\n without affecting the interactive namespace.\n """\n args = magic_arguments.parse_argstring(self.pylab, line)\n if args.no_import_all is None:\n # get default from Application\n if Application.initialized():\n app = Application.instance()\n try:\n import_all = app.pylab_import_all\n except AttributeError:\n import_all = True\n else:\n # nothing specified, no app - default True\n import_all = True\n else:\n # invert no-import flag\n import_all = not args.no_import_all\n\n gui, backend, clobbered = self.shell.enable_pylab(args.gui, import_all=import_all)\n self._show_matplotlib_backend(args.gui, backend)\n print(\n "%pylab is deprecated, use %matplotlib inline and import the required libraries."\n )\n print("Populating the interactive namespace from numpy and matplotlib")\n if clobbered:\n warn("pylab import has clobbered these variables: %s" % clobbered +\n "\n`%matplotlib` prevents importing * from pylab and numpy"\n )\n\n def _show_matplotlib_backend(self, gui, backend):\n """show matplotlib message backend message"""\n if not gui or gui == 'auto':\n print("Using matplotlib backend: %s" % backend)\n
.venv\Lib\site-packages\IPython\core\magics\pylab.py
pylab.py
Python
6,624
0.95
0.098266
0.122302
vue-tools
767
2025-01-28T09:49:12.538019
GPL-3.0
false
bdd14c067b74817875ff37de4bb923bb
"""Implementation of all the magic functions built into IPython.\n"""\n#-----------------------------------------------------------------------------\n# Copyright (c) 2012 The IPython Development Team.\n#\n# Distributed under the terms of the Modified BSD License.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#-----------------------------------------------------------------------------\n\n#-----------------------------------------------------------------------------\n# Imports\n#-----------------------------------------------------------------------------\n\nfrom ..magic import Magics, magics_class\nfrom .auto import AutoMagics\nfrom .basic import BasicMagics, AsyncMagics\nfrom .code import CodeMagics, MacroToEdit\nfrom .config import ConfigMagics\nfrom .display import DisplayMagics\nfrom .execution import ExecutionMagics\nfrom .extension import ExtensionMagics\nfrom .history import HistoryMagics\nfrom .logging import LoggingMagics\nfrom .namespace import NamespaceMagics\nfrom .osm import OSMagics\nfrom .packaging import PackagingMagics\nfrom .pylab import PylabMagics\nfrom .script import ScriptMagics\n\n#-----------------------------------------------------------------------------\n# Magic implementation classes\n#-----------------------------------------------------------------------------\n\n@magics_class\nclass UserMagics(Magics):\n """Placeholder for user-defined magics to be added at runtime.\n\n All magics are eventually merged into a single namespace at runtime, but we\n use this class to isolate the magics defined dynamically by the user into\n their own class.\n """\n
.venv\Lib\site-packages\IPython\core\magics\__init__.py
__init__.py
Python
1,619
0.95
0.095238
0.351351
python-kit
653
2024-04-22T02:25:27.365396
MIT
false
87b045764f7933431625b341312fe574
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\ast_mod.cpython-313.pyc
ast_mod.cpython-313.pyc
Other
13,471
0.95
0.07113
0.005208
node-utils
703
2025-07-02T13:16:17.676605
Apache-2.0
false
d33f5ccf61479154ffcb2c68de9e2798
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\auto.cpython-313.pyc
auto.cpython-313.pyc
Other
5,210
0.95
0.120482
0.015873
vue-tools
369
2024-02-06T06:55:56.759521
GPL-3.0
false
98d3f43fed2768c37582e01ec955a9ee
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\basic.cpython-313.pyc
basic.cpython-313.pyc
Other
28,638
0.95
0.057357
0.009063
node-utils
538
2024-09-21T18:09:23.996113
Apache-2.0
false
cfe4a54804391cee8980a08760099603
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\code.cpython-313.pyc
code.cpython-313.pyc
Other
28,197
0.95
0.074398
0
vue-tools
183
2024-01-15T00:39:56.123991
Apache-2.0
false
72277945ba82c6c688a02c343551d4f9
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\config.cpython-313.pyc
config.cpython-313.pyc
Other
4,902
0.95
0.089888
0
awesome-app
641
2023-07-11T22:56:19.799543
BSD-3-Clause
false
f94d3a245cea3a51f2f38b15e1c640e4
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\display.cpython-313.pyc
display.cpython-313.pyc
Other
3,608
0.8
0.061224
0
vue-tools
335
2025-03-29T07:34:12.815504
Apache-2.0
false
43a437934a20cd83b440f68819d6ad9f
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\execution.cpython-313.pyc
execution.cpython-313.pyc
Other
65,406
0.75
0.067829
0.01308
react-lib
394
2024-09-28T12:35:53.990572
MIT
false
8f8eadb444502b1e380e5ba78cb37570
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\extension.cpython-313.pyc
extension.cpython-313.pyc
Other
2,673
0.85
0.074074
0
vue-tools
524
2025-07-03T13:51:46.421434
GPL-3.0
false
de2d31b64c71f1a34755ccd90f95c534
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\history.cpython-313.pyc
history.cpython-313.pyc
Other
12,953
0.95
0.06278
0
node-utils
492
2024-05-27T09:25:15.341634
BSD-3-Clause
false
b9cff3a6cfc1dad5a7e6e6d709502c07
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\logging.cpython-313.pyc
logging.cpython-313.pyc
Other
6,820
0.95
0.054688
0.019608
node-utils
66
2025-01-10T15:36:08.237949
Apache-2.0
false
5e76f2a6f16fc2c145f58d619aeb8cf3
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\namespace.cpython-313.pyc
namespace.cpython-313.pyc
Other
25,256
0.95
0.06499
0
awesome-app
926
2025-05-01T20:39:56.903144
Apache-2.0
false
1878c476f715521be5f79b9513d3c5f5
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\osm.cpython-313.pyc
osm.cpython-313.pyc
Other
34,880
0.95
0.064401
0.026201
vue-tools
195
2024-04-04T09:53:27.991712
BSD-3-Clause
false
778e92f015dbed7558004209008cde19
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\packaging.cpython-313.pyc
packaging.cpython-313.pyc
Other
6,986
0.95
0.0125
0
react-lib
389
2025-06-04T15:11:28.739151
GPL-3.0
false
cb96350bd633ac861c94abacf97b5978
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\pylab.cpython-313.pyc
pylab.cpython-313.pyc
Other
6,659
0.95
0.059322
0
vue-tools
808
2025-03-19T16:50:42.255710
GPL-3.0
false
2e44af557ec6e27994ffed4ce9d3fffc
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\script.cpython-313.pyc
script.cpython-313.pyc
Other
17,961
0.95
0.04878
0
node-utils
315
2023-12-14T21:49:55.415602
Apache-2.0
false
e738736da65c7fe584420d79b9cfe49a
\n\n
.venv\Lib\site-packages\IPython\core\magics\__pycache__\__init__.cpython-313.pyc
__init__.cpython-313.pyc
Other
1,519
0.95
0.130435
0
react-lib
82
2023-07-25T09:21:03.431226
MIT
false
fb31d4cd624cb377d90f91fbc68eef34
This is the IPython startup directory\n\n.py and .ipy files in this directory will be run *prior* to any code or files specified\nvia the exec_lines or exec_files configurables whenever you load this profile.\n\nFiles will be run in lexicographical order, so you can control the execution order of files\nwith a prefix, e.g.::\n\n 00-first.py\n 50-middle.py\n 99-last.ipy\n
.venv\Lib\site-packages\IPython\core\profile\README_STARTUP
README_STARTUP
Other
371
0.7
0
0
awesome-app
312
2025-02-07T16:07:59.682390
GPL-3.0
false
54b204e6c7c2472a17d482e4bfae7689
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\alias.cpython-313.pyc
alias.cpython-313.pyc
Other
10,769
0.95
0.045455
0.025
react-lib
519
2024-11-08T03:15:48.488219
BSD-3-Clause
false
537f5fdf618dedcaddbb3f48134f4a36
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\application.cpython-313.pyc
application.cpython-313.pyc
Other
23,041
0.95
0.044776
0.005435
react-lib
601
2025-03-17T16:13:23.629220
GPL-3.0
false
9f0d7f82b15de62ee6b4831a4b3cacd1
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\async_helpers.cpython-313.pyc
async_helpers.cpython-313.pyc
Other
6,252
0.95
0.111111
0
awesome-app
467
2023-12-19T02:35:36.202408
GPL-3.0
false
6d96307c4ab37e010839492994fb5573
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\autocall.cpython-313.pyc
autocall.cpython-313.pyc
Other
2,395
0.95
0.085714
0.111111
python-kit
926
2024-07-06T06:09:07.903562
MIT
false
ec663265e8e38dfdfdb3cd4f34ab2d08
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\builtin_trap.cpython-313.pyc
builtin_trap.cpython-313.pyc
Other
4,114
0.8
0.030303
0
node-utils
520
2025-07-04T13:31:08.577468
BSD-3-Clause
false
ec9ba86c52e6bf46b9ec26384b684863
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\compilerop.cpython-313.pyc
compilerop.cpython-313.pyc
Other
5,895
0.95
0.105263
0.036145
vue-tools
738
2024-03-20T09:59:23.899469
Apache-2.0
false
4070af8a3b5322bbd12ad4a61168eb39
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\completerlib.cpython-313.pyc
completerlib.cpython-313.pyc
Other
14,713
0.95
0.045455
0
react-lib
708
2023-09-30T19:44:33.708952
BSD-3-Clause
false
c2007c3daf1e1adf86ea4216c48cfe27
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\crashhandler.cpython-313.pyc
crashhandler.cpython-313.pyc
Other
9,092
0.95
0.078788
0.028777
python-kit
542
2024-12-13T05:39:09.694609
Apache-2.0
false
5b50ffb1c93b1fe94170b5729adcc0da
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\debugger.cpython-313.pyc
debugger.cpython-313.pyc
Other
46,491
0.95
0.046926
0.005859
node-utils
722
2025-03-13T13:32:59.594139
BSD-3-Clause
false
f8638ee3c90a89523bcc426a89babc34
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\debugger_backport.cpython-313.pyc
debugger_backport.cpython-313.pyc
Other
9,031
0.95
0.036765
0.00813
python-kit
50
2025-04-22T13:58:57.766193
MIT
false
f84c53eb9c5754213f2cb4d7eb218193
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\display.cpython-313.pyc
display.cpython-313.pyc
Other
47,823
0.95
0.056522
0.022913
react-lib
875
2025-05-15T20:49:04.199950
Apache-2.0
false
9544b9ac5b253b53cf45feeff8ca497d
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\displayhook.cpython-313.pyc
displayhook.cpython-313.pyc
Other
15,541
0.95
0.072917
0.024242
vue-tools
507
2024-04-23T12:58:09.864647
Apache-2.0
false
fb9128afa1ef0e606179320c7ebd73f3
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\displaypub.cpython-313.pyc
displaypub.cpython-313.pyc
Other
6,892
0.95
0.066667
0.11215
awesome-app
47
2024-02-03T00:49:20.558533
Apache-2.0
false
4920eb87c9198374f66ba6bc82c202a0
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\display_functions.cpython-313.pyc
display_functions.cpython-313.pyc
Other
12,230
0.95
0.094697
0.017937
react-lib
589
2024-12-17T10:16:07.443619
GPL-3.0
false
5da7fe794c15849b37bb056866edd4e4
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\display_trap.cpython-313.pyc
display_trap.cpython-313.pyc
Other
2,599
0.8
0.037037
0.086957
react-lib
291
2023-12-29T05:04:45.235020
GPL-3.0
false
f1684b788ab89d761b1f4eae6508f698
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\doctb.cpython-313.pyc
doctb.cpython-313.pyc
Other
16,509
0.8
0.009346
0.005102
python-kit
569
2024-06-22T22:17:44.510524
GPL-3.0
false
d8985e0df978d6e87df519cb50dd0b4a
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\error.cpython-313.pyc
error.cpython-313.pyc
Other
1,893
0.85
0.088235
0.115385
awesome-app
614
2024-02-20T23:29:32.612727
GPL-3.0
false
79f06f71834dcc04ee4f19040262fa8f
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\events.cpython-313.pyc
events.cpython-313.pyc
Other
6,031
0.95
0.194175
0
awesome-app
788
2024-04-23T21:25:42.469986
MIT
false
a6f1c7f358aa30cf4ad49119e1ca436d
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\extensions.cpython-313.pyc
extensions.cpython-313.pyc
Other
6,279
0.95
0.255556
0.0125
node-utils
883
2024-06-21T03:14:43.196307
GPL-3.0
false
9b7906a281ceaac8d6167b54aff23b1e
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\formatters.cpython-313.pyc
formatters.cpython-313.pyc
Other
39,592
0.95
0.136943
0.022857
react-lib
646
2024-01-15T15:43:19.296166
BSD-3-Clause
false
63f2340afdd0078b4238db8f7339bdc3
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\getipython.cpython-313.pyc
getipython.cpython-313.pyc
Other
691
0.95
0.222222
0
python-kit
856
2024-07-10T14:58:28.215820
GPL-3.0
false
b8382a81433e028a0fe87c30bd5ea92a
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\guarded_eval.cpython-313.pyc
guarded_eval.cpython-313.pyc
Other
35,946
0.95
0.065574
0.025271
node-utils
735
2024-03-06T04:51:31.031065
BSD-3-Clause
false
00f790cfee9c5e965a95f3679154296a
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\history.cpython-313.pyc
history.cpython-313.pyc
Other
47,705
0.95
0.060185
0.003367
awesome-app
947
2024-06-26T08:45:57.306469
GPL-3.0
false
dbec439be4b8f3a7e2dd2bf16a6f9f59
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\historyapp.cpython-313.pyc
historyapp.cpython-313.pyc
Other
7,786
0.8
0.028037
0
vue-tools
965
2024-10-12T02:21:39.082492
GPL-3.0
false
e45bed553c5bb07db948564fc2153258
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\hooks.cpython-313.pyc
hooks.cpython-313.pyc
Other
5,759
0.95
0.125
0
node-utils
848
2023-12-29T06:28:04.776789
BSD-3-Clause
false
c33e1211a1488787327535107fba0162
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\inputtransformer2.cpython-313.pyc
inputtransformer2.cpython-313.pyc
Other
35,154
0.95
0.055024
0.02439
react-lib
892
2025-02-10T08:47:18.526701
BSD-3-Clause
false
7b81a47b4d4c0a09ff393bd825164794
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\latex_symbols.cpython-313.pyc
latex_symbols.cpython-313.pyc
Other
53,982
0.8
0
0
vue-tools
880
2024-03-23T08:11:25.197211
GPL-3.0
false
c24ce238973eae7d7afc61f72d760ab3
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\logger.cpython-313.pyc
logger.cpython-313.pyc
Other
9,309
0.95
0.103448
0.012658
react-lib
460
2024-10-08T00:46:52.328517
MIT
false
d64668b3722cb3264d75f05ae282f591
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\macro.cpython-313.pyc
macro.cpython-313.pyc
Other
2,588
0.95
0.125
0.095238
react-lib
92
2025-05-13T20:23:43.619055
Apache-2.0
false
51d8523eddfd7ef8b457c1ea8fdae69d
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\magic.cpython-313.pyc
magic.cpython-313.pyc
Other
27,513
0.95
0.151741
0.020115
awesome-app
133
2024-06-27T20:20:29.413229
MIT
false
8b28af14a6b25c9ff842da2b168c4e73
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\magic_arguments.cpython-313.pyc
magic_arguments.cpython-313.pyc
Other
11,993
0.95
0.089172
0.007634
awesome-app
240
2024-05-26T17:17:15.754797
BSD-3-Clause
false
d13d9c60cfc896a29f586a763a11f046
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\oinspect.cpython-313.pyc
oinspect.cpython-313.pyc
Other
41,997
0.95
0.0746
0.012072
awesome-app
790
2025-03-19T21:58:16.901154
MIT
false
10bab94f5700f648ed29ffa02c50a83d
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\page.cpython-313.pyc
page.cpython-313.pyc
Other
12,732
0.8
0.078431
0
awesome-app
696
2024-04-16T07:51:08.778772
Apache-2.0
false
645dab0c0f1ffda10c853b0f4ce0c74e
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\payload.cpython-313.pyc
payload.cpython-313.pyc
Other
1,895
0.8
0.041667
0.111111
awesome-app
330
2024-09-19T00:47:32.713004
BSD-3-Clause
false
cf0bd669c8b63bfdf3f7174f50c656fa
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\payloadpage.cpython-313.pyc
payloadpage.cpython-313.pyc
Other
1,198
0.7
0
0
awesome-app
80
2023-09-13T09:31:34.966228
GPL-3.0
false
1fd101d104984e23efc698245274c423
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\prefilter.cpython-313.pyc
prefilter.cpython-313.pyc
Other
28,987
0.95
0.076923
0.018182
python-kit
853
2023-11-16T04:08:36.654564
MIT
false
20ec6cbc23b2f3e4d2d8ed750b81aaf8
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\profileapp.cpython-313.pyc
profileapp.cpython-313.pyc
Other
13,478
0.95
0.054795
0.007519
node-utils
833
2025-03-31T08:23:34.588943
MIT
false
2944b0385ccd844df4ee347f0d57d3d0
\n\n
.venv\Lib\site-packages\IPython\core\__pycache__\profiledir.cpython-313.pyc
profiledir.cpython-313.pyc
Other
11,060
0.95
0.066116
0
awesome-app
116
2025-01-20T21:15:24.211724
Apache-2.0
false
79be484251b0c09a6ba3ffdb3e31ae4f