# nonemptystr
[![PyPI](https://img.shields.io/pypi/v/nonemptystr)](https://pypi.org/project/nonemptystr/)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nonemptystr)](https://pypi.org/project/nonemptystr/)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![license](https://img.shields.io/github/license/nekonoshiri/nonemptystr)](https://github.com/nekonoshiri/nonemptystr/blob/main/LICENSE)
Non-empty string.
## Usage
```sh
pip install nonemptystr
```
```Python
from nonemptystr import EmptyString, nonemptystr
name: nonemptystr = nonemptystr("John")
try:
name = nonemptystr("")
except EmptyString:
print("The name is empty.")
```
### ... with [pydantic](https://github.com/pydantic/pydantic)
```sh
pip install nonemptystr, pydantic
```
```Python
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`.
Raw data
{
"_id": null,
"home_page": "https://github.com/nekonoshiri/nonemptystr",
"name": "nonemptystr",
"maintainer": "Shiri Nekono",
"docs_url": null,
"requires_python": ">=3.8.1",
"maintainer_email": "gexira.halen.toms@gmail.com",
"keywords": "str",
"author": "Shiri Nekono",
"author_email": "gexira.halen.toms@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ab/a3/e9e080f43fc80c7afd6af783aff27d9330002867d05264e7d92d409f761d/nonemptystr-1.0.0.tar.gz",
"platform": null,
"description": "# nonemptystr\n\n[![PyPI](https://img.shields.io/pypi/v/nonemptystr)](https://pypi.org/project/nonemptystr/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/nonemptystr)](https://pypi.org/project/nonemptystr/)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n[![license](https://img.shields.io/github/license/nekonoshiri/nonemptystr)](https://github.com/nekonoshiri/nonemptystr/blob/main/LICENSE)\n\nNon-empty string.\n\n## Usage\n\n```sh\npip install nonemptystr\n```\n\n```Python\nfrom nonemptystr import EmptyString, nonemptystr\n\nname: nonemptystr = nonemptystr(\"John\")\n\ntry:\n name = nonemptystr(\"\")\nexcept EmptyString:\n print(\"The name is empty.\")\n```\n\n### ... with [pydantic](https://github.com/pydantic/pydantic)\n\n```sh\npip install nonemptystr, pydantic\n```\n\n```Python\nfrom nonemptystr import nonemptystr\nfrom pydantic import BaseModel, ValidationError\n\nclass Request(BaseModel):\n user_id: nonemptystr\n\ntry:\n request = Request.model_validate({\"user_id\": \"\"})\n print(f\"user_id: {request.user_id}\")\nexcept ValidationError:\n print(\"user_id is empty\")\n```\n\n## API\n\n### Module `nonemptystr`\n\n#### *class* `nonemptystr(obj: object)`\n\nSubclass of `str`.\nRaise `EmptyString` exception if `str(obj)` is empty string.\n\n#### *class* `EmptyString`\n\nSubclass of `ValueError`.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Non-empty string",
"version": "1.0.0",
"project_urls": {
"Documentation": "https://github.com/nekonoshiri/nonemptystr",
"Homepage": "https://github.com/nekonoshiri/nonemptystr",
"Repository": "https://github.com/nekonoshiri/nonemptystr"
},
"split_keywords": [
"str"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9a9bb749092d60ce48c30f670b94bf105553f65edab4c0e68fd3a9a7324b9e7a",
"md5": "fc1e56fd7c79b5275de66d4bd852a03a",
"sha256": "a96b2dc347548c3b113c975de3a30d7e1badd87634d72e144b0ffba00f45538f"
},
"downloads": -1,
"filename": "nonemptystr-1.0.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fc1e56fd7c79b5275de66d4bd852a03a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8.1",
"size": 3585,
"upload_time": "2024-01-06T09:01:23",
"upload_time_iso_8601": "2024-01-06T09:01:23.149625Z",
"url": "https://files.pythonhosted.org/packages/9a/9b/b749092d60ce48c30f670b94bf105553f65edab4c0e68fd3a9a7324b9e7a/nonemptystr-1.0.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aba3e9e080f43fc80c7afd6af783aff27d9330002867d05264e7d92d409f761d",
"md5": "a81d5344b2a921b7882c35d304a67953",
"sha256": "928537e23c395d48da4334ff3cb476d6f996b058233801928759e3d15b51ddb3"
},
"downloads": -1,
"filename": "nonemptystr-1.0.0.tar.gz",
"has_sig": false,
"md5_digest": "a81d5344b2a921b7882c35d304a67953",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8.1",
"size": 2768,
"upload_time": "2024-01-06T09:01:24",
"upload_time_iso_8601": "2024-01-06T09:01:24.871629Z",
"url": "https://files.pythonhosted.org/packages/ab/a3/e9e080f43fc80c7afd6af783aff27d9330002867d05264e7d92d409f761d/nonemptystr-1.0.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-06 09:01:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "nekonoshiri",
"github_project": "nonemptystr",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "nonemptystr"
}