semvec/pypi-packages huggingface dataset:
unwrap-basemodel-fields 0.5.2
Unwrapper stores a Result object to implement unpacking of values if they are not None. The BaseModel object is also a little extended to work with the Result object.
License: MIT
Requires Python: >=3.8,<4.0
Keywords: python,uwrapping,optional handle,basemodel fields

# :recycle: Unwrapper pydantic optional fields :recycle:


Unwrapper stores a **Result** object to implement unpacking of values if they are not **None**. The **BaseModel** object is also a little extended to work with the **Result** object.


[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![pypi](https://img.shields.io/pypi/v/unwrap_basemodel_fields.svg)](https://pypi.python.org/pypi/unwrap_basemodel_fields)
[![versions](https://img.shields.io/pypi/pyversions/unwrap_basemodel_fields.svg)](https://github.com/luwqz1/unwrap_basemodel_fields)
[![license](https://img.shields.io/github/license/luwqz1/unwrap_basemodel_fields.svg)](https://github.com/luwqz1/unwrap_basemodel_fields/blob/main/LICENSE)


# :star: A simple example :star:
```python
from unwrapper import BaseModel, Result

class User(BaseModel):
    name: Result[str]
    age: int

data = {
    "age": 20
}
user = User(**data)
#> User(name=Result(None), age=20)
print("Hello", user.name.unwrap(error_msg="What's your name?"), "!")
#> ValueError: What's your name?
```

# :book: Documentation :book:
* In :ru: [**Russian**](https://github.com/luwqz1/unwrap_basemodel_fields/blob/main/docs/RU.md) :ru:
* In :us: [**English**](https://github.com/luwqz1/unwrap_basemodel_fields/blob/main/docs/EN.md) :us: