Skip to main content

objectmapper

A small module for mapping between object types.

Installation

objectmapper requires Python >= 3.6 because it relies on modern type annotations.

pip install objectmapper

Example

>>> import objectmapper
>>> mapper = objectmapper.ObjectMapper()
>>> # One-to-one mappings
>>> def int_to_str(i: int) -> str:
...     return str(i)
>>> mapper.create_map(int, str, int_to_str)
>>> mapper.map(42, str)
'42'
>>> # Many-to-one mappings
>>> def int_float_to_str(i: int, f: float) -> str:
...     return str(i + f)
>>> mapper.create_map((int, float), str, int_float_to_str)
>>> mapper.map((42, 42.5), str)
'84.5'

Metadata

Release files for objectmapper 0.0.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for objectmapper 0.0.7
File Size Uploaded
objectmapper-0.0.7.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for objectmapper 0.0.7
File Interpreter ABI Platform
objectmapper-0.0.7-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / objectmapper-0.0.7.tar.gz

Download URL objectmapper-0.0.7.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
598dcf97a4370313bbce32fadbfbcfdbd447746f30ae170211eb5c0659401faf
BLAKE2b-256 checksum
How to use checksums
81474596c2b8fcab27017aaf7d2e743c3d7510c2f94aa73157a453f9b46e796f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

Release files / objectmapper-0.0.7-py3-none-any.whl

Download URL objectmapper-0.0.7-py3-none-any.whl
Size 6.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2e47cd9168206295e0a93c703bcd9801d98c19aea9af93eb8547170be64f751a
BLAKE2b-256 checksum
How to use checksums
f7d429d9543996cb487e60f58410e1e45d3fd0bb29727194ddb7a997059db11b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.0.7 This release

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page