├── docs ├── .nojekyll ├── _static │ ├── custom.css │ ├── up.png │ ├── down.png │ ├── file.png │ ├── plus.png │ ├── comment.png │ ├── minus.png │ ├── ajax-loader.gif │ ├── down-pressed.png │ ├── up-pressed.png │ ├── comment-bright.png │ ├── comment-close.png │ ├── pygments.css │ ├── doctools.js │ ├── underscore.js │ ├── basic.css │ ├── alabaster.css │ ├── searchtools.js │ └── websupport.js ├── objects.inv ├── searchindex.js ├── _sources │ └── index.txt ├── genindex.html ├── search.html └── index.html ├── requirements.txt ├── MANIFEST ├── sanic_mongo ├── standalone │ ├── __init__.py │ ├── mongo_GridFs.py │ └── mongo_connection.py ├── __init__.py ├── mongo.py └── gridfs.py ├── .mypy_cache └── 3.6 │ ├── abc.meta.json │ ├── os │ ├── path.meta.json │ ├── __init__.meta.json │ └── path.data.json │ ├── setup.meta.json │ ├── typing.meta.json │ ├── sys.meta.json │ ├── io.meta.json │ ├── mypy_extensions.meta.json │ ├── types.meta.json │ ├── codecs.meta.json │ ├── builtins.meta.json │ ├── _importlib_modulespec.meta.json │ ├── setup.data.json │ ├── mypy_extensions.data.json │ ├── _importlib_modulespec.data.json │ └── abc.data.json ├── setup.py ├── example.py ├── example_gridfs.py ├── .gitignore ├── test.ipynb ├── README.rst └── LICENSE /docs/.nojekyll: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/_static/custom.css: -------------------------------------------------------------------------------- 1 | /* This file intentionally left blank. */ 2 | -------------------------------------------------------------------------------- /docs/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/objects.inv -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | motor>=1.1 2 | pymongo>=3.4.0 3 | sanic>=0.4.1 4 | user_agents>=1.1.0 5 | -------------------------------------------------------------------------------- /docs/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/up.png -------------------------------------------------------------------------------- /docs/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/down.png -------------------------------------------------------------------------------- /docs/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/file.png -------------------------------------------------------------------------------- /docs/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/plus.png -------------------------------------------------------------------------------- /docs/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/comment.png -------------------------------------------------------------------------------- /docs/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/minus.png -------------------------------------------------------------------------------- /docs/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/ajax-loader.gif -------------------------------------------------------------------------------- /docs/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/down-pressed.png -------------------------------------------------------------------------------- /docs/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/up-pressed.png -------------------------------------------------------------------------------- /docs/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/comment-bright.png -------------------------------------------------------------------------------- /docs/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Python-Tools/sanic-mongo/HEAD/docs/_static/comment-close.png -------------------------------------------------------------------------------- /MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | include LICENSE 3 | include README.rst 4 | include requirements.txt 5 | recursive-include sanic_mongo *.py -------------------------------------------------------------------------------- /sanic_mongo/standalone/__init__.py: -------------------------------------------------------------------------------- 1 | __all__=["MongoConnection","GridFSBucket"] 2 | 3 | from .mongo_connection import MongoConnection 4 | from .mongo_GridFs import GridFSBucket 5 | -------------------------------------------------------------------------------- /sanic_mongo/__init__.py: -------------------------------------------------------------------------------- 1 | # @Author: Huang Sizhe 2 | # @Date: 08-Apr-2017 3 | # @Email: hsz1273327@gmail.com 4 | # @Last modified by: huangsizhe 5 | # @Last modified time: 08-Apr-2017 6 | # @License: Apache License 2.0 7 | __all__=["Mongo","GridFS"] 8 | 9 | from sanic_mongo.mongo import Core as MongoCore 10 | from sanic_mongo.gridfs import Core as GridFSCore 11 | class Mongo(MongoCore): 12 | pass 13 | class GridFS(GridFSCore): 14 | pass 15 | -------------------------------------------------------------------------------- /sanic_mongo/standalone/mongo_GridFs.py: -------------------------------------------------------------------------------- 1 | from motor.motor_asyncio import AsyncIOMotorGridFSBucket 2 | 3 | 4 | from sanic_mongo.standalone import MongoConnection 5 | 6 | #class GridFSBucket(AsyncIOMotorGridFSBucket): 7 | class GridFSBucket: 8 | def __init__(self, uri: str, ioloop=None,collection="fs", only_db=False): 9 | mongo = MongoConnection(uri=uri,ioloop=ioloop, only_db= only_db) 10 | fs = AsyncIOMotorGridFSBucket(mongo.db,collection=collection) 11 | #super().__init__(mongo.db,collection=collection) 12 | setattr(fs,"client",mongo.client) 13 | self.bucket = fs 14 | -------------------------------------------------------------------------------- /.mypy_cache/3.6/abc.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "abc", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/abc.pyi", "mtime": 1496413232.0, "size": 809, "data_mtime": 1503064293.0, "dependencies": ["typing", "sys", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 10, 5], "interface_hash": "5b1402484b8b20a373de50bbce6e6251", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/os/path.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "os.path", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/os/path.pyi", "mtime": 1496413232.0, "size": 2734, "data_mtime": 1503064293.0, "dependencies": ["sys", "typing", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [10, 5, 5], "interface_hash": "aefed501b6e81de75a869a1d00e05454", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/setup.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "setup", "path": "/Users/huangsizhe/WORKSPACE/Sanic_Extensions/sanic-mongo/setup.py", "mtime": 1503064004.0, "size": 869, "data_mtime": 1503064293.0, "dependencies": ["codecs", "os.path", "builtins"], "suppressed": ["setuptools"], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 10, 5], "interface_hash": "91d88449efa160465854dde546f08db5", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/typing.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "typing", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/typing.pyi", "mtime": 1496413232.0, "size": 17380, "data_mtime": 1503064293.0, "dependencies": ["sys", "abc", "types", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [10, 5, 5, 5], "interface_hash": "23a0da38b6715ed093c06726a50d1fad", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/sys.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "sys", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/sys.pyi", "mtime": 1496413232.0, "size": 5580, "data_mtime": 1503064293.0, "dependencies": ["typing", "types", "mypy_extensions", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 5, 5, 5], "interface_hash": "1e83fa6d41a50523abfffecb33f88ae0", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/io.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "io", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/io.pyi", "mtime": 1496413232.0, "size": 10022, "data_mtime": 1503064293.0, "dependencies": ["typing", "builtins", "codecs", "sys", "types"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 10, 10, 10, 5], "interface_hash": "36ca21f43a1b1e8bb21e946fa940e5ff", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/mypy_extensions.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "mypy_extensions", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/third_party/2and3/mypy_extensions.pyi", "mtime": 1496413232.0, "size": 712, "data_mtime": 1503064293.0, "dependencies": ["typing", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 5], "interface_hash": "91cc0804c18b4800606d7326e3fd74b4", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/types.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "types", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/types.pyi", "mtime": 1496413232.0, "size": 5467, "data_mtime": 1503064293.0, "dependencies": ["sys", "typing", "_importlib_modulespec", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [10, 5, 5, 5], "interface_hash": "d752a8f4588fb251dbaf26a66f0159a2", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/codecs.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "codecs", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/2and3/codecs.pyi", "mtime": 1496413232.0, "size": 8684, "data_mtime": 1503064293.0, "dependencies": ["sys", "typing", "abc", "types", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [10, 5, 5, 10, 5], "interface_hash": "7127834cadf2214d37b935d564483cd0", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/builtins.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "builtins", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/builtins.pyi", "mtime": 1496413232.0, "size": 42219, "data_mtime": 1503064293.0, "dependencies": ["typing", "abc", "types", "sys", "mypy_extensions"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 5, 5, 10, 5], "interface_hash": "4d83dc6ff273f1c91897d2021fab1ed0", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/_importlib_modulespec.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "_importlib_modulespec", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/_importlib_modulespec.pyi", "mtime": 1496413232.0, "size": 1790, "data_mtime": 1503064293.0, "dependencies": ["abc", "sys", "typing", "builtins"], "suppressed": [], "child_modules": [], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 10, 5, 5], "interface_hash": "eab741cc6d7b11d7af46249a257bf48b", "version_id": "0.511"} -------------------------------------------------------------------------------- /.mypy_cache/3.6/os/__init__.meta.json: -------------------------------------------------------------------------------- 1 | {"id": "os", "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/os/__init__.pyi", "mtime": 1496413232.0, "size": 17423, "data_mtime": 1503064293.0, "dependencies": ["builtins", "io", "sys", "typing", "os.path", "mypy_extensions"], "suppressed": [], "child_modules": ["os.path"], "options": {"check_untyped_defs": false, "strict_optional": false, "strict_boolean": false, "ignore_missing_imports": true, "show_none_errors": true, "quick_and_dirty": false, "warn_return_any": false, "disallow_untyped_defs": false, "warn_no_return": true, "follow_imports": "silent", "strict_optional_whitelist": null, "ignore_errors": false, "debug_cache": false, "disallow_untyped_calls": false}, "dep_prios": [5, 5, 10, 5, 10, 5], "interface_hash": "91bde5c1f51a63a9696b9795b843b940", "version_id": "0.511"} -------------------------------------------------------------------------------- /docs/searchindex.js: -------------------------------------------------------------------------------- 1 | Search.setIndex({envversion:49,filenames:["index"],objects:{},objnames:{},objtypes:{},terms:{"5\u7248\u672c\u4ee5\u4e0a\u7684":0,"\u4ee3\u7801":0,"\u547d\u4ee4":0,"\u5b98\u65b9\u4f8b\u5b50":0,"\u652f\u63013":0,"\u652f\u6301\u7684\u64cd\u4f5c\u90fd\u652f\u6301":0,"\u662f":0,"\u7075\u611f\u6765\u6e90\u81ea":0,"\u7684\u5c01\u88c5":0,"\u76ee\u7684\u53ea\u662f\u4e3a\u4e86\u7b80\u5316\u64cd\u4f5c":0,"import":0,"new":0,"return":0,"sanic\u7684mongodb\u5f02\u6b65\u5de5\u5177":0,__main__:0,__name__:0,_id:0,app:0,async:0,await:0,databas:0,def:0,del:0,doc:0,find:0,format:0,from:0,get:0,host:0,instal:0,json:0,length:0,localhost:0,mongo_uri:0,mongodb:0,motor:0,object:0,object_id:0,page:0,pip:0,port:0,post:0,pymongo:0,request:0,respons:0,run:0,sanic_mongo:0,save:0,search:0,str:0,test:0,test_col:0,to_list:0},titles:["Sanic-Mongo"],titleterms:{"\u4f8b\u5b50":0,"\u4f9d\u8d56":0,"\u5b89\u88c5":0,"\u7279\u70b9":0,exampl:0,featur:0,indice:0,installat:0,mongo:0,requir:0,sanic:0,tabl:0}}) -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | """setup.py file 2 | sanic-mongo 3 | """ 4 | from codecs import open 5 | from setuptools import setup, find_packages 6 | from os import path 7 | 8 | PACKAGES = find_packages(exclude=['contrib', 'docs', 'test']) 9 | 10 | required = ["motor>=1.1", 11 | "pymongo>=3.4.0", 12 | "sanic>=0.4.1", 13 | "user_agents>=1.1.0"] 14 | 15 | 16 | HERE = path.abspath(path.dirname(__file__)) 17 | with open(path.join(HERE, 'README.rst'), encoding='utf-8') as f: 18 | LONG_DESCRIPTION = f.read() 19 | setup( 20 | name='sanic-mongo', 21 | version='1.7.1', 22 | author='Huang Sizhe', 23 | author_email='hsz1273327@gmail.com', 24 | packages=PACKAGES, 25 | license='Apache License 2.0', 26 | description='a simple sanic extension for using motor', 27 | long_description=LONG_DESCRIPTION, 28 | install_requires=required, 29 | url="https://sanic-extensions.github.io/sanic-mongo/", 30 | data_files=[('requirements', ['requirements.txt'])] 31 | ) 32 | -------------------------------------------------------------------------------- /example.py: -------------------------------------------------------------------------------- 1 | # @Author: Huang Sizhe 2 | # @Date: 08-Apr-2017 3 | # @Email: hsz1273327@gmail.com 4 | # @Last modified by: huangsizhe 5 | # @Last modified time: 08-Apr-2017 6 | # @License: MIT 7 | 8 | 9 | from sanic import Sanic 10 | from sanic.response import json 11 | from sanic_mongo import Mongo 12 | 13 | app = Sanic(__name__) 14 | mongo_uri = "mongodb://{host}:{port}/{database}".format( 15 | database='test', 16 | port=27017, 17 | host='localhost' 18 | ) 19 | 20 | Mongo.SetConfig(app,test=mongo_uri) 21 | Mongo(app) 22 | 23 | @app.get('/objects') 24 | async def get(request): 25 | docs = await app.mongo['test'].test_col.find().to_list(length=100) 26 | for doc in docs: 27 | doc['id'] = str(doc['_id']) 28 | del doc['_id'] 29 | return json(docs) 30 | 31 | 32 | @app.post('/objects') 33 | async def new(request): 34 | doc = request.json 35 | print(type(app.mongo['test'])) 36 | object_id = await app.mongo['test']["test_col"].save(doc) 37 | return json({'object_id': str(object_id)}) 38 | 39 | 40 | if __name__ == "__main__": 41 | app.run(host='127.0.0.1', port=8000,debug=True) 42 | -------------------------------------------------------------------------------- /example_gridfs.py: -------------------------------------------------------------------------------- 1 | # @Author: Huang Sizhe 2 | # @Date: 08-Apr-2017 3 | # @Email: hsz1273327@gmail.com 4 | # @Last modified by: huangsizhe 5 | # @Last modified time: 08-Apr-2017 6 | # @License: MIT 7 | 8 | 9 | from sanic import Sanic 10 | from sanic.response import json,text 11 | from sanic_mongo import GridFS 12 | 13 | app = Sanic(__name__) 14 | mongo_uri = "mongodb://{host}:{port}/{database}".format( 15 | database='test', 16 | port=27017, 17 | host='localhost' 18 | ) 19 | 20 | GridFS.SetConfig(app,test_fs=(mongo_uri,"fs")) 21 | GridFS(app) 22 | 23 | @app.get('/pics') 24 | async def get(request): 25 | cursor = app.GridFS["test_fs"].find() 26 | result = [{i._id:i.name} async for i in cursor] 27 | return json({"result":result}) 28 | 29 | 30 | @app.post('/pics') 31 | async def new(request): 32 | doc = request.files.get('file') 33 | 34 | async with app.GridFS["test_fs"].open_upload_stream(filename=doc.name, 35 | metadata={"contentType": doc.type}) as gridin: 36 | 37 | object_id = gridin._id 38 | await gridin.write(doc.body) 39 | 40 | return json({'object_id': str(object_id)}) 41 | 42 | 43 | if __name__ == "__main__": 44 | app.run(host='127.0.0.1', port=8000,debug=True) 45 | -------------------------------------------------------------------------------- /sanic_mongo/standalone/mongo_connection.py: -------------------------------------------------------------------------------- 1 | from motor.motor_asyncio import AsyncIOMotorClient 2 | from pymongo.uri_parser import parse_uri 3 | import asyncio 4 | 5 | 6 | class MongoConnection: 7 | 8 | def create_client(self,only_db=False): 9 | """返回连接的客户端 10 | """ 11 | #database = parse_uri(self.uri).get("database") 12 | 13 | if self.ioloop: 14 | if only_db == False: 15 | client = AsyncIOMotorClient("/".join(self.uri.split("/")[:-1]), io_loop=self.ioloop) 16 | else: 17 | client = AsyncIOMotorClient(self.uri, io_loop=self.ioloop) 18 | 19 | else: 20 | if only_db == False: 21 | client = AsyncIOMotorClient("/".join(self.uri.split("/")[:-1])) 22 | else: 23 | client = AsyncIOMotorClient(self.uri) 24 | return client 25 | 26 | def __init__(self, uri: str, ioloop=None, only_db=False): 27 | 28 | self.uri = uri 29 | self.ioloop = ioloop 30 | client = self.create_client(only_db = only_db) 31 | self.client = client 32 | self.database = parse_uri(self.uri).get("database") 33 | if not self.database: 34 | raise AttributeError("uri must have a database") 35 | self.db = self.client[self.database] 36 | 37 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | env/ 12 | build/ 13 | develop-eggs/ 14 | dist/ 15 | downloads/ 16 | eggs/ 17 | .eggs/ 18 | lib/ 19 | lib64/ 20 | parts/ 21 | sdist/ 22 | var/ 23 | *.egg-info/ 24 | .installed.cfg 25 | *.egg 26 | 27 | # PyInstaller 28 | # Usually these files are written by a python script from a template 29 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 30 | *.manifest 31 | *.spec 32 | 33 | # Installer logs 34 | pip-log.txt 35 | pip-delete-this-directory.txt 36 | 37 | # Unit test / coverage reports 38 | htmlcov/ 39 | .tox/ 40 | .coverage 41 | .coverage.* 42 | .cache 43 | nosetests.xml 44 | coverage.xml 45 | *,cover 46 | .hypothesis/ 47 | 48 | # Translations 49 | *.mo 50 | *.pot 51 | 52 | # Django stuff: 53 | *.log 54 | local_settings.py 55 | 56 | # Flask stuff: 57 | instance/ 58 | .webassets-cache 59 | 60 | # Scrapy stuff: 61 | .scrapy 62 | 63 | # Sphinx documentation 64 | docs/_build/ 65 | source/ 66 | 67 | # PyBuilder 68 | target/ 69 | 70 | # IPython Notebook 71 | .ipynb_checkpoints 72 | 73 | # pyenv 74 | .python-version 75 | 76 | # celery beat schedule file 77 | celerybeat-schedule 78 | 79 | # dotenv 80 | .env 81 | 82 | # virtualenv 83 | venv/ 84 | ENV/ 85 | 86 | # Spyder project settings 87 | .spyderproject 88 | 89 | # Rope project settings 90 | .ropeproject 91 | 92 | # vscode 93 | .vscode/ -------------------------------------------------------------------------------- /docs/_sources/index.txt: -------------------------------------------------------------------------------- 1 | .. sanic_mongo documentation master file, created by 2 | sphinx-quickstart on Sun Apr 9 14:31:43 2017. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | Sanic-Mongo 7 | ======================================= 8 | 9 | sanic的mongodb异步工具,灵感来源自 `官方例子 `_. 10 | 11 | 是 `motor `_ 的封装,目的只是为了简化操作. 12 | 13 | 14 | 特点 Features 15 | ------------------------ 16 | 17 | + `motor `_ 支持的操作都支持 18 | + 支持3.5版本以上的 19 | 20 | 21 | 依赖 Requirements 22 | ------------------------ 23 | 24 | 1. motor>=1.1 25 | 2. pymongo>=3.4.0 26 | 3. sanic>=0.4.1 27 | 28 | 29 | 安装 Installation 30 | ------------------------ 31 | 32 | 命令: :: 33 | 34 | pip install sanic-mongo 35 | 36 | 37 | 例子 Example 38 | ----------------------- 39 | 40 | 代码: :: 41 | 42 | 43 | from sanic import Sanic 44 | from sanic.response import json 45 | from sanic_mongo import Mongo 46 | 47 | app = Sanic(__name__) 48 | mongo_uri = "mongodb://{host}:{port}/{database}".format( 49 | database='test', 50 | port=27017, 51 | host='localhost' 52 | ) 53 | 54 | mongo = Mongo(mongo_uri) 55 | db = mongo(app) 56 | @app.get('/objects') 57 | async def get(request): 58 | docs = await db().test_col.find().to_list(length=100) 59 | for doc in docs: 60 | doc['id'] = str(doc['_id']) 61 | del doc['_id'] 62 | return json(docs) 63 | 64 | 65 | @app.post('/objects') 66 | async def new(request): 67 | doc = request.json 68 | object_id = await db("test_col").save(doc) 69 | return json({'object_id': str(object_id)}) 70 | 71 | 72 | if __name__ == "__main__": 73 | app.run(host='127.0.0.1', port=8000) 74 | 75 | 76 | 77 | 78 | Indices and tables 79 | ================== 80 | 81 | * :ref:`search` 82 | -------------------------------------------------------------------------------- /sanic_mongo/mongo.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #!/usr/bin/env python 3 | """ 4 | @Author: Huang Sizhe 5 | @Date: 08-Apr-2017 6 | @Email: hsz1273327@gmail.com 7 | # @Last modified by: huangsizhe 8 | # @Last modified time: 08-Apr-2017 9 | @License: Apache License 2.0 10 | @Description: 11 | """ 12 | 13 | __all__ = ["Core"] 14 | 15 | from sanic.log import logger as log 16 | 17 | from sanic_mongo.standalone import MongoConnection 18 | 19 | 20 | class Core: 21 | 22 | @staticmethod 23 | def SetConfig(app, **confs): 24 | app.config.MONGO_URIS = confs 25 | return app 26 | 27 | def __init__(self, app=None,): 28 | self.mongodbs = {} 29 | if app: 30 | self.init_app(app) 31 | else: 32 | pass 33 | 34 | def init_app(self, app): 35 | """绑定app 36 | """ 37 | if app.config.MONGO_URIS and isinstance(app.config.MONGO_URIS, dict): 38 | self.MONGO_URIS = app.config.MONGO_URIS 39 | self.app = app 40 | 41 | else: 42 | raise ValueError( 43 | "nonstandard sanic config MONGO_URIS,MONGO_URIS must be a Dict[dbname,dburl]") 44 | 45 | 46 | @app.listener("before_server_start") 47 | async def init_mongo_connection(app, loop): 48 | for dbname, dburl in app.config.MONGO_URIS.items(): 49 | if isinstance(dburl,str): 50 | db = MongoConnection(dburl,ioloop=loop).db 51 | else: 52 | db = MongoConnection(ioloop=loop,**dburl).db 53 | self.mongodbs[dbname] = db 54 | 55 | @app.listener("before_server_stop") 56 | async def sub_close(app, loop): 57 | log.info("mongo connection {numbr}".format(numbr=len(self.mongodbs))) 58 | for dbname,db in self.mongodbs.items(): 59 | db.client.close 60 | log.info("{dbname} connection closed".format(dbname=dbname)) 61 | 62 | if "extensions" not in app.__dir__(): 63 | app.extensions = {} 64 | app.extensions['SanicMongo'] = self 65 | 66 | app.mongo = self.mongodbs 67 | return self 68 | -------------------------------------------------------------------------------- /sanic_mongo/gridfs.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8 -*- 2 | #!/usr/bin/env python 3 | """ 4 | gridfs使用的模块,用于存储文件到mongodb, 5 | 需要设置app.config中的GRIDFS_URIS字段,格式为: 6 | 7 | { 8 | Bucket_name:(mongodbURI,collection), 9 | ... 10 | } 11 | 12 | 13 | """ 14 | 15 | __all__ = ["Core"] 16 | 17 | from sanic.log import logger as log 18 | 19 | from sanic_mongo.standalone import GridFSBucket 20 | 21 | 22 | class Core: 23 | 24 | @staticmethod 25 | def SetConfig(app, **confs): 26 | app.config.GRIDFS_SETTINGS = confs 27 | return app 28 | 29 | def __init__(self, app): 30 | self.GridFSs = {} 31 | if app: 32 | self.init_app(app) 33 | else: 34 | pass 35 | 36 | def init_app(self, app): 37 | """绑定app 38 | """ 39 | if app.config.GRIDFS_SETTINGS and isinstance(app.config.GRIDFS_SETTINGS, dict): 40 | self.GRIDFS_SETTINGS = app.config.GRIDFS_SETTINGS 41 | self.app = app 42 | 43 | else: 44 | raise ValueError( 45 | "nonstandard sanic config GRIDFS_URIS,GRIDFS_URIS must be a Dict[Bucket_name,Tuple[dburl,collection]]") 46 | 47 | @app.listener("before_server_start") 48 | async def init_mongo_connection(app, loop): 49 | for bucket_name, (dburl,collection) in app.config.GRIDFS_SETTINGS.items(): 50 | if isinstance(dburl,str): 51 | bucket = GridFSBucket(dburl,ioloop=loop,collection = collection).bucket 52 | else: 53 | bucket = GridFSBucket(ioloop=loop,collection = collection,**dburl).bucket 54 | self.GridFSs[bucket_name] = bucket 55 | 56 | @app.listener("before_server_stop") 57 | async def sub_close(app, loop): 58 | log.info("mongo connection {numbr}".format(numbr=len(self.GridFSs))) 59 | for bucket_name,bucket in self.GridFSs.items(): 60 | bucket.client.close 61 | log.info("{bucket_name} connection closed".format(bucket_name=bucket_name)) 62 | 63 | 64 | if "extensions" not in app.__dir__(): 65 | app.extensions = {} 66 | app.extensions['SanicGridFS'] = self 67 | 68 | app.GridFS = self.GridFSs 69 | return self 70 | -------------------------------------------------------------------------------- /.mypy_cache/3.6/setup.data.json: -------------------------------------------------------------------------------- 1 | {".class": "MypyFile", "_fullname": "setup", "_name": null, "is_stub": false, "names": {".class": "SymbolTable", "HERE": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": [], "fullname": "setup.HERE", "name": "HERE", "type": "builtins.str"}}, "LONG_DESCRIPTION": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": [], "fullname": "setup.LONG_DESCRIPTION", "name": "LONG_DESCRIPTION", "type": "builtins.str"}}, "PACKAGES": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": [], "fullname": "setup.PACKAGES", "name": "PACKAGES", "type": {".class": "AnyType"}}}, "__doc__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "setup.__doc__", "name": "__doc__", "type": "builtins.str"}}, "__file__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "setup.__file__", "name": "__file__", "type": "builtins.str"}}, "__name__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "setup.__name__", "name": "__name__", "type": "builtins.str"}}, "__package__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "setup.__package__", "name": "__package__", "type": "builtins.str"}}, "f": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": [], "fullname": "setup.f", "name": "f", "type": "codecs.StreamReaderWriter"}}, "find_packages": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready", "is_suppressed_import"], "fullname": "setup.find_packages", "name": "find_packages", "type": {".class": "AnyType"}}}, "open": {".class": "SymbolTableNode", "cross_ref": "codecs.open", "kind": "Gdef"}, "path": {".class": "SymbolTableNode", "cross_ref": "os.path", "kind": "ModuleRef"}, "required": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": [], "fullname": "setup.required", "name": "required", "type": {".class": "Instance", "args": ["builtins.str"], "type_ref": "builtins.list"}}}, "setup": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready", "is_suppressed_import"], "fullname": "setup.setup", "name": "setup", "type": {".class": "AnyType"}}}}, "path": "/Users/huangsizhe/WORKSPACE/Sanic_Extensions/sanic-mongo/setup.py"} 2 | -------------------------------------------------------------------------------- /test.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# gridfs" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 8, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "import requests\n", 17 | "with open('README.md', 'r') as f:\n", 18 | " files = {'file': f}\n", 19 | " r = requests.post(\"http://localhost:8000/pics\",files=files)\n", 20 | " s = r.json()" 21 | ] 22 | }, 23 | { 24 | "cell_type": "code", 25 | "execution_count": 9, 26 | "metadata": {}, 27 | "outputs": [ 28 | { 29 | "data": { 30 | "text/plain": [ 31 | "{'object_id': '5990906618d12112052c7b25'}" 32 | ] 33 | }, 34 | "execution_count": 9, 35 | "metadata": {}, 36 | "output_type": "execute_result" 37 | } 38 | ], 39 | "source": [ 40 | "s" 41 | ] 42 | }, 43 | { 44 | "cell_type": "code", 45 | "execution_count": 10, 46 | "metadata": {}, 47 | "outputs": [ 48 | { 49 | "data": { 50 | "text/plain": [ 51 | "{'result': [{'5900c8e618d121a9c0ce87f7': 'cat.jpg'},\n", 52 | " {'5900c92318d121a9e08e16b7': 'cat.jpg'},\n", 53 | " {'5900caec18d121aa7cc4fbe4': 'cat.jpg'},\n", 54 | " {'5900cb2b18d121aa966646f3': 'cat.jpg'},\n", 55 | " {'599079fb18d1210c28e3732a': 'README.md'},\n", 56 | " {'59907a5e18d1210c28e3732c': 'README.md'},\n", 57 | " {'5990906618d12112052c7b25': 'README.md'}]}" 58 | ] 59 | }, 60 | "execution_count": 10, 61 | "metadata": {}, 62 | "output_type": "execute_result" 63 | } 64 | ], 65 | "source": [ 66 | "requests.get(\"http://localhost:8000/pics\").json()" 67 | ] 68 | }, 69 | { 70 | "cell_type": "markdown", 71 | "metadata": {}, 72 | "source": [ 73 | "# mongo" 74 | ] 75 | }, 76 | { 77 | "cell_type": "code", 78 | "execution_count": null, 79 | "metadata": { 80 | "collapsed": true 81 | }, 82 | "outputs": [], 83 | "source": [] 84 | } 85 | ], 86 | "metadata": { 87 | "kernelspec": { 88 | "display_name": "Python 3", 89 | "language": "python", 90 | "name": "python3" 91 | }, 92 | "language_info": { 93 | "codemirror_mode": { 94 | "name": "ipython", 95 | "version": 3 96 | }, 97 | "file_extension": ".py", 98 | "mimetype": "text/x-python", 99 | "name": "python", 100 | "nbconvert_exporter": "python", 101 | "pygments_lexer": "ipython3", 102 | "version": "3.6.0" 103 | } 104 | }, 105 | "nbformat": 4, 106 | "nbformat_minor": 2 107 | } 108 | -------------------------------------------------------------------------------- /docs/genindex.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | Index — sanic_mongo documentation 11 | 12 | 13 | 14 | 15 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 |
39 |
40 |
41 |
42 | 43 | 44 |

