movoid-function


Namemovoid-function JSON
Version 1.7.5 PyPI version JSON
download
home_pageNone
SummaryNone
upload_time2025-02-16 18:33:09
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/6d/2e/e90f34f0390ea154bf78b17e0d7b464ef0bf11c0031a909da5e0528b8bdc/movoid_function-1.7.5.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.5",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a9f88cdc3b53ed4ad9e138d2acba11e9c2d85c79af8f0ae0e26d1f870492780f",
                "md5": "9ce4d5b1dfc39de4586080ec047c44c8",
                "sha256": "5e1db8076c25795fdc93394473c8161b1c4e77f3d6fa983d9d99749092022d60"
            },
            "downloads": -1,
            "filename": "movoid_function-1.7.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "9ce4d5b1dfc39de4586080ec047c44c8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 15766,
            "upload_time": "2025-02-16T18:33:08",
            "upload_time_iso_8601": "2025-02-16T18:33:08.271106Z",
            "url": "https://files.pythonhosted.org/packages/a9/f8/8cdc3b53ed4ad9e138d2acba11e9c2d85c79af8f0ae0e26d1f870492780f/movoid_function-1.7.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "6d2ee90f34f0390ea154bf78b17e0d7b464ef0bf11c0031a909da5e0528b8bdc",
                "md5": "f768870131f8159342529e7a659b8d0d",
                "sha256": "8819fc83353cdcfee4d48581c8980a0ed0ed2ec8540b4bd7345dd6ea0a95bf5a"
            },
            "downloads": -1,
            "filename": "movoid_function-1.7.5.tar.gz",
            "has_sig": false,
            "md5_digest": "f768870131f8159342529e7a659b8d0d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 15067,
            "upload_time": "2025-02-16T18:33:09",
            "upload_time_iso_8601": "2025-02-16T18:33:09.269235Z",
            "url": "https://files.pythonhosted.org/packages/6d/2e/e90f34f0390ea154bf78b17e0d7b464ef0bf11c0031a909da5e0528b8bdc/movoid_function-1.7.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-16 18:33:09",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "movoid-function"
}
        
Elapsed time: 0.41132s