Skip to main content

Read Strings

Project description

readstr

Provides readstr, a function that can read a lot of different types from strings:

from readstr import readstr
import typing
import uuid

readstr('1,2,3', typing.Set[int])
readstr('foo=3,bar=10', typing.Dict[str, int])
readstr('vUfDOuQwRVavn3_QjMxp7Q', uuid.UUID)

Useful for reading arguments from command line arg, from environment variables, etc.

Extensible

from dataclasses import dataclass
from typing import List
from readstr import readstr, reads

@dataclass
class Path:
    path: str

@reads
def read_path(str_value: str) -> Path:
    return Path(str_value)

readstr('file://a,file://b', List[Path])

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

readstr-0.2.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

readstr-0.2.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file readstr-0.2.2.tar.gz.

File metadata

  • Download URL: readstr-0.2.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for readstr-0.2.2.tar.gz
Algorithm Hash digest
SHA256 9740004c73758fef69a47eb56359c281f6e5ad727063938332998e9383e47324
MD5 ba8aa0e415530b990c3b357cc9707446
BLAKE2b-256 a298fdadc2f43be3c5ee66eda307f4a5cde304bb391cdda77e31706df6c9e7d2

See more details on using hashes here.

File details

Details for the file readstr-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: readstr-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for readstr-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a34d5cd758dcf07cc4410adc99ca48d3d671618996b672613aba064f64e450f6
MD5 4b4f4769c07df88b08c4cbde700cafcb
BLAKE2b-256 c6d8a83c83c3d95e08b8f311ce664628d1e64b60d180f2c1e3337bf4191c9adc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page