Typed Null support
Project description
nullable
Typed Null support
import typing as t
from dataclasses import dataclass
from nullable import Null, NullType, Nullable, NullableNoneOr
# valid typehints:
val: int | NullType = Null
val: Nullable[int] = Null
val: int | None | NullType = Null
val: NullableNoneOr[int] = Null
# example usage:
@dataclass
class Settings:
is_cool: bool
countdown: t.Optional[int]
def alter(
self,
*,
is_cool: Nullable[bool] = Null,
countdown: NullableNoneOr[int] = Null,
) -> None:
if is_cool is not Null:
self.is_cool = is_cool
if countdown is not Null:
self.countdown = countdown
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
nullable-0.2.0.tar.gz
(1.8 kB
view details)
Built Distribution
File details
Details for the file nullable-0.2.0.tar.gz
.
File metadata
- Download URL: nullable-0.2.0.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1035-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d42011b1634750e1df528a86781f3d0abd92d2aba8211c91a9182880a1753307 |
|
MD5 | fb499d94eeca6754a8b54f68d4ab028a |
|
BLAKE2b-256 | fba0f7c97dcffa9a101b0c733f1c41bd2a43a345892820f6e7f74deb8a46ec4e |
File details
Details for the file nullable-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: nullable-0.2.0-py3-none-any.whl
- Upload date:
- Size: 2.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.8.16 Linux/5.15.0-1035-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3faea4e40fbd0b23080df2bb77113aa6a5d6eaaa148731aab73b1a045b9f35cf |
|
MD5 | 912def4f45aae09d3aa89dbc62b6d8fe |
|
BLAKE2b-256 | d198952254e3c02a462958bb73f725fb48c8fac1a7a0f2df9b79d585e527f72e |