movoid-function


Namemovoid-function JSON
Version 1.7.2 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2024-08-25 08:48:21
maintainerNone
docs_urlNone
authormovoid
requires_pythonNone
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            这个一个对函数进行各方面操作的包,包含了很多十分精妙的功能。

这个包分了几个大的模块,分别对应了不同的函数操作小玩法

## 装饰器

装饰器部分包含了常见一个装饰器所需的一些辅助类的装饰器函数

### wraps

这个装饰器本质就是为了替代functools.wraps而创建的。

它的作用和functools.wraps本质上是一样的,唯一的区别就是它在装饰了函数之后,会把函数的参数和注释全部保留,使得在运行过程中可以正确获得原函数的参数情况。


## 函数

函数是针对函数直接或间接的一些操作的功能


### replace_function

替代函数,其本身是为了解决需要直接改变builtin函数的逻辑(对,就是你,print),但是又希望这个函数的变动可以随时复原,或者能自由地调用原函数地功能。

不过现在这个函数已经被开发得可以任意替换任意包内定义的普通函数

```python
from movoid_function import replace_function

def special_print(text):
    return text

replace_function(print, special_print)

a = print("666") #此时不会打印任何信息,并且会给a赋值为'666'
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "movoid-function",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "movoid",
    "author_email": "bobrobotsun@163.com",
    "download_url": "https://files.pythonhosted.org/packages/33/ac/2ea203e87feb921408ff5dcd06929980bbd8066775be4db1eecea8065a03/movoid_function-1.7.2.tar.gz",
    "platform": null,
    "description": "\u8fd9\u4e2a\u4e00\u4e2a\u5bf9\u51fd\u6570\u8fdb\u884c\u5404\u65b9\u9762\u64cd\u4f5c\u7684\u5305\uff0c\u5305\u542b\u4e86\u5f88\u591a\u5341\u5206\u7cbe\u5999\u7684\u529f\u80fd\u3002\n\n\u8fd9\u4e2a\u5305\u5206\u4e86\u51e0\u4e2a\u5927\u7684\u6a21\u5757\uff0c\u5206\u522b\u5bf9\u5e94\u4e86\u4e0d\u540c\u7684\u51fd\u6570\u64cd\u4f5c\u5c0f\u73a9\u6cd5\n\n## \u88c5\u9970\u5668\n\n\u88c5\u9970\u5668\u90e8\u5206\u5305\u542b\u4e86\u5e38\u89c1\u4e00\u4e2a\u88c5\u9970\u5668\u6240\u9700\u7684\u4e00\u4e9b\u8f85\u52a9\u7c7b\u7684\u88c5\u9970\u5668\u51fd\u6570\n\n### wraps\n\n\u8fd9\u4e2a\u88c5\u9970\u5668\u672c\u8d28\u5c31\u662f\u4e3a\u4e86\u66ff\u4ee3functools.wraps\u800c\u521b\u5efa\u7684\u3002\n\n\u5b83\u7684\u4f5c\u7528\u548cfunctools.wraps\u672c\u8d28\u4e0a\u662f\u4e00\u6837\u7684\uff0c\u552f\u4e00\u7684\u533a\u522b\u5c31\u662f\u5b83\u5728\u88c5\u9970\u4e86\u51fd\u6570\u4e4b\u540e\uff0c\u4f1a\u628a\u51fd\u6570\u7684\u53c2\u6570\u548c\u6ce8\u91ca\u5168\u90e8\u4fdd\u7559\uff0c\u4f7f\u5f97\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\u53ef\u4ee5\u6b63\u786e\u83b7\u5f97\u539f\u51fd\u6570\u7684\u53c2\u6570\u60c5\u51b5\u3002\n\n\n## \u51fd\u6570\n\n\u51fd\u6570\u662f\u9488\u5bf9\u51fd\u6570\u76f4\u63a5\u6216\u95f4\u63a5\u7684\u4e00\u4e9b\u64cd\u4f5c\u7684\u529f\u80fd\n\n\n### replace_function\n\n\u66ff\u4ee3\u51fd\u6570\uff0c\u5176\u672c\u8eab\u662f\u4e3a\u4e86\u89e3\u51b3\u9700\u8981\u76f4\u63a5\u6539\u53d8builtin\u51fd\u6570\u7684\u903b\u8f91\uff08\u5bf9\uff0c\u5c31\u662f\u4f60\uff0cprint\uff09\uff0c\u4f46\u662f\u53c8\u5e0c\u671b\u8fd9\u4e2a\u51fd\u6570\u7684\u53d8\u52a8\u53ef\u4ee5\u968f\u65f6\u590d\u539f\uff0c\u6216\u8005\u80fd\u81ea\u7531\u5730\u8c03\u7528\u539f\u51fd\u6570\u5730\u529f\u80fd\u3002\n\n\u4e0d\u8fc7\u73b0\u5728\u8fd9\u4e2a\u51fd\u6570\u5df2\u7ecf\u88ab\u5f00\u53d1\u5f97\u53ef\u4ee5\u4efb\u610f\u66ff\u6362\u4efb\u610f\u5305\u5185\u5b9a\u4e49\u7684\u666e\u901a\u51fd\u6570\n\n```python\nfrom movoid_function import replace_function\n\ndef special_print(text):\n    return text\n\nreplace_function(print, special_print)\n\na = print(\"666\") #\u6b64\u65f6\u4e0d\u4f1a\u6253\u5370\u4efb\u4f55\u4fe1\u606f\uff0c\u5e76\u4e14\u4f1a\u7ed9a\u8d4b\u503c\u4e3a'666'\n```\n",
    "bugtrack_url": null,
    "license": null,
    "summary": null,
    "version": "1.7.2",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1c2f48a05f01d48ba18a8ca2b5044989bb4a8a070cd7bbb5d094702721a3218f",
                "md5": "d8881b4f859212456e9b5387cc43b4ff",
                "sha256": "af5838093a124de1df355933c11ec8cb9126d810be51a8bb88a1f11c5ad65a95"
            },
            "downloads": -1,
            "filename": "movoid_function-1.7.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d8881b4f859212456e9b5387cc43b4ff",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15134,
            "upload_time": "2024-08-25T08:48:20",
            "upload_time_iso_8601": "2024-08-25T08:48:20.040328Z",
            "url": "https://files.pythonhosted.org/packages/1c/2f/48a05f01d48ba18a8ca2b5044989bb4a8a070cd7bbb5d094702721a3218f/movoid_function-1.7.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "33ac2ea203e87feb921408ff5dcd06929980bbd8066775be4db1eecea8065a03",
                "md5": "24459c3ed49368002141526ad9ea2dde",
                "sha256": "26689645d54a1c05cff20f4c8ba624965cd976e009f602951cd4b168b734792d"
            },
            "downloads": -1,
            "filename": "movoid_function-1.7.2.tar.gz",
            "has_sig": false,
            "md5_digest": "24459c3ed49368002141526ad9ea2dde",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 14415,
            "upload_time": "2024-08-25T08:48:21",
            "upload_time_iso_8601": "2024-08-25T08:48:21.117650Z",
            "url": "https://files.pythonhosted.org/packages/33/ac/2ea203e87feb921408ff5dcd06929980bbd8066775be4db1eecea8065a03/movoid_function-1.7.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-08-25 08:48:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "movoid-function"
}
        
Elapsed time: 0.30122s