mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
add NonPositive/NonNegative Int/Float (#1987)
fix #1975 * add NonPositive/NonNegative Int/Float * delete data.json file
This commit is contained in:
@@ -6,6 +6,10 @@ from pydantic import (
|
||||
NegativeInt,
|
||||
PositiveFloat,
|
||||
PositiveInt,
|
||||
NonNegativeFloat,
|
||||
NonNegativeInt,
|
||||
NonPositiveFloat,
|
||||
NonPositiveInt,
|
||||
conbytes,
|
||||
condecimal,
|
||||
confloat,
|
||||
@@ -29,12 +33,16 @@ class Model(BaseModel):
|
||||
mod_int: conint(multiple_of=5)
|
||||
pos_int: PositiveInt
|
||||
neg_int: NegativeInt
|
||||
non_neg_int: NonNegativeInt
|
||||
non_pos_int: NonPositiveInt
|
||||
|
||||
big_float: confloat(gt=1000, lt=1024)
|
||||
unit_interval: confloat(ge=0, le=1)
|
||||
mod_float: confloat(multiple_of=0.5)
|
||||
pos_float: PositiveFloat
|
||||
neg_float: NegativeFloat
|
||||
non_neg_float: NonNegativeFloat
|
||||
non_pos_float: NonPositiveFloat
|
||||
|
||||
short_list: conlist(int, min_items=1, max_items=4)
|
||||
short_set: conset(int, min_items=1, max_items=4)
|
||||
|
||||
Reference in New Issue
Block a user