Non-empty string
Project description
nonemptystr
Non-empty string.
Usage
pip install nonemptystr
from nonemptystr import EmptyString, nonemptystr
name: nonemptystr = nonemptystr("John")
try:
name = nonemptystr("")
except EmptyString:
print("The name is empty.")
... with pydantic
pip install nonemptystr, pydantic
from nonemptystr import nonemptystr
from pydantic import BaseModel, ValidationError
class Request(BaseModel):
user_id: nonemptystr
try:
request = Request.model_validate({"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-1.0.0.tar.gz
(2.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nonemptystr-1.0.0.tar.gz.
File metadata
- Download URL: nonemptystr-1.0.0.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.3 Darwin/23.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
928537e23c395d48da4334ff3cb476d6f996b058233801928759e3d15b51ddb3
|
|
| MD5 |
a81d5344b2a921b7882c35d304a67953
|
|
| BLAKE2b-256 |
aba3e9e080f43fc80c7afd6af783aff27d9330002867d05264e7d92d409f761d
|
File details
Details for the file nonemptystr-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nonemptystr-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.11.3 Darwin/23.2.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a96b2dc347548c3b113c975de3a30d7e1badd87634d72e144b0ffba00f45538f
|
|
| MD5 |
fc1e56fd7c79b5275de66d4bd852a03a
|
|
| BLAKE2b-256 |
9a9bb749092d60ce48c30f670b94bf105553f65edab4c0e68fd3a9a7324b9e7a
|