{ "info": { "author": "Stas Shilov", "author_email": "shilowstanisalw@gamail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# privatebroker\n\nPrivateBroker (beta) is a module for encapsulation.\n\nIt allows you to hide methods of classes that are undesirable in the implementation of child elements. Private methods become unavailable in instances of classes and classes of heirs.\n\nPrivate methods are kept in the \"broker\", which allows you to access the private method if necessary.\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/...) to install foobar.\n\n```bash\npip install privatebroker\n```\n\n## Usage\n\nthe privateclass decorator accepts a class whose specific methods must be hidden. the decorator privatemethod accepts the method and puts it in the broker.\n\nThe broker returns the necessary function (attribute of the private method) by taking two arguments: the class (from example A (!! not self !!)) and the name of the method (the string is required).\n\nTo get the result of a private method, you need to refer to the attribute of the private method and pass it the arguments expected by the private method.\n\n```python\n\nfrom privatebroker import privateclass, privatemethod\n\n@privateclass\nclass A(object):\n \n def __init__(self, *args, **kwargs):\n self.some_one = {}\n \n \n @privatemethod\n def a_private2(self):\n pass\n \n \n @privatemethod\n def a_private(self, key, value):\n self.some_one[key] = value\n \n \n def test(self, x, y):\n private = self.broker(A, 'a_private') # call to private\n return private(self, x, y)\n \n \n def a_public(self):\n return self.some_one\n\n#a = A()\n#print(a.a_private()) - > Error\n\n@privateclass\nclass B(A):\n \n @privatemethod\n def b_private(self):\n return '\u042f \u043c\u043e\u0433\u0443 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0443 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 B'\n \n def b_public(self):\n self.test('a', 11)\n return self.some_one\n\n\nb = B()\nprint(b.b_public())\n```\n\n## Contributing\n\nImportant!\nThis is the first test version and so far the expediency of using this module is questionable!\nTraction requests are welcome. For major changes, please first open the question to discuss\nwhat you would like to change.\n\nPlease remember to update the tests as needed.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/stanley0707/privatebroker.git", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "privatebroker", "package_url": "https://pypi.org/project/privatebroker/", "platform": "", "project_url": "https://pypi.org/project/privatebroker/", "project_urls": { "Homepage": "https://github.com/stanley0707/privatebroker.git" }, "release_url": "https://pypi.org/project/privatebroker/0.0.1/", "requires_dist": null, "requires_python": "", "summary": "", "version": "0.0.1" }, "last_serial": 4737330, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "4367d23b83de883c3d556b8a44ec8c6b", "sha256": "8e65922ab8f92ddda5e8e456e192b257323f317f58c40954fd26166c64ea9138" }, "downloads": -1, "filename": "privatebroker-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4367d23b83de883c3d556b8a44ec8c6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3148, "upload_time": "2019-01-24T20:52:51", "url": "https://files.pythonhosted.org/packages/a9/cf/12befca3619368898d3c942212e1300de9cc729aa2ab9766c84e9a8e662f/privatebroker-0.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4367d23b83de883c3d556b8a44ec8c6b", "sha256": "8e65922ab8f92ddda5e8e456e192b257323f317f58c40954fd26166c64ea9138" }, "downloads": -1, "filename": "privatebroker-0.0.1.tar.gz", "has_sig": false, "md5_digest": "4367d23b83de883c3d556b8a44ec8c6b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3148, "upload_time": "2019-01-24T20:52:51", "url": "https://files.pythonhosted.org/packages/a9/cf/12befca3619368898d3c942212e1300de9cc729aa2ab9766c84e9a8e662f/privatebroker-0.0.1.tar.gz" } ] }