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

Uploaded Source

Built Distribution

readstr-0.7.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: readstr-0.7.0.tar.gz
  • Upload date:
  • Size: 5.9 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.0.tar.gz
Algorithm Hash digest
SHA256 c1dc5e327a8cb990abbd84fda2a7af11c8a2f2583f4ee488498c2d419f1dd3a6
MD5 2934c9047f4be238a36f697f507a6802
BLAKE2b-256 0d40eac10bbbd807dad9c41c474029903ea7c59ad5b7e06d35a8e2f4ff00e2ca

See more details on using hashes here.

File details

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

File metadata

  • Download URL: readstr-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 8.3 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 841e437aeab093c858529efa9a7f00e3ccc953cc4b4cf9bc14d9dd4020816be7
MD5 bd25e5be8a477cc333df1cc166f41b2b
BLAKE2b-256 5ce01d7ef181efebb3422da8dc5faeabb909187146f6dba962088ff7c2859309

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