[Python-modules-commits] [python-motor] 01/03: import ../python-motor_1.0.orig.tar.gz
Ondřej Nový
onovy at moszumanska.debian.org
Fri Nov 11 16:32:50 UTC 2016
This is an automated email from the git hooks/post-receive script.
onovy pushed a commit to branch master
in repository python-motor.
commit a5e8d2d79f1968dfd8f7bba511c4a7fa872e7a8b
Author: Ondřej Nový <onovy at debian.org>
Date: Fri Nov 11 17:16:02 2016 +0100
import ../python-motor_1.0.orig.tar.gz
---
.gitignore | 13 +
CONTRIBUTING.rst | 50 +
LICENSE | 202 ++++
MANIFEST.in | 8 +
README.rst | 120 +++
doc/Makefile | 89 ++
doc/__init__.py | 1 +
doc/_static/motor.png | Bin 0 -> 57234 bytes
doc/api-asyncio/aiohttp.rst | 8 +
doc/api-asyncio/asyncio_gridfs.rst | 434 ++++++++
doc/api-asyncio/asyncio_motor_client.rst | 11 +
doc/api-asyncio/asyncio_motor_collection.rst | 127 +++
doc/api-asyncio/asyncio_motor_cursor.rst | 7 +
doc/api-asyncio/asyncio_motor_database.rst | 14 +
doc/api-asyncio/index.rst | 17 +
doc/api-tornado/gridfs.rst | 485 +++++++++
doc/api-tornado/index.rst | 16 +
doc/api-tornado/motor_client.rst | 13 +
doc/api-tornado/motor_collection.rst | 135 +++
doc/api-tornado/motor_cursor.rst | 7 +
doc/api-tornado/motor_database.rst | 14 +
doc/api-tornado/web.rst | 8 +
doc/changelog.rst | 888 ++++++++++++++++
doc/conf.py | 196 ++++
doc/contributors.rst | 12 +
doc/coroutine_annotation.py | 29 +
doc/developer-guide.rst | 107 ++
doc/differences.rst | 222 ++++
doc/examples/aiohttp_example.py | 51 +
doc/examples/aiohttp_gridfs_example.py | 52 +
doc/examples/aiohttp_gridfs_example.rst | 21 +
doc/examples/authentication.rst | 40 +
doc/examples/bulk.rst | 205 ++++
doc/examples/callbacks-and-coroutines.rst | 201 ++++
doc/examples/index.rst | 14 +
doc/examples/tailable-cursors.rst | 29 +
doc/features.rst | 41 +
doc/index.rst | 82 ++
doc/installation.rst | 13 +
doc/make.bat | 113 ++
doc/migrate-to-motor-1.rst | 400 +++++++
doc/mongo_extensions.py | 99 ++
doc/motor_extensions.py | 322 ++++++
doc/pydoctheme/static/pydoctheme.css | 178 ++++
doc/pydoctheme/theme.conf | 23 +
doc/pymongo-objects.inv | Bin 0 -> 6488 bytes
doc/requirements.rst | 162 +++
doc/static/sidebar.js | 193 ++++
doc/tutorial-asyncio.rst | 500 +++++++++
doc/tutorial-tornado.rst | 590 +++++++++++
ez_setup.py | 426 ++++++++
motor/__init__.py | 73 ++
motor/aiohttp.py | 260 +++++
motor/core.py | 1094 ++++++++++++++++++++
motor/docstrings.py | 292 ++++++
motor/frameworks/__init__.py | 0
motor/frameworks/asyncio/__init__.py | 144 +++
motor/frameworks/tornado/__init__.py | 192 ++++
motor/metaprogramming.py | 347 +++++++
motor/motor_asyncio.py | 72 ++
motor/motor_common.py | 19 +
motor/motor_gridfs.py | 617 +++++++++++
motor/motor_py3_compat.py | 38 +
motor/motor_tornado.py | 80 ++
motor/web.py | 178 ++++
setup.py | 170 +++
synchro/__init__.py | 625 +++++++++++
synchro/synchrotest.py | 250 +++++
test/__init__.py | 104 ++
test/assert_logs_backport.py | 79 ++
test/asyncio_tests/__init__.py | 294 ++++++
test/asyncio_tests/test_aiohttp_gridfs.py | 312 ++++++
test/asyncio_tests/test_asyncio_await.py | 152 +++
test/asyncio_tests/test_asyncio_basic.py | 134 +++
test/asyncio_tests/test_asyncio_bulk.py | 90 ++
test/asyncio_tests/test_asyncio_client.py | 272 +++++
test/asyncio_tests/test_asyncio_collection.py | 472 +++++++++
test/asyncio_tests/test_asyncio_cursor.py | 584 +++++++++++
test/asyncio_tests/test_asyncio_database.py | 209 ++++
test/asyncio_tests/test_asyncio_gridfs.py | 366 +++++++
test/asyncio_tests/test_asyncio_gridfsbucket.py | 60 ++
test/asyncio_tests/test_asyncio_ipv6.py | 55 +
test/asyncio_tests/test_asyncio_replica_set.py | 70 ++
test/asyncio_tests/test_asyncio_son_manipulator.py | 83 ++
test/asyncio_tests/test_asyncio_ssl.py | 241 +++++
test/asyncio_tests/test_asyncio_tests.py | 200 ++++
test/certificates/ca.pem | 48 +
test/certificates/client.pem | 48 +
test/certificates/crl.pem | 38 +
test/certificates/server.pem | 48 +
test/test_environment.py | 268 +++++
test/tornado_tests/__init__.py | 218 ++++
test/tornado_tests/test_motor_await.py | 155 +++
test/tornado_tests/test_motor_basic.py | 134 +++
test/tornado_tests/test_motor_bulk.py | 103 ++
test/tornado_tests/test_motor_client.py | 328 ++++++
test/tornado_tests/test_motor_collection.py | 514 +++++++++
test/tornado_tests/test_motor_core.py | 143 +++
test/tornado_tests/test_motor_cursor.py | 636 ++++++++++++
test/tornado_tests/test_motor_database.py | 239 +++++
test/tornado_tests/test_motor_gen.py | 68 ++
test/tornado_tests/test_motor_grid_file.py | 381 +++++++
test/tornado_tests/test_motor_gridfs.py | 219 ++++
test/tornado_tests/test_motor_gridfsbucket.py | 69 ++
test/tornado_tests/test_motor_ipv6.py | 59 ++
test/tornado_tests/test_motor_replica_set.py | 133 +++
test/tornado_tests/test_motor_son_manipulator.py | 119 +++
test/tornado_tests/test_motor_ssl.py | 232 +++++
test/tornado_tests/test_motor_web.py | 250 +++++
test/tornado_tests/test_test.py | 51 +
test/utils.py | 68 ++
test/version.py | 50 +
tox.ini | 102 ++
113 files changed, 19937 insertions(+)
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..82bc5a7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,13 @@
+*~
+*#*
+.DS*
+*.pyc
+*.pyd
+build/
+dist/
+motor.egg-info/
+setup.cfg
+*.egg
+.tox
+doc/_build/
+.idea/
diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst
new file mode 100644
index 0000000..d695589
--- /dev/null
+++ b/CONTRIBUTING.rst
@@ -0,0 +1,50 @@
+Contributing to Motor
+=====================
+
+Contributions are encouraged. Please read these guidelines before sending a
+pull request.
+
+Bugfixes and New Features
+-------------------------
+
+Before starting to write code, look for existing tickets or create one in `Jira
+<https://jira.mongodb.org/browse/MOTOR>`_ for your specific issue or feature
+request.
+
+Running Tests
+-------------
+
+Install a recent version of MongoDB and run it on the default port from a clean
+data directory. Pass "--setParameter enableTestCommands=1" to mongod to enable
+testing MotorCursor's ``max_time_ms`` method.
+
+Control how the tests connect to MongoDB with these environment variables:
+
+ - ``DB_IP``: Defaults to "localhost", can be a domain name or IP
+ - ``DB_PORT``: Defaults to 27017
+ - ``DB_USER``: If auth is enabled the test suite creates an admin user by
+ default, or logs in to the admin database with the username provided
+ - ``DB_PASSWORD``: If auth is enabled the test suite creates an admin user by
+ default, or logs in to the admin database with the username provided
+- ``CERT_DIR``: Path with alternate client.pem and ca.pem for testing.
+ Otherwise the suite uses those in test/certificates/.
+
+Install `tox`_ and run it from the command line in the repository directory.
+You will need a variety of Python interpreters installed. For a minimal test,
+ensure you have Python 2.6 and 3.5, and run::
+
+ > tox -e tornado4-py26-min,tornado4-py35-min
+
+The doctests pass with Python 3.5 and a MongoDB 3.2 instance running on
+port 27017:
+
+ > tox -e py3-sphinx-doctest
+
+.. _tox: https://testrun.org/tox/
+
+General Guidelines
+------------------
+
+- Avoid backward breaking changes if at all possible.
+- Write inline documentation for new classes and methods.
+- Add yourself to doc/contributors.rst :)
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..57bc88a
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [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.
+
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..64c1bb1
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,8 @@
+include README.rst
+include LICENSE
+recursive-include doc *.rst
+recursive-include doc *.py
+recursive-include test *.py
+recursive-include doc *.conf
+recursive-include doc *.css
+recursive-include doc *.js
diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..61db65a
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,120 @@
+=====
+Motor
+=====
+
+.. image:: https://raw.github.com/mongodb/motor/master/doc/_static/motor.png
+
+:Info: Motor is a full-featured, non-blocking MongoDB_ driver for Python
+ Tornado_ and asyncio_ applications.
+:Author: A\. Jesse Jiryu Davis
+
+About
+=====
+
+Motor presents a callback- or Future-based API for non-blocking access
+to MongoDB. The source is `on GitHub <https://github.com/mongodb/motor>`_
+and the docs are on ReadTheDocs_.
+
+ "We use Motor in high throughput environments, processing tens of thousands
+ of requests per second. It allows us to take full advantage of modern
+ hardware, ensuring we utilise the entire capacity of our purchased CPUs.
+ This helps us be more efficient with computing power, compute spend and
+ minimises the environmental impact of our infrastructure as a result."
+
+ --*David Mytton, Server Density*
+
+ "We develop easy-to-use sensors and sensor systems with open source
+ software to ensure every innovator, from school child to laboratory
+ researcher, has the same opportunity to create. We integrate Motor into our
+ software to guarantee massively scalable sensor systems for everyone."
+
+ --*Ryan Smith, inXus Interactive*
+
+Installation
+============
+
+ $ pip install motor
+
+Dependencies
+============
+
+Motor works in all the environments officially supported by Tornado or by
+asyncio. It requires:
+
+* Unix, including Mac OS X. Windows is not supported.
+* PyMongo_ 3.3 or later.
+* Python 2.6 or later.
+* `futures`_ on Python 2.6.
+* `backports.pbkdf2`_ for faster authentication with MongoDB 3.0+,
+ especially on Python older than 2.7.8, or on Python 3 before Python 3.4.
+
+See `requirements <https://motor.readthedocs.io/en/stable/requirements.html>`_
+for details about compatibility.
+
+How To Ask For Help
+===================
+
+Issues with, questions about, or feedback for Motor should be sent to the
+`mongodb-user list on Google Groups`_.
+
+For confirmed issues or feature requests,
+open a case in `Jira <http://jira.mongodb.org>`_ in the "MOTOR" project.
+Please include all of the following information:
+
+- Detailed steps to reproduce the problem, including your code and a full
+ traceback, if possible.
+- What you expected to happen, and what actually happened.
+- The exact python version used, with patch level::
+
+ $ python -c "import sys; print(sys.version)"
+
+- The exact version of PyMongo used:
+
+ $ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
+
+- The exact Tornado version, if you are using Tornado::
+
+ $ python -c "import tornado; print(tornado.version)"
+
+- The operating system and version (e.g. RedHat Enterprise Linux 6.4, OSX 10.9.5, ...)
+
+Documentation
+=============
+
+Motor's documentation is on ReadTheDocs_.
+
+Build the documentation with Python 3.5. Install sphinx, Tornado, and aiohttp,
+and do ``cd doc; make html``.
+
+Examples
+========
+
+See the `examples on ReadTheDocs <https://motor.readthedocs.io/en/latest/examples/index.html>`_.
+
+Testing
+=======
+
+Run ``python setup.py test``.
+Tests are located in the ``test/`` directory.
+In Python 2.6, unittest2_ is automatically installed.
+
+.. _PyMongo: http://pypi.python.org/pypi/pymongo/
+
+.. _MongoDB: http://mongodb.org/
+
+.. _Tornado: http://tornadoweb.org/
+
+.. _asyncio: https://docs.python.org/3/library/asyncio.html
+
+.. _futures: https://pypi.python.org/pypi/futures
+
+.. _backports.pbkdf2: https://pypi.python.org/pypi/backports.pbkdf2/
+
+.. _ReadTheDocs: https://motor.readthedocs.io/
+
+.. _mongodb-user list on Google Groups:
+ https://groups.google.com/forum/?fromgroups#!forum/mongodb-user
+
+.. _sphinx: http://sphinx.pocoo.org/
+
+.. _unittest2: https://pypi.python.org/pypi/unittest2
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..59a62f2
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,89 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml pickle json htmlhelp qthelp latex changes linkcheck doctest
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ -rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Motor.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Motor.qhc"
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make all-pdf' or \`make all-ps' in that directory to" \
+ "run these through (pdf)latex."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
diff --git a/doc/__init__.py b/doc/__init__.py
new file mode 100644
index 0000000..8b13789
--- /dev/null
+++ b/doc/__init__.py
@@ -0,0 +1 @@
+
diff --git a/doc/_static/motor.png b/doc/_static/motor.png
new file mode 100644
index 0000000..7447cca
Binary files /dev/null and b/doc/_static/motor.png differ
diff --git a/doc/api-asyncio/aiohttp.rst b/doc/api-asyncio/aiohttp.rst
new file mode 100644
index 0000000..8e4c305
--- /dev/null
+++ b/doc/api-asyncio/aiohttp.rst
@@ -0,0 +1,8 @@
+:mod:`motor.aiohttp` - Integrate Motor with the aiohttp web framework
+=====================================================================
+
+.. currentmodule:: motor.aiohttp
+
+.. automodule:: motor.aiohttp
+ :members:
+ :no-inherited-members:
diff --git a/doc/api-asyncio/asyncio_gridfs.rst b/doc/api-asyncio/asyncio_gridfs.rst
new file mode 100644
index 0000000..2cae253
--- /dev/null
+++ b/doc/api-asyncio/asyncio_gridfs.rst
@@ -0,0 +1,434 @@
+asyncio GridFS Classes
+======================
+
+.. currentmodule:: motor.motor_asyncio
+
+Store blobs of data in `GridFS <http://dochub.mongodb.org/core/gridfs>`_.
+
+.. seealso:: :ref:`Differences between PyMongo's and Motor's GridFS APIs
+ <gridfs-differences>`.
+
+
+.. class:: AsyncIOMotorGridFSBucket
+
+ Create a new instance of :class:`AsyncIOMotorGridFSBucket`.
+
+ Raises :exc:`TypeError` if `database` is not an instance of
+ :class:`AsyncIOMotorDatabase`.
+
+ Raises :exc:`~pymongo.errors.ConfigurationError` if `write_concern`
+ is not acknowledged.
+
+ :Parameters:
+ - `database`: database to use.
+ - `bucket_name` (optional): The name of the bucket. Defaults to 'fs'.
+ - `chunk_size_bytes` (optional): The chunk size in bytes. Defaults
+ to 255KB.
+ - `write_concern` (optional): The
+ :class:`~pymongo.write_concern.WriteConcern` to use. If ``None``
+ (the default) db.write_concern is used.
+ - `read_preference` (optional): The read preference to use. If
+ ``None`` (the default) db.read_preference is used.
+
+ .. mongodoc:: gridfs
+
+ .. coroutinemethod:: delete(self, file_id)
+
+ Delete a file's metadata and data chunks from a GridFS bucket::
+
+ async def delete():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ # Get _id of file to delete
+ file_id = await fs.upload_from_stream("test_file",
+ b"data I want to store!")
+ await fs.delete(file_id)
+
+ Raises :exc:`~gridfs.errors.NoFile` if no file with file_id exists.
+
+ :Parameters:
+ - `file_id`: The _id of the file to be deleted.
+
+ .. coroutinemethod:: download_to_stream(self, file_id, destination)
+
+ Downloads the contents of the stored file specified by file_id and
+ writes the contents to `destination`::
+
+ async def download():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ # Get _id of file to read
+ file_id = await fs.upload_from_stream("test_file",
+ b"data I want to store!")
+ # Get file to write to
+ file = open('myfile','wb+')
+ await fs.download_to_stream(file_id, file)
+ file.seek(0)
+ contents = file.read()
+
+ Raises :exc:`~gridfs.errors.NoFile` if no file with file_id exists.
+
+ :Parameters:
+ - `file_id`: The _id of the file to be downloaded.
+ - `destination`: a file-like object implementing :meth:`write`.
+
+ .. coroutinemethod:: download_to_stream_by_name(self, filename, destination, revision=-1)
+
+ Write the contents of `filename` (with optional `revision`) to
+ `destination`.
+
+ For example::
+
+ async def download_by_name():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ # Get file to write to
+ file = open('myfile','wb')
+ await fs.download_to_stream_by_name("test_file", file)
+
+ Raises :exc:`~gridfs.errors.NoFile` if no such version of
+ that file exists.
+
+ Raises :exc:`~ValueError` if `filename` is not a string.
+
+ :Parameters:
+ - `filename`: The name of the file to read from.
+ - `destination`: A file-like object that implements :meth:`write`.
+ - `revision` (optional): Which revision (documents with the same
+ filename and different uploadDate) of the file to retrieve.
+ Defaults to -1 (the most recent revision).
+
+ :Note: Revision numbers are defined as follows:
+
+ - 0 = the original stored file
+ - 1 = the first revision
+ - 2 = the second revision
+ - etc...
+ - -2 = the second most recent revision
+ - -1 = the most recent revision
+
+ .. method:: find(self, *args, **kwargs)
+
+ Find and return the files collection documents that match ``filter``.
+
+ Returns a cursor that iterates across files matching
+ arbitrary queries on the files collection. Can be combined
+ with other modifiers for additional control.
+
+ For example::
+
+ async def find():
+ cursor = fs.find({"filename": "lisa.txt"},
+ no_cursor_timeout=True)
+
+ async for grid_data in cursor:
+ data = grid_data.read()
+
+ iterates through all versions of "lisa.txt" stored in GridFS.
+ Setting no_cursor_timeout may be important to
+ prevent the cursor from timing out during long multi-file processing
+ work.
+
+ As another example, the call::
+
+ most_recent_three = fs.find().sort("uploadDate", -1).limit(3)
+
+ returns a cursor to the three most recently uploaded files in GridFS.
+
+ Follows a similar interface to :meth:`~AsyncIOMotorCollection.find`
+ in :class:`AsyncIOMotorCollection`.
+
+ :Parameters:
+ - `filter`: Search query.
+ - `batch_size` (optional): The number of documents to return per
+ batch.
+ - `limit` (optional): The maximum number of documents to return.
+ - `no_cursor_timeout` (optional): The server normally times out idle
+ cursors after an inactivity period (10 minutes) to prevent excess
+ memory use. Set this option to True prevent that.
+ - `skip` (optional): The number of documents to skip before
+ returning.
+ - `sort` (optional): The order by which to sort results. Defaults to
+ None.
+
+ .. coroutinemethod:: open_download_stream(self, file_id)
+
+ Opens a stream to read the contents of the stored file specified by file_id::
+
+ async def download_stream():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ # get _id of file to read.
+ file_id = await fs.upload_from_stream("test_file",
+ b"data I want to store!")
+ grid_out = await fs.open_download_stream(file_id)
+ contents = await grid_out.read()
+
+ Raises :exc:`~gridfs.errors.NoFile` if no file with file_id exists.
+
+ :Parameters:
+ - `file_id`: The _id of the file to be downloaded.
+
+ Returns a :class:`AsyncIOMotorGridOut`.
+
+ .. coroutinemethod:: open_download_stream_by_name(self, filename, revision=-1)
+
+ Opens a stream to read the contents of `filename` and optional `revision`::
+
+ async def download_by_name():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ # get _id of file to read.
+ file_id = await fs.upload_from_stream("test_file",
+ b"data I want to store!")
+ grid_out = await fs.open_download_stream_by_name(file_id)
+ contents = await grid_out.read()
+
+ Raises :exc:`~gridfs.errors.NoFile` if no such version of
+ that file exists.
+
+ Raises :exc:`~ValueError` filename is not a string.
+
+ :Parameters:
+ - `filename`: The name of the file to read from.
+ - `revision` (optional): Which revision (documents with the same
+ filename and different uploadDate) of the file to retrieve.
+ Defaults to -1 (the most recent revision).
+
+ Returns a :class:`AsyncIOMotorGridOut`.
+
+ :Note: Revision numbers are defined as follows:
+
+ - 0 = the original stored file
+ - 1 = the first revision
+ - 2 = the second revision
+ - etc...
+ - -2 = the second most recent revision
+ - -1 = the most recent revision
+
+ .. method:: open_upload_stream(self, filename, chunk_size_bytes=None, metadata=None)
+
+ Opens a stream for writing.
+
+ Specify the filename, and add any additional information in the metadata
+ field of the file document or modify the chunk size::
+
+ async def upload():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ grid_in, file_id = fs.open_upload_stream(
+ "test_file", chunk_size_bytes=4,
+ metadata={"contentType": "text/plain"})
+
+ await grid_in.write(b"data I want to store!")
+ await grid_in.close() # uploaded on close
+
+ Returns an instance of :class:`AsyncIOMotorGridIn`.
+
+ Raises :exc:`~gridfs.errors.NoFile` if no such version of
+ that file exists.
+ Raises :exc:`~ValueError` if `filename` is not a string.
+
+ In a Python 3.5 native coroutine, the "async with" statement calls
+ :meth:`~AsyncIOMotorGridIn.close` automatically::
+
+ async def upload():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ async with await fs.new_file() as gridin:
+ await gridin.write(b'First part\n')
+ await gridin.write(b'Second part')
+
+ # gridin is now closed automatically.
+
+ :Parameters:
+ - `filename`: The name of the file to upload.
+ - `chunk_size_bytes` (options): The number of bytes per chunk of this
+ file. Defaults to the chunk_size_bytes in :class:`AsyncIOMotorGridFSBucket`.
+ - `metadata` (optional): User data for the 'metadata' field of the
+ files collection document. If not provided the metadata field will
+ be omitted from the files collection document.
+
+ .. method:: open_upload_stream_with_id(self, file_id, filename, chunk_size_bytes=None, metadata=None)
+
+ Opens a stream for writing.
+
+ Specify the filed_id and filename, and add any additional information in
+ the metadata field of the file document, or modify the chunk size::
+
+ async def upload():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ grid_in, file_id = fs.open_upload_stream_with_id(
+ ObjectId(),
+ "test_file",
+ chunk_size_bytes=4,
+ metadata={"contentType": "text/plain"})
+
+ await grid_in.write(b"data I want to store!")
+ await grid_in.close() # uploaded on close
+
+ Returns an instance of :class:`AsyncIOMotorGridIn`.
+
+ Raises :exc:`~gridfs.errors.NoFile` if no such version of
+ that file exists.
+ Raises :exc:`~ValueError` if `filename` is not a string.
+
+ :Parameters:
+ - `file_id`: The id to use for this file. The id must not have
+ already been used for another file.
+ - `filename`: The name of the file to upload.
+ - `chunk_size_bytes` (options): The number of bytes per chunk of this
+ file. Defaults to the chunk_size_bytes in :class:`AsyncIOMotorGridFSBucket`.
+ - `metadata` (optional): User data for the 'metadata' field of the
+ files collection document. If not provided the metadata field will
+ be omitted from the files collection document.
+
+ .. coroutinemethod:: rename(self, file_id, new_filename)
+
+ Renames the stored file with the specified file_id.
+
+ For example::
+
+
+ async def rename():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ # get _id of file to read.
+ file_id = await fs.upload_from_stream("test_file",
+ b"data I want to store!")
+
+ await fs.rename(file_id, "new_test_name")
+
+ Raises :exc:`~gridfs.errors.NoFile` if no file with file_id exists.
+
+ :Parameters:
+ - `file_id`: The _id of the file to be renamed.
+ - `new_filename`: The new name of the file.
+
+ .. coroutinemethod:: upload_from_stream(self, filename, source, chunk_size_bytes=None, metadata=None)
+
+ Uploads a user file to a GridFS bucket.
+
+ Reads the contents of the user file from `source` and uploads
+ it to the file `filename`. Source can be a string or file-like object.
+ For example::
+
+ async def upload_from_stream():
+ my_db = AsyncIOMotorClient().test
+ fs = AsyncIOMotorGridFSBucket(my_db)
+ file_id = await fs.upload_from_stream(
+ "test_file",
+ b"data I want to store!",
+ chunk_size_bytes=4,
+ metadata={"contentType": "text/plain"})
+
+ Raises :exc:`~gridfs.errors.NoFile` if no such version of
+ that file exists.
+ Raises :exc:`~ValueError` if `filename` is not a string.
+
+ :Parameters:
... 19732 lines suppressed ...
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-motor.git
More information about the Python-modules-commits
mailing list