{ "info": { "author": "Vinicius Pacheco", "author_email": "vfpweb@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# PyChecko [![Build Status](https://travis-ci.org/viniciusfeitosa/pychecko.svg?branch=master)](https://travis-ci.org/viniciusfeitosa/pychecko)\n\nThe PyChecko is a MicroFramework to compose a instance in execution time by rules predefined.\n\n# Example:\n\nThere are some [examples](example/).\n\n# Installation:\n\n```\npip install pychecko\n```\n\n# Getting started\n\nInside the directory application...\n\n## Defining class to be used\n\nOur example has two modules, the `app.py` and the `lib.py`.\nInside the `lib.py` there is a method to apply over a class.\n\n```python\n# lib.py\ndef bar(self):\n self.email = 'john.doe@email.com'\n```\n\nInside the `app.py` there are a method to apply over the class instance too.\nTake a look in the code comments to understand the logic\n\n```python\n# app.py\nimport lib # inside lib has a method bar with the attribute email definition\nfrom pychecko import Pychecko\n\n\n# There is another method bar with a different definition to the attribute email\ndef bar(self):\n self.email = 'bar@email.com'\n\n\n# Class A definition\nclass A:\n def __init__(self, first_name, last_name):\n # There are just two attributes\n self.first_name = first_name\n self.last_name = last_name\n\n # And just the method foo\n def foo(self):\n print('{first_name} {last_name}: {email}'.format(\n first_name=self.first_name,\n last_name=self.last_name,\n email=self.email)) # There is a attribute that is defined just in the bar\n\n\n# the main logic\nif __name__ == '__main__':\n # Instantiate the class A\n a = A('FirstName', 'LastName')\n # pass the instance variable to PyChecko\n pycheck = Pychecko(a)\n # Add the methods that you want apply\n pycheck.add(\n bar,\n [a.first_name == 'FirstName', a.last_name == 'LastName'] # Two bool conditions\n )\n pycheck.add(\n lib.bar,\n [a.first_name != 'FirstName' or a.last_name != 'LastName'] # One bool condition\n )\n\n # running PyChecko and get the modified instance\n a = pycheck.execute\n\n a.bar()\n a.foo() # The result will be: FirstName LastName: 'bar@email.com'\n```\n\n## Pychecko with bulk insert\n\n```python\n# app.py\nfrom pychecko import Pychecko\n\n\n# Method bar definition outside the class\ndef bar(self):\n self.email = 'bar@email.com'\n\n\n# Method foo definition outside the class\ndef foo(self):\n print('{first_name} {last_name}: {email}'.format(\n first_name=self.first_name,\n last_name=self.last_name,\n email=self.email)) # attribute that is defined just in the bar\n\n\n# Class A definition\nclass A:\n def __init__(self, first_name, last_name):\n # There are just two attributes\n self.first_name = first_name\n self.last_name = last_name\n\n\n# the main logic\nif __name__ == '__main__':\n # Instantiate the class A\n a = A('FirstName', 'LastName')\n # pass the instance variable to PyChecko\n pycheck = Pychecko(a)\n\n # Add the methods that you want apply\n\n # Two bool conditions\n pycheck.bulk_add(\n [\n bar,\n foo,\n ]\n [True]\n )\n\n # running PyChecko and get the modified instance\n a = pycheck.execute\n\n a.bar()\n a.foo() # The result is: FirstName LastName: 'bar@email.com'\n```\n\n## Pychecko Using Classes\n\n```python\nfrom pychecko import PycheckoComponent\n\n# Creating a pycheko component\nclass MyComponentA(PycheckoComponent):\n\n # is_applied is required for the PychecoComponents\n # It's responsible to identify if all class methods\n # should be applied in an instance\n def is_applied(self):\n return True\n\n def bar(self):\n self.email = 'john.doe@email.com'\n\n\nclass MyComponentB(PycheckoComponent):\n\n def is_applied(self):\n return True\n\n def name_changer(self):\n self.first_name = 'john doe'\n```\n\n```python\n# app.py\nimport lib # inside lib has a method bar with the attribute email definition\nfrom pychecko import PycheckoClassModifier\n\n\n# There is another method bar with a different\n# definition to the attribute email\ndef bar(self):\n self.email = 'bar@email.com'\n\n\n# Class A definition\nclass A:\n def __init__(self, first_name, last_name):\n # There are just two attributes\n self.first_name = first_name\n self.last_name = last_name\n\n # And just the method foo\n def foo(self):\n print('{first_name} {last_name}: {email}'.format(\n first_name=self.first_name,\n last_name=self.last_name,\n email=self.email)) # attribute that is defined just in the bar\n\n\n# the main logic\nif __name__ == '__main__':\n # Instantiate the class A\n instance = A('FirstName', 'LastName')\n # pass the instance variable to PyCheckoClassModifier\n # whit the classes that should be applied\n pycheck = PycheckoClassModifier(instance, [\n lib.MyComponentA(), # This implements bar()\n lib.MyComponentB(), # This implements name_changer()\n ])\n\n # running PyChecko and get the modified instance\n a = pycheck.execute\n\n a.bar()\n a.name_changer()\n a.foo() # The result is: John Doe LastName: 'bar@email.com'\n\n```\n\n## Applying instance validation\n\nAnother possible option is validate the instance integrity.\n\n```python\n# app.py\n\n'''\ncreate a list with the name methods that must be\nin the instance after execute the Pychecko\n'''\ninstance_signature [\n 'method_a',\n 'method_b',\n 'method_c',\n]\n\n# In the Pychecko declaration, send the list in the optional parameter\na = A('value1', 'value2')\npycheck = Pychecko(a, signature=instance_signature)\n# ...\n\n'''\nAt final, if all methods that you sent in the list\nto Pychecko are in the instance, the instance will be returned\nusing the `execute` property.\n\nIf the instance does't respect the signature will the thrown the\nException InvalidSignatureClassError\n'''\na = pycheck.execute\n\n# ...\n```\n\n# Next Features\n\n* Check signature at method level\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/viniciusfeitosa/pychecko/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "PyChecko", "package_url": "https://pypi.org/project/PyChecko/", "platform": "any", "project_url": "https://pypi.org/project/PyChecko/", "project_urls": { "Homepage": "https://github.com/viniciusfeitosa/pychecko/" }, "release_url": "https://pypi.org/project/PyChecko/1.3.0/", "requires_dist": null, "requires_python": "", "summary": "MicroFramework to compose instances in execution time", "version": "1.3.0" }, "last_serial": 3910701, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "cd983834576100e6c967f6e90f2ef1cc", "sha256": "dd83b17b05e4ba5cf92b69c94f6ec2ea672a53c78eccbb6912b9613ce232edca" }, "downloads": -1, "filename": "PyChecko-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "cd983834576100e6c967f6e90f2ef1cc", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 1877, "upload_time": "2017-08-27T03:34:12", "url": "https://files.pythonhosted.org/packages/d9/17/da3b9093696fcbd995356d9a7fc7bfcff71fed9f7bd9323f200917442cfc/PyChecko-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "61806dff38252488b67a622900baa7a5", "sha256": "92c44c6271bf618f1de2f79ace319892441559c5db8a5c1fd9170202c9ec2081" }, "downloads": -1, "filename": "PyChecko-1.0.0.tar.gz", "has_sig": false, "md5_digest": "61806dff38252488b67a622900baa7a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 937, "upload_time": "2017-08-27T03:34:10", "url": "https://files.pythonhosted.org/packages/3b/14/2c66aca2657c7046b7209f2acf3f0f7645b2a5370b85e57e0c0955276b7f/PyChecko-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "25e18c3f7b9f6f2806fb49ce6c38eb2b", "sha256": "49d12fbf771f856f714a12db39461452b98fbed71f49fd68b2ea2baefa0ce5f3" }, "downloads": -1, "filename": "PyChecko-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "25e18c3f7b9f6f2806fb49ce6c38eb2b", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 1877, "upload_time": "2017-08-27T19:51:44", "url": "https://files.pythonhosted.org/packages/37/e7/482a2c1393872ed408a2e297cdd05d2a45f81d09fd4f38174cdb56991b7c/PyChecko-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "6fc5f7f67bb5d0661b05692c31c225f8", "sha256": "de3731405c0a1973c2f746387d6b3f2c6a7528e69dc12b8a99b96407aab32bb9" }, "downloads": -1, "filename": "PyChecko-1.0.1.tar.gz", "has_sig": false, "md5_digest": "6fc5f7f67bb5d0661b05692c31c225f8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 955, "upload_time": "2017-08-27T19:51:42", "url": "https://files.pythonhosted.org/packages/80/15/f784c3638473a3dbc971d73e6d5f1405252a2de166c813868010aa855fc8/PyChecko-1.0.1.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "9a1aa6af11257459f06a06900a61d824", "sha256": "06ac7777f50a760498d5a9162ea95d48493ca00bbefe95d527adb7b8c476ed46" }, "downloads": -1, "filename": "PyChecko-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "9a1aa6af11257459f06a06900a61d824", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 1823, "upload_time": "2017-08-29T05:08:24", "url": "https://files.pythonhosted.org/packages/fa/41/8182fe3e24d9adcdd2fb827d4aab393354961bf9672034e6a26cd7e06e90/PyChecko-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4417021fc246488e6794fc53107cb4c5", "sha256": "4f7fdc562b7686c8019996f91ba030985fb9f7065a71165263e358f8b17d24e6" }, "downloads": -1, "filename": "PyChecko-1.1.0.tar.gz", "has_sig": false, "md5_digest": "4417021fc246488e6794fc53107cb4c5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 839, "upload_time": "2017-08-29T05:08:22", "url": "https://files.pythonhosted.org/packages/80/34/a0193d47a513c9a8f443a8019108548d26b6040c3e8abb81744501bb508d/PyChecko-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "1d891dbc87f2cd10c22a77cfa71e4b2e", "sha256": "93b0e93a3ccb18e43bdc91c6fbe3bdbffa93cf3bede334759eeb1997a724adb5" }, "downloads": -1, "filename": "PyChecko-1.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "1d891dbc87f2cd10c22a77cfa71e4b2e", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 4341, "upload_time": "2017-09-12T17:35:08", "url": "https://files.pythonhosted.org/packages/d3/5e/e12344d53361abc68c318cff053c2ddba7f710cf0a1b279a6a49b74111c9/PyChecko-1.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "47065c0cc0123fd3aa5303e41799c136", "sha256": "bb94161fd7a6d6163c29d007d3f6ff3c41b58d870ca93eac2f3a67f8e67f81aa" }, "downloads": -1, "filename": "PyChecko-1.1.1.tar.gz", "has_sig": false, "md5_digest": "47065c0cc0123fd3aa5303e41799c136", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2636, "upload_time": "2017-09-12T17:35:06", "url": "https://files.pythonhosted.org/packages/87/47/7ed31b18fe135cc16171ab8d2db18109842ca2a3e36e01cd5bc770f4fd6c/PyChecko-1.1.1.tar.gz" } ], "1.2.0": [ { "comment_text": "", "digests": { "md5": "10880c26082f3e70bc13bf496782a9d4", "sha256": "16683f90e72c12285224531c59249ffd52ae7e43ac69b4ce789930b56adc788b" }, "downloads": -1, "filename": "PyChecko-1.2.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "10880c26082f3e70bc13bf496782a9d4", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 4679, "upload_time": "2017-09-13T20:51:45", "url": "https://files.pythonhosted.org/packages/8d/7b/e3e368a2cce5f2853cb62e07ce41045ab55226d4f70b439be2edd2fcc394/PyChecko-1.2.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a19f2e921a42d18d59d8508d8a87812c", "sha256": "c71b8d59aba7ab3d6bfa014e55d259ab1ef5a810891387fb7dc66f43cf010247" }, "downloads": -1, "filename": "PyChecko-1.2.0.tar.gz", "has_sig": false, "md5_digest": "a19f2e921a42d18d59d8508d8a87812c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2906, "upload_time": "2017-09-13T20:51:42", "url": "https://files.pythonhosted.org/packages/96/f1/cd0508089c6b689b5ecfbc25850c04e151e03cd80aef1965a96152be5b18/PyChecko-1.2.0.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "6ea66a0904a609a6e4224b174fe9033e", "sha256": "3c80f7c8e1dbf4b0e0175b35b8daadb9b4c333c8cdf31af1c00b5dd57225a696" }, "downloads": -1, "filename": "PyChecko-1.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6ea66a0904a609a6e4224b174fe9033e", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 6448, "upload_time": "2018-05-29T21:57:57", "url": "https://files.pythonhosted.org/packages/fc/53/5d6a661abaa827824fa96f675e81b29818ab6bbfe21fb3ec53c7914ba50f/PyChecko-1.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a24daed049eb7305a3dafa40d1239b7", "sha256": "b9e963e9b274e93fde391487231a95ac1dec4fcc323eaff42f992971c1e3785b" }, "downloads": -1, "filename": "PyChecko-1.3.0.tar.gz", "has_sig": false, "md5_digest": "1a24daed049eb7305a3dafa40d1239b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5380, "upload_time": "2018-05-29T21:57:55", "url": "https://files.pythonhosted.org/packages/13/37/f591c7bbe9f7bafc6a72502229906f62ca68b0c1f79791a367ae2cdb3d0b/PyChecko-1.3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6ea66a0904a609a6e4224b174fe9033e", "sha256": "3c80f7c8e1dbf4b0e0175b35b8daadb9b4c333c8cdf31af1c00b5dd57225a696" }, "downloads": -1, "filename": "PyChecko-1.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6ea66a0904a609a6e4224b174fe9033e", "packagetype": "bdist_wheel", "python_version": "3.6", "requires_python": null, "size": 6448, "upload_time": "2018-05-29T21:57:57", "url": "https://files.pythonhosted.org/packages/fc/53/5d6a661abaa827824fa96f675e81b29818ab6bbfe21fb3ec53c7914ba50f/PyChecko-1.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "1a24daed049eb7305a3dafa40d1239b7", "sha256": "b9e963e9b274e93fde391487231a95ac1dec4fcc323eaff42f992971c1e3785b" }, "downloads": -1, "filename": "PyChecko-1.3.0.tar.gz", "has_sig": false, "md5_digest": "1a24daed049eb7305a3dafa40d1239b7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5380, "upload_time": "2018-05-29T21:57:55", "url": "https://files.pythonhosted.org/packages/13/37/f591c7bbe9f7bafc6a72502229906f62ca68b0c1f79791a367ae2cdb3d0b/PyChecko-1.3.0.tar.gz" } ] }