Python library for managing string types
Project description
Str Types
Python library for managing string types
pip install strtypes
Links
Quick Overview
Define a class that inherits from StrTyped
,
then define any number of StrType
objects, like this:
from strtypes import StrTyped, StrType
class StatusTypes(StrTyped):
active = StrType('active')
hold = StrType('hold')
Example
from strtypes import DjangoStrTyped, StrType
class QTypes(DjangoStrTyped):
radio = StrType("radio", "one from list")
checkbox = StrType("checkbox", "many from list")
user_input = StrType("user_input", "user input")
not_an_strtype = "..."
Here is what you got:
assert QTypes.radio == "radio"
assert "user_input" == QTypes.user_input
assert str(QTypes.checkbox) == "checkbox"
assert len(QTypes.all_strtypes()) == 3
assert len(QTypes.choices_style()) == 3
assert QTypes.choices_style()[0] == ("radio", "one from list")
You may notice that this package comes with DjangoStrTyped which has some special methods for django development.
More examples in examples/
directory
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
strtypes-0.0.2.tar.gz
(2.1 kB
view details)
Built Distribution
File details
Details for the file strtypes-0.0.2.tar.gz
.
File metadata
- Download URL: strtypes-0.0.2.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e26bfd003eb9791502a44326459a7d4d0f104f0138d8752e04b2f567ab8058e2 |
|
MD5 | 261f32973ac01d7f6c9928b270cb1173 |
|
BLAKE2b-256 | 8b35b23e3b7c2a57c2bc1394448591c934a1948fd9924da4e064316456b46cf9 |
File details
Details for the file strtypes-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: strtypes-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fd81751f9b308dd8374b8ae116cb2985585b1477d287dc160d585c128e8dcc8 |
|
MD5 | 135f0bd1470e681599029e68435689d3 |
|
BLAKE2b-256 | 0a7399390fb2ed87f0593000126358cda27b43f44823929aa230b8a8e51df33d |