Non-empty string
Project description
nonemptystr
Non-empty string.
Usage
from nonemptystr import EmptyString, nonemptystr
name: nonemptystr = nonemptystr("John")
try:
name = nonemptystr("")
except EmptyString:
print("The name is empty.")
... with pydantic
from nonemptystr import nonemptystr
from pydantic import BaseModel, ValidationError
class Request(BaseModel):
user_id: nonemptystr
try:
request = Request.parse_obj({"user_id": ""})
print(f"user_id: {request.user_id}")
except ValidationError:
print("user_id is empty")
API
Module nonemptystr
class nonemptystr(obj: object)
Subclass of str
.
Raise EmptyString
exception if str(obj)
is empty string.
class EmptyString
Subclass of ValueError
.
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
nonemptystr-0.2.0.tar.gz
(2.9 kB
view hashes)
Built Distribution
Close
Hashes for nonemptystr-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eef0a3f5f93e4a86e2699a308e71af3363cdef041de757a9d196022d26966cbb |
|
MD5 | 5599c9917421abcab0d0b7b61e79d05b |
|
BLAKE2b-256 | 283655b1a026ebc434fabe484b5f892a65b506b5dcbc1f8236c3949b492202f7 |