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
Release history Release notifications | RSS feed
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.2.tar.gz
(8.0 kB
view details)
Built Distribution
File details
Details for the file readstr-0.7.2.tar.gz
.
File metadata
- Download URL: readstr-0.7.2.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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 320b18ca5cc634f16587e3ab5ae95f25d4c1f0e3aabe7427a847ba86628f79ec |
|
MD5 | fe38bcfa41e50bb605511920ad8fc411 |
|
BLAKE2b-256 | a6e8b0d6c2696593cec518daf23e20dc3b348044f85c9c47de66a7ec8b29e08b |
File details
Details for the file readstr-0.7.2-py3-none-any.whl
.
File metadata
- Download URL: readstr-0.7.2-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
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4702bf093acaf00e3bf7f1247ec5bbb8c9440f444621970ee2c24596d8ddc48 |
|
MD5 | 6a8033950472dcf8dfb60b242bc85fa4 |
|
BLAKE2b-256 | f590c4c1526911ea94e88472cdd7ba55fb2e920e34829089aa80085de6306e7e |