argument-names


Nameargument-names JSON
Version 0.1.0a2 PyPI version JSON
download
home_pageNone
SummaryThis decorator dynamically maps argument names from a function's call to a specified function.
upload_time2024-10-07 17:00:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseMIT License Copyright (c) 2024 Santiago Papiernik Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords decorator argument names python type checking
VCS
bugtrack_url
requirements packaging typing-extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Argument Names

A Python library that provides a decorator to automatically retrieve and process the argument names of a function when it's called. This can be useful for tasks like debugging, logging, or other custom operations.

## Installation

Install argument-names via pip:

```python
pip install argument-names
```


## Use Case Example
This example demonstrates how to utilize the argument_names decorator to log the names of the arguments passed to a function:
```py
from argument_names import argument_names

@argument_names(function=lambda *args: print("Received arguments:", *args))
def process_data(_1, _2, _3):
    pass

# Example invocation
name = "Alice"
age = 30
occupation = "Engineer"

# Calling the process_data function with the specified arguments
process_data(name, age, occupation)   # Received arguments: name age occupation

process_data(occupation, age, age)   # Received arguments: occupation age age
```

```py
from argument_names import argument_names

@argument_names(function=lambda *args: print("".join(args)))
def foo(*args):
    pass

h = None
e = 1
l = 9
o = 3
w = True
r = 3.14
d = 600
_ = 0.03

foo(h, e, l, l, o, _, w, o, r, l, d) # hello_world
```

## Limitations

- The library requires you to provide named variables as arguments when calling the decorated function. Direct values, literals, or function calls will not work as expected.

  For example, calling `process_data("Alice", 30, "Engineer")` would not work properly because the arguments are passed as values, not named variables. You must use named arguments like in the example `process_data(name, age, occupation)`.
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "argument-names",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "decorator, argument names, Python, type checking",
    "author": null,
    "author_email": "Santiago Papiernik <spapiernik12@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/8c/c5/55ba045c9e0a656f19f370ad62d35fcd04539245ca434c2dc9c3c91d4b33/argument_names-0.1.0a2.tar.gz",
    "platform": null,
    "description": "# Argument Names\n\nA Python library that provides a decorator to automatically retrieve and process the argument names of a function when it's called. This can be useful for tasks like debugging, logging, or other custom operations.\n\n## Installation\n\nInstall argument-names via pip:\n\n```python\npip install argument-names\n```\n\n\n## Use Case Example\nThis example demonstrates how to utilize the argument_names decorator to log the names of the arguments passed to a function:\n```py\nfrom argument_names import argument_names\n\n@argument_names(function=lambda *args: print(\"Received arguments:\", *args))\ndef process_data(_1, _2, _3):\n    pass\n\n# Example invocation\nname = \"Alice\"\nage = 30\noccupation = \"Engineer\"\n\n# Calling the process_data function with the specified arguments\nprocess_data(name, age, occupation)   # Received arguments: name age occupation\n\nprocess_data(occupation, age, age)   # Received arguments: occupation age age\n```\n\n```py\nfrom argument_names import argument_names\n\n@argument_names(function=lambda *args: print(\"\".join(args)))\ndef foo(*args):\n    pass\n\nh = None\ne = 1\nl = 9\no = 3\nw = True\nr = 3.14\nd = 600\n_ = 0.03\n\nfoo(h, e, l, l, o, _, w, o, r, l, d) # hello_world\n```\n\n## Limitations\n\n- The library requires you to provide named variables as arguments when calling the decorated function. Direct values, literals, or function calls will not work as expected.\n\n  For example, calling `process_data(\"Alice\", 30, \"Engineer\")` would not work properly because the arguments are passed as values, not named variables. You must use named arguments like in the example `process_data(name, age, occupation)`.",
    "bugtrack_url": null,
    "license": "MIT License\n         \n         Copyright (c) 2024 Santiago Papiernik\n         \n         Permission is hereby granted, free of charge, to any person obtaining a copy\n         of this software and associated documentation files (the \"Software\"), to deal\n         in the Software without restriction, including without limitation the rights\n         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n         copies of the Software, and to permit persons to whom the Software is\n         furnished to do so, subject to the following conditions:\n         \n         The above copyright notice and this permission notice shall be included in all\n         copies or substantial portions of the Software.\n         \n         THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n         SOFTWARE.",
    "summary": "This decorator dynamically maps argument names from a function's call to a specified function.",
    "version": "0.1.0a2",
    "project_urls": {
        "Repository": "https://github.com/Cxx-mlr/identifiers"
    },
    "split_keywords": [
        "decorator",
        " argument names",
        " python",
        " type checking"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3a049dc9087810907490245f51236b30a0f998039a7ebbb4bd5b4e88115cc7cc",
                "md5": "a52201faddf0c7c2c004cc5e81ed7a08",
                "sha256": "853217a989d38a32c49048d09d86df90313d1ce0abaf31832da2fb80cff44b70"
            },
            "downloads": -1,
            "filename": "argument_names-0.1.0a2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a52201faddf0c7c2c004cc5e81ed7a08",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 4837,
            "upload_time": "2024-10-07T16:59:59",
            "upload_time_iso_8601": "2024-10-07T16:59:59.647827Z",
            "url": "https://files.pythonhosted.org/packages/3a/04/9dc9087810907490245f51236b30a0f998039a7ebbb4bd5b4e88115cc7cc/argument_names-0.1.0a2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8cc555ba045c9e0a656f19f370ad62d35fcd04539245ca434c2dc9c3c91d4b33",
                "md5": "97a152f8a761d3d725b52e663ca42f14",
                "sha256": "156e97034bc1e917b0754533d8a1601ea8568e968fae0c30eb549ffba2a70654"
            },
            "downloads": -1,
            "filename": "argument_names-0.1.0a2.tar.gz",
            "has_sig": false,
            "md5_digest": "97a152f8a761d3d725b52e663ca42f14",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 3686,
            "upload_time": "2024-10-07T17:00:01",
            "upload_time_iso_8601": "2024-10-07T17:00:01.037811Z",
            "url": "https://files.pythonhosted.org/packages/8c/c5/55ba045c9e0a656f19f370ad62d35fcd04539245ca434c2dc9c3c91d4b33/argument_names-0.1.0a2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-07 17:00:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Cxx-mlr",
    "github_project": "identifiers",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "packaging",
            "specs": [
                [
                    "==",
                    "24.1"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    "==",
                    "4.12.2"
                ]
            ]
        }
    ],
    "lcname": "argument-names"
}
        
Elapsed time: 0.86675s