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

Uploaded Source

Built Distribution

readstr-0.7.3-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: readstr-0.7.3.tar.gz
  • Upload date:
  • Size: 8.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.62.2 CPython/3.8.5

File hashes

Hashes for readstr-0.7.3.tar.gz
Algorithm Hash digest
SHA256 33101be5f027ff8b5ecee31e283c4725995de18fb0b6515dece02fda32e15521
MD5 bb0f0c989d8eb0b82d2ecaeb812c4a4c
BLAKE2b-256 33dd00b54ee89933dd1ef80b9386d90acbf13aae608388ad00d330a808fb1af6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: readstr-0.7.3-py3-none-any.whl
  • Upload date:
  • Size: 8.6 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.62.2 CPython/3.8.5

File hashes

Hashes for readstr-0.7.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f12b00a7fbba7d000d60080f4e56332281c9c58684af8f1486a7fdfe3bf6c95e
MD5 8795d53f4dbbe6f1fb39c60522e2a1e7
BLAKE2b-256 8932ca965cc5118985cfb5bbd7a8c23df719e55e99662378ac456f41476e68f1

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