Represent
Installation
$ pip install represent
Automatic Generation
from represent import autorepr
@autorepr
class Rectangle:
def __init__(self, name, color, width, height):
self.name = name
self.color = color
self.width = width
self.height = height
rect = Rectangle('Timothy', 'red', 15, 4.5)
print(rect)
Rectangle(name='Timothy', color='red', width=15, height=4.5)
Declarative Generation
from represent import ReprHelperMixin
class ContrivedExample(ReprHelperMixin, object):
def __init__(self, description, radians, shape, color, miles):
self.description = description
self.degrees = radians * 180 / 3.141592654
self.shape = shape
self._color = color
self.km = 1.60934 * miles
def _repr_helper_(self, r):
r.positional_from_attr('description')
r.positional_with_value(self.degrees * 3.141592654 / 180)
r.keyword_from_attr('shape')
r.keyword_from_attr('color', '_color')
r.keyword_with_value('miles', self.km / 1.60934)
ce = ContrivedExample('does something', 0.345, 'square', 'red', 22)
print(ce)
from IPython.lib.pretty import pprint
pprint(ce)
ContrivedExample('does something', 0.345, shape='square', color='red', miles=22.0)
ContrivedExample('does something',
0.345,
shape='square',
color='red',
miles=22.0)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
represent-2.2.0.tar.gz
(71.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file represent-2.2.0.tar.gz.
File metadata
- Download URL: represent-2.2.0.tar.gz
- Upload date:
- Size: 71.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
403daa7f8360390b84b143b7bf1dd720965a3e93a234994923c7123cc55d5fe1
|
|
| MD5 |
750759bf7d15d49c394c1ab8d0f77905
|
|
| BLAKE2b-256 |
51f0965dfb05568ec7d56cd37b8fc75eb35ed159c0e9a80309019155511046ab
|
Provenance
The following attestation bundles were made for represent-2.2.0.tar.gz:
Publisher:
python-publish.yml on RazerM/represent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
represent-2.2.0.tar.gz -
Subject digest:
403daa7f8360390b84b143b7bf1dd720965a3e93a234994923c7123cc55d5fe1 - Sigstore transparency entry: 2205606180
- Sigstore integration time:
-
Permalink:
RazerM/represent@a620bc583f43851d512747e484fd800df63d2217 -
Branch / Tag:
refs/tags/2.2.0 - Owner: https://github.com/RazerM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a620bc583f43851d512747e484fd800df63d2217 -
Trigger Event:
push
-
Statement type:
File details
Details for the file represent-2.2.0-py3-none-any.whl.
File metadata
- Download URL: represent-2.2.0-py3-none-any.whl
- Upload date:
- Size: 8.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
317db78ccb92cdbd5cd836652b34812385a12610f825d9d950874d2a39fd0f02
|
|
| MD5 |
063d06705f5b8cfd5c6bbff0924023fb
|
|
| BLAKE2b-256 |
835a373677ed4e15b094365c68f6f0e825f972d6b0e2976312b47ac794fcbb34
|
Provenance
The following attestation bundles were made for represent-2.2.0-py3-none-any.whl:
Publisher:
python-publish.yml on RazerM/represent
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
represent-2.2.0-py3-none-any.whl -
Subject digest:
317db78ccb92cdbd5cd836652b34812385a12610f825d9d950874d2a39fd0f02 - Sigstore transparency entry: 2205606497
- Sigstore integration time:
-
Permalink:
RazerM/represent@a620bc583f43851d512747e484fd800df63d2217 -
Branch / Tag:
refs/tags/2.2.0 - Owner: https://github.com/RazerM
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@a620bc583f43851d512747e484fd800df63d2217 -
Trigger Event:
push
-
Statement type: