first commit
This commit is contained in:
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,28 @@
|
||||
Copyright 2010 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,124 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Flask
|
||||
Version: 2.0.1
|
||||
Summary: A simple framework for building complex web applications.
|
||||
Home-page: https://palletsprojects.com/p/flask
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://flask.palletsprojects.com/
|
||||
Project-URL: Changes, https://flask.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/flask/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/flask/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Flask
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
|
||||
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Requires-Dist: Werkzeug (>=2.0)
|
||||
Requires-Dist: Jinja2 (>=3.0)
|
||||
Requires-Dist: itsdangerous (>=2.0)
|
||||
Requires-Dist: click (>=7.1.2)
|
||||
Provides-Extra: async
|
||||
Requires-Dist: asgiref (>=3.2) ; extra == 'async'
|
||||
Provides-Extra: dotenv
|
||||
Requires-Dist: python-dotenv ; extra == 'dotenv'
|
||||
|
||||
Flask
|
||||
=====
|
||||
|
||||
Flask is a lightweight `WSGI`_ web application framework. It is designed
|
||||
to make getting started quick and easy, with the ability to scale up to
|
||||
complex applications. It began as a simple wrapper around `Werkzeug`_
|
||||
and `Jinja`_ and has become one of the most popular Python web
|
||||
application frameworks.
|
||||
|
||||
Flask offers suggestions, but doesn't enforce any dependencies or
|
||||
project layout. It is up to the developer to choose the tools and
|
||||
libraries they want to use. There are many extensions provided by the
|
||||
community that make adding new functionality easy.
|
||||
|
||||
.. _WSGI: https://wsgi.readthedocs.io/
|
||||
.. _Werkzeug: https://werkzeug.palletsprojects.com/
|
||||
.. _Jinja: https://jinja.palletsprojects.com/
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ pip install -U Flask
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
A Simple Example
|
||||
----------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# save this as app.py
|
||||
from flask import Flask
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
return "Hello, World!"
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ flask run
|
||||
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
For guidance on setting up a development environment and how to make a
|
||||
contribution to Flask, see the `contributing guidelines`_.
|
||||
|
||||
.. _contributing guidelines: https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports Flask and the libraries
|
||||
it uses. In order to grow the community of contributors and users, and
|
||||
allow the maintainers to devote more time to the projects, `please
|
||||
donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://flask.palletsprojects.com/
|
||||
- Changes: https://flask.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/Flask/
|
||||
- Source Code: https://github.com/pallets/flask/
|
||||
- Issue Tracker: https://github.com/pallets/flask/issues/
|
||||
- Website: https://palletsprojects.com/p/flask/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
../../../bin/flask,sha256=EvIM3XMnKgEAdW90lNiHV97MK-JWLp1Oo91zT3dhDCY,228
|
||||
Flask-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask-2.0.1.dist-info/LICENSE.rst,sha256=SJqOEQhQntmKN7uYPhHg9-HTHwvY-Zp5yESOf_N9B-o,1475
|
||||
Flask-2.0.1.dist-info/METADATA,sha256=50Jm1647RKw98p4RF64bCqRh0wajk-n3hQ7av2-pniA,3808
|
||||
Flask-2.0.1.dist-info/RECORD,,
|
||||
Flask-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask-2.0.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Flask-2.0.1.dist-info/entry_points.txt,sha256=gBLA1aKg0OYR8AhbAfg8lnburHtKcgJLDU52BBctN0k,42
|
||||
Flask-2.0.1.dist-info/top_level.txt,sha256=dvi65F6AeGWVU0TBpYiC04yM60-FX1gJFkK31IKQr5c,6
|
||||
flask/__init__.py,sha256=w5v6GCNm8eLDMNWqs2ue7HLHo75aslAwz1h3k3YO9HY,2251
|
||||
flask/__main__.py,sha256=bYt9eEaoRQWdejEHFD8REx9jxVEdZptECFsV7F49Ink,30
|
||||
flask/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask/__pycache__/__main__.cpython-311.pyc,,
|
||||
flask/__pycache__/app.cpython-311.pyc,,
|
||||
flask/__pycache__/blueprints.cpython-311.pyc,,
|
||||
flask/__pycache__/cli.cpython-311.pyc,,
|
||||
flask/__pycache__/config.cpython-311.pyc,,
|
||||
flask/__pycache__/ctx.cpython-311.pyc,,
|
||||
flask/__pycache__/debughelpers.cpython-311.pyc,,
|
||||
flask/__pycache__/globals.cpython-311.pyc,,
|
||||
flask/__pycache__/helpers.cpython-311.pyc,,
|
||||
flask/__pycache__/logging.cpython-311.pyc,,
|
||||
flask/__pycache__/scaffold.cpython-311.pyc,,
|
||||
flask/__pycache__/sessions.cpython-311.pyc,,
|
||||
flask/__pycache__/signals.cpython-311.pyc,,
|
||||
flask/__pycache__/templating.cpython-311.pyc,,
|
||||
flask/__pycache__/testing.cpython-311.pyc,,
|
||||
flask/__pycache__/typing.cpython-311.pyc,,
|
||||
flask/__pycache__/views.cpython-311.pyc,,
|
||||
flask/__pycache__/wrappers.cpython-311.pyc,,
|
||||
flask/app.py,sha256=q6lpiiWVxjljQRwjjneUBpfllXYPEq0CFAUpTQ5gIeA,82376
|
||||
flask/blueprints.py,sha256=OjI-dkwx96ZNMUGDDFMKzgcpUJf240WRuMlHkmgI1Lc,23541
|
||||
flask/cli.py,sha256=iN1pL2SevE5Nmvey-0WwnxG3nipZXIiE__Ed4lx3IuM,32036
|
||||
flask/config.py,sha256=jj_7JGen_kYuTlKrx8ZPBsZddb8mihC0ODg4gcjXBX8,11068
|
||||
flask/ctx.py,sha256=EM3W0v1ctuFQAGk_HWtQdoJEg_r2f5Le4xcmElxFwwk,17428
|
||||
flask/debughelpers.py,sha256=wk5HtLwENsQ4e8tkxfBn6ykUeVRDuMbQCKgtEVe6jxk,6171
|
||||
flask/globals.py,sha256=cWd-R2hUH3VqPhnmQNww892tQS6Yjqg_wg8UvW1M7NM,1723
|
||||
flask/helpers.py,sha256=00WqA3wYeyjMrnAOPZTUyrnUf7H8ik3CVT0kqGl_qjk,30589
|
||||
flask/json/__init__.py,sha256=d-db2DJMASq0G7CI-JvobehRE1asNRGX1rIDQ1GF9WM,11580
|
||||
flask/json/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask/json/__pycache__/tag.cpython-311.pyc,,
|
||||
flask/json/tag.py,sha256=fys3HBLssWHuMAIJuTcf2K0bCtosePBKXIWASZEEjnU,8857
|
||||
flask/logging.py,sha256=1o_hirVGqdj7SBdETnhX7IAjklG89RXlrwz_2CjzQQE,2273
|
||||
flask/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
flask/scaffold.py,sha256=EhQuiFrdcmJHxqPGQkEpqLsEUZ7ULZD0rtED2NrduvM,32400
|
||||
flask/sessions.py,sha256=Kb7zY4qBIOU2cw1xM5mQ_KmgYUBDFbUYWjlkq0EFYis,15189
|
||||
flask/signals.py,sha256=HQWgBEXlrLbHwLBoWqAStJKcN-rsB1_AMO8-VZ7LDOo,2126
|
||||
flask/templating.py,sha256=l96VD39JQ0nue4Bcj7wZ4-FWWs-ppLxvgBCpwDQ4KAk,5626
|
||||
flask/testing.py,sha256=OsHT-2B70abWH3ulY9IbhLchXIeyj3L-cfcDa88wv5E,10281
|
||||
flask/typing.py,sha256=zVqhz53KklncAv-WxbpxGZfaRGOqeWAsLdP1tTMaCuE,1684
|
||||
flask/views.py,sha256=F2PpWPloe4x0906IUjnPcsOqg5YvmQIfk07_lFeAD4s,5865
|
||||
flask/wrappers.py,sha256=VndbHPRBSUUOejmd2Y3ydkoCVUtsS2OJIdJEVIkBVD8,5604
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[console_scripts]
|
||||
flask = flask.cli:main
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
flask
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2017 Grey Li
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,81 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Flask-Dropzone
|
||||
Version: 1.6.0
|
||||
Summary: Upload files in Flask with Dropzone.js.
|
||||
Home-page: https://github.com/greyli/flask-dropzone
|
||||
Author: Grey Li
|
||||
Author-email: withlihui@gmail.com
|
||||
License: MIT
|
||||
Keywords: flask extension development upload
|
||||
Platform: any
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Dist: Flask
|
||||
|
||||
===============
|
||||
Flask-Dropzone
|
||||
===============
|
||||
|
||||
Flask-Dropzone packages `Dropzone.js
|
||||
<http://dropzonejs.com>`_ into an extension to add file upload support for Flask.
|
||||
It can create links to serve Dropzone from a CDN and works with no JavaScript code in your application.
|
||||
|
||||
NOTICE: This extension is built for simple usage, if you need more flexibility, please use Dropzone.js directly.
|
||||
|
||||
Basic Usage
|
||||
-----------
|
||||
|
||||
Step 1: Initialize the extension:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from flask_dropzone import Dropzone
|
||||
|
||||
dropzone = Dropzone(app)
|
||||
|
||||
|
||||
Step 2: In your `<head>` section of your base template add the following code::
|
||||
|
||||
<head>
|
||||
{{ dropzone.load_css() }}
|
||||
</head>
|
||||
<body>
|
||||
...
|
||||
{{ dropzone.load_js() }}
|
||||
</body>
|
||||
|
||||
You can assign the version of Dropzone.js through `version` argument, the default value is `5.2.0`.
|
||||
Step 3: Creating a Drop Zone with `create()`, and configure it with `config()`::
|
||||
|
||||
{{ dropzone.create(action='the_url_which_handle_uploads') }}
|
||||
...
|
||||
{{ dropzone.config() }}
|
||||
|
||||
Also to edit the action view to yours.
|
||||
|
||||
Beautify Dropzone
|
||||
-----------------
|
||||
|
||||
Style it according to your preferences through `style()` method::
|
||||
|
||||
{{ dropzone.style('border: 2px dashed #0087F7; margin: 10%; min-height: 400px;') }}
|
||||
|
||||
More Detail
|
||||
-----------
|
||||
|
||||
Go to `Documentation
|
||||
<https://flask-dropzone.readthedocs.io/en/latest/>`_ , which you can check for more
|
||||
details.
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Flask_Dropzone-1.6.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask_Dropzone-1.6.0.dist-info/LICENSE.txt,sha256=urWe6H0ZCLXr2ZalRweug84-k_8wYWjAXq28Xc9aWsg,1085
|
||||
Flask_Dropzone-1.6.0.dist-info/METADATA,sha256=0OUcmvmRPA74UU4P14a3eM4NColYn5GI5JXwMRq_Ni4,2365
|
||||
Flask_Dropzone-1.6.0.dist-info/RECORD,,
|
||||
Flask_Dropzone-1.6.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask_Dropzone-1.6.0.dist-info/WHEEL,sha256=Z-nyYpwrcSqxfdux5Mbn_DQ525iP7J2DG3JgGvOYyTQ,110
|
||||
Flask_Dropzone-1.6.0.dist-info/top_level.txt,sha256=tnmF1XttbqOTalmDk8Ple8B9lemHMKPzXFl96tCdVKE,15
|
||||
flask_dropzone/__init__.py,sha256=nC4V2_-dfU-VweN2kDMQri99Rjo4s8GMN6jTGAyppvo,20991
|
||||
flask_dropzone/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask_dropzone/__pycache__/utils.cpython-311.pyc,,
|
||||
flask_dropzone/static/dropzone.min.css,sha256=C1uHyYDGrQDAk1IbmtnkXnXT_u3PkM9wh0hkpLMhy8U,9718
|
||||
flask_dropzone/static/dropzone.min.js,sha256=k394u1_NWzM2OVjwVumG22a0prnevsijOBBv3JrDlx4,42791
|
||||
flask_dropzone/utils.py,sha256=3DloM9U_-YL5ty0S12UXG2GhdYVF1QlL38MtbtOAqpg,728
|
||||
@@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
flask_dropzone
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,203 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
Copyright (c) 2018 heartsucker
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2018 heartsucker
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
|
||||
persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
|
||||
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,70 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Flask-FontAwesome
|
||||
Version: 0.1.5
|
||||
Summary: FontAwesome for Flask
|
||||
Home-page: https://github.com/heartsucker/flask-fontawesome
|
||||
Author: heartsucker
|
||||
Author-email: heartsucker@autistici.org
|
||||
License: UNKNOWN
|
||||
Platform: any
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Flask
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: Apache Software License
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.5
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Requires-Python: >=3.5
|
||||
Description-Content-Type: text/markdown
|
||||
Requires-Dist: Flask
|
||||
|
||||
# Flask-FontAwesome
|
||||
[](https://pypi.python.org/pypi/Flask-FontAwesome) [](https://api.travis-ci.org/heartsucker/flask-fontawesome.svg?branch=develop) [](https://flask-fontawesome.readthedocs.io/en/latest/?badge=latest)
|
||||
|
||||
Flask extension for [FontAwesome](https://fontawesome.com/).
|
||||
|
||||
## Example
|
||||
|
||||
```python
|
||||
from flask import Flask, render_template
|
||||
from flask_fontawesome import FontAwesome
|
||||
|
||||
app = Flask(__name__)
|
||||
fa = FontAwesome(app)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
app.run(host='127.0.0.1', port=8080)
|
||||
```
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
{{ fontawesome_html() }}
|
||||
<title>FontAwesome Example</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>FontAwesome Example</h1>
|
||||
<p>This is an example of a <span class="fas fa-link"></span> link.</p>
|
||||
</body>
|
||||
</html>
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
This work is dual licensed under the MIT and Apache-2.0 licenses. See [LICENSE-MIT](./LICENSE-MIT)
|
||||
and [LICENSE-APACHE](./LICENSE-APACHE) for details.
|
||||
|
||||
### Attribution
|
||||
|
||||
The resources contained under [`flask_fontawesome/static`](./flask_fontawesome/static) are licensed to FontAwesome.
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.32.3)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
flask_fontawesome
|
||||
@@ -0,0 +1,59 @@
|
||||
|Build Status| |Coverage Status| |PyPI Version| |PyPI Downloads| |Wheel Status|
|
||||
|
||||
Flask-Navigation
|
||||
================
|
||||
|
||||
Build navigation bars in your Flask application. ::
|
||||
|
||||
nav.Bar('top', [
|
||||
nav.Item('Home', 'index'),
|
||||
nav.Item('Latest News', 'news', {'page': 1}),
|
||||
])
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
$ pip install Flask-Navigation
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- `Document <https://flask-navigation.readthedocs.org>`_
|
||||
- `Issue Track <https://github.com/tonyseek/flask-navigation/issues>`_
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
If you want to report bugs or request features, please create issues on
|
||||
`GitHub Issues <https://github.com/tonyseek/flask-navigation/issues>`_.
|
||||
|
||||
|
||||
Contributes
|
||||
-----------
|
||||
|
||||
You can send a pull reueqst on
|
||||
`GitHub <https://github.com/tonyseek/flask-navigation/pulls>`_.
|
||||
|
||||
|
||||
.. |Build Status| image:: https://travis-ci.org/tonyseek/flask-navigation.svg?branch=master,develop
|
||||
:target: https://travis-ci.org/tonyseek/flask-navigation
|
||||
:alt: Build Status
|
||||
.. |Coverage Status| image:: https://img.shields.io/coveralls/tonyseek/flask-navigation/develop.svg
|
||||
:target: https://coveralls.io/r/tonyseek/flask-navigation
|
||||
:alt: Coverage Status
|
||||
.. |Wheel Status| image:: https://pypip.in/wheel/Flask-Navigation/badge.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Wheel Status
|
||||
.. |PyPI Version| image:: https://img.shields.io/pypi/v/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: PyPI Version
|
||||
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Downloads
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,84 @@
|
||||
Metadata-Version: 2.0
|
||||
Name: Flask-Navigation
|
||||
Version: 0.2.0
|
||||
Summary: The navigation of Flask application.
|
||||
Home-page: https://github.com/tonyseek/flask-navigation
|
||||
Author: Jiangge Zhang
|
||||
Author-email: tonyseek@gmail.com
|
||||
License: MIT
|
||||
Keywords: navigation,flask,navbar,nav
|
||||
Platform: UNKNOWN
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Programming Language :: Python :: 2.7
|
||||
Classifier: Programming Language :: Python :: 3.3
|
||||
Classifier: Programming Language :: Python :: 3.4
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
Classifier: Development Status :: 3 - Alpha
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Framework :: Flask
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Dist: Flask
|
||||
Requires-Dist: blinker
|
||||
|
||||
|Build Status| |Coverage Status| |PyPI Version| |PyPI Downloads| |Wheel Status|
|
||||
|
||||
Flask-Navigation
|
||||
================
|
||||
|
||||
Build navigation bars in your Flask application. ::
|
||||
|
||||
nav.Bar('top', [
|
||||
nav.Item('Home', 'index'),
|
||||
nav.Item('Latest News', 'news', {'page': 1}),
|
||||
])
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
::
|
||||
|
||||
$ pip install Flask-Navigation
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- `Document <https://flask-navigation.readthedocs.org>`_
|
||||
- `Issue Track <https://github.com/tonyseek/flask-navigation/issues>`_
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
If you want to report bugs or request features, please create issues on
|
||||
`GitHub Issues <https://github.com/tonyseek/flask-navigation/issues>`_.
|
||||
|
||||
|
||||
Contributes
|
||||
-----------
|
||||
|
||||
You can send a pull reueqst on
|
||||
`GitHub <https://github.com/tonyseek/flask-navigation/pulls>`_.
|
||||
|
||||
|
||||
.. |Build Status| image:: https://travis-ci.org/tonyseek/flask-navigation.svg?branch=master,develop
|
||||
:target: https://travis-ci.org/tonyseek/flask-navigation
|
||||
:alt: Build Status
|
||||
.. |Coverage Status| image:: https://img.shields.io/coveralls/tonyseek/flask-navigation/develop.svg
|
||||
:target: https://coveralls.io/r/tonyseek/flask-navigation
|
||||
:alt: Coverage Status
|
||||
.. |Wheel Status| image:: https://pypip.in/wheel/Flask-Navigation/badge.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Wheel Status
|
||||
.. |PyPI Version| image:: https://img.shields.io/pypi/v/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: PyPI Version
|
||||
.. |PyPI Downloads| image:: https://img.shields.io/pypi/dm/Flask-Navigation.svg
|
||||
:target: https://pypi.python.org/pypi/Flask-Navigation
|
||||
:alt: Downloads
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
Flask_Navigation-0.2.0.dist-info/DESCRIPTION.rst,sha256=gr-3wNADqpwmzOwJtlpikBw5y-ytgSKFuHr0IEpDfRw,1622
|
||||
Flask_Navigation-0.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask_Navigation-0.2.0.dist-info/METADATA,sha256=m6TFfXHlgd6zGKWVtWLF4NY9JQPs1xFDKX2k0dNvZE0,2548
|
||||
Flask_Navigation-0.2.0.dist-info/RECORD,,
|
||||
Flask_Navigation-0.2.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask_Navigation-0.2.0.dist-info/WHEEL,sha256=6lxp_S3wZGmTBtGMVmNNLyvKFcp7HqQw2Wn4YYk-Suo,110
|
||||
Flask_Navigation-0.2.0.dist-info/metadata.json,sha256=FlrQF9vFyjQF_LfdvlhV4tjR1rtcYyD3p4fElb-Y0gc,1014
|
||||
Flask_Navigation-0.2.0.dist-info/top_level.txt,sha256=yPiZ-n1i5T4KiiwzsFUqKiDHSm2FSFyi1vZseMQQjvk,23
|
||||
flask_navigation/__init__.py,sha256=I8PKMi6uUY0rbBhoYcQMgPYcMXZLSQDEcPJY2wcSpok,77
|
||||
flask_navigation/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/api.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/item.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/navbar.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/signals.cpython-311.pyc,,
|
||||
flask_navigation/__pycache__/utils.cpython-311.pyc,,
|
||||
flask_navigation/api.py,sha256=ORh-RV8f_RuooTcoeqXpoG2h19hDFpJp3jih6GQdRMI,1980
|
||||
flask_navigation/item.py,sha256=1bHlBxD8ffnYlPk5lsfUgitqBPdyhdmYY1dJ7-tgZs0,6971
|
||||
flask_navigation/navbar.py,sha256=rCavK3yqivp2vgBJIhcth4DdGvkcGBkKNRgJsbaULd8,1478
|
||||
flask_navigation/signals.py,sha256=pwwfBB0BRiq2xnJMDIKKYjPacESeYbXrEBb3JoIy6ys,112
|
||||
flask_navigation/utils.py,sha256=iUaK1fpKfDQIkT7V2ve5Ez8Fsf8ocoOkgPFpRAQmUNY,2188
|
||||
tests/integration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
tests/integration/__pycache__/__init__.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/app.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/ext.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/test_app.cpython-311.pyc,,
|
||||
tests/integration/__pycache__/views.cpython-311.pyc,,
|
||||
tests/integration/app.py,sha256=enKCtXGhyTuZb1HwW-K1oD0ngKSNdxd4oXPutLWa5xA,285
|
||||
tests/integration/ext.py,sha256=KNbqvFYK6f_ciQ-dGBqlD_2CRzwfrm2dsisTHO9TgnI,65
|
||||
tests/integration/test_app.py,sha256=OarYJFaHQZBMKxs8CfFJ2rGbZhDJxuZBLC1SalcfZvw,1301
|
||||
tests/integration/views.py,sha256=JX7Fwnz9301MToprFJFPyiEf0rLfVTKEOqOoRPN08nE,724
|
||||
@@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.23.0)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
{"name": "Flask-Navigation", "metadata_version": "2.0", "keywords": "navigation,flask,navbar,nav", "extras": [], "generator": "bdist_wheel (0.23.0)", "version": "0.2.0", "document_names": {"description": "DESCRIPTION.rst"}, "license": "MIT", "summary": "The navigation of Flask application.", "project_urls": {"Home": "https://github.com/tonyseek/flask-navigation"}, "contacts": [{"role": "author", "email": "tonyseek@gmail.com", "name": "Jiangge Zhang"}], "classifiers": ["Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: PyPy", "Development Status :: 3 - Alpha", "License :: OSI Approved :: MIT License", "Intended Audience :: Developers", "Operating System :: OS Independent", "Environment :: Web Environment", "Framework :: Flask", "Topic :: Software Development :: Libraries :: Python Modules"], "run_requires": [{"requires": ["Flask", "blinker"]}]}
|
||||
@@ -0,0 +1,2 @@
|
||||
flask_navigation
|
||||
tests
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Miguel Grinberg
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@@ -0,0 +1,79 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Flask-SocketIO
|
||||
Version: 5.1.1
|
||||
Summary: Socket.IO integration for Flask applications
|
||||
Home-page: https://github.com/miguelgrinberg/flask-socketio
|
||||
Author: Miguel Grinberg
|
||||
Author-email: miguel.grinberg@gmail.com
|
||||
License: UNKNOWN
|
||||
Project-URL: Bug Tracker, https://github.com/miguelgrinberg/flask-socketio/issues
|
||||
Platform: UNKNOWN
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: Programming Language :: Python :: 3
|
||||
Classifier: License :: OSI Approved :: MIT License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/markdown
|
||||
License-File: LICENSE
|
||||
Requires-Dist: Flask (>=0.9)
|
||||
Requires-Dist: python-socketio (>=5.0.2)
|
||||
|
||||
Flask-SocketIO
|
||||
==============
|
||||
|
||||
[](https://github.com/miguelgrinberg/Flask-SocketIO/actions) [](https://codecov.io/gh/miguelgrinberg/flask-socketio)
|
||||
|
||||
Socket.IO integration for Flask applications.
|
||||
|
||||
Sponsors
|
||||
--------
|
||||
|
||||
The following organizations are funding this project:
|
||||
|
||||
<br>[Socket.IO](https://socket.io) | [Add your company here!](https://github.com/sponsors/miguelgrinberg)|
|
||||
-|-
|
||||
|
||||
Many individual sponsors also support this project through small ongoing contributions. Why not [join them](https://github.com/sponsors/miguelgrinberg)?
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
You can install this package as usual with pip:
|
||||
|
||||
pip install flask-socketio
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
```py
|
||||
from flask import Flask, render_template
|
||||
from flask_socketio import SocketIO, emit
|
||||
|
||||
app = Flask(__name__)
|
||||
app.config['SECRET_KEY'] = 'secret!'
|
||||
socketio = SocketIO(app)
|
||||
|
||||
@app.route('/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
|
||||
@socketio.event
|
||||
def my_event(message):
|
||||
emit('my response', {'data': 'got it!'})
|
||||
|
||||
if __name__ == '__main__':
|
||||
socketio.run(app)
|
||||
```
|
||||
|
||||
Resources
|
||||
---------
|
||||
|
||||
- [Tutorial](http://blog.miguelgrinberg.com/post/easy-websockets-with-flask-and-gevent)
|
||||
- [Documentation](http://flask-socketio.readthedocs.io/en/latest/)
|
||||
- [PyPI](https://pypi.python.org/pypi/Flask-SocketIO)
|
||||
- [Change Log](https://github.com/miguelgrinberg/Flask-SocketIO/blob/main/CHANGES.md)
|
||||
- Questions? See the [questions](https://stackoverflow.com/questions/tagged/flask-socketio) others have asked on Stack Overflow, or [ask](https://stackoverflow.com/questions/ask?tags=python+flask-socketio+python-socketio) your own question.
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
Flask_SocketIO-5.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Flask_SocketIO-5.1.1.dist-info/LICENSE,sha256=aNCWbkgKjS_T1cJtACyZbvCM36KxWnfQ0LWTuavuYKQ,1082
|
||||
Flask_SocketIO-5.1.1.dist-info/METADATA,sha256=YfMRfjfaG2KLc9B9HklyU6EKEa6Mwi5GIfAGpTEWFdA,2611
|
||||
Flask_SocketIO-5.1.1.dist-info/RECORD,,
|
||||
Flask_SocketIO-5.1.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Flask_SocketIO-5.1.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Flask_SocketIO-5.1.1.dist-info/top_level.txt,sha256=C1ugzQBJ3HHUJsWGzyt70XRVOX-y4CUAR8MWKjwJOQ8,15
|
||||
flask_socketio/__init__.py,sha256=2qJGh4OhAkj90wj0Go5IBk34GefHASkjx3QcXwJHdDw,48440
|
||||
flask_socketio/__pycache__/__init__.cpython-311.pyc,,
|
||||
flask_socketio/__pycache__/namespace.cpython-311.pyc,,
|
||||
flask_socketio/__pycache__/test_client.cpython-311.pyc,,
|
||||
flask_socketio/namespace.py,sha256=b3oyXEemu2po-wpoy4ILTHQMVuVQqicogCDxfymfz_w,2020
|
||||
flask_socketio/test_client.py,sha256=97iQtnjxNPWdm255vI1d_WB4y1QuHhZ0-qK-QTE25L0,10468
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
flask_socketio
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,28 @@
|
||||
Copyright 2007 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,112 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Jinja2
|
||||
Version: 3.0.1
|
||||
Summary: A very fast and expressive template engine.
|
||||
Home-page: https://palletsprojects.com/p/jinja/
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://jinja.palletsprojects.com/
|
||||
Project-URL: Changes, https://jinja.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/jinja/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/jinja/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Text Processing :: Markup :: HTML
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Requires-Dist: MarkupSafe (>=2.0)
|
||||
Provides-Extra: i18n
|
||||
Requires-Dist: Babel (>=2.7) ; extra == 'i18n'
|
||||
|
||||
Jinja
|
||||
=====
|
||||
|
||||
Jinja is a fast, expressive, extensible templating engine. Special
|
||||
placeholders in the template allow writing code similar to Python
|
||||
syntax. Then the template is passed data to render the final document.
|
||||
|
||||
It includes:
|
||||
|
||||
- Template inheritance and inclusion.
|
||||
- Define and import macros within templates.
|
||||
- HTML templates can use autoescaping to prevent XSS from untrusted
|
||||
user input.
|
||||
- A sandboxed environment can safely render untrusted templates.
|
||||
- AsyncIO support for generating templates and calling async
|
||||
functions.
|
||||
- I18N support with Babel.
|
||||
- Templates are compiled to optimized Python code just-in-time and
|
||||
cached, or can be compiled ahead-of-time.
|
||||
- Exceptions point to the correct line in templates to make debugging
|
||||
easier.
|
||||
- Extensible filters, tests, functions, and even syntax.
|
||||
|
||||
Jinja's philosophy is that while application logic belongs in Python if
|
||||
possible, it shouldn't make the template designer's job difficult by
|
||||
restricting functionality too much.
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
$ pip install -U Jinja2
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
In A Nutshell
|
||||
-------------
|
||||
|
||||
.. code-block:: jinja
|
||||
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Members{% endblock %}
|
||||
{% block content %}
|
||||
<ul>
|
||||
{% for user in users %}
|
||||
<li><a href="{{ user.url }}">{{ user.username }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports Jinja and other popular
|
||||
packages. In order to grow the community of contributors and users, and
|
||||
allow the maintainers to devote more time to the projects, `please
|
||||
donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://jinja.palletsprojects.com/
|
||||
- Changes: https://jinja.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/Jinja2/
|
||||
- Source Code: https://github.com/pallets/jinja/
|
||||
- Issue Tracker: https://github.com/pallets/jinja/issues/
|
||||
- Website: https://palletsprojects.com/p/jinja/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
||||
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
Jinja2-3.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Jinja2-3.0.1.dist-info/LICENSE.rst,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475
|
||||
Jinja2-3.0.1.dist-info/METADATA,sha256=k6STiOONbGESP2rEKmjhznuG10vm9sNCHCUQL9AQFM4,3508
|
||||
Jinja2-3.0.1.dist-info/RECORD,,
|
||||
Jinja2-3.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Jinja2-3.0.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Jinja2-3.0.1.dist-info/entry_points.txt,sha256=Qy_DkVo6Xj_zzOtmErrATe8lHZhOqdjpt3e4JJAGyi8,61
|
||||
Jinja2-3.0.1.dist-info/top_level.txt,sha256=PkeVWtLb3-CqjWi1fO29OCbj55EhX_chhKrCdrVe_zs,7
|
||||
jinja2/__init__.py,sha256=fd8jaCRsCATgC7ahuUTD8CyfQoc4aRfALEIny4mwfog,2205
|
||||
jinja2/__pycache__/__init__.cpython-311.pyc,,
|
||||
jinja2/__pycache__/_identifier.cpython-311.pyc,,
|
||||
jinja2/__pycache__/async_utils.cpython-311.pyc,,
|
||||
jinja2/__pycache__/bccache.cpython-311.pyc,,
|
||||
jinja2/__pycache__/compiler.cpython-311.pyc,,
|
||||
jinja2/__pycache__/constants.cpython-311.pyc,,
|
||||
jinja2/__pycache__/debug.cpython-311.pyc,,
|
||||
jinja2/__pycache__/defaults.cpython-311.pyc,,
|
||||
jinja2/__pycache__/environment.cpython-311.pyc,,
|
||||
jinja2/__pycache__/exceptions.cpython-311.pyc,,
|
||||
jinja2/__pycache__/ext.cpython-311.pyc,,
|
||||
jinja2/__pycache__/filters.cpython-311.pyc,,
|
||||
jinja2/__pycache__/idtracking.cpython-311.pyc,,
|
||||
jinja2/__pycache__/lexer.cpython-311.pyc,,
|
||||
jinja2/__pycache__/loaders.cpython-311.pyc,,
|
||||
jinja2/__pycache__/meta.cpython-311.pyc,,
|
||||
jinja2/__pycache__/nativetypes.cpython-311.pyc,,
|
||||
jinja2/__pycache__/nodes.cpython-311.pyc,,
|
||||
jinja2/__pycache__/optimizer.cpython-311.pyc,,
|
||||
jinja2/__pycache__/parser.cpython-311.pyc,,
|
||||
jinja2/__pycache__/runtime.cpython-311.pyc,,
|
||||
jinja2/__pycache__/sandbox.cpython-311.pyc,,
|
||||
jinja2/__pycache__/tests.cpython-311.pyc,,
|
||||
jinja2/__pycache__/utils.cpython-311.pyc,,
|
||||
jinja2/__pycache__/visitor.cpython-311.pyc,,
|
||||
jinja2/_identifier.py,sha256=EdgGJKi7O1yvr4yFlvqPNEqV6M1qHyQr8Gt8GmVTKVM,1775
|
||||
jinja2/async_utils.py,sha256=bY2nCUfBA_4FSnNUsIsJgljBq3hACr6fzLi7LiyMTn8,1751
|
||||
jinja2/bccache.py,sha256=smAvSDgDSvXdvJzCN_9s0XfkVpQEu8be-QwgeMlrwiM,12677
|
||||
jinja2/compiler.py,sha256=qq0Fo9EpDAEwHPLAs3sAP7dindUvDrFrbx4AcB8xV5M,72046
|
||||
jinja2/constants.py,sha256=GMoFydBF_kdpaRKPoM5cl5MviquVRLVyZtfp5-16jg0,1433
|
||||
jinja2/debug.py,sha256=uBmrsiwjYH5l14R9STn5mydOOyriBYol5lDGvEqAb3A,9238
|
||||
jinja2/defaults.py,sha256=boBcSw78h-lp20YbaXSJsqkAI2uN_mD_TtCydpeq5wU,1267
|
||||
jinja2/environment.py,sha256=T6U4be9mY1CUXXin_EQFwpvpFqCiryweGqzXGRYIoSA,61573
|
||||
jinja2/exceptions.py,sha256=ioHeHrWwCWNaXX1inHmHVblvc4haO7AXsjCp3GfWvx0,5071
|
||||
jinja2/ext.py,sha256=44SjDjeYkkxQTpmC2BetOTxEFMgQ42p2dfSwXmPFcSo,32122
|
||||
jinja2/filters.py,sha256=LslRsJd0JVFBHtdfU_WraM1eQitotciwawiW-seR42U,52577
|
||||
jinja2/idtracking.py,sha256=KdFVohVNK-baOwt_INPMco19D7AfLDEN8i3_JoiYnGQ,10713
|
||||
jinja2/lexer.py,sha256=D5qOKB3KnRqK9gPAZFQvRguomYsQok5-14TKiWTN8Jw,29923
|
||||
jinja2/loaders.py,sha256=ePpWB0xDrILgLVqNFcxqqSbPizsI0T-JlkNEUFqq9fo,22350
|
||||
jinja2/meta.py,sha256=GNPEvifmSaU3CMxlbheBOZjeZ277HThOPUTf1RkppKQ,4396
|
||||
jinja2/nativetypes.py,sha256=62hvvsAxAj0YaxylOHoREYVogJ5JqOlJISgGY3OKd_o,3675
|
||||
jinja2/nodes.py,sha256=LHF97fu6GW4r2Z9UaOX92MOT1wZpdS9Nx4N-5Fp5ti8,34509
|
||||
jinja2/optimizer.py,sha256=tHkMwXxfZkbfA1KmLcqmBMSaz7RLIvvItrJcPoXTyD8,1650
|
||||
jinja2/parser.py,sha256=kHnU8v92GwMYkfr0MVakWv8UlSf_kJPx8LUsgQMof70,39767
|
||||
jinja2/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
jinja2/runtime.py,sha256=bSWdawLjReKpKHhF3-96OIuWYpUy1yxFJCN3jBYyoXc,35013
|
||||
jinja2/sandbox.py,sha256=-8zxR6TO9kUkciAVFsIKu8Oq-C7PTeYEdZ5TtA55-gw,14600
|
||||
jinja2/tests.py,sha256=Am5Z6Lmfr2XaH_npIfJJ8MdXtWsbLjMULZJulTAj30E,5905
|
||||
jinja2/utils.py,sha256=0wGkxDbxlW10y0ac4-kEiy1Bn0AsWXqz8uomK9Ugy1Q,26961
|
||||
jinja2/visitor.py,sha256=ZmeLuTj66ic35-uFH-1m0EKXiw4ObDDb_WuE6h5vPFg,3572
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[babel.extractors]
|
||||
jinja2 = jinja2.ext:babel_extract [i18n]
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
jinja2
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,28 @@
|
||||
Copyright 2010 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,98 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: MarkupSafe
|
||||
Version: 2.0.1
|
||||
Summary: Safely add untrusted strings to HTML/XML markup.
|
||||
Home-page: https://palletsprojects.com/p/markupsafe/
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://markupsafe.palletsprojects.com/
|
||||
Project-URL: Changes, https://markupsafe.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/markupsafe/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/markupsafe/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Text Processing :: Markup :: HTML
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
License-File: LICENSE.rst
|
||||
|
||||
MarkupSafe
|
||||
==========
|
||||
|
||||
MarkupSafe implements a text object that escapes characters so it is
|
||||
safe to use in HTML and XML. Characters that have special meanings are
|
||||
replaced so that they display as the actual characters. This mitigates
|
||||
injection attacks, meaning untrusted user input can safely be displayed
|
||||
on a page.
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
pip install -U MarkupSafe
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
Examples
|
||||
--------
|
||||
|
||||
.. code-block:: pycon
|
||||
|
||||
>>> from markupsafe import Markup, escape
|
||||
|
||||
>>> # escape replaces special characters and wraps in Markup
|
||||
>>> escape("<script>alert(document.cookie);</script>")
|
||||
Markup('<script>alert(document.cookie);</script>')
|
||||
|
||||
>>> # wrap in Markup to mark text "safe" and prevent escaping
|
||||
>>> Markup("<strong>Hello</strong>")
|
||||
Markup('<strong>hello</strong>')
|
||||
|
||||
>>> escape(Markup("<strong>Hello</strong>"))
|
||||
Markup('<strong>hello</strong>')
|
||||
|
||||
>>> # Markup is a str subclass
|
||||
>>> # methods and operators escape their arguments
|
||||
>>> template = Markup("Hello <em>{name}</em>")
|
||||
>>> template.format(name='"World"')
|
||||
Markup('Hello <em>"World"</em>')
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports MarkupSafe and other
|
||||
popular packages. In order to grow the community of contributors and
|
||||
users, and allow the maintainers to devote more time to the projects,
|
||||
`please donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://markupsafe.palletsprojects.com/
|
||||
- Changes: https://markupsafe.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/MarkupSafe/
|
||||
- Source Code: https://github.com/pallets/markupsafe/
|
||||
- Issue Tracker: https://github.com/pallets/markupsafe/issues/
|
||||
- Website: https://palletsprojects.com/p/markupsafe/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
||||
@@ -0,0 +1,15 @@
|
||||
MarkupSafe-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
MarkupSafe-2.0.1.dist-info/LICENSE.rst,sha256=SJqOEQhQntmKN7uYPhHg9-HTHwvY-Zp5yESOf_N9B-o,1475
|
||||
MarkupSafe-2.0.1.dist-info/METADATA,sha256=kHBnecBZmK_95Z7-6QYaHD5qJqzuV83lJ2_Cnzhba2Y,3217
|
||||
MarkupSafe-2.0.1.dist-info/RECORD,,
|
||||
MarkupSafe-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
MarkupSafe-2.0.1.dist-info/WHEEL,sha256=wCpHU5PrLGNdpo-ZaCOtE6te0ycAK2oYvJmTJCUKnUQ,105
|
||||
MarkupSafe-2.0.1.dist-info/top_level.txt,sha256=qy0Plje5IJuvsCBjejJyhDCjEAdcDLK_2agVcex8Z6U,11
|
||||
markupsafe/__init__.py,sha256=9Tez4UIlI7J6_sQcUFK1dKniT_b_8YefpGIyYJ3Sr2Q,8923
|
||||
markupsafe/__pycache__/__init__.cpython-311.pyc,,
|
||||
markupsafe/__pycache__/_native.cpython-311.pyc,,
|
||||
markupsafe/_native.py,sha256=GTKEV-bWgZuSjklhMHOYRHU9k0DMewTf5mVEZfkbuns,1986
|
||||
markupsafe/_speedups.c,sha256=CDDtwaV21D2nYtypnMQzxvvpZpcTvIs8OZ6KDa1g4t0,7400
|
||||
markupsafe/_speedups.cpython-311-x86_64-linux-gnu.so,sha256=RtdXWrnxj3Ugi82YrszU99ICt_jGTKLMgUhZ-aVbIy0,42360
|
||||
markupsafe/_speedups.pyi,sha256=vfMCsOgbAXRNLUXkyuyonG8uEWKYU4PDqNuMaDELAYw,229
|
||||
markupsafe/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.38.4)
|
||||
Root-Is-Purelib: false
|
||||
Tag: cp311-cp311-linux_x86_64
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
markupsafe
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,28 @@
|
||||
Copyright 2007 Pallets
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
|
||||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
|
||||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
@@ -0,0 +1,128 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: Werkzeug
|
||||
Version: 2.0.1
|
||||
Summary: The comprehensive WSGI web application library.
|
||||
Home-page: https://palletsprojects.com/p/werkzeug/
|
||||
Author: Armin Ronacher
|
||||
Author-email: armin.ronacher@active-4.com
|
||||
Maintainer: Pallets
|
||||
Maintainer-email: contact@palletsprojects.com
|
||||
License: BSD-3-Clause
|
||||
Project-URL: Donate, https://palletsprojects.com/donate
|
||||
Project-URL: Documentation, https://werkzeug.palletsprojects.com/
|
||||
Project-URL: Changes, https://werkzeug.palletsprojects.com/changes/
|
||||
Project-URL: Source Code, https://github.com/pallets/werkzeug/
|
||||
Project-URL: Issue Tracker, https://github.com/pallets/werkzeug/issues/
|
||||
Project-URL: Twitter, https://twitter.com/PalletsTeam
|
||||
Project-URL: Chat, https://discord.gg/pallets
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 5 - Production/Stable
|
||||
Classifier: Environment :: Web Environment
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: BSD License
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Application
|
||||
Classifier: Topic :: Internet :: WWW/HTTP :: WSGI :: Middleware
|
||||
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Requires-Dist: dataclasses ; python_version < "3.7"
|
||||
Provides-Extra: watchdog
|
||||
Requires-Dist: watchdog ; extra == 'watchdog'
|
||||
|
||||
Werkzeug
|
||||
========
|
||||
|
||||
*werkzeug* German noun: "tool". Etymology: *werk* ("work"), *zeug* ("stuff")
|
||||
|
||||
Werkzeug is a comprehensive `WSGI`_ web application library. It began as
|
||||
a simple collection of various utilities for WSGI applications and has
|
||||
become one of the most advanced WSGI utility libraries.
|
||||
|
||||
It includes:
|
||||
|
||||
- An interactive debugger that allows inspecting stack traces and
|
||||
source code in the browser with an interactive interpreter for any
|
||||
frame in the stack.
|
||||
- A full-featured request object with objects to interact with
|
||||
headers, query args, form data, files, and cookies.
|
||||
- A response object that can wrap other WSGI applications and handle
|
||||
streaming data.
|
||||
- A routing system for matching URLs to endpoints and generating URLs
|
||||
for endpoints, with an extensible system for capturing variables
|
||||
from URLs.
|
||||
- HTTP utilities to handle entity tags, cache control, dates, user
|
||||
agents, cookies, files, and more.
|
||||
- A threaded WSGI server for use while developing applications
|
||||
locally.
|
||||
- A test client for simulating HTTP requests during testing without
|
||||
requiring running a server.
|
||||
|
||||
Werkzeug doesn't enforce any dependencies. It is up to the developer to
|
||||
choose a template engine, database adapter, and even how to handle
|
||||
requests. It can be used to build all sorts of end user applications
|
||||
such as blogs, wikis, or bulletin boards.
|
||||
|
||||
`Flask`_ wraps Werkzeug, using it to handle the details of WSGI while
|
||||
providing more structure and patterns for defining powerful
|
||||
applications.
|
||||
|
||||
.. _WSGI: https://wsgi.readthedocs.io/en/latest/
|
||||
.. _Flask: https://www.palletsprojects.com/p/flask/
|
||||
|
||||
|
||||
Installing
|
||||
----------
|
||||
|
||||
Install and update using `pip`_:
|
||||
|
||||
.. code-block:: text
|
||||
|
||||
pip install -U Werkzeug
|
||||
|
||||
.. _pip: https://pip.pypa.io/en/stable/quickstart/
|
||||
|
||||
|
||||
A Simple Example
|
||||
----------------
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from werkzeug.wrappers import Request, Response
|
||||
|
||||
@Request.application
|
||||
def application(request):
|
||||
return Response('Hello, World!')
|
||||
|
||||
if __name__ == '__main__':
|
||||
from werkzeug.serving import run_simple
|
||||
run_simple('localhost', 4000, application)
|
||||
|
||||
|
||||
Donate
|
||||
------
|
||||
|
||||
The Pallets organization develops and supports Werkzeug and other
|
||||
popular packages. In order to grow the community of contributors and
|
||||
users, and allow the maintainers to devote more time to the projects,
|
||||
`please donate today`_.
|
||||
|
||||
.. _please donate today: https://palletsprojects.com/donate
|
||||
|
||||
|
||||
Links
|
||||
-----
|
||||
|
||||
- Documentation: https://werkzeug.palletsprojects.com/
|
||||
- Changes: https://werkzeug.palletsprojects.com/changes/
|
||||
- PyPI Releases: https://pypi.org/project/Werkzeug/
|
||||
- Source Code: https://github.com/pallets/werkzeug/
|
||||
- Issue Tracker: https://github.com/pallets/werkzeug/issues/
|
||||
- Website: https://palletsprojects.com/p/werkzeug/
|
||||
- Twitter: https://twitter.com/PalletsTeam
|
||||
- Chat: https://discord.gg/pallets
|
||||
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
Werkzeug-2.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
Werkzeug-2.0.1.dist-info/LICENSE.rst,sha256=O0nc7kEF6ze6wQ-vG-JgQI_oXSUrjp3y4JefweCUQ3s,1475
|
||||
Werkzeug-2.0.1.dist-info/METADATA,sha256=8-W33EMnGqnCCi-d8Dv63IQQuyELRIsXhwOJNXbNgL0,4421
|
||||
Werkzeug-2.0.1.dist-info/RECORD,,
|
||||
Werkzeug-2.0.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
Werkzeug-2.0.1.dist-info/WHEEL,sha256=OqRkF0eY5GHssMorFjlbTIq072vpHpF60fIQA6lS9xA,92
|
||||
Werkzeug-2.0.1.dist-info/top_level.txt,sha256=QRyj2VjwJoQkrwjwFIOlB8Xg3r9un0NtqVHQF-15xaw,9
|
||||
werkzeug/__init__.py,sha256=_CCsfdeqNllFNRJx8cvqYrwBsQQQXJaMmnk2sAZnDng,188
|
||||
werkzeug/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/_internal.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/_reloader.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/datastructures.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/exceptions.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/filesystem.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/formparser.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/http.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/local.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/routing.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/security.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/serving.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/test.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/testapp.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/urls.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/user_agent.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/useragents.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/utils.cpython-311.pyc,,
|
||||
werkzeug/__pycache__/wsgi.cpython-311.pyc,,
|
||||
werkzeug/_internal.py,sha256=_QKkvdaG4pDFwK68c0EpPzYJGe9Y7toRAT1cBbC-CxU,18572
|
||||
werkzeug/_reloader.py,sha256=B1hEfgsUOz2IginBQM5Zak_eaIF7gr3GS5-0x2OHvAE,13950
|
||||
werkzeug/datastructures.py,sha256=KahVPSLOapbNbKh1ppr9K8_DgWJv1EGgA9DhTEGMHcg,97886
|
||||
werkzeug/datastructures.pyi,sha256=5DTPF8P8Zvi458eK27Qcj7eNUlLM_AC0jBNkj6uQpds,33774
|
||||
werkzeug/debug/__init__.py,sha256=CUFrPEYAaotHRkmjOieqd3EasXDii2JVC1HdmEzMwqM,17924
|
||||
werkzeug/debug/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/debug/__pycache__/console.cpython-311.pyc,,
|
||||
werkzeug/debug/__pycache__/repr.cpython-311.pyc,,
|
||||
werkzeug/debug/__pycache__/tbtools.cpython-311.pyc,,
|
||||
werkzeug/debug/console.py,sha256=E1nBMEvFkX673ShQjPtVY-byYatfX9MN-dBMjRI8a8E,5897
|
||||
werkzeug/debug/repr.py,sha256=QCSHENKsChEZDCIApkVi_UNjhJ77v8BMXK1OfxO189M,9483
|
||||
werkzeug/debug/shared/FONT_LICENSE,sha256=LwAVEI1oYnvXiNMT9SnCH_TaLCxCpeHziDrMg0gPkAI,4673
|
||||
werkzeug/debug/shared/ICON_LICENSE.md,sha256=DhA6Y1gUl5Jwfg0NFN9Rj4VWITt8tUx0IvdGf0ux9-s,222
|
||||
werkzeug/debug/shared/console.png,sha256=bxax6RXXlvOij_KeqvSNX0ojJf83YbnZ7my-3Gx9w2A,507
|
||||
werkzeug/debug/shared/debugger.js,sha256=dYbUmFmb3YZb5YpWpYPOQArdrN7NPeY0ODawL7ihzDI,10524
|
||||
werkzeug/debug/shared/less.png,sha256=-4-kNRaXJSONVLahrQKUxMwXGm9R4OnZ9SxDGpHlIR4,191
|
||||
werkzeug/debug/shared/more.png,sha256=GngN7CioHQoV58rH6ojnkYi8c_qED2Aka5FO5UXrReY,200
|
||||
werkzeug/debug/shared/source.png,sha256=RoGcBTE4CyCB85GBuDGTFlAnUqxwTBiIfDqW15EpnUQ,818
|
||||
werkzeug/debug/shared/style.css,sha256=vyp1RnB227Fuw8LIyM5C-bBCBQN5hvZSCApY2oeJ9ik,6705
|
||||
werkzeug/debug/shared/ubuntu.ttf,sha256=1eaHFyepmy4FyDvjLVzpITrGEBu_CZYY94jE0nED1c0,70220
|
||||
werkzeug/debug/tbtools.py,sha256=TfReusPbM3yjm3xvOFkH45V7-5JnNqB9x1EQPnVC6Xo,19189
|
||||
werkzeug/exceptions.py,sha256=CUwx0pBiNbk4f9cON17ekgKnmLi6HIVFjUmYZc2x0wM,28681
|
||||
werkzeug/filesystem.py,sha256=JS2Dv2QF98WILxY4_thHl-WMcUcwluF_4igkDPaP1l4,1956
|
||||
werkzeug/formparser.py,sha256=GIKfzuQ_khuBXnf3N7_LzOEruYwNc3m4bI02BgtT5jg,17385
|
||||
werkzeug/http.py,sha256=oUCXFFMnkOQ-cHbUY_aiqitshcrSzNDq3fEMf1VI_yk,45141
|
||||
werkzeug/local.py,sha256=WsR6H-2XOtPigpimjORbLsS3h9WI0lCdZjGI2LHDDxA,22733
|
||||
werkzeug/middleware/__init__.py,sha256=qfqgdT5npwG9ses3-FXQJf3aB95JYP1zchetH_T3PUw,500
|
||||
werkzeug/middleware/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/dispatcher.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/http_proxy.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/lint.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/profiler.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/proxy_fix.cpython-311.pyc,,
|
||||
werkzeug/middleware/__pycache__/shared_data.cpython-311.pyc,,
|
||||
werkzeug/middleware/dispatcher.py,sha256=Fh_w-KyWnTSYF-Lfv5dimQ7THSS7afPAZMmvc4zF1gg,2580
|
||||
werkzeug/middleware/http_proxy.py,sha256=HE8VyhS7CR-E1O6_9b68huv8FLgGGR1DLYqkS3Xcp3Q,7558
|
||||
werkzeug/middleware/lint.py,sha256=yMzMdm4xI2_N-Wv2j1yoaVI3ltHOYS6yZyA-wUv1sKw,13962
|
||||
werkzeug/middleware/profiler.py,sha256=G2JieUMv4QPamtCY6ibIK7P-piPRdPybav7bm2MSFvs,4898
|
||||
werkzeug/middleware/proxy_fix.py,sha256=uRgQ3dEvFV8JxUqajHYYYOPEeA_BFqaa51Yp8VW0uzA,6849
|
||||
werkzeug/middleware/shared_data.py,sha256=eOCGr-i6BCexDfL7xdPRWMwPJPgp0NE2B416Gl67Q78,10959
|
||||
werkzeug/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
werkzeug/routing.py,sha256=FDRtvCfaZSmXnQ0cUYxowb3P0y0dxlUlMSUmerY5sb0,84147
|
||||
werkzeug/sansio/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
werkzeug/sansio/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/multipart.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/request.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/response.cpython-311.pyc,,
|
||||
werkzeug/sansio/__pycache__/utils.cpython-311.pyc,,
|
||||
werkzeug/sansio/multipart.py,sha256=bJMCNC2f5xyAaylahNViJ0JqmV4ThLRbDVGVzKwcqrQ,8751
|
||||
werkzeug/sansio/request.py,sha256=aA9rABkWiG4MhYMByanst2NXkEclsq8SIxhb0LQf0e0,20228
|
||||
werkzeug/sansio/response.py,sha256=HSG6t-tyPZd3awzWqr7qL9IV4HYAvDgON1c0YPU2RXw,24117
|
||||
werkzeug/sansio/utils.py,sha256=V5v-UUnX8pm4RehP9Tt_NiUSOJGJGUvKjlW0eOIQldM,4164
|
||||
werkzeug/security.py,sha256=gPDRuCjkjWrcqj99tBMq8_nHFZLFQjgoW5Ga5XIw9jo,8158
|
||||
werkzeug/serving.py,sha256=_RG2dCclOQcdjJ2NE8tzCRybGePlwcs8kTypiWRP2gY,38030
|
||||
werkzeug/test.py,sha256=EJXJy-b_JriHrlfs5VNCkwbki8Kn_xUDkOYOCx_6Q7Q,48096
|
||||
werkzeug/testapp.py,sha256=f48prWSGJhbSrvYb8e1fnAah4BkrLb0enHSdChgsjBY,9471
|
||||
werkzeug/urls.py,sha256=3o_aUcr5Ou13XihSU6VvX6RHMhoWkKpXuCCia9SSAb8,41021
|
||||
werkzeug/user_agent.py,sha256=WclZhpvgLurMF45hsioSbS75H1Zb4iMQGKN3_yZ2oKo,1420
|
||||
werkzeug/useragents.py,sha256=G8tmv_6vxJaPrLQH3eODNgIYe0_V6KETROQlJI-WxDE,7264
|
||||
werkzeug/utils.py,sha256=WrU-LbwemyGd8zBHBgQyLaIxing4QLEChiP0qnzr2sc,36771
|
||||
werkzeug/wrappers/__init__.py,sha256=-s75nPbyXHzU_rwmLPDhoMuGbEUk0jZT_n0ZQAOFGf8,654
|
||||
werkzeug/wrappers/__pycache__/__init__.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/accept.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/auth.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/base_request.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/base_response.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/common_descriptors.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/cors.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/etag.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/json.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/request.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/response.cpython-311.pyc,,
|
||||
werkzeug/wrappers/__pycache__/user_agent.cpython-311.pyc,,
|
||||
werkzeug/wrappers/accept.py,sha256=_oZtAQkahvsrPRkNj2fieg7_St9P0NFC3SgZbJKS6xU,429
|
||||
werkzeug/wrappers/auth.py,sha256=rZPCzGxHk9R55PRkmS90kRywUVjjuMWzCGtH68qCq8U,856
|
||||
werkzeug/wrappers/base_request.py,sha256=saz9RyNQkvI_XLPYVm29KijNHmD1YzgxDqa0qHTbgss,1174
|
||||
werkzeug/wrappers/base_response.py,sha256=q_-TaYywT5G4zA-DWDRDJhJSat2_4O7gOPob6ye4_9A,1186
|
||||
werkzeug/wrappers/common_descriptors.py,sha256=v_kWLH3mvCiSRVJ1FNw7nO3w2UJfzY57UKKB5J4zCvE,898
|
||||
werkzeug/wrappers/cors.py,sha256=c5UndlZsZvYkbPrp6Gj5iSXxw_VOJDJHskO6-jRmNyQ,846
|
||||
werkzeug/wrappers/etag.py,sha256=XHWQQs7Mdd1oWezgBIsl-bYe8ydKkRZVil2Qd01D0Mo,846
|
||||
werkzeug/wrappers/json.py,sha256=HM1btPseGeXca0vnwQN_MvZl6h-qNsFY5YBKXKXFwus,410
|
||||
werkzeug/wrappers/request.py,sha256=0zAkCUwJbUBzioGy2UKxE6XpuXPAZbEhhML4WErzeBo,24818
|
||||
werkzeug/wrappers/response.py,sha256=95hXIysZTeNC0bqhvGB2fLBRKxedR_cgI5szZZWfyzw,35177
|
||||
werkzeug/wrappers/user_agent.py,sha256=Wl1-A0-1r8o7cHIZQTB55O4Ged6LpCKENaQDlOY5pXA,435
|
||||
werkzeug/wsgi.py,sha256=7psV3SHLtCzk1KSuGmIK5uP2QTDXyfCCDclyqCmIUO4,33715
|
||||
@@ -0,0 +1,5 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.36.2)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
werkzeug
|
||||
Binary file not shown.
222
hypenv/lib/python3.11/site-packages/_distutils_hack/__init__.py
Normal file
222
hypenv/lib/python3.11/site-packages/_distutils_hack/__init__.py
Normal file
@@ -0,0 +1,222 @@
|
||||
# don't import any costly modules
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
is_pypy = '__pypy__' in sys.builtin_module_names
|
||||
|
||||
|
||||
def warn_distutils_present():
|
||||
if 'distutils' not in sys.modules:
|
||||
return
|
||||
if is_pypy and sys.version_info < (3, 7):
|
||||
# PyPy for 3.6 unconditionally imports distutils, so bypass the warning
|
||||
# https://foss.heptapod.net/pypy/pypy/-/blob/be829135bc0d758997b3566062999ee8b23872b4/lib-python/3/site.py#L250
|
||||
return
|
||||
import warnings
|
||||
|
||||
warnings.warn(
|
||||
"Distutils was imported before Setuptools, but importing Setuptools "
|
||||
"also replaces the `distutils` module in `sys.modules`. This may lead "
|
||||
"to undesirable behaviors or errors. To avoid these issues, avoid "
|
||||
"using distutils directly, ensure that setuptools is installed in the "
|
||||
"traditional way (e.g. not an editable install), and/or make sure "
|
||||
"that setuptools is always imported before distutils."
|
||||
)
|
||||
|
||||
|
||||
def clear_distutils():
|
||||
if 'distutils' not in sys.modules:
|
||||
return
|
||||
import warnings
|
||||
|
||||
warnings.warn("Setuptools is replacing distutils.")
|
||||
mods = [
|
||||
name
|
||||
for name in sys.modules
|
||||
if name == "distutils" or name.startswith("distutils.")
|
||||
]
|
||||
for name in mods:
|
||||
del sys.modules[name]
|
||||
|
||||
|
||||
def enabled():
|
||||
"""
|
||||
Allow selection of distutils by environment variable.
|
||||
"""
|
||||
which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local')
|
||||
return which == 'local'
|
||||
|
||||
|
||||
def ensure_local_distutils():
|
||||
import importlib
|
||||
|
||||
clear_distutils()
|
||||
|
||||
# With the DistutilsMetaFinder in place,
|
||||
# perform an import to cause distutils to be
|
||||
# loaded from setuptools._distutils. Ref #2906.
|
||||
with shim():
|
||||
importlib.import_module('distutils')
|
||||
|
||||
# check that submodules load as expected
|
||||
core = importlib.import_module('distutils.core')
|
||||
assert '_distutils' in core.__file__, core.__file__
|
||||
assert 'setuptools._distutils.log' not in sys.modules
|
||||
|
||||
|
||||
def do_override():
|
||||
"""
|
||||
Ensure that the local copy of distutils is preferred over stdlib.
|
||||
|
||||
See https://github.com/pypa/setuptools/issues/417#issuecomment-392298401
|
||||
for more motivation.
|
||||
"""
|
||||
if enabled():
|
||||
warn_distutils_present()
|
||||
ensure_local_distutils()
|
||||
|
||||
|
||||
class _TrivialRe:
|
||||
def __init__(self, *patterns):
|
||||
self._patterns = patterns
|
||||
|
||||
def match(self, string):
|
||||
return all(pat in string for pat in self._patterns)
|
||||
|
||||
|
||||
class DistutilsMetaFinder:
|
||||
def find_spec(self, fullname, path, target=None):
|
||||
# optimization: only consider top level modules and those
|
||||
# found in the CPython test suite.
|
||||
if path is not None and not fullname.startswith('test.'):
|
||||
return
|
||||
|
||||
method_name = 'spec_for_{fullname}'.format(**locals())
|
||||
method = getattr(self, method_name, lambda: None)
|
||||
return method()
|
||||
|
||||
def spec_for_distutils(self):
|
||||
if self.is_cpython():
|
||||
return
|
||||
|
||||
import importlib
|
||||
import importlib.abc
|
||||
import importlib.util
|
||||
|
||||
try:
|
||||
mod = importlib.import_module('setuptools._distutils')
|
||||
except Exception:
|
||||
# There are a couple of cases where setuptools._distutils
|
||||
# may not be present:
|
||||
# - An older Setuptools without a local distutils is
|
||||
# taking precedence. Ref #2957.
|
||||
# - Path manipulation during sitecustomize removes
|
||||
# setuptools from the path but only after the hook
|
||||
# has been loaded. Ref #2980.
|
||||
# In either case, fall back to stdlib behavior.
|
||||
return
|
||||
|
||||
class DistutilsLoader(importlib.abc.Loader):
|
||||
def create_module(self, spec):
|
||||
mod.__name__ = 'distutils'
|
||||
return mod
|
||||
|
||||
def exec_module(self, module):
|
||||
pass
|
||||
|
||||
return importlib.util.spec_from_loader(
|
||||
'distutils', DistutilsLoader(), origin=mod.__file__
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def is_cpython():
|
||||
"""
|
||||
Suppress supplying distutils for CPython (build and tests).
|
||||
Ref #2965 and #3007.
|
||||
"""
|
||||
return os.path.isfile('pybuilddir.txt')
|
||||
|
||||
def spec_for_pip(self):
|
||||
"""
|
||||
Ensure stdlib distutils when running under pip.
|
||||
See pypa/pip#8761 for rationale.
|
||||
"""
|
||||
if self.pip_imported_during_build():
|
||||
return
|
||||
clear_distutils()
|
||||
self.spec_for_distutils = lambda: None
|
||||
|
||||
@classmethod
|
||||
def pip_imported_during_build(cls):
|
||||
"""
|
||||
Detect if pip is being imported in a build script. Ref #2355.
|
||||
"""
|
||||
import traceback
|
||||
|
||||
return any(
|
||||
cls.frame_file_is_setup(frame) for frame, line in traceback.walk_stack(None)
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def frame_file_is_setup(frame):
|
||||
"""
|
||||
Return True if the indicated frame suggests a setup.py file.
|
||||
"""
|
||||
# some frames may not have __file__ (#2940)
|
||||
return frame.f_globals.get('__file__', '').endswith('setup.py')
|
||||
|
||||
def spec_for_sensitive_tests(self):
|
||||
"""
|
||||
Ensure stdlib distutils when running select tests under CPython.
|
||||
|
||||
python/cpython#91169
|
||||
"""
|
||||
clear_distutils()
|
||||
self.spec_for_distutils = lambda: None
|
||||
|
||||
sensitive_tests = (
|
||||
[
|
||||
'test.test_distutils',
|
||||
'test.test_peg_generator',
|
||||
'test.test_importlib',
|
||||
]
|
||||
if sys.version_info < (3, 10)
|
||||
else [
|
||||
'test.test_distutils',
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
for name in DistutilsMetaFinder.sensitive_tests:
|
||||
setattr(
|
||||
DistutilsMetaFinder,
|
||||
f'spec_for_{name}',
|
||||
DistutilsMetaFinder.spec_for_sensitive_tests,
|
||||
)
|
||||
|
||||
|
||||
DISTUTILS_FINDER = DistutilsMetaFinder()
|
||||
|
||||
|
||||
def add_shim():
|
||||
DISTUTILS_FINDER in sys.meta_path or insert_shim()
|
||||
|
||||
|
||||
class shim:
|
||||
def __enter__(self):
|
||||
insert_shim()
|
||||
|
||||
def __exit__(self, exc, value, tb):
|
||||
remove_shim()
|
||||
|
||||
|
||||
def insert_shim():
|
||||
sys.meta_path.insert(0, DISTUTILS_FINDER)
|
||||
|
||||
|
||||
def remove_shim():
|
||||
try:
|
||||
sys.meta_path.remove(DISTUTILS_FINDER)
|
||||
except ValueError:
|
||||
pass
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1 @@
|
||||
__import__('_distutils_hack').do_override()
|
||||
@@ -0,0 +1 @@
|
||||
pip
|
||||
@@ -0,0 +1,373 @@
|
||||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
This Source Code Form is subject to the terms of the Mozilla Public
|
||||
License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
@@ -0,0 +1,334 @@
|
||||
Metadata-Version: 2.1
|
||||
Name: bidict
|
||||
Version: 0.21.2
|
||||
Summary: The bidirectional mapping library for Python.
|
||||
Home-page: https://bidict.readthedocs.io
|
||||
Author: Joshua Bronson
|
||||
Author-email: jabronson@gmail.com
|
||||
License: MPL 2.0
|
||||
Keywords: dict dictionary mapping datastructure bimap bijection bijective injective inverse reverse bidirectional two-way 2-way
|
||||
Platform: UNKNOWN
|
||||
Classifier: Development Status :: 4 - Beta
|
||||
Classifier: Intended Audience :: Developers
|
||||
Classifier: License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)
|
||||
Classifier: Operating System :: OS Independent
|
||||
Classifier: Programming Language :: Python :: 3 :: Only
|
||||
Classifier: Programming Language :: Python :: 3.6
|
||||
Classifier: Programming Language :: Python :: 3.7
|
||||
Classifier: Programming Language :: Python :: 3.8
|
||||
Classifier: Programming Language :: Python :: Implementation :: CPython
|
||||
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
||||
Requires-Python: >=3.6
|
||||
Description-Content-Type: text/x-rst
|
||||
Provides-Extra: coverage
|
||||
Requires-Dist: coverage (<6) ; extra == 'coverage'
|
||||
Requires-Dist: pytest-cov (<3) ; extra == 'coverage'
|
||||
Provides-Extra: dev
|
||||
Requires-Dist: setuptools-scm ; extra == 'dev'
|
||||
Requires-Dist: hypothesis (<6) ; extra == 'dev'
|
||||
Requires-Dist: py (<2) ; extra == 'dev'
|
||||
Requires-Dist: pytest (<7) ; extra == 'dev'
|
||||
Requires-Dist: pytest-benchmark (<4,>=3.2.0) ; extra == 'dev'
|
||||
Requires-Dist: sortedcollections (<2) ; extra == 'dev'
|
||||
Requires-Dist: sortedcontainers (<3) ; extra == 'dev'
|
||||
Requires-Dist: Sphinx (<4) ; extra == 'dev'
|
||||
Requires-Dist: sphinx-autodoc-typehints (<2) ; extra == 'dev'
|
||||
Requires-Dist: coverage (<6) ; extra == 'dev'
|
||||
Requires-Dist: pytest-cov (<3) ; extra == 'dev'
|
||||
Requires-Dist: pre-commit (<3) ; extra == 'dev'
|
||||
Requires-Dist: tox (<4) ; extra == 'dev'
|
||||
Provides-Extra: docs
|
||||
Requires-Dist: Sphinx (<4) ; extra == 'docs'
|
||||
Requires-Dist: sphinx-autodoc-typehints (<2) ; extra == 'docs'
|
||||
Provides-Extra: precommit
|
||||
Requires-Dist: pre-commit (<3) ; extra == 'precommit'
|
||||
Provides-Extra: test
|
||||
Requires-Dist: hypothesis (<6) ; extra == 'test'
|
||||
Requires-Dist: py (<2) ; extra == 'test'
|
||||
Requires-Dist: pytest (<7) ; extra == 'test'
|
||||
Requires-Dist: pytest-benchmark (<4,>=3.2.0) ; extra == 'test'
|
||||
Requires-Dist: sortedcollections (<2) ; extra == 'test'
|
||||
Requires-Dist: sortedcontainers (<3) ; extra == 'test'
|
||||
Requires-Dist: Sphinx (<4) ; extra == 'test'
|
||||
Requires-Dist: sphinx-autodoc-typehints (<2) ; extra == 'test'
|
||||
|
||||
.. Forward declarations for all the custom interpreted text roles that
|
||||
Sphinx defines and that are used below. This helps Sphinx-unaware tools
|
||||
(e.g. rst2html, PyPI's and GitHub's renderers, etc.).
|
||||
.. role:: doc
|
||||
|
||||
.. Use :doc: rather than :ref: references below for better interop as well.
|
||||
|
||||
|
||||
``bidict``
|
||||
==========
|
||||
|
||||
The bidirectional mapping library for Python.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/jab/bidict/master/assets/logo-sm.png
|
||||
:target: https://bidict.readthedocs.io/
|
||||
:alt: bidict logo
|
||||
|
||||
|
||||
Status
|
||||
------
|
||||
|
||||
.. image:: https://img.shields.io/pypi/v/bidict.svg
|
||||
:target: https://pypi.org/project/bidict
|
||||
:alt: Latest release
|
||||
|
||||
.. image:: https://img.shields.io/readthedocs/bidict/master.svg
|
||||
:target: https://bidict.readthedocs.io/en/master/
|
||||
:alt: Documentation
|
||||
|
||||
.. image:: https://api.travis-ci.org/jab/bidict.svg?branch=master
|
||||
:target: https://travis-ci.org/jab/bidict
|
||||
:alt: Travis-CI build status
|
||||
|
||||
.. image:: https://codecov.io/gh/jab/bidict/branch/master/graph/badge.svg
|
||||
:target: https://codecov.io/gh/jab/bidict
|
||||
:alt: Test coverage
|
||||
|
||||
.. Hide to reduce clutter
|
||||
.. image:: https://img.shields.io/lgtm/alerts/github/jab/bidict.svg
|
||||
:target: https://lgtm.com/projects/g/jab/bidict/
|
||||
:alt: LGTM alerts
|
||||
.. image:: https://bestpractices.coreinfrastructure.org/projects/2354/badge
|
||||
:target: https://bestpractices.coreinfrastructure.org/en/projects/2354
|
||||
:alt: CII best practices badge
|
||||
.. image:: https://img.shields.io/badge/tidelift-pro%20support-orange.svg
|
||||
:target: https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=docs
|
||||
:alt: Paid support available via Tidelift
|
||||
.. image:: https://ci.appveyor.com/api/projects/status/gk133415udncwto3/branch/master?svg=true
|
||||
:target: https://ci.appveyor.com/project/jab/bidict
|
||||
:alt: AppVeyor (Windows) build status
|
||||
.. image:: https://img.shields.io/pypi/pyversions/bidict.svg
|
||||
:target: https://pypi.org/project/bidict
|
||||
:alt: Supported Python versions
|
||||
.. image:: https://img.shields.io/pypi/implementation/bidict.svg
|
||||
:target: https://pypi.org/project/bidict
|
||||
:alt: Supported Python implementations
|
||||
|
||||
.. image:: https://img.shields.io/pypi/l/bidict.svg
|
||||
:target: https://raw.githubusercontent.com/jab/bidict/master/LICENSE
|
||||
:alt: License
|
||||
|
||||
.. image:: https://static.pepy.tech/badge/bidict
|
||||
:target: https://pepy.tech/project/bidict
|
||||
:alt: PyPI Downloads
|
||||
|
||||
|
||||
``bidict``:
|
||||
^^^^^^^^^^^
|
||||
|
||||
- has been used for many years by several teams at
|
||||
**Google, Venmo, CERN, Bank of America Merrill Lynch, Bloomberg, Two Sigma,** and many others
|
||||
- has carefully designed APIs for
|
||||
**safety, simplicity, flexibility, and ergonomics**
|
||||
- is **fast, lightweight, and has no runtime dependencies** other than Python's standard library
|
||||
- **integrates natively** with Python’s ``collections.abc`` interfaces
|
||||
- provides **type hints** for all public APIs
|
||||
- is implemented in **concise, well-factored, pure (PyPy-compatible) Python code**
|
||||
that is **optimized for running efficiently**
|
||||
as well as for **reading and learning** [#fn-learning]_
|
||||
- has **extensive docs and test coverage**
|
||||
(including property-based tests and benchmarks)
|
||||
run continuously on all supported Python versions
|
||||
|
||||
|
||||
Note: Python 3 Required
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
As promised in the 0.18.2 release (see :doc:`changelog` [#fn-changelog]_),
|
||||
**Python 2 is no longer supported**.
|
||||
Version 0.18.3
|
||||
is the last release of ``bidict`` that supports Python 2.
|
||||
This makes ``bidict`` more efficient on Python 3
|
||||
and enables further improvement to bidict in the future.
|
||||
See `python3statement.org <https://python3statement.org>`__
|
||||
for more info.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
``pip install bidict``
|
||||
|
||||
|
||||
Quick Start
|
||||
-----------
|
||||
|
||||
.. code:: python
|
||||
|
||||
>>> from bidict import bidict
|
||||
>>> element_by_symbol = bidict({'H': 'hydrogen'})
|
||||
>>> element_by_symbol['H']
|
||||
'hydrogen'
|
||||
>>> element_by_symbol.inverse['hydrogen']
|
||||
'H'
|
||||
|
||||
|
||||
For more usage documentation,
|
||||
head to the :doc:`intro` [#fn-intro]_
|
||||
and proceed from there.
|
||||
|
||||
|
||||
Community Support
|
||||
-----------------
|
||||
|
||||
.. image:: https://img.shields.io/badge/chat-on%20gitter-5AB999.svg?logo=gitter-white
|
||||
:target: https://gitter.im/jab/bidict
|
||||
:alt: Chat
|
||||
|
||||
If you are thinking of using ``bidict`` in your work,
|
||||
or if you have any questions, comments, or suggestions,
|
||||
I'd love to know about your use case
|
||||
and provide as much voluntary support for it as possible.
|
||||
|
||||
Please feel free to leave a message in the
|
||||
`chatroom <https://gitter.im/jab/bidict>`__
|
||||
or open a new issue on GitHub.
|
||||
You can search through
|
||||
`existing issues <https://github.com/jab/bidict/issues>`__
|
||||
before creating a new one
|
||||
in case your questions or concerns have been adressed there already.
|
||||
|
||||
|
||||
Enterprise-Grade Support via Tidelift
|
||||
-------------------------------------
|
||||
|
||||
.. image:: https://img.shields.io/badge/tidelift-pro%20support-orange.svg
|
||||
:target: https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=readme
|
||||
:alt: Paid support available via Tidelift
|
||||
|
||||
If your use case requires a greater level of support,
|
||||
enterprise-grade support for ``bidict`` can be obtained via the
|
||||
`Tidelift subscription <https://tidelift.com/subscription/pkg/pypi-bidict?utm_source=pypi-bidict&utm_medium=referral&utm_campaign=readme>`__.
|
||||
|
||||
|
||||
Notice of Usage
|
||||
---------------
|
||||
|
||||
If you use ``bidict``,
|
||||
and especially if your usage or your organization is significant in some way,
|
||||
please let me know.
|
||||
|
||||
You can:
|
||||
|
||||
- `star bidict on GitHub <https://github.com/jab/bidict>`__
|
||||
- `create an issue <https://github.com/jab/bidict/issues/new?title=Notice+of+Usage&body=I+am+using+bidict+for...>`__
|
||||
- leave a message in the `chat room <https://gitter.im/jab/bidict>`__
|
||||
- `email me <mailto:jabronson@gmail.com?subject=bidict&body=I%20am%20using%20bidict%20for...>`__
|
||||
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
See the :doc:`changelog` [#fn-changelog]_
|
||||
for a history of notable changes to ``bidict``.
|
||||
|
||||
|
||||
Release Notifications
|
||||
---------------------
|
||||
|
||||
.. duplicated in CHANGELOG.rst:
|
||||
(would use `.. include::` but GitHub doesn't understand it)
|
||||
|
||||
.. image:: https://img.shields.io/badge/libraries.io-subscribe-5BC0DF.svg
|
||||
:target: https://libraries.io/pypi/bidict
|
||||
:alt: Follow on libraries.io
|
||||
|
||||
Subscribe to releases
|
||||
`on GitHub <https://github.blog/changelog/2018-11-27-watch-releases/>`__ or
|
||||
`libraries.io <https://libraries.io/pypi/bidict>`__
|
||||
to be notified when new versions of ``bidict`` are released.
|
||||
|
||||
|
||||
Learning from ``bidict``
|
||||
------------------------
|
||||
|
||||
One of the best things about ``bidict``
|
||||
is that it touches a surprising number of
|
||||
interesting Python corners,
|
||||
especially given its small size and scope.
|
||||
|
||||
Check out :doc:`learning-from-bidict` [#fn-learning]_
|
||||
if you're interested in learning more.
|
||||
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
``bidict`` is currently a one-person operation
|
||||
maintained on a voluntary basis.
|
||||
|
||||
Your help would be most welcome!
|
||||
|
||||
|
||||
Reviewers Wanted!
|
||||
^^^^^^^^^^^^^^^^^
|
||||
|
||||
One of the most valuable ways to contribute to ``bidict`` –
|
||||
and to explore some interesting Python corners [#fn-learning]_
|
||||
while you're at it –
|
||||
is to review the relatively small codebase.
|
||||
|
||||
Please create an issue or pull request with any improvements you'd propose
|
||||
or any other results you found.
|
||||
Submitting a `draft PR <https://github.blog/2019-02-14-introducing-draft-pull-requests/>`__
|
||||
with feedback in inline code comments, or a
|
||||
`"Review results" issue <https://github.com/jab/bidict/issues/new?title=Review+results>`__,
|
||||
would each work well.
|
||||
|
||||
You can also
|
||||
+1 `this issue <https://github.com/jab/bidict/issues/63>`__
|
||||
to sign up to give feedback on future proposed changes
|
||||
that are in need of a reviewer.
|
||||
|
||||
|
||||
Giving Back
|
||||
^^^^^^^^^^^
|
||||
|
||||
.. duplicated in CONTRIBUTING.rst
|
||||
(would use `.. include::` but GitHub doesn't understand it)
|
||||
|
||||
``bidict`` is the product of hundreds of hours of unpaid, voluntary work.
|
||||
|
||||
If ``bidict`` has helped you accomplish your work,
|
||||
especially work you've been paid for,
|
||||
please consider chipping in toward the costs
|
||||
of its maintenance and development
|
||||
and/or ask your organization to do the same.
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/jab/bidict/master/assets/support-on-gumroad.png
|
||||
:target: https://gumroad.com/l/bidict
|
||||
:alt: Support bidict
|
||||
|
||||
|
||||
Finding Documentation
|
||||
---------------------
|
||||
|
||||
If you're viewing this on `<https://bidict.readthedocs.io>`__,
|
||||
note that multiple versions of the documentation are available,
|
||||
and you can choose a different version using the popup menu at the bottom-right.
|
||||
Please make sure you're viewing the version of the documentation
|
||||
that corresponds to the version of ``bidict`` you'd like to use.
|
||||
|
||||
If you're viewing this on GitHub, PyPI, or some other place
|
||||
that can't render and link this documentation properly
|
||||
and are seeing broken links,
|
||||
try these alternate links instead:
|
||||
|
||||
.. [#fn-learning] `<docs/learning-from-bidict.rst>`__ | `<https://bidict.readthedocs.io/learning-from-bidict.html>`__
|
||||
|
||||
.. [#fn-changelog] `<CHANGELOG.rst>`__ | `<https://bidict.readthedocs.io/changelog.html>`__
|
||||
|
||||
.. [#fn-intro] `<docs/intro.rst>`__ | `<https://bidict.readthedocs.io/intro.html>`__
|
||||
|
||||
|
||||
----
|
||||
|
||||
Next: :doc:`intro` [#fn-intro]_
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
bidict-0.21.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
|
||||
bidict-0.21.2.dist-info/LICENSE,sha256=HyVuytGSiAUQ6ErWBHTqt1iSGHhLmlC8fO7jTCuR8dU,16725
|
||||
bidict-0.21.2.dist-info/METADATA,sha256=6p33oEnK6iIEBM4o7wQLGPUyeYHtc-yEW6_s05N3d5c,11630
|
||||
bidict-0.21.2.dist-info/RECORD,,
|
||||
bidict-0.21.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
bidict-0.21.2.dist-info/WHEEL,sha256=ADKeyaGyKF5DwBNE0sRE5pvW-bSkFMJfBuhzZ3rceP4,110
|
||||
bidict-0.21.2.dist-info/top_level.txt,sha256=WuQO02jp0ODioS7sJoaHg3JJ5_3h6Sxo9RITvNGPYmc,7
|
||||
bidict/__init__.py,sha256=A2ZUK4jTHNN6T3QUaSh7xuIwc-Ytgw6gVLHNx07D7Fo,3910
|
||||
bidict/__pycache__/__init__.cpython-311.pyc,,
|
||||
bidict/__pycache__/_abc.cpython-311.pyc,,
|
||||
bidict/__pycache__/_base.cpython-311.pyc,,
|
||||
bidict/__pycache__/_bidict.cpython-311.pyc,,
|
||||
bidict/__pycache__/_delegating.cpython-311.pyc,,
|
||||
bidict/__pycache__/_dup.cpython-311.pyc,,
|
||||
bidict/__pycache__/_exc.cpython-311.pyc,,
|
||||
bidict/__pycache__/_frozenbidict.cpython-311.pyc,,
|
||||
bidict/__pycache__/_frozenordered.cpython-311.pyc,,
|
||||
bidict/__pycache__/_iter.cpython-311.pyc,,
|
||||
bidict/__pycache__/_mut.cpython-311.pyc,,
|
||||
bidict/__pycache__/_named.cpython-311.pyc,,
|
||||
bidict/__pycache__/_orderedbase.cpython-311.pyc,,
|
||||
bidict/__pycache__/_orderedbidict.cpython-311.pyc,,
|
||||
bidict/__pycache__/_typing.cpython-311.pyc,,
|
||||
bidict/__pycache__/_version.cpython-311.pyc,,
|
||||
bidict/__pycache__/metadata.cpython-311.pyc,,
|
||||
bidict/_abc.py,sha256=irEWsolFCp8ps77OKmWwB0gTrpXc5be0RBdHaQoPybk,4626
|
||||
bidict/_base.py,sha256=k7oLFwb_6ZMHMhfI217hnM-WfJ4oxVMTol1BG14E3cA,16180
|
||||
bidict/_bidict.py,sha256=85G1TyWeMZLE70HK-qwCVug-bCdaI3bIeoBxJzwSkkQ,2005
|
||||
bidict/_delegating.py,sha256=UibZewwgmN8iBECZtjELwKl5zhcuxYnyy2gsiAXBe3c,1313
|
||||
bidict/_dup.py,sha256=j0DSseguIdCgAhqxm0Zn2887110zx70F19Lvw7hiayg,1819
|
||||
bidict/_exc.py,sha256=nKOGqxqOvyjheh-Pgo-dZZWRRvPEWYyD8Ukm5XR8WNk,1053
|
||||
bidict/_frozenbidict.py,sha256=IYMIzsm9pAXTS819Tw7z_VTLIEZir4oLJbrcRc5yFP8,2494
|
||||
bidict/_frozenordered.py,sha256=E4kzBIoriZLuth9I1ll57KelvUN_xDAvZjQH7GNdn30,3224
|
||||
bidict/_iter.py,sha256=F9zoHs-IrkucujbRGnMJslH_Gc_Qrla4Mk1sOvn7ELg,2333
|
||||
bidict/_mut.py,sha256=MBXzglmeNJniRbdZ1C0Tx14pcsaBdi1NPaaFGIzZEpg,7352
|
||||
bidict/_named.py,sha256=_WQjoz9pE1d_HwVQX05vn5TthOREOw49yDdFSs5lvU4,3784
|
||||
bidict/_orderedbase.py,sha256=yMIRfDtY5DQJoAeI5YvIW49O42MuKqK8qxDrczr1NQY,12196
|
||||
bidict/_orderedbidict.py,sha256=tkfAMxehLetMqTrGoQq9KfdOpgRdhzWqp2lmk6_4vL0,3409
|
||||
bidict/_typing.py,sha256=3lq-wZhWGyn3q7euw6YK7LwFnxOVB1qdqX1x1HcW4Ng,862
|
||||
bidict/_version.py,sha256=e4Wu3F4t-gj1TaiLYadYEQ_3R8pNGz4Xi1K4eN1WFIw,117
|
||||
bidict/metadata.py,sha256=htEXequ7kpMnWeRKrl4cUJZBQIbBegxgu_bxFZ0pIkY,1812
|
||||
bidict/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
||||
@@ -0,0 +1,6 @@
|
||||
Wheel-Version: 1.0
|
||||
Generator: bdist_wheel (0.35.1)
|
||||
Root-Is-Purelib: true
|
||||
Tag: py2-none-any
|
||||
Tag: py3-none-any
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
bidict
|
||||
94
hypenv/lib/python3.11/site-packages/bidict/__init__.py
Normal file
94
hypenv/lib/python3.11/site-packages/bidict/__init__.py
Normal file
@@ -0,0 +1,94 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# Current: __init__.py Next: _abc.py →
|
||||
#==============================================================================
|
||||
|
||||
|
||||
"""The bidirectional mapping library for Python.
|
||||
|
||||
bidict by example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
>>> from bidict import bidict
|
||||
>>> element_by_symbol = bidict({'H': 'hydrogen'})
|
||||
>>> element_by_symbol['H']
|
||||
'hydrogen'
|
||||
>>> element_by_symbol.inverse['hydrogen']
|
||||
'H'
|
||||
|
||||
|
||||
Please see https://github.com/jab/bidict for the most up-to-date code and
|
||||
https://bidict.readthedocs.io for the most up-to-date documentation
|
||||
if you are reading this elsewhere.
|
||||
|
||||
|
||||
.. :copyright: (c) 2009-2020 Joshua Bronson.
|
||||
.. :license: MPLv2. See LICENSE for details.
|
||||
"""
|
||||
|
||||
# Use private aliases to not re-export these publicly (for Sphinx automodule with imported-members).
|
||||
from sys import version_info as _version_info
|
||||
|
||||
|
||||
if _version_info < (3, 6): # pragma: no cover
|
||||
raise ImportError('Python 3.6+ is required.')
|
||||
|
||||
# The rest of this file only collects functionality implemented in the rest of the
|
||||
# source for the purposes of exporting it under the `bidict` module namespace.
|
||||
# flake8: noqa: F401 (imported but unused)
|
||||
from ._abc import BidirectionalMapping, MutableBidirectionalMapping
|
||||
from ._base import BidictBase
|
||||
from ._mut import MutableBidict
|
||||
from ._bidict import bidict
|
||||
from ._frozenbidict import frozenbidict
|
||||
from ._frozenordered import FrozenOrderedBidict
|
||||
from ._named import namedbidict
|
||||
from ._orderedbase import OrderedBidictBase
|
||||
from ._orderedbidict import OrderedBidict
|
||||
from ._dup import ON_DUP_DEFAULT, ON_DUP_RAISE, ON_DUP_DROP_OLD, RAISE, DROP_OLD, DROP_NEW, OnDup, OnDupAction
|
||||
from ._exc import BidictException, DuplicationError, KeyDuplicationError, ValueDuplicationError, KeyAndValueDuplicationError
|
||||
from ._iter import inverted
|
||||
from .metadata import (
|
||||
__author__, __maintainer__, __copyright__, __email__, __credits__, __url__,
|
||||
__license__, __status__, __description__, __keywords__, __version__, __version_info__,
|
||||
)
|
||||
|
||||
# Set __module__ of re-exported classes to the 'bidict' top-level module name
|
||||
# so that private/internal submodules are not exposed to users e.g. in repr strings.
|
||||
_locals = tuple(locals().items())
|
||||
for _name, _obj in _locals: # pragma: no cover
|
||||
if not getattr(_obj, '__module__', '').startswith('bidict.'):
|
||||
continue
|
||||
try:
|
||||
_obj.__module__ = 'bidict'
|
||||
except AttributeError as exc: # raised when __module__ is read-only (as in OnDup)
|
||||
pass
|
||||
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# Current: __init__.py Next: _abc.py →
|
||||
#==============================================================================
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
105
hypenv/lib/python3.11/site-packages/bidict/_abc.py
Normal file
105
hypenv/lib/python3.11/site-packages/bidict/_abc.py
Normal file
@@ -0,0 +1,105 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: __init__.py Current: _abc.py Next: _base.py →
|
||||
#==============================================================================
|
||||
|
||||
|
||||
"""Provide the :class:`BidirectionalMapping` abstract base class."""
|
||||
|
||||
import typing as _t
|
||||
from abc import abstractmethod
|
||||
|
||||
from ._typing import KT, VT
|
||||
|
||||
|
||||
class BidirectionalMapping(_t.Mapping[KT, VT]):
|
||||
"""Abstract base class (ABC) for bidirectional mapping types.
|
||||
|
||||
Extends :class:`collections.abc.Mapping` primarily by adding the
|
||||
(abstract) :attr:`inverse` property,
|
||||
which implementors of :class:`BidirectionalMapping`
|
||||
should override to return a reference to the inverse
|
||||
:class:`BidirectionalMapping` instance.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def inverse(self) -> 'BidirectionalMapping[VT, KT]':
|
||||
"""The inverse of this bidirectional mapping instance.
|
||||
|
||||
*See also* :attr:`bidict.BidictBase.inverse`, :attr:`bidict.BidictBase.inv`
|
||||
|
||||
:raises NotImplementedError: Meant to be overridden in subclasses.
|
||||
"""
|
||||
# The @abstractproperty decorator prevents BidirectionalMapping subclasses from being
|
||||
# instantiated unless they override this method. So users shouldn't be able to get to the
|
||||
# point where they can unintentionally call this implementation of .inverse on something
|
||||
# anyway. Could leave the method body empty, but raise NotImplementedError so it's extra
|
||||
# clear there's no reason to call this implementation (e.g. via super() after overriding).
|
||||
raise NotImplementedError
|
||||
|
||||
def __inverted__(self) -> _t.Iterator[_t.Tuple[VT, KT]]:
|
||||
"""Get an iterator over the items in :attr:`inverse`.
|
||||
|
||||
This is functionally equivalent to iterating over the items in the
|
||||
forward mapping and inverting each one on the fly, but this provides a
|
||||
more efficient implementation: Assuming the already-inverted items
|
||||
are stored in :attr:`inverse`, just return an iterator over them directly.
|
||||
|
||||
Providing this default implementation enables external functions,
|
||||
particularly :func:`~bidict.inverted`, to use this optimized
|
||||
implementation when available, instead of having to invert on the fly.
|
||||
|
||||
*See also* :func:`bidict.inverted`
|
||||
"""
|
||||
return iter(self.inverse.items())
|
||||
|
||||
def values(self) -> _t.AbstractSet[VT]: # type: ignore # https://github.com/python/typeshed/issues/4435
|
||||
"""A set-like object providing a view on the contained values.
|
||||
|
||||
Override the implementation inherited from
|
||||
:class:`~collections.abc.Mapping`.
|
||||
Because the values of a :class:`~bidict.BidirectionalMapping`
|
||||
are the keys of its inverse,
|
||||
this returns a :class:`~collections.abc.KeysView`
|
||||
rather than a :class:`~collections.abc.ValuesView`,
|
||||
which has the advantages of constant-time containment checks
|
||||
and supporting set operations.
|
||||
"""
|
||||
return self.inverse.keys()
|
||||
|
||||
|
||||
class MutableBidirectionalMapping(BidirectionalMapping[KT, VT], _t.MutableMapping[KT, VT]):
|
||||
"""Abstract base class (ABC) for mutable bidirectional mapping types."""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: __init__.py Current: _abc.py Next: _base.py →
|
||||
#==============================================================================
|
||||
383
hypenv/lib/python3.11/site-packages/bidict/_base.py
Normal file
383
hypenv/lib/python3.11/site-packages/bidict/_base.py
Normal file
@@ -0,0 +1,383 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _abc.py Current: _base.py Next: _frozenbidict.py →
|
||||
#==============================================================================
|
||||
|
||||
|
||||
"""Provide :class:`BidictBase`."""
|
||||
|
||||
import typing as _t
|
||||
from collections import namedtuple
|
||||
from copy import copy
|
||||
from weakref import ref
|
||||
|
||||
from ._abc import BidirectionalMapping
|
||||
from ._dup import ON_DUP_DEFAULT, RAISE, DROP_OLD, DROP_NEW, OnDup
|
||||
from ._exc import DuplicationError, KeyDuplicationError, ValueDuplicationError, KeyAndValueDuplicationError
|
||||
from ._iter import _iteritems_args_kw
|
||||
from ._typing import _NONE, KT, VT, OKT, OVT, IterItems, MapOrIterItems
|
||||
|
||||
|
||||
_WriteResult = namedtuple('_WriteResult', 'key val oldkey oldval')
|
||||
_DedupResult = namedtuple('_DedupResult', 'isdupkey isdupval invbyval fwdbykey')
|
||||
_NODUP = _DedupResult(False, False, _NONE, _NONE)
|
||||
|
||||
BT = _t.TypeVar('BT', bound='BidictBase') # typevar for BidictBase.copy
|
||||
|
||||
|
||||
class BidictBase(BidirectionalMapping[KT, VT]):
|
||||
"""Base class implementing :class:`BidirectionalMapping`."""
|
||||
|
||||
__slots__ = ['_fwdm', '_invm', '_inv', '_invweak', '_hash', '__weakref__']
|
||||
|
||||
#: The default :class:`~bidict.OnDup`
|
||||
#: that governs behavior when a provided item
|
||||
#: duplicates the key or value of other item(s).
|
||||
#:
|
||||
#: *See also* :ref:`basic-usage:Values Must Be Unique`, :doc:`extending`
|
||||
on_dup = ON_DUP_DEFAULT
|
||||
|
||||
_fwdm_cls = dict #: class of the backing forward mapping
|
||||
_invm_cls = dict #: class of the backing inverse mapping
|
||||
|
||||
#: The object used by :meth:`__repr__` for printing the contained items.
|
||||
_repr_delegate = dict
|
||||
|
||||
def __init_subclass__(cls, **kw):
|
||||
super().__init_subclass__(**kw)
|
||||
# Compute and set _inv_cls, the inverse of this bidict class.
|
||||
if '_inv_cls' in cls.__dict__:
|
||||
return
|
||||
if cls._fwdm_cls is cls._invm_cls:
|
||||
cls._inv_cls = cls
|
||||
return
|
||||
inv_cls = type(cls.__name__ + 'Inv', cls.__bases__, {
|
||||
**cls.__dict__,
|
||||
'_inv_cls': cls,
|
||||
'_fwdm_cls': cls._invm_cls,
|
||||
'_invm_cls': cls._fwdm_cls,
|
||||
})
|
||||
cls._inv_cls = inv_cls
|
||||
|
||||
@_t.overload
|
||||
def __init__(self, __arg: _t.Mapping[KT, VT], **kw: VT) -> None: ...
|
||||
@_t.overload
|
||||
def __init__(self, __arg: IterItems[KT, VT], **kw: VT) -> None: ...
|
||||
@_t.overload
|
||||
def __init__(self, **kw: VT) -> None: ...
|
||||
def __init__(self, *args: MapOrIterItems[KT, VT], **kw: VT) -> None:
|
||||
"""Make a new bidirectional dictionary.
|
||||
The signature behaves like that of :class:`dict`.
|
||||
Items passed in are added in the order they are passed,
|
||||
respecting the :attr:`on_dup` class attribute in the process.
|
||||
"""
|
||||
#: The backing :class:`~collections.abc.Mapping`
|
||||
#: storing the forward mapping data (*key* → *value*).
|
||||
self._fwdm: _t.Dict[KT, VT] = self._fwdm_cls()
|
||||
#: The backing :class:`~collections.abc.Mapping`
|
||||
#: storing the inverse mapping data (*value* → *key*).
|
||||
self._invm: _t.Dict[VT, KT] = self._invm_cls()
|
||||
self._init_inv()
|
||||
if args or kw:
|
||||
self._update(True, self.on_dup, *args, **kw)
|
||||
|
||||
def _init_inv(self) -> None:
|
||||
# Create the inverse bidict instance via __new__, bypassing its __init__ so that its
|
||||
# _fwdm and _invm can be assigned to this bidict's _invm and _fwdm. Store it in self._inv,
|
||||
# which holds a strong reference to a bidict's inverse, if one is available.
|
||||
self._inv = inv = self._inv_cls.__new__(self._inv_cls) # type: ignore
|
||||
inv._fwdm = self._invm
|
||||
inv._invm = self._fwdm
|
||||
# Only give the inverse a weak reference to this bidict to avoid creating a reference cycle,
|
||||
# stored in the _invweak attribute. See also the docs in
|
||||
# :ref:`addendum:Bidict Avoids Reference Cycles`
|
||||
inv._inv = None
|
||||
inv._invweak = ref(self)
|
||||
# Since this bidict has a strong reference to its inverse already, set its _invweak to None.
|
||||
self._invweak = None
|
||||
|
||||
@property
|
||||
def _isinv(self) -> bool:
|
||||
return self._inv is None
|
||||
|
||||
@property
|
||||
def inverse(self) -> 'BidictBase[VT, KT]':
|
||||
"""The inverse of this bidict."""
|
||||
# Resolve and return a strong reference to the inverse bidict.
|
||||
# One may be stored in self._inv already.
|
||||
if self._inv is not None:
|
||||
return self._inv # type: ignore
|
||||
# Otherwise a weakref is stored in self._invweak. Try to get a strong ref from it.
|
||||
assert self._invweak is not None
|
||||
inv = self._invweak()
|
||||
if inv is not None:
|
||||
return inv
|
||||
# Refcount of referent must have dropped to zero, as in `bidict().inv.inv`. Init a new one.
|
||||
self._init_inv() # Now this bidict will retain a strong ref to its inverse.
|
||||
return self._inv
|
||||
|
||||
#: Alias for :attr:`inverse`.
|
||||
inv = inverse
|
||||
|
||||
def __getstate__(self) -> dict:
|
||||
"""Needed to enable pickling due to use of :attr:`__slots__` and weakrefs.
|
||||
|
||||
*See also* :meth:`object.__getstate__`
|
||||
"""
|
||||
state = {}
|
||||
for cls in self.__class__.__mro__:
|
||||
slots = getattr(cls, '__slots__', ())
|
||||
for slot in slots:
|
||||
if hasattr(self, slot):
|
||||
state[slot] = getattr(self, slot)
|
||||
# weakrefs can't be pickled.
|
||||
state.pop('_invweak', None) # Added back in __setstate__ via _init_inv call.
|
||||
state.pop('__weakref__', None) # Not added back in __setstate__. Python manages this one.
|
||||
return state
|
||||
|
||||
def __setstate__(self, state: dict) -> None:
|
||||
"""Implemented because use of :attr:`__slots__` would prevent unpickling otherwise.
|
||||
|
||||
*See also* :meth:`object.__setstate__`
|
||||
"""
|
||||
for slot, value in state.items():
|
||||
setattr(self, slot, value)
|
||||
self._init_inv()
|
||||
|
||||
def __repr__(self) -> str:
|
||||
"""See :func:`repr`."""
|
||||
clsname = self.__class__.__name__
|
||||
if not self:
|
||||
return f'{clsname}()'
|
||||
return f'{clsname}({self._repr_delegate(self.items())})'
|
||||
|
||||
# The inherited Mapping.__eq__ implementation would work, but it's implemented in terms of an
|
||||
# inefficient ``dict(self.items()) == dict(other.items())`` comparison, so override it with a
|
||||
# more efficient implementation.
|
||||
def __eq__(self, other: object) -> bool:
|
||||
"""*x.__eq__(other) ⟺ x == other*
|
||||
|
||||
Equivalent to *dict(x.items()) == dict(other.items())*
|
||||
but more efficient.
|
||||
|
||||
Note that :meth:`bidict's __eq__() <bidict.bidict.__eq__>` implementation
|
||||
is inherited by subclasses,
|
||||
in particular by the ordered bidict subclasses,
|
||||
so even with ordered bidicts,
|
||||
:ref:`== comparison is order-insensitive <eq-order-insensitive>`.
|
||||
|
||||
*See also* :meth:`bidict.FrozenOrderedBidict.equals_order_sensitive`
|
||||
"""
|
||||
if not isinstance(other, _t.Mapping) or len(self) != len(other):
|
||||
return False
|
||||
selfget = self.get
|
||||
return all(selfget(k, _NONE) == v for (k, v) in other.items()) # type: ignore
|
||||
|
||||
# The following methods are mutating and so are not public. But they are implemented in this
|
||||
# non-mutable base class (rather than the mutable `bidict` subclass) because they are used here
|
||||
# during initialization (starting with the `_update` method). (Why is this? Because `__init__`
|
||||
# and `update` share a lot of the same behavior (inserting the provided items while respecting
|
||||
# `on_dup`), so it makes sense for them to share implementation too.)
|
||||
def _pop(self, key: KT) -> VT:
|
||||
val = self._fwdm.pop(key)
|
||||
del self._invm[val]
|
||||
return val
|
||||
|
||||
def _put(self, key: KT, val: VT, on_dup: OnDup) -> None:
|
||||
dedup_result = self._dedup_item(key, val, on_dup)
|
||||
if dedup_result is not None:
|
||||
self._write_item(key, val, dedup_result)
|
||||
|
||||
def _dedup_item(self, key: KT, val: VT, on_dup: OnDup) -> _t.Optional[_DedupResult]:
|
||||
"""Check *key* and *val* for any duplication in self.
|
||||
|
||||
Handle any duplication as per the passed in *on_dup*.
|
||||
|
||||
(key, val) already present is construed as a no-op, not a duplication.
|
||||
|
||||
If duplication is found and the corresponding :class:`~bidict.OnDupAction` is
|
||||
:attr:`~bidict.DROP_NEW`, return None.
|
||||
|
||||
If duplication is found and the corresponding :class:`~bidict.OnDupAction` is
|
||||
:attr:`~bidict.RAISE`, raise the appropriate error.
|
||||
|
||||
If duplication is found and the corresponding :class:`~bidict.OnDupAction` is
|
||||
:attr:`~bidict.DROP_OLD`,
|
||||
or if no duplication is found,
|
||||
return the :class:`_DedupResult` *(isdupkey, isdupval, oldkey, oldval)*.
|
||||
"""
|
||||
fwdm = self._fwdm
|
||||
invm = self._invm
|
||||
oldval: OVT = fwdm.get(key, _NONE)
|
||||
oldkey: OKT = invm.get(val, _NONE)
|
||||
isdupkey = oldval is not _NONE
|
||||
isdupval = oldkey is not _NONE
|
||||
dedup_result = _DedupResult(isdupkey, isdupval, oldkey, oldval)
|
||||
if isdupkey and isdupval:
|
||||
if self._already_have(key, val, oldkey, oldval):
|
||||
# (key, val) duplicates an existing item -> no-op.
|
||||
return None
|
||||
# key and val each duplicate a different existing item.
|
||||
if on_dup.kv is RAISE:
|
||||
raise KeyAndValueDuplicationError(key, val)
|
||||
if on_dup.kv is DROP_NEW:
|
||||
return None
|
||||
assert on_dup.kv is DROP_OLD
|
||||
# Fall through to the return statement on the last line.
|
||||
elif isdupkey:
|
||||
if on_dup.key is RAISE:
|
||||
raise KeyDuplicationError(key)
|
||||
if on_dup.key is DROP_NEW:
|
||||
return None
|
||||
assert on_dup.key is DROP_OLD
|
||||
# Fall through to the return statement on the last line.
|
||||
elif isdupval:
|
||||
if on_dup.val is RAISE:
|
||||
raise ValueDuplicationError(val)
|
||||
if on_dup.val is DROP_NEW:
|
||||
return None
|
||||
assert on_dup.val is DROP_OLD
|
||||
# Fall through to the return statement on the last line.
|
||||
# else neither isdupkey nor isdupval.
|
||||
return dedup_result
|
||||
|
||||
@staticmethod
|
||||
def _already_have(key: KT, val: VT, oldkey: OKT, oldval: OVT) -> bool:
|
||||
# Overridden by _orderedbase.OrderedBidictBase.
|
||||
isdup = oldkey == key
|
||||
assert isdup == (oldval == val), f'{key} {val} {oldkey} {oldval}'
|
||||
return isdup
|
||||
|
||||
def _write_item(self, key: KT, val: VT, dedup_result: _DedupResult) -> _WriteResult:
|
||||
# Overridden by _orderedbase.OrderedBidictBase.
|
||||
isdupkey, isdupval, oldkey, oldval = dedup_result
|
||||
fwdm = self._fwdm
|
||||
invm = self._invm
|
||||
fwdm[key] = val
|
||||
invm[val] = key
|
||||
if isdupkey:
|
||||
del invm[oldval]
|
||||
if isdupval:
|
||||
del fwdm[oldkey]
|
||||
return _WriteResult(key, val, oldkey, oldval)
|
||||
|
||||
def _update(self, init: bool, on_dup: OnDup, *args: MapOrIterItems[KT, VT], **kw: VT) -> None:
|
||||
# args[0] may be a generator that yields many items, so process input in a single pass.
|
||||
if not args and not kw:
|
||||
return
|
||||
can_skip_dup_check = not self and not kw and isinstance(args[0], BidirectionalMapping)
|
||||
if can_skip_dup_check:
|
||||
self._update_no_dup_check(args[0]) # type: ignore
|
||||
return
|
||||
can_skip_rollback = init or RAISE not in on_dup
|
||||
if can_skip_rollback:
|
||||
self._update_no_rollback(on_dup, *args, **kw)
|
||||
else:
|
||||
self._update_with_rollback(on_dup, *args, **kw)
|
||||
|
||||
def _update_no_dup_check(self, other: BidirectionalMapping[KT, VT]) -> None:
|
||||
write_item = self._write_item
|
||||
for (key, val) in other.items():
|
||||
write_item(key, val, _NODUP)
|
||||
|
||||
def _update_no_rollback(self, on_dup: OnDup, *args: MapOrIterItems[KT, VT], **kw: VT) -> None:
|
||||
put = self._put
|
||||
for (key, val) in _iteritems_args_kw(*args, **kw):
|
||||
put(key, val, on_dup)
|
||||
|
||||
def _update_with_rollback(self, on_dup: OnDup, *args: MapOrIterItems[KT, VT], **kw: VT) -> None:
|
||||
"""Update, rolling back on failure."""
|
||||
writes: _t.List[_t.Tuple[_DedupResult, _WriteResult]] = []
|
||||
append_write = writes.append
|
||||
dedup_item = self._dedup_item
|
||||
write_item = self._write_item
|
||||
for (key, val) in _iteritems_args_kw(*args, **kw):
|
||||
try:
|
||||
dedup_result = dedup_item(key, val, on_dup)
|
||||
except DuplicationError:
|
||||
undo_write = self._undo_write
|
||||
for dedup_result, write_result in reversed(writes):
|
||||
undo_write(dedup_result, write_result)
|
||||
raise
|
||||
if dedup_result is not None:
|
||||
write_result = write_item(key, val, dedup_result)
|
||||
append_write((dedup_result, write_result))
|
||||
|
||||
def _undo_write(self, dedup_result: _DedupResult, write_result: _WriteResult) -> None:
|
||||
isdupkey, isdupval, _, _ = dedup_result
|
||||
key, val, oldkey, oldval = write_result
|
||||
if not isdupkey and not isdupval:
|
||||
self._pop(key)
|
||||
return
|
||||
fwdm = self._fwdm
|
||||
invm = self._invm
|
||||
if isdupkey:
|
||||
fwdm[key] = oldval
|
||||
invm[oldval] = key
|
||||
if not isdupval:
|
||||
del invm[val]
|
||||
if isdupval:
|
||||
invm[val] = oldkey
|
||||
fwdm[oldkey] = val
|
||||
if not isdupkey:
|
||||
del fwdm[key]
|
||||
|
||||
def copy(self: BT) -> BT:
|
||||
"""A shallow copy."""
|
||||
# Could just ``return self.__class__(self)`` here instead, but the below is faster. It uses
|
||||
# __new__ to create a copy instance while bypassing its __init__, which would result
|
||||
# in copying this bidict's items into the copy instance one at a time. Instead, make whole
|
||||
# copies of each of the backing mappings, and make them the backing mappings of the copy,
|
||||
# avoiding copying items one at a time.
|
||||
cp = self.__class__.__new__(self.__class__)
|
||||
cp._fwdm = copy(self._fwdm)
|
||||
cp._invm = copy(self._invm)
|
||||
cp._init_inv()
|
||||
return cp # type: ignore
|
||||
|
||||
#: Used for the copy protocol.
|
||||
#: *See also* the :mod:`copy` module
|
||||
__copy__ = copy
|
||||
|
||||
def __len__(self) -> int:
|
||||
"""The number of contained items."""
|
||||
return len(self._fwdm)
|
||||
|
||||
def __iter__(self) -> _t.Iterator[KT]:
|
||||
"""Iterator over the contained keys."""
|
||||
return iter(self._fwdm)
|
||||
|
||||
def __getitem__(self, key: KT) -> VT:
|
||||
"""*x.__getitem__(key) ⟺ x[key]*"""
|
||||
return self._fwdm[key]
|
||||
|
||||
|
||||
# Work around weakref slot with Generics bug on Python 3.6 (https://bugs.python.org/issue41451):
|
||||
BidictBase.__slots__.remove('__weakref__')
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _abc.py Current: _base.py Next: _frozenbidict.py →
|
||||
#==============================================================================
|
||||
51
hypenv/lib/python3.11/site-packages/bidict/_bidict.py
Normal file
51
hypenv/lib/python3.11/site-packages/bidict/_bidict.py
Normal file
@@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _mut.py Current: _bidict.py Next: _orderedbase.py →
|
||||
#==============================================================================
|
||||
|
||||
|
||||
"""Provide :class:`bidict`."""
|
||||
|
||||
import typing as _t
|
||||
|
||||
from ._delegating import _DelegatingBidict
|
||||
from ._mut import MutableBidict
|
||||
from ._typing import KT, VT
|
||||
|
||||
|
||||
class bidict(_DelegatingBidict[KT, VT], MutableBidict[KT, VT]):
|
||||
"""Base class for mutable bidirectional mappings."""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
if _t.TYPE_CHECKING:
|
||||
@property
|
||||
def inverse(self) -> 'bidict[VT, KT]': ...
|
||||
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _mut.py Current: _bidict.py Next: _orderedbase.py →
|
||||
#==============================================================================
|
||||
39
hypenv/lib/python3.11/site-packages/bidict/_delegating.py
Normal file
39
hypenv/lib/python3.11/site-packages/bidict/_delegating.py
Normal file
@@ -0,0 +1,39 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
"""Provide :class:`_DelegatingBidict`."""
|
||||
|
||||
import typing as _t
|
||||
|
||||
from ._base import BidictBase
|
||||
from ._typing import KT, VT
|
||||
|
||||
|
||||
class _DelegatingBidict(BidictBase[KT, VT]):
|
||||
"""Provide optimized implementations of several methods by delegating to backing dicts.
|
||||
|
||||
Used to override less efficient implementations inherited by :class:`~collections.abc.Mapping`.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __iter__(self) -> _t.Iterator[KT]:
|
||||
"""Iterator over the contained keys."""
|
||||
return iter(self._fwdm)
|
||||
|
||||
def keys(self) -> _t.KeysView[KT]:
|
||||
"""A set-like object providing a view on the contained keys."""
|
||||
return self._fwdm.keys()
|
||||
|
||||
def values(self) -> _t.KeysView[VT]: # type: ignore # https://github.com/python/typeshed/issues/4435
|
||||
"""A set-like object providing a view on the contained values."""
|
||||
return self._invm.keys()
|
||||
|
||||
def items(self) -> _t.ItemsView[KT, VT]:
|
||||
"""A set-like object providing a view on the contained items."""
|
||||
return self._fwdm.items()
|
||||
58
hypenv/lib/python3.11/site-packages/bidict/_dup.py
Normal file
58
hypenv/lib/python3.11/site-packages/bidict/_dup.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
"""Provide :class:`OnDup` and related functionality."""
|
||||
|
||||
|
||||
from collections import namedtuple
|
||||
from enum import Enum
|
||||
|
||||
|
||||
class OnDupAction(Enum):
|
||||
"""An action to take to prevent duplication from occurring."""
|
||||
|
||||
#: Raise a :class:`~bidict.DuplicationError`.
|
||||
RAISE = 'RAISE'
|
||||
#: Overwrite existing items with new items.
|
||||
DROP_OLD = 'DROP_OLD'
|
||||
#: Keep existing items and drop new items.
|
||||
DROP_NEW = 'DROP_NEW'
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return f'<{self.name}>'
|
||||
|
||||
|
||||
RAISE = OnDupAction.RAISE
|
||||
DROP_OLD = OnDupAction.DROP_OLD
|
||||
DROP_NEW = OnDupAction.DROP_NEW
|
||||
|
||||
|
||||
class OnDup(namedtuple('_OnDup', 'key val kv')):
|
||||
r"""A 3-tuple of :class:`OnDupAction`\s specifying how to handle the 3 kinds of duplication.
|
||||
|
||||
*See also* :ref:`basic-usage:Values Must Be Unique`
|
||||
|
||||
If *kv* is not specified, *val* will be used for *kv*.
|
||||
"""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
def __new__(cls, key: OnDupAction = DROP_OLD, val: OnDupAction = RAISE, kv: OnDupAction = RAISE) -> 'OnDup':
|
||||
"""Override to provide user-friendly default values."""
|
||||
return super().__new__(cls, key, val, kv or val)
|
||||
|
||||
|
||||
#: Default :class:`OnDup` used for the
|
||||
#: :meth:`~bidict.bidict.__init__`,
|
||||
#: :meth:`~bidict.bidict.__setitem__`, and
|
||||
#: :meth:`~bidict.bidict.update` methods.
|
||||
ON_DUP_DEFAULT = OnDup()
|
||||
#: An :class:`OnDup` whose members are all :obj:`RAISE`.
|
||||
ON_DUP_RAISE = OnDup(key=RAISE, val=RAISE, kv=RAISE)
|
||||
#: An :class:`OnDup` whose members are all :obj:`DROP_OLD`.
|
||||
ON_DUP_DROP_OLD = OnDup(key=DROP_OLD, val=DROP_OLD, kv=DROP_OLD)
|
||||
35
hypenv/lib/python3.11/site-packages/bidict/_exc.py
Normal file
35
hypenv/lib/python3.11/site-packages/bidict/_exc.py
Normal file
@@ -0,0 +1,35 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
"""Provide all bidict exceptions."""
|
||||
|
||||
|
||||
class BidictException(Exception):
|
||||
"""Base class for bidict exceptions."""
|
||||
|
||||
|
||||
class DuplicationError(BidictException):
|
||||
"""Base class for exceptions raised when uniqueness is violated
|
||||
as per the :attr:~bidict.RAISE` :class:`~bidict.OnDupAction`.
|
||||
"""
|
||||
|
||||
|
||||
class KeyDuplicationError(DuplicationError):
|
||||
"""Raised when a given key is not unique."""
|
||||
|
||||
|
||||
class ValueDuplicationError(DuplicationError):
|
||||
"""Raised when a given value is not unique."""
|
||||
|
||||
|
||||
class KeyAndValueDuplicationError(KeyDuplicationError, ValueDuplicationError):
|
||||
"""Raised when a given item's key and value are not unique.
|
||||
|
||||
That is, its key duplicates that of another item,
|
||||
and its value duplicates that of a different other item.
|
||||
"""
|
||||
58
hypenv/lib/python3.11/site-packages/bidict/_frozenbidict.py
Normal file
58
hypenv/lib/python3.11/site-packages/bidict/_frozenbidict.py
Normal file
@@ -0,0 +1,58 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _base.py Current: _frozenbidict.py Next: _mut.py →
|
||||
#==============================================================================
|
||||
|
||||
"""Provide :class:`frozenbidict`, an immutable, hashable bidirectional mapping type."""
|
||||
|
||||
import typing as _t
|
||||
|
||||
from ._delegating import _DelegatingBidict
|
||||
from ._typing import KT, VT
|
||||
|
||||
|
||||
class frozenbidict(_DelegatingBidict[KT, VT]):
|
||||
"""Immutable, hashable bidict type."""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
# Work around lack of support for higher-kinded types in mypy.
|
||||
# Ref: https://github.com/python/typing/issues/548#issuecomment-621571821
|
||||
# Remove this and similar type stubs from other classes if support is ever added.
|
||||
if _t.TYPE_CHECKING:
|
||||
@property
|
||||
def inverse(self) -> 'frozenbidict[VT, KT]': ...
|
||||
|
||||
def __hash__(self) -> int:
|
||||
"""The hash of this bidict as determined by its items."""
|
||||
if getattr(self, '_hash', None) is None:
|
||||
self._hash = _t.ItemsView(self)._hash() # type: ignore
|
||||
return self._hash # type: ignore
|
||||
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _base.py Current: _frozenbidict.py Next: _mut.py →
|
||||
#==============================================================================
|
||||
75
hypenv/lib/python3.11/site-packages/bidict/_frozenordered.py
Normal file
75
hypenv/lib/python3.11/site-packages/bidict/_frozenordered.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
#← Prev: _orderedbase.py Current: _frozenordered.py Next: _orderedbidict.py →
|
||||
#==============================================================================
|
||||
|
||||
"""Provide :class:`FrozenOrderedBidict`, an immutable, hashable, ordered bidict."""
|
||||
|
||||
import typing as _t
|
||||
|
||||
from ._frozenbidict import frozenbidict
|
||||
from ._orderedbase import OrderedBidictBase
|
||||
from ._typing import KT, VT
|
||||
|
||||
|
||||
class FrozenOrderedBidict(OrderedBidictBase[KT, VT]):
|
||||
"""Hashable, immutable, ordered bidict type."""
|
||||
|
||||
__slots__ = ()
|
||||
__hash__ = frozenbidict.__hash__
|
||||
|
||||
if _t.TYPE_CHECKING:
|
||||
@property
|
||||
def inverse(self) -> 'FrozenOrderedBidict[VT, KT]': ...
|
||||
|
||||
# Assume the Python implementation's dict type is ordered (e.g. PyPy or CPython >= 3.6), so we
|
||||
# can delegate to `_fwdm` and `_invm` for faster implementations of several methods. Both
|
||||
# `_fwdm` and `_invm` will always be initialized with the provided items in the correct order,
|
||||
# and since `FrozenOrderedBidict` is immutable, their respective orders can't get out of sync
|
||||
# after a mutation.
|
||||
def __iter__(self) -> _t.Iterator[KT]:
|
||||
"""Iterator over the contained keys in insertion order."""
|
||||
return self._iter()
|
||||
|
||||
def _iter(self, *, reverse: bool = False) -> _t.Iterator[KT]:
|
||||
if reverse:
|
||||
return super()._iter(reverse=True)
|
||||
return iter(self._fwdm._fwdm)
|
||||
|
||||
def keys(self) -> _t.KeysView[KT]:
|
||||
"""A set-like object providing a view on the contained keys."""
|
||||
return self._fwdm._fwdm.keys()
|
||||
|
||||
def values(self) -> _t.KeysView[VT]: # type: ignore
|
||||
"""A set-like object providing a view on the contained values."""
|
||||
return self._invm._fwdm.keys()
|
||||
|
||||
# We can't delegate for items because values in `_fwdm` are nodes.
|
||||
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
#← Prev: _orderedbase.py Current: _frozenordered.py Next: _orderedbidict.py →
|
||||
#==============================================================================
|
||||
67
hypenv/lib/python3.11/site-packages/bidict/_iter.py
Normal file
67
hypenv/lib/python3.11/site-packages/bidict/_iter.py
Normal file
@@ -0,0 +1,67 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
"""Functions for iterating over items in a mapping."""
|
||||
|
||||
import typing as _t
|
||||
from collections.abc import Mapping
|
||||
from itertools import chain, repeat
|
||||
|
||||
from ._typing import KT, VT, IterItems, MapOrIterItems
|
||||
|
||||
|
||||
_NULL_IT = repeat(None, 0) # repeat 0 times -> raise StopIteration from the start
|
||||
|
||||
|
||||
def _iteritems_mapping_or_iterable(arg: MapOrIterItems[KT, VT]) -> IterItems[KT, VT]:
|
||||
"""Yield the items in *arg*.
|
||||
|
||||
If *arg* is a :class:`~collections.abc.Mapping`, return an iterator over its items.
|
||||
Otherwise return an iterator over *arg* itself.
|
||||
"""
|
||||
return iter(arg.items() if isinstance(arg, Mapping) else arg)
|
||||
|
||||
|
||||
def _iteritems_args_kw(*args: MapOrIterItems[KT, VT], **kw: VT) -> IterItems[KT, VT]:
|
||||
"""Yield the items from the positional argument (if given) and then any from *kw*.
|
||||
|
||||
:raises TypeError: if more than one positional argument is given.
|
||||
"""
|
||||
args_len = len(args)
|
||||
if args_len > 1:
|
||||
raise TypeError(f'Expected at most 1 positional argument, got {args_len}')
|
||||
itemchain = None
|
||||
if args:
|
||||
arg = args[0]
|
||||
if arg:
|
||||
itemchain = _iteritems_mapping_or_iterable(arg)
|
||||
if kw:
|
||||
iterkw = iter(kw.items())
|
||||
itemchain = chain(itemchain, iterkw) if itemchain else iterkw # type: ignore
|
||||
return itemchain or _NULL_IT # type: ignore
|
||||
|
||||
|
||||
@_t.overload
|
||||
def inverted(arg: _t.Mapping[KT, VT]) -> IterItems[VT, KT]: ...
|
||||
@_t.overload
|
||||
def inverted(arg: IterItems[KT, VT]) -> IterItems[VT, KT]: ...
|
||||
def inverted(arg: MapOrIterItems[KT, VT]) -> IterItems[VT, KT]:
|
||||
"""Yield the inverse items of the provided object.
|
||||
|
||||
If *arg* has a :func:`callable` ``__inverted__`` attribute,
|
||||
return the result of calling it.
|
||||
|
||||
Otherwise, return an iterator over the items in `arg`,
|
||||
inverting each item on the fly.
|
||||
|
||||
*See also* :attr:`bidict.BidirectionalMapping.__inverted__`
|
||||
"""
|
||||
inv = getattr(arg, '__inverted__', None)
|
||||
if callable(inv):
|
||||
return inv() # type: ignore
|
||||
return ((val, key) for (key, val) in _iteritems_mapping_or_iterable(arg))
|
||||
188
hypenv/lib/python3.11/site-packages/bidict/_mut.py
Normal file
188
hypenv/lib/python3.11/site-packages/bidict/_mut.py
Normal file
@@ -0,0 +1,188 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2009-2020 Joshua Bronson. All Rights Reserved.
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
|
||||
#==============================================================================
|
||||
# * Welcome to the bidict source code *
|
||||
#==============================================================================
|
||||
|
||||
# Doing a code review? You'll find a "Code review nav" comment like the one
|
||||
# below at the top and bottom of the most important source files. This provides
|
||||
# a suggested initial path through the source when reviewing.
|
||||
#
|
||||
# Note: If you aren't reading this on https://github.com/jab/bidict, you may be
|
||||
# viewing an outdated version of the code. Please head to GitHub to review the
|
||||
# latest version, which contains important improvements over older versions.
|
||||
#
|
||||
# Thank you for reading and for any feedback you provide.
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _frozenbidict.py Current: _mut.py Next: _bidict.py →
|
||||
#==============================================================================
|
||||
|
||||
|
||||
"""Provide :class:`MutableBidict`."""
|
||||
|
||||
import typing as _t
|
||||
|
||||
from ._abc import MutableBidirectionalMapping
|
||||
from ._base import BidictBase
|
||||
from ._dup import OnDup, ON_DUP_RAISE, ON_DUP_DROP_OLD
|
||||
from ._typing import _NONE, KT, VT, VDT, IterItems, MapOrIterItems
|
||||
|
||||
|
||||
class MutableBidict(BidictBase[KT, VT], MutableBidirectionalMapping[KT, VT]):
|
||||
"""Base class for mutable bidirectional mappings."""
|
||||
|
||||
__slots__ = ()
|
||||
|
||||
if _t.TYPE_CHECKING:
|
||||
@property
|
||||
def inverse(self) -> 'MutableBidict[VT, KT]': ...
|
||||
|
||||
def __delitem__(self, key: KT) -> None:
|
||||
"""*x.__delitem__(y) ⟺ del x[y]*"""
|
||||
self._pop(key)
|
||||
|
||||
def __setitem__(self, key: KT, val: VT) -> None:
|
||||
"""Set the value for *key* to *val*.
|
||||
|
||||
If *key* is already associated with *val*, this is a no-op.
|
||||
|
||||
If *key* is already associated with a different value,
|
||||
the old value will be replaced with *val*,
|
||||
as with dict's :meth:`__setitem__`.
|
||||
|
||||
If *val* is already associated with a different key,
|
||||
an exception is raised
|
||||
to protect against accidental removal of the key
|
||||
that's currently associated with *val*.
|
||||
|
||||
Use :meth:`put` instead if you want to specify different behavior in
|
||||
the case that the provided key or value duplicates an existing one.
|
||||
Or use :meth:`forceput` to unconditionally associate *key* with *val*,
|
||||
replacing any existing items as necessary to preserve uniqueness.
|
||||
|
||||
:raises bidict.ValueDuplicationError: if *val* duplicates that of an
|
||||
existing item.
|
||||
|
||||
:raises bidict.KeyAndValueDuplicationError: if *key* duplicates the key of an
|
||||
existing item and *val* duplicates the value of a different
|
||||
existing item.
|
||||
"""
|
||||
self._put(key, val, self.on_dup)
|
||||
|
||||
def put(self, key: KT, val: VT, on_dup: OnDup = ON_DUP_RAISE) -> None:
|
||||
"""Associate *key* with *val*, honoring the :class:`OnDup` given in *on_dup*.
|
||||
|
||||
For example, if *on_dup* is :attr:`~bidict.ON_DUP_RAISE`,
|
||||
then *key* will be associated with *val* if and only if
|
||||
*key* is not already associated with an existing value and
|
||||
*val* is not already associated with an existing key,
|
||||
otherwise an exception will be raised.
|
||||
|
||||
If *key* is already associated with *val*, this is a no-op.
|
||||
|
||||
:raises bidict.KeyDuplicationError: if attempting to insert an item
|
||||
whose key only duplicates an existing item's, and *on_dup.key* is
|
||||
:attr:`~bidict.RAISE`.
|
||||
|
||||
:raises bidict.ValueDuplicationError: if attempting to insert an item
|
||||
whose value only duplicates an existing item's, and *on_dup.val* is
|
||||
:attr:`~bidict.RAISE`.
|
||||
|
||||
:raises bidict.KeyAndValueDuplicationError: if attempting to insert an
|
||||
item whose key duplicates one existing item's, and whose value
|
||||
duplicates another existing item's, and *on_dup.kv* is
|
||||
:attr:`~bidict.RAISE`.
|
||||
"""
|
||||
self._put(key, val, on_dup)
|
||||
|
||||
def forceput(self, key: KT, val: VT) -> None:
|
||||
"""Associate *key* with *val* unconditionally.
|
||||
|
||||
Replace any existing mappings containing key *key* or value *val*
|
||||
as necessary to preserve uniqueness.
|
||||
"""
|
||||
self._put(key, val, ON_DUP_DROP_OLD)
|
||||
|
||||
def clear(self) -> None:
|
||||
"""Remove all items."""
|
||||
self._fwdm.clear()
|
||||
self._invm.clear()
|
||||
|
||||
@_t.overload
|
||||
def pop(self, key: KT) -> VT: ...
|
||||
@_t.overload
|
||||
def pop(self, key: KT, default: VDT = ...) -> VDT: ...
|
||||
def pop(self, key: KT, default: VDT = _NONE) -> VDT:
|
||||
"""*x.pop(k[, d]) → v*
|
||||
|
||||
Remove specified key and return the corresponding value.
|
||||
|
||||
:raises KeyError: if *key* is not found and no *default* is provided.
|
||||
"""
|
||||
try:
|
||||
return self._pop(key)
|
||||
except KeyError:
|
||||
if default is _NONE:
|
||||
raise
|
||||
return default
|
||||
|
||||
def popitem(self) -> _t.Tuple[KT, VT]:
|
||||
"""*x.popitem() → (k, v)*
|
||||
|
||||
Remove and return some item as a (key, value) pair.
|
||||
|
||||
:raises KeyError: if *x* is empty.
|
||||
"""
|
||||
if not self:
|
||||
raise KeyError('mapping is empty')
|
||||
key, val = self._fwdm.popitem()
|
||||
del self._invm[val]
|
||||
return key, val
|
||||
|
||||
@_t.overload
|
||||
def update(self, __arg: _t.Mapping[KT, VT], **kw: VT) -> None: ...
|
||||
@_t.overload
|
||||
def update(self, __arg: IterItems[KT, VT], **kw: VT) -> None: ...
|
||||
@_t.overload
|
||||
def update(self, **kw: VT) -> None: ...
|
||||
def update(self, *args: MapOrIterItems[KT, VT], **kw: VT) -> None:
|
||||
"""Like calling :meth:`putall` with *self.on_dup* passed for *on_dup*."""
|
||||
if args or kw:
|
||||
self._update(False, self.on_dup, *args, **kw)
|
||||
|
||||
@_t.overload
|
||||
def forceupdate(self, __arg: _t.Mapping[KT, VT], **kw: VT) -> None: ...
|
||||
@_t.overload
|
||||
def forceupdate(self, __arg: IterItems[KT, VT], **kw: VT) -> None: ...
|
||||
@_t.overload
|
||||
def forceupdate(self, **kw: VT) -> None: ...
|
||||
def forceupdate(self, *args: MapOrIterItems[KT, VT], **kw: VT) -> None:
|
||||
"""Like a bulk :meth:`forceput`."""
|
||||
self._update(False, ON_DUP_DROP_OLD, *args, **kw)
|
||||
|
||||
@_t.overload
|
||||
def putall(self, items: _t.Mapping[KT, VT], on_dup: OnDup) -> None: ...
|
||||
@_t.overload
|
||||
def putall(self, items: IterItems[KT, VT], on_dup: OnDup = ON_DUP_RAISE) -> None: ...
|
||||
def putall(self, items: MapOrIterItems[KT, VT], on_dup: OnDup = ON_DUP_RAISE) -> None:
|
||||
"""Like a bulk :meth:`put`.
|
||||
|
||||
If one of the given items causes an exception to be raised,
|
||||
none of the items is inserted.
|
||||
"""
|
||||
if items:
|
||||
self._update(False, on_dup, items)
|
||||
|
||||
|
||||
# * Code review nav *
|
||||
#==============================================================================
|
||||
# ← Prev: _frozenbidict.py Current: _mut.py Next: _bidict.py →
|
||||
#==============================================================================
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user