Name | lazyrepr JSON |
Version |
0.0.1
JSON |
| download |
home_page | |
Summary | A mixin class for concise object representation |
upload_time | 2024-01-10 18:50:14 |
maintainer | |
docs_url | None |
author | |
requires_python | >=3.8 |
license | |
keywords |
mixin
repr
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# Python mixin class for automatic object representation
This library offers a mixin class `ReprMixin` that implements the `__repr__`
and `_repr_pretty_` methods to represent objects in a concise way.
The implementation is based on the class `__init__` method signature,
and will consider whether its parameters are positional or optional
to construct a representation as succinct as possible.
Positional arguments are represented as values only and
optional arguments are included only when different from their default value.
Please note this is intended to be used on lightweight classes that map arguments to attributes.
Also it will not work with dataclasses that override the `__repr__` method.
## Usage
```python
from lazyrepr import ReprMixin
class MACD(ReprMixin):
def __init__(self, short=12, long=26, signal=9, *, percent=False):
self.short = short
self.long = long
self.signal = signal
self.percent = percent
obj = MACD()
print(obj) # >>> MACD(12, 26, 9)
```
## Examples
Examples notebooks are in the `extras` folder.
## Installation
You can install this package with `pip`.
```console
pip install git+ssh://git@github.com/furechan/lazyrepr.git
```
## Related Projects
- [easyrepr](https://github.com/chrisbouchard/easyrepr)
Python decorator to automatically generate repr strings
Raw data
{
"_id": null,
"home_page": "",
"name": "lazyrepr",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": "",
"keywords": "mixin,repr",
"author": "",
"author_email": "furechan <furechan@xsmail.com>",
"download_url": "",
"platform": null,
"description": "# Python mixin class for automatic object representation\n\nThis library offers a mixin class `ReprMixin` that implements the `__repr__`\nand `_repr_pretty_` methods to represent objects in a concise way.\nThe implementation is based on the class `__init__` method signature,\nand will consider whether its parameters are positional or optional\nto construct a representation as succinct as possible.\nPositional arguments are represented as values only and \noptional arguments are included only when different from their default value.\n\nPlease note this is intended to be used on lightweight classes that map arguments to attributes.\nAlso it will not work with dataclasses that override the `__repr__` method.\n\n\n## Usage\n\n```python\nfrom lazyrepr import ReprMixin\n\nclass MACD(ReprMixin):\n def __init__(self, short=12, long=26, signal=9, *, percent=False):\n self.short = short\n self.long = long\n self.signal = signal\n self.percent = percent\n\nobj = MACD()\nprint(obj) # >>> MACD(12, 26, 9)\n```\n\n## Examples\n\nExamples notebooks are in the `extras` folder.\n\n## Installation\n\nYou can install this package with `pip`.\n\n```console\npip install git+ssh://git@github.com/furechan/lazyrepr.git\n```\n\n## Related Projects\n\n- [easyrepr](https://github.com/chrisbouchard/easyrepr)\nPython decorator to automatically generate repr strings \n",
"bugtrack_url": null,
"license": "",
"summary": "A mixin class for concise object representation",
"version": "0.0.1",
"project_urls": {
"homepage": "https://github.com/furechan/lazyrepr"
},
"split_keywords": [
"mixin",
"repr"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "22cd034c19fa2e21d192707d625d9cc5d174ca8513c1c40a9800df374be6cc30",
"md5": "c4f00f03ad23f13add13e2d8b0ee4fb5",
"sha256": "93408800b721d8cb4688fc2faed1933decf81852614ac3f9e171b6a8541d2496"
},
"downloads": -1,
"filename": "lazyrepr-0.0.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c4f00f03ad23f13add13e2d8b0ee4fb5",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 3445,
"upload_time": "2024-01-10T18:50:14",
"upload_time_iso_8601": "2024-01-10T18:50:14.912378Z",
"url": "https://files.pythonhosted.org/packages/22/cd/034c19fa2e21d192707d625d9cc5d174ca8513c1c40a9800df374be6cc30/lazyrepr-0.0.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-10 18:50:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "furechan",
"github_project": "lazyrepr",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "lazyrepr"
}