Skip to main content

Data converter

Install

poetry add totype

or

pip install totype

Examples

Transform value

from totype.fields import Field

value = "1"

field = Field(
    transform_funcs=[
        int, 
        lambda x: x * 100,
        str
    ]
)
valid, new_value = field(value)

assert valid
assert new_value == "100"

Transform rows

import datetime as dt
from totype import fields, RowTransform


transform = RowTransform(
    fields=[
        fields.TextField(),
        fields.IntField(),
        fields.UIntField(),
        fields.FloatField(),
        fields.ArrayField(),
        fields.JSONField(),
        fields.DateTimeField(),
        fields.DateField(),
    ],
    skip_error_rows=False,
    store_rows_with_errors=False,
)
newrow = transform(
    (1, "20", "-100", "500", "[[100]]", '{"100": 100}', "2021-01-01", "2021-01-01")
)
assert newrow == ("1", 20, 0, 500.0, [[100]], {"100": 100}, dt.datetime(2021,1,1), dt.date(2021,1,1))

Metadata

Release files for totype 0.1.0

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

Source distribution (sdist)

Source distribution for totype 0.1.0
File Size Uploaded Provenance
totype-0.1.0.tar.gz 10.9 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 27.4 kB

Release files / totype-0.1.0.tar.gz

Download URL totype-0.1.0.tar.gz
Size 10.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e8d264a6aebe9f6c3d2b3c097ee53226f42192fd9e9a400941298cdb3f651a6a
BLAKE2b-256 checksum
How to use checksums
480805cddb21c3d96b239596325d28f165c5ce5ffe30c223f727f2a72605b3be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.8rc1 Windows/10

Release files / totype-0.1.0-py3-none-any.whl

Download URL totype-0.1.0-py3-none-any.whl
Size 16.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b87a0cf778bedea51efc7d063d2856b47511992f028972cda524971305ee0958
BLAKE2b-256 checksum
How to use checksums
79584d5283d7269ddc2211734098ac6746991502d9191788c8e8fc5bcc900dce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.8rc1 Windows/10

Security for totype 0.1.0

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

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