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.7.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

readstr-0.7.1-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: readstr-0.7.1.tar.gz
  • Upload date:
  • Size: 6.0 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.7.1.tar.gz
Algorithm Hash digest
SHA256 12a35e0e1d5489eb298a623f8b1de07ff54f0945c89a9986df62e96a187ba614
MD5 e1c0a0455d6a9c546e5fab58176202b1
BLAKE2b-256 29822cbe6646cf1a009dc3aaeaf1479b36fa70f20e0466f074a9b757cc6257c6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: readstr-0.7.1-py3-none-any.whl
  • Upload date:
  • Size: 8.4 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.7.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dc2540b80380f67a8df832e0f75d625df53f6d7b7c5d102a21ac116bba5bac84
MD5 bab69320b2339a4fc20cda47c882e880
BLAKE2b-256 f0884fee312fb0e3f9043dbc9affef166a1cfaf73fca50c7a392dd459efd77f5

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