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

Uploaded Source

Built Distribution

readstr-0.6.0-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: readstr-0.6.0.tar.gz
  • Upload date:
  • Size: 5.1 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.6.0.tar.gz
Algorithm Hash digest
SHA256 a479b5342cbaed1382bfc8b141dddc58b6833869342eaf10c70ea52eec9f90ba
MD5 0017955e3d45f830c4ca1be44512bbd8
BLAKE2b-256 ef5baef397c305a055ab9510097292ccdb28ffcf12d6c0429bddde12428017c7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: readstr-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 7.1 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.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3c8fe8447a300abf83e9254def8e965352c00da83a6513808546c41568b97dbe
MD5 e0ebc6c1405a89fbf7870f769a8c4ec4
BLAKE2b-256 2d204957f3ea5a43f249b56e0cbfb9a5750e14bee68a309747e2c213fef2f55f

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