{ "info": { "author": "xlzd", "author_email": "i@xlzd.me", "bugtrack_url": null, "classifiers": [], "description": "xtls : \u6211\u7684\u5de5\u5177\u5305\n===============================\n\n\n\u4ec0\u4e48\u662fxtls\n-------\n\nxtls\u662fxlzd's tools\u7684\u7b80\u5199\uff0c\u5728\u5199\u4ee3\u7801\u7684\u8fc7\u7a0b\u4e2d\u4f1a\u9047\u5230\u5f88\u591a\u9700\u8981\u91cd\u590d\u590d\u5236\u7c98\u8d34\u7684\u4ee3\u7801\u3002\u4e3a\u4e86\u4fdd\u6301\u4ee3\u7801\u7684\u7f8e\u89c2\u6574\u6d01\uff0c\u6240\u4ee5\u62bd\u53d6\u6210\u4e86\u8fd9\u4e2a\u5e93\uff0c\u4ee5\u65b9\u4fbf\u81ea\u5df1\u4f7f\u7528\u3002\u5982\u679c\u80fd\u591f\u65b9\u4fbf\u66f4\u591a\u670b\u53cb\uff0c\u90a3\u5c31\u66f4\u597d\u4e86\u3002\n\n\n\n\u5b89\u88c5\u4e0e\u5347\u7ea7\n-------\n\nxtls\u5df2\u7ecf\u4e0a\u4f20\u5230\u4e86pypi(https://pypi.python.org/pypi/xtls)\uff0c\u6240\u4ee5\u4f60\u53ef\u4ee5\u76f4\u63a5\u901a\u8fc7pip\u5b89\u88c5\u548c\u5347\u7ea7\uff1a\n\n**\u5b89\u88c5\uff1a**\n\n.. code-block:: console\n\n $ pip install xtls\n\n\n**\u5347\u7ea7\uff1a**\n\n.. code-block:: console\n\n $ pip install xtls --upgrade\n\n\n\n\u5df2\u7ecf\u5b9e\u73b0\u7684\u90e8\u5206\u529f\u80fd\n-------\n\n\n\u7531\u4e8e\u8fd9\u4e2a\u5e93\u5f88\u5927\u7a0b\u5ea6\u4e0a\u662f\u6211\u81ea\u7528\uff0c\u6240\u4ee5\u5e76\u6ca1\u6709\u5b8c\u6574\u7684\u6ce8\u91ca\u548c\u6587\u6863\uff0c\u4e0b\u9762\u7b80\u5355\u5217\u4e3e\u4e00\u4e9b\u5e38\u89c1\u7684\u529f\u80fd\u3002\n \n\n**\u68c0\u6d4b\u51fd\u6570\u8fd0\u884c\u65f6\u957f\uff1a**\n\n.. code-block:: Python\n\n from xtls.codehelper import timeit\n \n # \u5c06\u8fd0\u884c\u65f6\u95f4\u6253\u5370\u5230\u63a7\u5236\u53f0\n @timeit\n def func():\n pass\n \n # \u5c06\u8fd0\u884c\u65f6\u95f4\u8bb0\u5f55\u5230\u65e5\u5fd7\n @timeit(logger)\n def func():\n pass\n \n \n \n**\u68c0\u6d4b\u8bed\u53e5\u5757\u8fd0\u884c\u65f6\u957f\uff1a**\n\n.. code-block:: Python\n\n from xtls.codehelper import timetime\n \n # \u5c06\u8fd0\u884c\u65f6\u95f4\u6253\u5370\u5230\u63a7\u5236\u53f0\n with timetime():\n # \u6267\u884c\u4e00\u6bb5\u4ee3\u7801\uff0c\u5b8c\u6210\u4e4b\u540e\u5c06\u4f1a\u6253\u5370\u51fa\u8fd9\u6bb5\u4ee3\u7801\u7684\u8fd0\u884c\u65f6\u95f4\n pass\n \n # \u5c06\u8fd0\u884c\u65f6\u95f4\u8bb0\u5f55\u5230\u65e5\u5fd7\n with timetime(tag='\u8fd9\u6bb5\u4ee3\u7801\u7684\u6807\u7b7e', logger=logger):\n # \u6267\u884c\u4e00\u6bb5\u4ee3\u7801\uff0c\u5b8c\u6210\u4e4b\u540e\u5c06\u4f1a\u6253\u5370\u51fa\u8fd9\u6bb5\u4ee3\u7801\u7684\u8fd0\u884c\u65f6\u95f4\n pass\n \n \n \n \n**\u63a7\u5236\u51fd\u6570\u4e0d\u629b\u51fa\u5f02\u5e38\uff1a**\n\n.. code-block:: Python\n\n from xtls.codehelper import no_exception\n \n \n # \u540c\u4e0a\uff0c\u652f\u6301\u4e00\u4e2a\u53ef\u9009\u7684logger\u53c2\u6570\n @no_exception(on_exception='\u5f53\u53d1\u751f\u5f02\u5e38\u65f6\u8fd4\u56de\u8fd9\u4e2a')\n def func():\n pass\n \n # \u8fd9\u4e2a\u88c5\u9970\u5668\u4e3b\u8981\u662f\u7528\u5728\u6709\u4e9b\u65f6\u5019\u5e76\u4e0d\u5173\u5fc3\u51fd\u6570\u629b\u51fa\u5f02\u5e38\uff0c\u8981\u628a\u4ee3\u7801\u6574\u4e2atry-catch\u8d77\u6765\u7684\u60c5\u51b5\u3002 \n \n \n \n \n**\u63a7\u5236\u8bed\u53e5\u5757\u4e0d\u629b\u51fa\u5f02\u5e38\uff1a**\n\n.. code-block:: Python\n\n from xtls.codehelper import trytry\n \n # \u540c\u4e0a\uff0c\u652f\u6301\u4e00\u4e2a\u53ef\u9009\u7684logger\u53c2\u6570\n with trytry():\n # \u5982\u679c\u9047\u5230\u5f02\u5e38\uff0c\u540e\u9762\u7684\u4ee3\u7801\u4f1a\u7ee7\u7eed\u6267\u884c\n pass\n \n \n \n \n**\u88c5\u9970\u5355\u4f8b\uff1a**\n\n.. code-block:: Python\n\n from xtls.codehelper import singleton\n \n @singleton\n class Singleton(object):\n # \u8fd9\u4e2a\u7c7b\u5c06\u53ea\u80fd\u88ab\u521b\u5efa\u4e00\u4e2a\u5b9e\u4f8b\n pass\n \n\n \n**\u83b7\u53d6\u5f53\u524d\u673a\u5668IP\u7b49\uff1a**\n\n.. code-block:: Python\n\n from xtls.codehelper import get_ip, get_user, get_runner\n \n print get_ip() # 192.168.1.100\n print get_user() # xlzd\n print get_runner() # xlzd@192.168.1.100\n \n \n \n**\u65f6\u95f4\u89e3\u6790\uff1a**\n\n.. code-block:: Python\n\n from xtls.timeparser import parse_time\n \n parse_time(u'20160325')\n parse_time(u'2016\u5e743\u670825\u65e515\u70b913\u520653\u79d2')\n parse_time(u'\u4e8c\u96f6\u4e00\u516d\u5e74\u4e09\u6708\u4e8c\u5341\u4e94\u65e5')\n parse_time(u'1\u5929\u524d')\n parse_time(u'3\u5206\u949f\u4ee5\u540e')\n \n \n \n**\u5728\u7ec8\u7aef\u6253\u5370\u5f69\u8272\u5b57\u7b26\uff1a**\n\n.. code-block:: Python\n\n from xtls.colorful import colorful_print, Color, dyeing\n \n colorful_print('what', Color.RED) # \u5728\u7ec8\u7aef\u76f4\u63a5\u6253\u5370\u7ea2\u8272\u7684 \u2018what\u2019\n color_str = dyeing('what', Color.RED) # \u8fd4\u56de\u201c\u67d3\u8272\u540e\u201d\u7684\u5b57\u7b26\u4e32\uff0c\u901a\u8fc7print\u6253\u5370\u4e00\u6837\u4f1a\u6709\u989c\u8272\n \n\n \n \n**\u6c49\u5b57\u8f6c\u62fc\u97f3\uff1a**\n\n.. code-block:: Python\n\n from xtls.pinyin import parse\n parse(u'\u4f60\u597d') # [('NI', '3'), ('HAO', '3')]\uff0c \n \n\n \n**\u57fa\u4e8etornado\u7684\u5e76\u53d1\u722c\u866b\uff1a**\n\n.. code-block:: Python\n\n from xtls.basecrawler import AsyncCrawler\n \n \u8fd9\u4e2a\u81ea\u5df1\u770b\u4ee3\u7801\u6216\u8005\u76f4\u63a5\u95ee\u6211\u5427\uff0c\u53ea\u8a00\u7247\u8bed\u4e0d\u597d\u63cf\u8ff0\n\n \n \n\u540e\u7eed\n-------\n\n\u8fd9\u91cc\u9762\u5927\u591a\u662f\u6211\u5e38\u7528\u5230\u7684\u4e1c\u897f\uff0c\u4e5f\u6709\u90e8\u5206\u4e0d\u5e38\u7528\u4f46\u662f\u633a\u6709\u8da3\u7684\u5185\u5bb9\uff0c\u5982\u679c\u4f60\u4e5f\u6709\u60f3\u653e\u8fdb\u6765\u7684\u4ee3\u7801\uff0c\u5c3d\u7ba1fork\u4e4b\u540e\u63d0\u4ea4pull request\u5427\u3002", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/xlzd/xtls", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/xlzd/xtls", "keywords": "xlzd,python,python tools", "license": "GPLv2", "maintainer": null, "maintainer_email": null, "name": "xtls", "package_url": "https://pypi.org/project/xtls/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/xtls/", "project_urls": { "Download": "https://github.com/xlzd/xtls", "Homepage": "https://github.com/xlzd/xtls" }, "release_url": "https://pypi.org/project/xtls/0.4.5/", "requires_dist": null, "requires_python": null, "summary": "xtls: tools by xlzd", "version": "0.4.5" }, "last_serial": 2037201, "releases": { "0.4.4": [ { "comment_text": "", "digests": { "md5": "e4b34d60033ba4a883bfe1016d4f3a36", "sha256": "23975f69cbe2e3d331389b133a3360eaebe0f998d9f252bf69156468a485eb89" }, "downloads": -1, "filename": "xtls-0.4.4.tar.gz", "has_sig": false, "md5_digest": "e4b34d60033ba4a883bfe1016d4f3a36", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 143452, "upload_time": "2016-03-30T07:51:49", "url": "https://files.pythonhosted.org/packages/cc/8c/df972a0698c469385300c77a855fad05cc9f2bbbaf2814bb923509b10377/xtls-0.4.4.tar.gz" } ], "0.4.5": [ { "comment_text": "", "digests": { "md5": "8db4045732ba9bd4ed5a68b21df2b085", "sha256": "f2481f2e3630784b3d37b7c99f641ed896c597b5e38b30ebe9d241e9c8238dab" }, "downloads": -1, "filename": "xtls-0.4.5.tar.gz", "has_sig": false, "md5_digest": "8db4045732ba9bd4ed5a68b21df2b085", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 143464, "upload_time": "2016-03-31T02:14:04", "url": "https://files.pythonhosted.org/packages/01/b2/8f52ccf7b6cc875e35510dd03d2387eac0f2e17293dfc864e884ac7b86bd/xtls-0.4.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8db4045732ba9bd4ed5a68b21df2b085", "sha256": "f2481f2e3630784b3d37b7c99f641ed896c597b5e38b30ebe9d241e9c8238dab" }, "downloads": -1, "filename": "xtls-0.4.5.tar.gz", "has_sig": false, "md5_digest": "8db4045732ba9bd4ed5a68b21df2b085", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 143464, "upload_time": "2016-03-31T02:14:04", "url": "https://files.pythonhosted.org/packages/01/b2/8f52ccf7b6cc875e35510dd03d2387eac0f2e17293dfc864e884ac7b86bd/xtls-0.4.5.tar.gz" } ] }