Python 3.7 helper tool to work with mapping of dataclasses.
It allow automapping a dataclass attributes
from automapping import Mapper, Rename
@dataclass
class InnerA:
number: int
list_of_values: List[str]
untyped_list: list
@dataclass
class A:
name: str
id_a: int
inner: InnerA
@dataclass
class InnerB:
number: int
list_of_values: List[str]
untyped_list: list
@dataclass
class B:
name: str
id_b: int
inner: InnerB
mapper = Mapper()
mapper.add_mapper(AutoMap(A, B, [
Rename('id_a', 'id_b')
]))
mapper.add_mapper(AutoMap(InnerA, InnerB))
input_a = A(name='Paul', id_a=6, inner=InnerA(
number=10, list_of_values=['a', 'b'], untyped_list=[1, True]))
result = mapper.map(input_a, B, ObjectDictTypeUpdater)
print(result) # B(name='Paul', id_b=6, inner=InnerB(number=10, list_of_values=['a', 'b'], untyped_list=[1, True]))
Metadata
Release files for automapping 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| automapping-0.0.1.tar.gz | 7.8 kB | Without provenance | Details for automapping-0.0.1.tar.gz |
Release files / automapping-0.0.1.tar.gz
| Download URL | automapping-0.0.1.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60bfcf94d704c24a2e001b8aa8dacf42c48c256985db4a18908d52ed237dc8b8
|
|
BLAKE2b-256 checksum How to use checksums |
960dba8b0e35791774d6e87ac6bbceb8707cbaabe3ee961241cdd4096182cb7c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.3
|
Security for automapping 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.