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.3.0.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file readstr-0.3.0.tar.gz
.
File metadata
- Download URL: readstr-0.3.0.tar.gz
- Upload date:
- Size: 4.4 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 710baa53be1822fd1aeb782f415046c34e96ed75247da8670dc29745facd9703 |
|
MD5 | 1d1343efe95d7ff6963c66736d4f4340 |
|
BLAKE2b-256 | e23e6a7687949e97cdf6f04967c9a5d3939c396dfa8ad8266c19db74e22f7621 |
File details
Details for the file readstr-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: readstr-0.3.0-py3-none-any.whl
- Upload date:
- Size: 5.9 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
Algorithm | Hash digest | |
---|---|---|
SHA256 | 695ac26351855b72018c51eed2368519175484be06124b047ab30cbd269e14e9 |
|
MD5 | d60b26b1f442314f909ea8cdcd4e554c |
|
BLAKE2b-256 | b65c7462abbae3e0014c400c14bb91863ee95019ada07731870c7d02ed022e15 |