{ "info": { "author": "Te-j\u00e9 Rodgers", "author_email": "tjd.rodgers@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5" ], "description": "scopes\n=========\n\n|build-status| |license| |coveralls| |pypi|\n\n*scopes* exposes the ``Set`` class, a container type intended to\nsimplify checking authorization scope.\n\nInstallation\n------------\n\nYou can install scopes from PyPi::\n\n > pip install scopes\n\nThat should install all the dependencies for you. If you want to install\ndirectly from source, clone the git repository and run the standard\n`python setup.py install` command.\n\nDependencies\n~~~~~~~~~~~~\n\n* Python 2.7, 3.2+\n\nUsage\n-----\n\nscopes.Set implements the ``__contains__`` magic method, making it easy\nto check if a particular scope and permission is expressed in a set of\nscopes.\n\n>>> from scopes import Set\n>>> Set(['user/emails+r'])\nSet(['user/emails'])\n>>> 'user/emails' in Set(['user/emails'])\nTrue\n>>> ('foo/bar', 'foo/baz') <= Set('foo')\nTrue\n>>> ['foo/bar', 'foo/baz', 'extra'] <= Set(['foo', 'bar'])\nFalse\n>>> Set(['foo', 'bar']) >= ('foo/bar', 'foo/baz')\nTrue\n\nA Set in fact works almost like any set type.\n\n>>> len(Set(['user/emails', 'user/repo']))\n2\n>>> list(Set(['user/emails+r', 'user/repo+aaaaa']).formatted())\n['user/emails', 'user/repo+a']\n\nThey can be quickly parsed from strings too.\n\n>>> Set(\"user/emails+r user/emails+n\")\nSet(['user/emails', 'user/emails+n'])\n\nThis method uses a single space as a separator.\n\nPermissions\n~~~~~~~~~~~\n\nYou can append letters to scope items to express certain permissions.\nAny ascii letter that follows the permission separator (``+`` by\ndefault) is interpreted as a permission. When checking for an item\nin the scope list, both its value and permission must match at least\none item in the list.\n\n>>> 'user/emails+a' in Set(['user/emails'])\nFalse\n>>> 'user/emails+a' in Set(['user/emails+a'])\nTrue\n\nIndicate multiple permissions in a scope list item by including more than\none letter after the ``+`` symbol. Duplicate permissions are ignored.\n\n>>> 'user/repo+w' in Set(['user/repo+abcd', 'user/repo+rw'])\nTrue\n\nPermissions are totally arbitrary, except that ``+r`` is assumed by\ndefault when no permissions are explicitly given.\n\n>>> 'user/emails+r' in Set(['user/emails'])\nTrue\n\nYou can change the default permissions to whatever you like.\n\n>>> 'user/emails+n' in Set(['user/emails'], default_permissions='n')\nTrue\n>>> 'user/emails+q' in Set(['user/emails'], default_permissions='pq')\nTrue\n>>> 'user/emails+p' in Set(['user/emails'], default_permissions='pq')\nTrue\n\nThe permissions separator is also configurable.\n\n>>> 'user/emails|r' in Set(['user/emails'], permission_sep='|')\nTrue\n\nParents\n~~~~~~~\n\nThe ``/`` symbol is the default child separator. Parent scope items\nautomatically 'contain' child items in the scope list.\n\n>>> 'user/emails+r' in Set(['user'])\nTrue\n>>> 'user/emails+w' in Set(['user'])\nFalse\n>>> 'user/emails+rw' in Set(['user+w', 'user/emails+r'])\nTrue\n\nThe child separator can also be changed:\n\n>>> 'user:emails+r' in Set(['user'], child_sep=':')\nTrue\n\n.. |build-status| image:: https://travis-ci.org/te-je/scopes.svg?branch=develop\n :target: https://travis-ci.org/te-je/scopes?branch=develop\n :alt: build status\n :scale: 100%\n\n.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg\n :target: https://raw.githubusercontent.com/te-je/scopes/develop/LICENSE.rst\n :alt: License\n :scale: 100%\n\n.. |pypi| image:: https://img.shields.io/pypi/v/scopes.svg?maxAge=2592000\n :target: https://pypi.python.org/pypi/scopes\n :scale: 100%\n\n.. |coveralls| image:: https://coveralls.io/repos/github/te-je/scopes/badge.svg?branch=develop\n :target: https://coveralls.io/github/te-je/scopes?branch=develop\n\n\nLicense\n-------\n\nCopyright (c) 2016 Te-j\u00e9 Rodgers\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/te-je/scopes", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "scopes", "package_url": "https://pypi.org/project/scopes/", "platform": "", "project_url": "https://pypi.org/project/scopes/", "project_urls": { "Homepage": "https://github.com/te-je/scopes" }, "release_url": "https://pypi.org/project/scopes/0.2.0/", "requires_dist": null, "requires_python": "", "summary": "A container class for authorization scopes", "version": "0.2.0" }, "last_serial": 2206945, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "52b1fda508e103d4486e4d42bfa6f512", "sha256": "42f7458d22277647ee5f8fc38b90e321646b4bf5b54cb88b6ecf9867bd54d8da" }, "downloads": -1, "filename": "scopes-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "52b1fda508e103d4486e4d42bfa6f512", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8172, "upload_time": "2016-07-07T00:09:30", "url": "https://files.pythonhosted.org/packages/ae/64/edbdc210f435fe8e95200e85470184b4c0fe2f0ee13c577a27940943b8e6/scopes-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "77fd9cbd9c987bd2a023bd0ca9e483cf", "sha256": "27e7a11cac56f5adf209d079bf4fd7e54db5ff50404c9bb0cb07690f5998321f" }, "downloads": -1, "filename": "scopes-0.2.0.zip", "has_sig": false, "md5_digest": "77fd9cbd9c987bd2a023bd0ca9e483cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12937, "upload_time": "2016-07-07T00:09:33", "url": "https://files.pythonhosted.org/packages/b4/f9/8d36edf49f25c86ce14bf6b7b383948819a60fa362acf375edc3a47b49eb/scopes-0.2.0.zip" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "52b1fda508e103d4486e4d42bfa6f512", "sha256": "42f7458d22277647ee5f8fc38b90e321646b4bf5b54cb88b6ecf9867bd54d8da" }, "downloads": -1, "filename": "scopes-0.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "52b1fda508e103d4486e4d42bfa6f512", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8172, "upload_time": "2016-07-07T00:09:30", "url": "https://files.pythonhosted.org/packages/ae/64/edbdc210f435fe8e95200e85470184b4c0fe2f0ee13c577a27940943b8e6/scopes-0.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "77fd9cbd9c987bd2a023bd0ca9e483cf", "sha256": "27e7a11cac56f5adf209d079bf4fd7e54db5ff50404c9bb0cb07690f5998321f" }, "downloads": -1, "filename": "scopes-0.2.0.zip", "has_sig": false, "md5_digest": "77fd9cbd9c987bd2a023bd0ca9e483cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12937, "upload_time": "2016-07-07T00:09:33", "url": "https://files.pythonhosted.org/packages/b4/f9/8d36edf49f25c86ce14bf6b7b383948819a60fa362acf375edc3a47b49eb/scopes-0.2.0.zip" } ] }