Index

45 | 46 |
47 | 48 |
49 | 50 | 51 |
52 |
53 |
54 | 77 |
78 |
79 | 87 | 88 | 89 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /docs/search.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Search — sanic_mongo documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 |
46 |
47 |
48 |
49 | 50 |

Search

51 |
52 | 53 |

54 | Please activate JavaScript to enable the search 55 | functionality. 56 |

57 |
58 |

59 | From here you can search these documents. Enter your search 60 | words into the box below and click "search". Note that the search 61 | function will automatically search for all of the words. Pages 62 | containing fewer words won't appear in the result list. 63 |

64 |
65 | 66 | 67 | 68 |
69 | 70 |
71 | 72 |
73 | 74 |
75 |
76 |
77 | 87 |
88 |
89 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | sanic-mongo 2 | ==================== 3 | 4 | sanic的mongodb异步工具,灵感来源自 `官方例子 `_ 的封装, 5 | 目的只是为了简化操作. 6 | 7 | 更新 8 | ----------------------- 9 | 10 | * v1.7.1 修正了mongo连接权限可能引发的问题,现在可以配置每个连接是否是只能连database,默认为False.{"uri":xxxx,"only_db":True} 11 | * v1.6.0 修正了验证无法通过的问题 12 | * v1.5.0 将接口调整至和sanic-aioorm一致. 13 | 14 | 15 | 16 | 特点 Features 17 | ------------------------- 18 | 19 | * `motor `_ 支持的操作都支持 20 | * 支持3.5版本以上的 21 | * 支持多数据库 22 | * 支持mongodb和gridfs 23 | 24 | 25 | 26 | 依赖 Requirements 27 | ----------------------------- 28 | 1. motor>=1.1 29 | 2. pymongo>=3.4.0 30 | 3. sanic>=0.4.1 31 | 32 | 33 | 安装 Installation 34 | -------------------------- 35 | 36 | - ``pip install sanic-mongo`` 37 | 38 | 39 | 用法 40 | ---------------------------- 41 | 42 | mongo需要给`app.config`设置关键字`MONGO_URIS`,它是一个由mongodb名字和url组成的字典. 43 | 同时也可以使用`Mongo.SetConfig(app,**kws)`来注册kws的内容到`MONGO_URIS`. 44 | 而使用的时候可以访问`app.mongo[mongodb名字]`访问对应的db 45 | 46 | gridfs与之类似,只是关键字是`GRIDFS_SETTINGS`,而访问需要使用`app.GridFS[GridFS名字]` 47 | 48 | 49 | 例子 Example 50 | ----------------------------------- 51 | 52 | 1. mongodb 53 | 54 | .. code:: python 55 | from sanic import Sanic 56 | from sanic.response import json 57 | from sanic_mongo import Mongo 58 | 59 | app = Sanic(__name__) 60 | mongo_uri = "mongodb://{host}:{port}/{database}".format( 61 | database='test', 62 | port=27017, 63 | host='localhost' 64 | ) 65 | 66 | Mongo.SetConfig(app,test=mongo_uri) 67 | Mongo(app) 68 | 69 | @app.get('/objects') 70 | async def get(request): 71 | docs = await app.mongo['test'].test_col.find().to_list(length=100) 72 | for doc in docs: 73 | doc['id'] = str(doc['_id']) 74 | del doc['_id'] 75 | return json(docs) 76 | 77 | 78 | @app.post('/objects') 79 | async def new(request): 80 | doc = request.json 81 | print(type(app.mongo['test'])) 82 | object_id = await app.mongo['test']["test_col"].save(doc) 83 | return json({'object_id': str(object_id)}) 84 | 85 | 86 | if __name__ == "__main__": 87 | app.run(host='127.0.0.1', port=8000,debug=True) 88 | 89 | 90 | 91 | 92 | 2. gridfs 93 | 94 | .. code:: python 95 | 96 | from sanic import Sanic 97 | from sanic.response import json,text 98 | from sanic_mongo import GridFS 99 | 100 | app = Sanic(__name__) 101 | mongo_uri = "mongodb://{host}:{port}/{database}".format( 102 | database='test', 103 | port=27017, 104 | host='localhost' 105 | ) 106 | 107 | GridFS.SetConfig(app,test_fs=(mongo_uri,"fs")) 108 | GridFS(app) 109 | 110 | @app.get('/pics') 111 | async def get(request): 112 | cursor = app.GridFS["test_fs"].find() 113 | result = [{i._id:i.name} async for i in cursor] 114 | return json({"result":result}) 115 | 116 | 117 | @app.post('/pics') 118 | async def new(request): 119 | doc = request.files.get('file') 120 | 121 | async with app.GridFS["test_fs"].open_upload_stream(filename=doc.name, 122 | metadata={"contentType": doc.type}) as gridin: 123 | 124 | object_id = gridin._id 125 | await gridin.write(doc.body) 126 | 127 | return json({'object_id': str(object_id)}) 128 | 129 | 130 | if __name__ == "__main__": 131 | app.run(host='127.0.0.1', port=8000,debug=True) 132 | 133 | -------------------------------------------------------------------------------- /docs/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ 8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 9 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ 11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 14 | .highlight .ge { font-style: italic } /* Generic.Emph */ 15 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 18 | .highlight .go { color: #333333 } /* Generic.Output */ 19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 20 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 28 | .highlight .kt { color: #902000 } /* Keyword.Type */ 29 | .highlight .m { color: #208050 } /* Literal.Number */ 30 | .highlight .s { color: #4070a0 } /* Literal.String */ 31 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 32 | .highlight .nb { color: #007020 } /* Name.Builtin */ 33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 34 | .highlight .no { color: #60add5 } /* Name.Constant */ 35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 37 | .highlight .ne { color: #007020 } /* Name.Exception */ 38 | .highlight .nf { color: #06287e } /* Name.Function */ 39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 50 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 51 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 52 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 53 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 54 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 55 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 56 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 57 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 58 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 59 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 60 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 61 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 62 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 63 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 64 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 65 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /.mypy_cache/3.6/mypy_extensions.data.json: -------------------------------------------------------------------------------- 1 | {".class": "MypyFile", "_fullname": "mypy_extensions", "_name": null, "is_stub": true, "names": {".class": "SymbolTable", "Arg": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "flags": [], "fullname": "mypy_extensions.Arg", "name": "Arg", "type": {".class": "CallableType", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "builtins.str"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"Arg\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}, "DefaultArg": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "flags": [], "fullname": "mypy_extensions.DefaultArg", "name": "DefaultArg", "type": {".class": "CallableType", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "builtins.str"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"DefaultArg\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}, "DefaultNamedArg": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "flags": [], "fullname": "mypy_extensions.DefaultNamedArg", "name": "DefaultNamedArg", "type": {".class": "CallableType", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "builtins.str"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"DefaultNamedArg\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}, "Dict": {".class": "SymbolTableNode", "cross_ref": "builtins.dict", "kind": "Gdef", "module_public": false}, "KwArg": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [1], "arg_names": ["type"], "flags": [], "fullname": "mypy_extensions.KwArg", "name": "KwArg", "type": {".class": "CallableType", "arg_kinds": [1], "arg_names": ["type"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"KwArg\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}, "NamedArg": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "flags": [], "fullname": "mypy_extensions.NamedArg", "name": "NamedArg", "type": {".class": "CallableType", "arg_kinds": [1, 1], "arg_names": ["type", "name"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "builtins.str"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"NamedArg\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}, "NoReturn": {".class": "SymbolTableNode", "kind": "TypeAlias", "node": {".class": "Var", "flags": [], "fullname": "mypy_extensions.NoReturn", "name": "NoReturn", "type": null}, "type_override": {".class": "UninhabitedType", "is_noreturn": false}}, "Optional": {".class": "SymbolTableNode", "cross_ref": "typing.Optional", "kind": "Gdef", "module_public": false}, "Type": {".class": "SymbolTableNode", "cross_ref": "typing.Type", "kind": "Gdef", "module_public": false}, "TypeVar": {".class": "SymbolTableNode", "cross_ref": "typing.TypeVar", "kind": "Gdef", "module_public": false}, "TypedDict": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0], "arg_names": ["typename", "fields"], "flags": [], "fullname": "mypy_extensions.TypedDict", "name": "TypedDict", "type": {".class": "CallableType", "arg_kinds": [0, 0], "arg_names": ["typename", "fields"], "arg_types": ["builtins.str", {".class": "Instance", "args": ["builtins.str", {".class": "TypeType", "item": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}}], "type_ref": "builtins.dict"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"TypedDict\"", "ret_type": {".class": "TypeType", "item": "builtins.dict"}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}, "Union": {".class": "SymbolTableNode", "cross_ref": "typing.Union", "kind": "Gdef", "module_public": false}, "VarArg": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [1], "arg_names": ["type"], "flags": [], "fullname": "mypy_extensions.VarArg", "name": "VarArg", "type": {".class": "CallableType", "arg_kinds": [1], "arg_names": ["type"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"VarArg\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}, "_T": {".class": "SymbolTableNode", "kind": "Tvar", "node": {".class": "TypeVarExpr", "fullname": "mypy_extensions._T", "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}}, "__doc__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "mypy_extensions.__doc__", "name": "__doc__", "type": "builtins.str"}}, "__file__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "mypy_extensions.__file__", "name": "__file__", "type": "builtins.str"}}, "__name__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "mypy_extensions.__name__", "name": "__name__", "type": "builtins.str"}}, "__package__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "mypy_extensions.__package__", "name": "__package__", "type": "builtins.str"}}}, "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/third_party/2and3/mypy_extensions.pyi"} 2 | -------------------------------------------------------------------------------- /docs/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | */ 33 | jQuery.urldecode = function(x) { 34 | return decodeURIComponent(x).replace(/\+/g, ' '); 35 | }; 36 | 37 | /** 38 | * small helper function to urlencode strings 39 | */ 40 | jQuery.urlencode = encodeURIComponent; 41 | 42 | /** 43 | * This function returns the parsed url parameters of the 44 | * current request. Multiple values per key are supported, 45 | * it will always return arrays of strings for the value parts. 46 | */ 47 | jQuery.getQueryParameters = function(s) { 48 | if (typeof s == 'undefined') 49 | s = document.location.search; 50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 51 | var result = {}; 52 | for (var i = 0; i < parts.length; i++) { 53 | var tmp = parts[i].split('=', 2); 54 | var key = jQuery.urldecode(tmp[0]); 55 | var value = jQuery.urldecode(tmp[1]); 56 | if (key in result) 57 | result[key].push(value); 58 | else 59 | result[key] = [value]; 60 | } 61 | return result; 62 | }; 63 | 64 | /** 65 | * highlight a given string on a jquery object by wrapping it in 66 | * span elements with the given class name. 67 | */ 68 | jQuery.fn.highlightText = function(text, className) { 69 | function highlight(node) { 70 | if (node.nodeType == 3) { 71 | var val = node.nodeValue; 72 | var pos = val.toLowerCase().indexOf(text); 73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { 74 | var span = document.createElement("span"); 75 | span.className = className; 76 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 77 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 78 | document.createTextNode(val.substr(pos + text.length)), 79 | node.nextSibling)); 80 | node.nodeValue = val.substr(0, pos); 81 | } 82 | } 83 | else if (!jQuery(node).is("button, select, textarea")) { 84 | jQuery.each(node.childNodes, function() { 85 | highlight(this); 86 | }); 87 | } 88 | } 89 | return this.each(function() { 90 | highlight(this); 91 | }); 92 | }; 93 | 94 | /* 95 | * backward compatibility for jQuery.browser 96 | * This will be supported until firefox bug is fixed. 97 | */ 98 | if (!jQuery.browser) { 99 | jQuery.uaMatch = function(ua) { 100 | ua = ua.toLowerCase(); 101 | 102 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 103 | /(webkit)[ \/]([\w.]+)/.exec(ua) || 104 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 105 | /(msie) ([\w.]+)/.exec(ua) || 106 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 107 | []; 108 | 109 | return { 110 | browser: match[ 1 ] || "", 111 | version: match[ 2 ] || "0" 112 | }; 113 | }; 114 | jQuery.browser = {}; 115 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; 116 | } 117 | 118 | /** 119 | * Small JavaScript module for the documentation. 120 | */ 121 | var Documentation = { 122 | 123 | init : function() { 124 | this.fixFirefoxAnchorBug(); 125 | this.highlightSearchWords(); 126 | this.initIndexTable(); 127 | 128 | }, 129 | 130 | /** 131 | * i18n support 132 | */ 133 | TRANSLATIONS : {}, 134 | PLURAL_EXPR : function(n) { return n == 1 ? 0 : 1; }, 135 | LOCALE : 'unknown', 136 | 137 | // gettext and ngettext don't access this so that the functions 138 | // can safely bound to a different name (_ = Documentation.gettext) 139 | gettext : function(string) { 140 | var translated = Documentation.TRANSLATIONS[string]; 141 | if (typeof translated == 'undefined') 142 | return string; 143 | return (typeof translated == 'string') ? translated : translated[0]; 144 | }, 145 | 146 | ngettext : function(singular, plural, n) { 147 | var translated = Documentation.TRANSLATIONS[singular]; 148 | if (typeof translated == 'undefined') 149 | return (n == 1) ? singular : plural; 150 | return translated[Documentation.PLURALEXPR(n)]; 151 | }, 152 | 153 | addTranslations : function(catalog) { 154 | for (var key in catalog.messages) 155 | this.TRANSLATIONS[key] = catalog.messages[key]; 156 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 157 | this.LOCALE = catalog.locale; 158 | }, 159 | 160 | /** 161 | * add context elements like header anchor links 162 | */ 163 | addContextElements : function() { 164 | $('div[id] > :header:first').each(function() { 165 | $('\u00B6'). 166 | attr('href', '#' + this.id). 167 | attr('title', _('Permalink to this headline')). 168 | appendTo(this); 169 | }); 170 | $('dt[id]').each(function() { 171 | $('\u00B6'). 172 | attr('href', '#' + this.id). 173 | attr('title', _('Permalink to this definition')). 174 | appendTo(this); 175 | }); 176 | }, 177 | 178 | /** 179 | * workaround a firefox stupidity 180 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 181 | */ 182 | fixFirefoxAnchorBug : function() { 183 | if (document.location.hash) 184 | window.setTimeout(function() { 185 | document.location.href += ''; 186 | }, 10); 187 | }, 188 | 189 | /** 190 | * highlight the search words provided in the url in the text 191 | */ 192 | highlightSearchWords : function() { 193 | var params = $.getQueryParameters(); 194 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 195 | if (terms.length) { 196 | var body = $('div.body'); 197 | if (!body.length) { 198 | body = $('body'); 199 | } 200 | window.setTimeout(function() { 201 | $.each(terms, function() { 202 | body.highlightText(this.toLowerCase(), 'highlighted'); 203 | }); 204 | }, 10); 205 | $('') 207 | .appendTo($('#searchbox')); 208 | } 209 | }, 210 | 211 | /** 212 | * init the domain index toggle buttons 213 | */ 214 | initIndexTable : function() { 215 | var togglers = $('img.toggler').click(function() { 216 | var src = $(this).attr('src'); 217 | var idnum = $(this).attr('id').substr(7); 218 | $('tr.cg-' + idnum).toggle(); 219 | if (src.substr(-9) == 'minus.png') 220 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 221 | else 222 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 223 | }).css('display', ''); 224 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 225 | togglers.click(); 226 | } 227 | }, 228 | 229 | /** 230 | * helper function to hide the search marks again 231 | */ 232 | hideSearchWords : function() { 233 | $('#searchbox .highlight-link').fadeOut(300); 234 | $('span.highlighted').removeClass('highlighted'); 235 | }, 236 | 237 | /** 238 | * make the url absolute 239 | */ 240 | makeURL : function(relativeURL) { 241 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 242 | }, 243 | 244 | /** 245 | * get the current relative url 246 | */ 247 | getCurrentURL : function() { 248 | var path = document.location.pathname; 249 | var parts = path.split(/\//); 250 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 251 | if (this == '..') 252 | parts.pop(); 253 | }); 254 | var url = parts.join('/'); 255 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 256 | }, 257 | 258 | initOnKeyListeners: function() { 259 | $(document).keyup(function(event) { 260 | var activeElementType = document.activeElement.tagName; 261 | // don't navigate when in search box or textarea 262 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { 263 | switch (event.keyCode) { 264 | case 37: // left 265 | var prevHref = $('link[rel="prev"]').prop('href'); 266 | if (prevHref) { 267 | window.location.href = prevHref; 268 | return false; 269 | } 270 | case 39: // right 271 | var nextHref = $('link[rel="next"]').prop('href'); 272 | if (nextHref) { 273 | window.location.href = nextHref; 274 | return false; 275 | } 276 | } 277 | } 278 | }); 279 | } 280 | }; 281 | 282 | // quick alias for translations 283 | _ = Documentation.gettext; 284 | 285 | $(document).ready(function() { 286 | Documentation.init(); 287 | }); -------------------------------------------------------------------------------- /.mypy_cache/3.6/_importlib_modulespec.data.json: -------------------------------------------------------------------------------- 1 | {".class": "MypyFile", "_fullname": "_importlib_modulespec", "_name": null, "is_stub": true, "names": {".class": "SymbolTable", "ABCMeta": {".class": "SymbolTableNode", "cross_ref": "abc.ABCMeta", "kind": "Gdef", "module_public": false}, "Any": {".class": "SymbolTableNode", "cross_ref": "typing.Any", "kind": "Gdef", "module_public": false}, "Dict": {".class": "SymbolTableNode", "cross_ref": "builtins.dict", "kind": "Gdef", "module_public": false}, "Loader": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "TypeInfo", "_promote": null, "abstract_attributes": [], "bases": ["builtins.object"], "declared_metaclass": "abc.ABCMeta", "defn": {".class": "ClassDef", "fullname": "_importlib_modulespec.Loader", "metaclass": "ABCMeta", "name": "Loader", "type_vars": []}, "flags": [], "fullname": "_importlib_modulespec.Loader", "metaclass_type": "abc.ABCMeta", "module_name": "_importlib_modulespec", "names": {".class": "SymbolTable", "create_module": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0], "arg_names": ["self", "spec"], "flags": ["is_conditional"], "fullname": "_importlib_modulespec.Loader.create_module", "name": "create_module", "type": {".class": "CallableType", "arg_kinds": [0, 0], "arg_names": ["self", "spec"], "arg_types": ["_importlib_modulespec.Loader", "_importlib_modulespec.ModuleSpec"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"create_module\" of \"Loader\"", "ret_type": "_importlib_modulespec.ModuleType", "variables": []}}}, "exec_module": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0], "arg_names": ["self", "module"], "flags": ["is_conditional"], "fullname": "_importlib_modulespec.Loader.exec_module", "name": "exec_module", "type": {".class": "CallableType", "arg_kinds": [0, 0], "arg_names": ["self", "module"], "arg_types": ["_importlib_modulespec.Loader", "_importlib_modulespec.ModuleType"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"exec_module\" of \"Loader\"", "ret_type": {".class": "NoneTyp"}, "variables": []}}}, "load_module": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0], "arg_names": ["self", "fullname"], "flags": [], "fullname": null, "name": "load_module", "type": {".class": "CallableType", "arg_kinds": [0, 0], "arg_names": ["self", "fullname"], "arg_types": ["_importlib_modulespec.Loader", "builtins.str"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"load_module\" of \"Loader\"", "ret_type": "_importlib_modulespec.ModuleType", "variables": []}}}, "module_repr": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0], "arg_names": ["self", "module"], "flags": ["is_conditional"], "fullname": "_importlib_modulespec.Loader.module_repr", "name": "module_repr", "type": {".class": "CallableType", "arg_kinds": [0, 0], "arg_names": ["self", "module"], "arg_types": ["_importlib_modulespec.Loader", "_importlib_modulespec.ModuleType"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"module_repr\" of \"Loader\"", "ret_type": "builtins.str", "variables": []}}}}, "tuple_type": null, "type_vars": [], "typeddict_type": null}}, "ModuleSpec": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "TypeInfo", "_promote": null, "abstract_attributes": [], "bases": ["builtins.object"], "declared_metaclass": null, "defn": {".class": "ClassDef", "fullname": "_importlib_modulespec.ModuleSpec", "metaclass": null, "name": "ModuleSpec", "type_vars": []}, "flags": [], "fullname": "_importlib_modulespec.ModuleSpec", "metaclass_type": null, "module_name": "_importlib_modulespec", "names": {".class": "SymbolTable", "__init__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0, 0, 5, 5, 5], "arg_names": ["self", "name", "loader", "origin", "loader_state", "is_package"], "flags": [], "fullname": null, "name": "__init__", "type": {".class": "CallableType", "arg_kinds": [0, 0, 0, 5, 5, 5], "arg_names": ["self", "name", "loader", "origin", "loader_state", "is_package"], "arg_types": ["_importlib_modulespec.ModuleSpec", "builtins.str", "_importlib_modulespec.Loader", "builtins.str", {".class": "AnyType"}, "builtins.bool"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"__init__\" of \"ModuleSpec\"", "ret_type": {".class": "NoneTyp"}, "variables": []}}}, "cached": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "cached", "type": "builtins.str"}}, "has_location": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "has_location", "type": "builtins.bool"}}, "loader": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "loader", "type": "_importlib_modulespec.Loader"}}, "loader_state": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "loader_state", "type": {".class": "AnyType"}}}, "name": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "name", "type": "builtins.str"}}, "origin": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "origin", "type": "builtins.str"}}, "parent": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "parent", "type": "builtins.str"}}, "submodule_search_locations": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "submodule_search_locations", "type": {".class": "AnyType"}}}}, "tuple_type": null, "type_vars": [], "typeddict_type": null}}, "ModuleType": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "TypeInfo", "_promote": null, "abstract_attributes": [], "bases": ["builtins.object"], "declared_metaclass": null, "defn": {".class": "ClassDef", "fullname": "_importlib_modulespec.ModuleType", "metaclass": null, "name": "ModuleType", "type_vars": []}, "flags": [], "fullname": "_importlib_modulespec.ModuleType", "metaclass_type": null, "module_name": "_importlib_modulespec", "names": {".class": "SymbolTable", "__dict__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "__dict__", "type": {".class": "Instance", "args": ["builtins.str", {".class": "AnyType"}], "type_ref": "builtins.dict"}}}, "__file__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "__file__", "type": "builtins.str"}}, "__init__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0, 1], "arg_names": ["self", "name", "doc"], "flags": [], "fullname": null, "name": "__init__", "type": {".class": "CallableType", "arg_kinds": [0, 0, 1], "arg_names": ["self", "name", "doc"], "arg_types": ["_importlib_modulespec.ModuleType", "builtins.str", "builtins.str"], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"__init__\" of \"ModuleType\"", "ret_type": {".class": "NoneTyp"}, "variables": []}}}, "__loader__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "__loader__", "type": "_importlib_modulespec.Loader"}}, "__name__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "__name__", "type": "builtins.str"}}, "__package__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "__package__", "type": "builtins.str"}}, "__spec__": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "Var", "flags": ["is_ready", "is_initialized_in_class"], "fullname": null, "name": "__spec__", "type": "_importlib_modulespec.ModuleSpec"}}}, "tuple_type": null, "type_vars": [], "typeddict_type": null}}, "Optional": {".class": "SymbolTableNode", "cross_ref": "typing.Optional", "kind": "Gdef", "module_public": false}, "__doc__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "_importlib_modulespec.__doc__", "name": "__doc__", "type": "builtins.str"}}, "__file__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "_importlib_modulespec.__file__", "name": "__file__", "type": "builtins.str"}}, "__name__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "_importlib_modulespec.__name__", "name": "__name__", "type": "builtins.str"}}, "__package__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "_importlib_modulespec.__package__", "name": "__package__", "type": "builtins.str"}}, "sys": {".class": "SymbolTableNode", "cross_ref": "sys", "kind": "ModuleRef", "module_public": false}}, "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/_importlib_modulespec.pyi"} 2 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | Sanic-Mongo — sanic_mongo documentation 10 | 11 | 12 | 13 | 14 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 |
38 |
39 |
40 |
41 | 42 |
43 |

Sanic-Mongo

44 |

sanic的mongodb异步工具,灵感来源自 官方例子.

45 |

motor 的封装,目的只是为了简化操作.

46 |
47 |

特点 Features

48 |
    49 |
  • motor 支持的操作都支持
  • 50 |
  • 支持3.5版本以上的
  • 51 |
52 |
53 |
54 |

依赖 Requirements

55 |
    56 |
  1. motor>=1.1
  2. 57 |
  3. pymongo>=3.4.0
  4. 58 |
  5. sanic>=0.4.1
  6. 59 |
60 |
61 |
62 |

安装 Installation

63 |

命令:

64 |
pip install sanic-mongo
 65 | 
66 |
67 |
68 |
69 |

例子 Example

70 |

代码:

71 |
from sanic import Sanic
 72 | from sanic.response import json
 73 | from sanic_mongo import Mongo
 74 | 
 75 | app = Sanic(__name__)
 76 | mongo_uri = "mongodb://{host}:{port}/{database}".format(
 77 |     database='test',
 78 |     port=27017,
 79 |     host='localhost'
 80 | )
 81 | 
 82 | mongo = Mongo(mongo_uri)
 83 | db = mongo(app)
 84 | @app.get('/objects')
 85 | async def get(request):
 86 |     docs = await db().test_col.find().to_list(length=100)
 87 |     for doc in docs:
 88 |         doc['id'] = str(doc['_id'])
 89 |         del doc['_id']
 90 |     return json(docs)
 91 | 
 92 | 
 93 | @app.post('/objects')
 94 | async def new(request):
 95 |     doc = request.json
 96 |     object_id = await db("test_col").save(doc)
 97 |     return json({'object_id': str(object_id)})
 98 | 
 99 | 
100 | if __name__ == "__main__":
101 |     app.run(host='127.0.0.1', port=8000)
102 | 
103 |
104 |
105 |
106 |
107 |

Indices and tables

108 | 111 |
112 | 113 | 114 |
115 |
116 |
117 | 156 |
157 |
158 | 169 | 170 | 171 | 172 | 173 | 174 | -------------------------------------------------------------------------------- /.mypy_cache/3.6/abc.data.json: -------------------------------------------------------------------------------- 1 | {".class": "MypyFile", "_fullname": "abc", "_name": null, "is_stub": true, "names": {".class": "SymbolTable", "ABC": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "TypeInfo", "_promote": null, "abstract_attributes": [], "bases": ["builtins.object"], "declared_metaclass": "abc.ABCMeta", "defn": {".class": "ClassDef", "fullname": "abc.ABC", "metaclass": "ABCMeta", "name": "ABC", "type_vars": []}, "flags": [], "fullname": "abc.ABC", "metaclass_type": "abc.ABCMeta", "module_name": "abc", "names": {".class": "SymbolTable"}, "tuple_type": null, "type_vars": [], "typeddict_type": null}}, "ABCMeta": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "TypeInfo", "_promote": null, "abstract_attributes": [], "bases": ["builtins.type"], "declared_metaclass": null, "defn": {".class": "ClassDef", "fullname": "abc.ABCMeta", "metaclass": null, "name": "ABCMeta", "type_vars": []}, "flags": [], "fullname": "abc.ABCMeta", "metaclass_type": null, "module_name": "abc", "names": {".class": "SymbolTable", "register": {".class": "SymbolTableNode", "kind": "Mdef", "node": {".class": "FuncDef", "arg_kinds": [0, 0], "arg_names": ["cls", "subclass"], "flags": ["is_conditional"], "fullname": "abc.ABCMeta.register", "name": "register", "type": {".class": "CallableType", "arg_kinds": [0, 0], "arg_names": ["cls", "subclass"], "arg_types": ["abc.ABCMeta", {".class": "TypeType", "item": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"register\" of \"ABCMeta\"", "ret_type": {".class": "TypeType", "item": {".class": "TypeVarType", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}]}}}}, "tuple_type": null, "type_vars": [], "typeddict_type": null}}, "Any": {".class": "SymbolTableNode", "cross_ref": "typing.Any", "kind": "Gdef", "module_public": false}, "Callable": {".class": "SymbolTableNode", "cross_ref": "typing.Callable", "kind": "Gdef", "module_public": false}, "Type": {".class": "SymbolTableNode", "cross_ref": "typing.Type", "kind": "Gdef", "module_public": false}, "TypeVar": {".class": "SymbolTableNode", "cross_ref": "typing.TypeVar", "kind": "Gdef", "module_public": false}, "_FuncT": {".class": "SymbolTableNode", "kind": "Tvar", "node": {".class": "TypeVarExpr", "fullname": "abc._FuncT", "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}}, "_T": {".class": "SymbolTableNode", "kind": "Tvar", "node": {".class": "TypeVarExpr", "fullname": "abc._T", "name": "_T", "upper_bound": "builtins.object", "values": [], "variance": 0}}, "__doc__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "abc.__doc__", "name": "__doc__", "type": "builtins.str"}}, "__file__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "abc.__file__", "name": "__file__", "type": "builtins.str"}}, "__name__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "abc.__name__", "name": "__name__", "type": "builtins.str"}}, "__package__": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "Var", "flags": ["is_ready"], "fullname": "abc.__package__", "name": "__package__", "type": "builtins.str"}}, "abstractclassmethod": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [0], "arg_names": ["callable"], "flags": [], "fullname": "abc.abstractclassmethod", "name": "abstractclassmethod", "type": {".class": "CallableType", "arg_kinds": [0], "arg_names": ["callable"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"abstractclassmethod\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}]}}}, "abstractmethod": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [0], "arg_names": ["callable"], "flags": [], "fullname": "abc.abstractmethod", "name": "abstractmethod", "type": {".class": "CallableType", "arg_kinds": [0], "arg_names": ["callable"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"abstractmethod\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}]}}}, "abstractproperty": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [0], "arg_names": ["callable"], "flags": [], "fullname": "abc.abstractproperty", "name": "abstractproperty", "type": {".class": "CallableType", "arg_kinds": [0], "arg_names": ["callable"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"abstractproperty\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}]}}}, "abstractstaticmethod": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [0], "arg_names": ["callable"], "flags": [], "fullname": "abc.abstractstaticmethod", "name": "abstractstaticmethod", "type": {".class": "CallableType", "arg_kinds": [0], "arg_names": ["callable"], "arg_types": [{".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"abstractstaticmethod\"", "ret_type": {".class": "TypeVarType", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}, "variables": [{".class": "TypeVarDef", "id": -1, "name": "_FuncT", "upper_bound": {".class": "CallableType", "arg_kinds": [2, 4], "arg_names": [null, null], "arg_types": [{".class": "AnyType"}, {".class": "AnyType"}], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": true, "name": null, "ret_type": {".class": "AnyType"}, "variables": []}, "values": [], "variance": 0}]}}}, "get_cache_token": {".class": "SymbolTableNode", "kind": "Gdef", "node": {".class": "FuncDef", "arg_kinds": [], "arg_names": [], "flags": ["is_conditional"], "fullname": "abc.get_cache_token", "name": "get_cache_token", "type": {".class": "CallableType", "arg_kinds": [], "arg_names": [], "arg_types": [], "bound_args": [], "fallback": "builtins.function", "implicit": false, "is_classmethod_class": false, "is_ellipsis_args": false, "name": "\"get_cache_token\"", "ret_type": "builtins.object", "variables": []}}}, "sys": {".class": "SymbolTableNode", "cross_ref": "sys", "kind": "ModuleRef", "module_public": false}}, "path": "/Users/huangsizhe/LIB/CONDA/anaconda/lib/mypy/typeshed/stdlib/3/abc.pyi"} 2 | -------------------------------------------------------------------------------- /docs/_static/underscore.js: -------------------------------------------------------------------------------- 1 | // Underscore.js 1.3.1 2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. 3 | // Underscore is freely distributable under the MIT license. 4 | // Portions of Underscore are inspired or borrowed from Prototype, 5 | // Oliver Steele's Functional, and John Resig's Micro-Templating. 6 | // For all details and documentation: 7 | // http://documentcloud.github.com/underscore 8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== 9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c, 10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each= 11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a== 12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect= 13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e= 14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= 15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a, 17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}}; 24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments, 25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)}; 26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"}; 27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a), 28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+ 29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]= 30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain= 31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); 32 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright {yyyy} {name of copyright owner} 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /docs/_static/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * basic.css 3 | * ~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- basic theme. 6 | * 7 | * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /* -- main layout ----------------------------------------------------------- */ 13 | 14 | div.clearer { 15 | clear: both; 16 | } 17 | 18 | /* -- relbar ---------------------------------------------------------------- */ 19 | 20 | div.related { 21 | width: 100%; 22 | font-size: 90%; 23 | } 24 | 25 | div.related h3 { 26 | display: none; 27 | } 28 | 29 | div.related ul { 30 | margin: 0; 31 | padding: 0 0 0 10px; 32 | list-style: none; 33 | } 34 | 35 | div.related li { 36 | display: inline; 37 | } 38 | 39 | div.related li.right { 40 | float: right; 41 | margin-right: 5px; 42 | } 43 | 44 | /* -- sidebar --------------------------------------------------------------- */ 45 | 46 | div.sphinxsidebarwrapper { 47 | padding: 10px 5px 0 10px; 48 | } 49 | 50 | div.sphinxsidebar { 51 | float: left; 52 | width: 230px; 53 | margin-left: -100%; 54 | font-size: 90%; 55 | word-wrap: break-word; 56 | overflow-wrap : break-word; 57 | } 58 | 59 | div.sphinxsidebar ul { 60 | list-style: none; 61 | } 62 | 63 | div.sphinxsidebar ul ul, 64 | div.sphinxsidebar ul.want-points { 65 | margin-left: 20px; 66 | list-style: square; 67 | } 68 | 69 | div.sphinxsidebar ul ul { 70 | margin-top: 0; 71 | margin-bottom: 0; 72 | } 73 | 74 | div.sphinxsidebar form { 75 | margin-top: 10px; 76 | } 77 | 78 | div.sphinxsidebar input { 79 | border: 1px solid #98dbcc; 80 | font-family: sans-serif; 81 | font-size: 1em; 82 | } 83 | 84 | div.sphinxsidebar #searchbox input[type="text"] { 85 | width: 170px; 86 | } 87 | 88 | img { 89 | border: 0; 90 | max-width: 100%; 91 | } 92 | 93 | /* -- search page ----------------------------------------------------------- */ 94 | 95 | ul.search { 96 | margin: 10px 0 0 20px; 97 | padding: 0; 98 | } 99 | 100 | ul.search li { 101 | padding: 5px 0 5px 20px; 102 | background-image: url(file.png); 103 | background-repeat: no-repeat; 104 | background-position: 0 7px; 105 | } 106 | 107 | ul.search li a { 108 | font-weight: bold; 109 | } 110 | 111 | ul.search li div.context { 112 | color: #888; 113 | margin: 2px 0 0 30px; 114 | text-align: left; 115 | } 116 | 117 | ul.keywordmatches li.goodmatch a { 118 | font-weight: bold; 119 | } 120 | 121 | /* -- index page ------------------------------------------------------------ */ 122 | 123 | table.contentstable { 124 | width: 90%; 125 | } 126 | 127 | table.contentstable p.biglink { 128 | line-height: 150%; 129 | } 130 | 131 | a.biglink { 132 | font-size: 1.3em; 133 | } 134 | 135 | span.linkdescr { 136 | font-style: italic; 137 | padding-top: 5px; 138 | font-size: 90%; 139 | } 140 | 141 | /* -- general index --------------------------------------------------------- */ 142 | 143 | table.indextable { 144 | width: 100%; 145 | } 146 | 147 | table.indextable td { 148 | text-align: left; 149 | vertical-align: top; 150 | } 151 | 152 | table.indextable dl, table.indextable dd { 153 | margin-top: 0; 154 | margin-bottom: 0; 155 | } 156 | 157 | table.indextable tr.pcap { 158 | height: 10px; 159 | } 160 | 161 | table.indextable tr.cap { 162 | margin-top: 10px; 163 | background-color: #f2f2f2; 164 | } 165 | 166 | img.toggler { 167 | margin-right: 3px; 168 | margin-top: 3px; 169 | cursor: pointer; 170 | } 171 | 172 | div.modindex-jumpbox { 173 | border-top: 1px solid #ddd; 174 | border-bottom: 1px solid #ddd; 175 | margin: 1em 0 1em 0; 176 | padding: 0.4em; 177 | } 178 | 179 | div.genindex-jumpbox { 180 | border-top: 1px solid #ddd; 181 | border-bottom: 1px solid #ddd; 182 | margin: 1em 0 1em 0; 183 | padding: 0.4em; 184 | } 185 | 186 | /* -- general body styles --------------------------------------------------- */ 187 | 188 | div.body p, div.body dd, div.body li, div.body blockquote { 189 | -moz-hyphens: auto; 190 | -ms-hyphens: auto; 191 | -webkit-hyphens: auto; 192 | hyphens: auto; 193 | } 194 | 195 | a.headerlink { 196 | visibility: hidden; 197 | } 198 | 199 | h1:hover > a.headerlink, 200 | h2:hover > a.headerlink, 201 | h3:hover > a.headerlink, 202 | h4:hover > a.headerlink, 203 | h5:hover > a.headerlink, 204 | h6:hover > a.headerlink, 205 | dt:hover > a.headerlink, 206 | caption:hover > a.headerlink, 207 | p.caption:hover > a.headerlink, 208 | div.code-block-caption:hover > a.headerlink { 209 | visibility: visible; 210 | } 211 | 212 | div.body p.caption { 213 | text-align: inherit; 214 | } 215 | 216 | div.body td { 217 | text-align: left; 218 | } 219 | 220 | .field-list ul { 221 | padding-left: 1em; 222 | } 223 | 224 | .first { 225 | margin-top: 0 !important; 226 | } 227 | 228 | p.rubric { 229 | margin-top: 30px; 230 | font-weight: bold; 231 | } 232 | 233 | img.align-left, .figure.align-left, object.align-left { 234 | clear: left; 235 | float: left; 236 | margin-right: 1em; 237 | } 238 | 239 | img.align-right, .figure.align-right, object.align-right { 240 | clear: right; 241 | float: right; 242 | margin-left: 1em; 243 | } 244 | 245 | img.align-center, .figure.align-center, object.align-center { 246 | display: block; 247 | margin-left: auto; 248 | margin-right: auto; 249 | } 250 | 251 | .align-left { 252 | text-align: left; 253 | } 254 | 255 | .align-center { 256 | text-align: center; 257 | } 258 | 259 | .align-right { 260 | text-align: right; 261 | } 262 | 263 | /* -- sidebars -------------------------------------------------------------- */ 264 | 265 | div.sidebar { 266 | margin: 0 0 0.5em 1em; 267 | border: 1px solid #ddb; 268 | padding: 7px 7px 0 7px; 269 | background-color: #ffe; 270 | width: 40%; 271 | float: right; 272 | } 273 | 274 | p.sidebar-title { 275 | font-weight: bold; 276 | } 277 | 278 | /* -- topics ---------------------------------------------------------------- */ 279 | 280 | div.topic { 281 | border: 1px solid #ccc; 282 | padding: 7px 7px 0 7px; 283 | margin: 10px 0 10px 0; 284 | } 285 | 286 | p.topic-title { 287 | font-size: 1.1em; 288 | font-weight: bold; 289 | margin-top: 10px; 290 | } 291 | 292 | /* -- admonitions ----------------------------------------------------------- */ 293 | 294 | div.admonition { 295 | margin-top: 10px; 296 | margin-bottom: 10px; 297 | padding: 7px; 298 | } 299 | 300 | div.admonition dt { 301 | font-weight: bold; 302 | } 303 | 304 | div.admonition dl { 305 | margin-bottom: 0; 306 | } 307 | 308 | p.admonition-title { 309 | margin: 0px 10px 5px 0px; 310 | font-weight: bold; 311 | } 312 | 313 | div.body p.centered { 314 | text-align: center; 315 | margin-top: 25px; 316 | } 317 | 318 | /* -- tables ---------------------------------------------------------------- */ 319 | 320 | table.docutils { 321 | border: 0; 322 | border-collapse: collapse; 323 | } 324 | 325 | table caption span.caption-number { 326 | font-style: italic; 327 | } 328 | 329 | table caption span.caption-text { 330 | } 331 | 332 | table.docutils td, table.docutils th { 333 | padding: 1px 8px 1px 5px; 334 | border-top: 0; 335 | border-left: 0; 336 | border-right: 0; 337 | border-bottom: 1px solid #aaa; 338 | } 339 | 340 | table.field-list td, table.field-list th { 341 | border: 0 !important; 342 | } 343 | 344 | table.footnote td, table.footnote th { 345 | border: 0 !important; 346 | } 347 | 348 | th { 349 | text-align: left; 350 | padding-right: 5px; 351 | } 352 | 353 | table.citation { 354 | border-left: solid 1px gray; 355 | margin-left: 1px; 356 | } 357 | 358 | table.citation td { 359 | border-bottom: none; 360 | } 361 | 362 | /* -- figures --------------------------------------------------------------- */ 363 | 364 | div.figure { 365 | margin: 0.5em; 366 | padding: 0.5em; 367 | } 368 | 369 | div.figure p.caption { 370 | padding: 0.3em; 371 | } 372 | 373 | div.figure p.caption span.caption-number { 374 | font-style: italic; 375 | } 376 | 377 | div.figure p.caption span.caption-text { 378 | } 379 | 380 | 381 | /* -- other body styles ----------------------------------------------------- */ 382 | 383 | ol.arabic { 384 | list-style: decimal; 385 | } 386 | 387 | ol.loweralpha { 388 | list-style: lower-alpha; 389 | } 390 | 391 | ol.upperalpha { 392 | list-style: upper-alpha; 393 | } 394 | 395 | ol.lowerroman { 396 | list-style: lower-roman; 397 | } 398 | 399 | ol.upperroman { 400 | list-style: upper-roman; 401 | } 402 | 403 | dl { 404 | margin-bottom: 15px; 405 | } 406 | 407 | dd p { 408 | margin-top: 0px; 409 | } 410 | 411 | dd ul, dd table { 412 | margin-bottom: 10px; 413 | } 414 | 415 | dd { 416 | margin-top: 3px; 417 | margin-bottom: 10px; 418 | margin-left: 30px; 419 | } 420 | 421 | dt:target, .highlighted { 422 | background-color: #fbe54e; 423 | } 424 | 425 | dl.glossary dt { 426 | font-weight: bold; 427 | font-size: 1.1em; 428 | } 429 | 430 | .field-list ul { 431 | margin: 0; 432 | padding-left: 1em; 433 | } 434 | 435 | .field-list p { 436 | margin: 0; 437 | } 438 | 439 | .optional { 440 | font-size: 1.3em; 441 | } 442 | 443 | .sig-paren { 444 | font-size: larger; 445 | } 446 | 447 | .versionmodified { 448 | font-style: italic; 449 | } 450 | 451 | .system-message { 452 | background-color: #fda; 453 | padding: 5px; 454 | border: 3px solid red; 455 | } 456 | 457 | .footnote:target { 458 | background-color: #ffa; 459 | } 460 | 461 | .line-block { 462 | display: block; 463 | margin-top: 1em; 464 | margin-bottom: 1em; 465 | } 466 | 467 | .line-block .line-block { 468 | margin-top: 0; 469 | margin-bottom: 0; 470 | margin-left: 1.5em; 471 | } 472 | 473 | .guilabel, .menuselection { 474 | font-family: sans-serif; 475 | } 476 | 477 | .accelerator { 478 | text-decoration: underline; 479 | } 480 | 481 | .classifier { 482 | font-style: oblique; 483 | } 484 | 485 | abbr, acronym { 486 | border-bottom: dotted 1px; 487 | cursor: help; 488 | } 489 | 490 | /* -- code displays --------------------------------------------------------- */ 491 | 492 | pre { 493 | overflow: auto; 494 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ 495 | } 496 | 497 | td.linenos pre { 498 | padding: 5px 0px; 499 | border: 0; 500 | background-color: transparent; 501 | color: #aaa; 502 | } 503 | 504 | table.highlighttable { 505 | margin-left: 0.5em; 506 | } 507 | 508 | table.highlighttable td { 509 | padding: 0 0.5em 0 0.5em; 510 | } 511 | 512 | div.code-block-caption { 513 | padding: 2px 5px; 514 | font-size: small; 515 | } 516 | 517 | div.code-block-caption code { 518 | background-color: transparent; 519 | } 520 | 521 | div.code-block-caption + div > div.highlight > pre { 522 | margin-top: 0; 523 | } 524 | 525 | div.code-block-caption span.caption-number { 526 | padding: 0.1em 0.3em; 527 | font-style: italic; 528 | } 529 | 530 | div.code-block-caption span.caption-text { 531 | } 532 | 533 | div.literal-block-wrapper { 534 | padding: 1em 1em 0; 535 | } 536 | 537 | div.literal-block-wrapper div.highlight { 538 | margin: 0; 539 | } 540 | 541 | code.descname { 542 | background-color: transparent; 543 | font-weight: bold; 544 | font-size: 1.2em; 545 | } 546 | 547 | code.descclassname { 548 | background-color: transparent; 549 | } 550 | 551 | code.xref, a code { 552 | background-color: transparent; 553 | font-weight: bold; 554 | } 555 | 556 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { 557 | background-color: transparent; 558 | } 559 | 560 | .viewcode-link { 561 | float: right; 562 | } 563 | 564 | .viewcode-back { 565 | float: right; 566 | font-family: sans-serif; 567 | } 568 | 569 | div.viewcode-block:target { 570 | margin: -1px -10px; 571 | padding: 0 10px; 572 | } 573 | 574 | /* -- math display ---------------------------------------------------------- */ 575 | 576 | img.math { 577 | vertical-align: middle; 578 | } 579 | 580 | div.body div.math p { 581 | text-align: center; 582 | } 583 | 584 | span.eqno { 585 | float: right; 586 | } 587 | 588 | /* -- printout stylesheet --------------------------------------------------- */ 589 | 590 | @media print { 591 | div.document, 592 | div.documentwrapper, 593 | div.bodywrapper { 594 | margin: 0 !important; 595 | width: 100%; 596 | } 597 | 598 | div.sphinxsidebar, 599 | div.related, 600 | div.footer, 601 | #top-link { 602 | display: none; 603 | } 604 | } -------------------------------------------------------------------------------- /docs/_static/alabaster.css: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | @import url("basic.css"); 54 | 55 | /* -- page layout ----------------------------------------------------------- */ 56 | 57 | body { 58 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif; 59 | font-size: 17px; 60 | background-color: #fff; 61 | color: #000; 62 | margin: 0; 63 | padding: 0; 64 | } 65 | 66 | 67 | div.document { 68 | width: 940px; 69 | margin: 30px auto 0 auto; 70 | } 71 | 72 | div.documentwrapper { 73 | float: left; 74 | width: 100%; 75 | } 76 | 77 | div.bodywrapper { 78 | margin: 0 0 0 220px; 79 | } 80 | 81 | div.sphinxsidebar { 82 | width: 220px; 83 | font-size: 14px; 84 | line-height: 1.5; 85 | } 86 | 87 | hr { 88 | border: 1px solid #B1B4B6; 89 | } 90 | 91 | div.body { 92 | background-color: #fff; 93 | color: #3E4349; 94 | padding: 0 30px 0 30px; 95 | } 96 | 97 | div.body > .section { 98 | text-align: left; 99 | } 100 | 101 | div.footer { 102 | width: 940px; 103 | margin: 20px auto 30px auto; 104 | font-size: 14px; 105 | color: #888; 106 | text-align: right; 107 | } 108 | 109 | div.footer a { 110 | color: #888; 111 | } 112 | 113 | p.caption { 114 | font-family: inherit; 115 | font-size: inherit; 116 | } 117 | 118 | 119 | div.relations { 120 | display: none; 121 | } 122 | 123 | 124 | div.sphinxsidebar a { 125 | color: #444; 126 | text-decoration: none; 127 | border-bottom: 1px dotted #999; 128 | } 129 | 130 | div.sphinxsidebar a:hover { 131 | border-bottom: 1px solid #999; 132 | } 133 | 134 | div.sphinxsidebarwrapper { 135 | padding: 18px 10px; 136 | } 137 | 138 | div.sphinxsidebarwrapper p.logo { 139 | padding: 0; 140 | margin: -10px 0 0 0px; 141 | text-align: center; 142 | } 143 | 144 | div.sphinxsidebarwrapper h1.logo { 145 | margin-top: -10px; 146 | text-align: center; 147 | margin-bottom: 5px; 148 | text-align: left; 149 | } 150 | 151 | div.sphinxsidebarwrapper h1.logo-name { 152 | margin-top: 0px; 153 | } 154 | 155 | div.sphinxsidebarwrapper p.blurb { 156 | margin-top: 0; 157 | font-style: normal; 158 | } 159 | 160 | div.sphinxsidebar h3, 161 | div.sphinxsidebar h4 { 162 | font-family: 'Garamond', 'Georgia', serif; 163 | color: #444; 164 | font-size: 24px; 165 | font-weight: normal; 166 | margin: 0 0 5px 0; 167 | padding: 0; 168 | } 169 | 170 | div.sphinxsidebar h4 { 171 | font-size: 20px; 172 | } 173 | 174 | div.sphinxsidebar h3 a { 175 | color: #444; 176 | } 177 | 178 | div.sphinxsidebar p.logo a, 179 | div.sphinxsidebar h3 a, 180 | div.sphinxsidebar p.logo a:hover, 181 | div.sphinxsidebar h3 a:hover { 182 | border: none; 183 | } 184 | 185 | div.sphinxsidebar p { 186 | color: #555; 187 | margin: 10px 0; 188 | } 189 | 190 | div.sphinxsidebar ul { 191 | margin: 10px 0; 192 | padding: 0; 193 | color: #000; 194 | } 195 | 196 | div.sphinxsidebar ul li.toctree-l1 > a { 197 | font-size: 120%; 198 | } 199 | 200 | div.sphinxsidebar ul li.toctree-l2 > a { 201 | font-size: 110%; 202 | } 203 | 204 | div.sphinxsidebar input { 205 | border: 1px solid #CCC; 206 | font-family: 'goudy old style', 'minion pro', 'bell mt', Georgia, 'Hiragino Mincho Pro', serif; 207 | font-size: 1em; 208 | } 209 | 210 | div.sphinxsidebar hr { 211 | border: none; 212 | height: 1px; 213 | color: #AAA; 214 | background: #AAA; 215 | 216 | text-align: left; 217 | margin-left: 0; 218 | width: 50%; 219 | } 220 | 221 | /* -- body styles ----------------------------------------------------------- */ 222 | 223 | a { 224 | color: #004B6B; 225 | text-decoration: underline; 226 | } 227 | 228 | a:hover { 229 | color: #6D4100; 230 | text-decoration: underline; 231 | } 232 | 233 | div.body h1, 234 | div.body h2, 235 | div.body h3, 236 | div.body h4, 237 | div.body h5, 238 | div.body h6 { 239 | font-family: 'Garamond', 'Georgia', serif; 240 | font-weight: normal; 241 | margin: 30px 0px 10px 0px; 242 | padding: 0; 243 | } 244 | 245 | div.body h1 { margin-top: 0; padding-top: 0; font-size: 240%; } 246 | div.body h2 { font-size: 180%; } 247 | div.body h3 { font-size: 150%; } 248 | div.body h4 { font-size: 130%; } 249 | div.body h5 { font-size: 100%; } 250 | div.body h6 { font-size: 100%; } 251 | 252 | a.headerlink { 253 | color: #DDD; 254 | padding: 0 4px; 255 | text-decoration: none; 256 | } 257 | 258 | a.headerlink:hover { 259 | color: #444; 260 | background: #EAEAEA; 261 | } 262 | 263 | div.body p, div.body dd, div.body li { 264 | line-height: 1.4em; 265 | } 266 | 267 | div.admonition { 268 | margin: 20px 0px; 269 | padding: 10px 30px; 270 | background-color: #EEE; 271 | border: 1px solid #CCC; 272 | } 273 | 274 | div.admonition tt.xref, div.admonition code.xref, div.admonition a tt { 275 | background-color: ; 276 | border-bottom: 1px solid #fafafa; 277 | } 278 | 279 | dd div.admonition { 280 | margin-left: -60px; 281 | padding-left: 60px; 282 | } 283 | 284 | div.admonition p.admonition-title { 285 | font-family: 'Garamond', 'Georgia', serif; 286 | font-weight: normal; 287 | font-size: 24px; 288 | margin: 0 0 10px 0; 289 | padding: 0; 290 | line-height: 1; 291 | } 292 | 293 | div.admonition p.last { 294 | margin-bottom: 0; 295 | } 296 | 297 | div.highlight { 298 | background-color: #fff; 299 | } 300 | 301 | dt:target, .highlight { 302 | background: #FAF3E8; 303 | } 304 | 305 | div.warning { 306 | background-color: #FCC; 307 | border: 1px solid #FAA; 308 | } 309 | 310 | div.danger { 311 | background-color: #FCC; 312 | border: 1px solid #FAA; 313 | -moz-box-shadow: 2px 2px 4px #D52C2C; 314 | -webkit-box-shadow: 2px 2px 4px #D52C2C; 315 | box-shadow: 2px 2px 4px #D52C2C; 316 | } 317 | 318 | div.error { 319 | background-color: #FCC; 320 | border: 1px solid #FAA; 321 | -moz-box-shadow: 2px 2px 4px #D52C2C; 322 | -webkit-box-shadow: 2px 2px 4px #D52C2C; 323 | box-shadow: 2px 2px 4px #D52C2C; 324 | } 325 | 326 | div.caution { 327 | background-color: #FCC; 328 | border: 1px solid #FAA; 329 | } 330 | 331 | div.attention { 332 | background-color: #FCC; 333 | border: 1px solid #FAA; 334 | } 335 | 336 | div.important { 337 | background-color: #EEE; 338 | border: 1px solid #CCC; 339 | } 340 | 341 | div.note { 342 | background-color: #EEE; 343 | border: 1px solid #CCC; 344 | } 345 | 346 | div.tip { 347 | background-color: #EEE; 348 | border: 1px solid #CCC; 349 | } 350 | 351 | div.hint { 352 | background-color: #EEE; 353 | border: 1px solid #CCC; 354 | } 355 | 356 | div.seealso { 357 | background-color: #EEE; 358 | border: 1px solid #CCC; 359 | } 360 | 361 | div.topic { 362 | background-color: #EEE; 363 | } 364 | 365 | p.admonition-title { 366 | display: inline; 367 | } 368 | 369 | p.admonition-title:after { 370 | content: ":"; 371 | } 372 | 373 | pre, tt, code { 374 | font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; 375 | font-size: 0.9em; 376 | } 377 | 378 | .hll { 379 | background-color: #FFC; 380 | margin: 0 -12px; 381 | padding: 0 12px; 382 | display: block; 383 | } 384 | 385 | img.screenshot { 386 | } 387 | 388 | tt.descname, tt.descclassname, code.descname, code.descclassname { 389 | font-size: 0.95em; 390 | } 391 | 392 | tt.descname, code.descname { 393 | padding-right: 0.08em; 394 | } 395 | 396 | img.screenshot { 397 | -moz-box-shadow: 2px 2px 4px #EEE; 398 | -webkit-box-shadow: 2px 2px 4px #EEE; 399 | box-shadow: 2px 2px 4px #EEE; 400 | } 401 | 402 | table.docutils { 403 | border: 1px solid #888; 404 | -moz-box-shadow: 2px 2px 4px #EEE; 405 | -webkit-box-shadow: 2px 2px 4px #EEE; 406 | box-shadow: 2px 2px 4px #EEE; 407 | } 408 | 409 | table.docutils td, table.docutils th { 410 | border: 1px solid #888; 411 | padding: 0.25em 0.7em; 412 | } 413 | 414 | table.field-list, table.footnote { 415 | border: none; 416 | -moz-box-shadow: none; 417 | -webkit-box-shadow: none; 418 | box-shadow: none; 419 | } 420 | 421 | table.footnote { 422 | margin: 15px 0; 423 | width: 100%; 424 | border: 1px solid #EEE; 425 | background: #FDFDFD; 426 | font-size: 0.9em; 427 | } 428 | 429 | table.footnote + table.footnote { 430 | margin-top: -15px; 431 | border-top: none; 432 | } 433 | 434 | table.field-list th { 435 | padding: 0 0.8em 0 0; 436 | } 437 | 438 | table.field-list td { 439 | padding: 0; 440 | } 441 | 442 | table.field-list p { 443 | margin-bottom: 0.8em; 444 | } 445 | 446 | table.footnote td.label { 447 | width: .1px; 448 | padding: 0.3em 0 0.3em 0.5em; 449 | } 450 | 451 | table.footnote td { 452 | padding: 0.3em 0.5em; 453 | } 454 | 455 | dl { 456 | margin: 0; 457 | padding: 0; 458 | } 459 | 460 | dl dd { 461 | margin-left: 30px; 462 | } 463 | 464 | blockquote { 465 | margin: 0 0 0 30px; 466 | padding: 0; 467 | } 468 | 469 | ul, ol { 470 | /* Matches the 30px from the narrow-screen "li > ul" selector below */ 471 | margin: 10px 0 10px 30px; 472 | padding: 0; 473 | } 474 | 475 | pre { 476 | background: #EEE; 477 | padding: 7px 30px; 478 | margin: 15px 0px; 479 | line-height: 1.3em; 480 | } 481 | 482 | div.viewcode-block:target { 483 | background: #ffd; 484 | } 485 | 486 | dl pre, blockquote pre, li pre { 487 | margin-left: 0; 488 | padding-left: 30px; 489 | } 490 | 491 | dl dl pre { 492 | margin-left: -90px; 493 | padding-left: 90px; 494 | } 495 | 496 | tt, code { 497 | background-color: #ecf0f3; 498 | color: #222; 499 | /* padding: 1px 2px; */ 500 | } 501 | 502 | tt.xref, code.xref, a tt { 503 | background-color: #FBFBFB; 504 | border-bottom: 1px solid #fff; 505 | } 506 | 507 | a.reference { 508 | text-decoration: none; 509 | border-bottom: 1px dotted #004B6B; 510 | } 511 | 512 | /* Don't put an underline on images */ 513 | a.image-reference, a.image-reference:hover { 514 | border-bottom: none; 515 | } 516 | 517 | a.reference:hover { 518 | border-bottom: 1px solid #6D4100; 519 | } 520 | 521 | a.footnote-reference { 522 | text-decoration: none; 523 | font-size: 0.7em; 524 | vertical-align: top; 525 | border-bottom: 1px dotted #004B6B; 526 | } 527 | 528 | a.footnote-reference:hover { 529 | border-bottom: 1px solid #6D4100; 530 | } 531 | 532 | a:hover tt, a:hover code { 533 | background: #EEE; 534 | } 535 | 536 | 537 | @media screen and (max-width: 870px) { 538 | 539 | div.sphinxsidebar { 540 | display: none; 541 | } 542 | 543 | div.document { 544 | width: 100%; 545 | 546 | } 547 | 548 | div.documentwrapper { 549 | margin-left: 0; 550 | margin-top: 0; 551 | margin-right: 0; 552 | margin-bottom: 0; 553 | } 554 | 555 | div.bodywrapper { 556 | margin-top: 0; 557 | margin-right: 0; 558 | margin-bottom: 0; 559 | margin-left: 0; 560 | } 561 | 562 | ul { 563 | margin-left: 0; 564 | } 565 | 566 | li > ul { 567 | /* Matches the 30px from the "ul, ol" selector above */ 568 | margin-left: 30px; 569 | } 570 | 571 | .document { 572 | width: auto; 573 | } 574 | 575 | .footer { 576 | width: auto; 577 | } 578 | 579 | .bodywrapper { 580 | margin: 0; 581 | } 582 | 583 | .footer { 584 | width: auto; 585 | } 586 | 587 | .github { 588 | display: none; 589 | } 590 | 591 | 592 | 593 | } 594 | 595 | 596 | 597 | @media screen and (max-width: 875px) { 598 | 599 | body { 600 | margin: 0; 601 | padding: 20px 30px; 602 | } 603 | 604 | div.documentwrapper { 605 | float: none; 606 | background: #fff; 607 | } 608 | 609 | div.sphinxsidebar { 610 | display: block; 611 | float: none; 612 | width: 102.5%; 613 | margin: 50px -30px -20px -30px; 614 | padding: 10px 20px; 615 | background: #333; 616 | color: #FFF; 617 | } 618 | 619 | div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p, 620 | div.sphinxsidebar h3 a { 621 | color: #fff; 622 | } 623 | 624 | div.sphinxsidebar a { 625 | color: #AAA; 626 | } 627 | 628 | div.sphinxsidebar p.logo { 629 | display: none; 630 | } 631 | 632 | div.document { 633 | width: 100%; 634 | margin: 0; 635 | } 636 | 637 | div.footer { 638 | display: none; 639 | } 640 | 641 | div.bodywrapper { 642 | margin: 0; 643 | } 644 | 645 | div.body { 646 | min-height: 0; 647 | padding: 0; 648 | } 649 | 650 | .rtd_doc_footer { 651 | display: none; 652 | } 653 | 654 | .document { 655 | width: auto; 656 | } 657 | 658 | .footer { 659 | width: auto; 660 | } 661 | 662 | .footer { 663 | width: auto; 664 | } 665 | 666 | .github { 667 | display: none; 668 | } 669 | } 670 | 671 | 672 | /* misc. */ 673 | 674 | .revsys-inline { 675 | display: none!important; 676 | } 677 | 678 | /* Make nested-list/multi-paragraph items look better in Releases changelog 679 | * pages. Without this, docutils' magical list fuckery causes inconsistent 680 | * formatting between different release sub-lists. 681 | */ 682 | div#changelog > div.section > ul > li > p:only-child { 683 | margin-bottom: 0; 684 | } 685 | 686 | /* Hide fugly table cell borders in ..bibliography:: directive output */ 687 | table.docutils.citation, table.docutils.citation td, table.docutils.citation th { 688 | border: none; 689 | /* Below needed in some edge cases; if not applied, bottom shadows appear */ 690 | -moz-box-shadow: none; 691 | -webkit-box-shadow: none; 692 | box-shadow: none; 693 | } -------------------------------------------------------------------------------- /docs/_static/searchtools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * searchtools.js_t 3 | * ~~~~~~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for the full-text search. 6 | * 7 | * :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | 13 | /* Non-minified version JS is _stemmer.js if file is provided */ 14 | /** 15 | * Porter Stemmer 16 | */ 17 | var Stemmer = function() { 18 | 19 | var step2list = { 20 | ational: 'ate', 21 | tional: 'tion', 22 | enci: 'ence', 23 | anci: 'ance', 24 | izer: 'ize', 25 | bli: 'ble', 26 | alli: 'al', 27 | entli: 'ent', 28 | eli: 'e', 29 | ousli: 'ous', 30 | ization: 'ize', 31 | ation: 'ate', 32 | ator: 'ate', 33 | alism: 'al', 34 | iveness: 'ive', 35 | fulness: 'ful', 36 | ousness: 'ous', 37 | aliti: 'al', 38 | iviti: 'ive', 39 | biliti: 'ble', 40 | logi: 'log' 41 | }; 42 | 43 | var step3list = { 44 | icate: 'ic', 45 | ative: '', 46 | alize: 'al', 47 | iciti: 'ic', 48 | ical: 'ic', 49 | ful: '', 50 | ness: '' 51 | }; 52 | 53 | var c = "[^aeiou]"; // consonant 54 | var v = "[aeiouy]"; // vowel 55 | var C = c + "[^aeiouy]*"; // consonant sequence 56 | var V = v + "[aeiou]*"; // vowel sequence 57 | 58 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 59 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 60 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 61 | var s_v = "^(" + C + ")?" + v; // vowel in stem 62 | 63 | this.stemWord = function (w) { 64 | var stem; 65 | var suffix; 66 | var firstch; 67 | var origword = w; 68 | 69 | if (w.length < 3) 70 | return w; 71 | 72 | var re; 73 | var re2; 74 | var re3; 75 | var re4; 76 | 77 | firstch = w.substr(0,1); 78 | if (firstch == "y") 79 | w = firstch.toUpperCase() + w.substr(1); 80 | 81 | // Step 1a 82 | re = /^(.+?)(ss|i)es$/; 83 | re2 = /^(.+?)([^s])s$/; 84 | 85 | if (re.test(w)) 86 | w = w.replace(re,"$1$2"); 87 | else if (re2.test(w)) 88 | w = w.replace(re2,"$1$2"); 89 | 90 | // Step 1b 91 | re = /^(.+?)eed$/; 92 | re2 = /^(.+?)(ed|ing)$/; 93 | if (re.test(w)) { 94 | var fp = re.exec(w); 95 | re = new RegExp(mgr0); 96 | if (re.test(fp[1])) { 97 | re = /.$/; 98 | w = w.replace(re,""); 99 | } 100 | } 101 | else if (re2.test(w)) { 102 | var fp = re2.exec(w); 103 | stem = fp[1]; 104 | re2 = new RegExp(s_v); 105 | if (re2.test(stem)) { 106 | w = stem; 107 | re2 = /(at|bl|iz)$/; 108 | re3 = new RegExp("([^aeiouylsz])\\1$"); 109 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 110 | if (re2.test(w)) 111 | w = w + "e"; 112 | else if (re3.test(w)) { 113 | re = /.$/; 114 | w = w.replace(re,""); 115 | } 116 | else if (re4.test(w)) 117 | w = w + "e"; 118 | } 119 | } 120 | 121 | // Step 1c 122 | re = /^(.+?)y$/; 123 | if (re.test(w)) { 124 | var fp = re.exec(w); 125 | stem = fp[1]; 126 | re = new RegExp(s_v); 127 | if (re.test(stem)) 128 | w = stem + "i"; 129 | } 130 | 131 | // Step 2 132 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 133 | if (re.test(w)) { 134 | var fp = re.exec(w); 135 | stem = fp[1]; 136 | suffix = fp[2]; 137 | re = new RegExp(mgr0); 138 | if (re.test(stem)) 139 | w = stem + step2list[suffix]; 140 | } 141 | 142 | // Step 3 143 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 144 | if (re.test(w)) { 145 | var fp = re.exec(w); 146 | stem = fp[1]; 147 | suffix = fp[2]; 148 | re = new RegExp(mgr0); 149 | if (re.test(stem)) 150 | w = stem + step3list[suffix]; 151 | } 152 | 153 | // Step 4 154 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 155 | re2 = /^(.+?)(s|t)(ion)$/; 156 | if (re.test(w)) { 157 | var fp = re.exec(w); 158 | stem = fp[1]; 159 | re = new RegExp(mgr1); 160 | if (re.test(stem)) 161 | w = stem; 162 | } 163 | else if (re2.test(w)) { 164 | var fp = re2.exec(w); 165 | stem = fp[1] + fp[2]; 166 | re2 = new RegExp(mgr1); 167 | if (re2.test(stem)) 168 | w = stem; 169 | } 170 | 171 | // Step 5 172 | re = /^(.+?)e$/; 173 | if (re.test(w)) { 174 | var fp = re.exec(w); 175 | stem = fp[1]; 176 | re = new RegExp(mgr1); 177 | re2 = new RegExp(meq1); 178 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 179 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 180 | w = stem; 181 | } 182 | re = /ll$/; 183 | re2 = new RegExp(mgr1); 184 | if (re.test(w) && re2.test(w)) { 185 | re = /.$/; 186 | w = w.replace(re,""); 187 | } 188 | 189 | // and turn initial Y back to y 190 | if (firstch == "y") 191 | w = firstch.toLowerCase() + w.substr(1); 192 | return w; 193 | } 194 | } 195 | 196 | 197 | 198 | /** 199 | * Simple result scoring code. 200 | */ 201 | var Scorer = { 202 | // Implement the following function to further tweak the score for each result 203 | // The function takes a result array [filename, title, anchor, descr, score] 204 | // and returns the new score. 205 | /* 206 | score: function(result) { 207 | return result[4]; 208 | }, 209 | */ 210 | 211 | // query matches the full name of an object 212 | objNameMatch: 11, 213 | // or matches in the last dotted part of the object name 214 | objPartialMatch: 6, 215 | // Additive scores depending on the priority of the object 216 | objPrio: {0: 15, // used to be importantResults 217 | 1: 5, // used to be objectResults 218 | 2: -5}, // used to be unimportantResults 219 | // Used when the priority is not in the mapping. 220 | objPrioDefault: 0, 221 | 222 | // query found in title 223 | title: 15, 224 | // query found in terms 225 | term: 5 226 | }; 227 | 228 | 229 | /** 230 | * Search Module 231 | */ 232 | var Search = { 233 | 234 | _index : null, 235 | _queued_query : null, 236 | _pulse_status : -1, 237 | 238 | init : function() { 239 | var params = $.getQueryParameters(); 240 | if (params.q) { 241 | var query = params.q[0]; 242 | $('input[name="q"]')[0].value = query; 243 | this.performSearch(query); 244 | } 245 | }, 246 | 247 | loadIndex : function(url) { 248 | $.ajax({type: "GET", url: url, data: null, 249 | dataType: "script", cache: true, 250 | complete: function(jqxhr, textstatus) { 251 | if (textstatus != "success") { 252 | document.getElementById("searchindexloader").src = url; 253 | } 254 | }}); 255 | }, 256 | 257 | setIndex : function(index) { 258 | var q; 259 | this._index = index; 260 | if ((q = this._queued_query) !== null) { 261 | this._queued_query = null; 262 | Search.query(q); 263 | } 264 | }, 265 | 266 | hasIndex : function() { 267 | return this._index !== null; 268 | }, 269 | 270 | deferQuery : function(query) { 271 | this._queued_query = query; 272 | }, 273 | 274 | stopPulse : function() { 275 | this._pulse_status = 0; 276 | }, 277 | 278 | startPulse : function() { 279 | if (this._pulse_status >= 0) 280 | return; 281 | function pulse() { 282 | var i; 283 | Search._pulse_status = (Search._pulse_status + 1) % 4; 284 | var dotString = ''; 285 | for (i = 0; i < Search._pulse_status; i++) 286 | dotString += '.'; 287 | Search.dots.text(dotString); 288 | if (Search._pulse_status > -1) 289 | window.setTimeout(pulse, 500); 290 | } 291 | pulse(); 292 | }, 293 | 294 | /** 295 | * perform a search for something (or wait until index is loaded) 296 | */ 297 | performSearch : function(query) { 298 | // create the required interface elements 299 | this.out = $('#search-results'); 300 | this.title = $('

' + _('Searching') + '

').appendTo(this.out); 301 | this.dots = $('').appendTo(this.title); 302 | this.status = $('

').appendTo(this.out); 303 | this.output = $('