hup.base.check module¶
Check types and values of objects.
-
has_attr
(obj: object, attr: str) → None¶ Check if object has an attribute.
-
has_opt_type
(name: str, obj: object, hint: Generic[T]) → None¶ Check type of optional object.
-
has_size
(name: str, obj: Sized, size: Optional[int] = None, min_size: Optional[int] = None, max_size: Optional[int] = None) → None¶ Check the size of a sized object.
-
has_type
(name: str, obj: object, hint: Generic[T]) → None¶ Check type of object.
-
is_callable
(name: str, obj: object) → None¶ Check if object is callable.
-
is_class
(name: str, obj: object) → None¶ Check if object is a class.
-
is_identifier
(name: str, string: str) → None¶ Check if a string is a valid identifier.
-
is_negative
(name: str, obj: Union[int, float]) → None¶ Check if number is negative.
-
is_not_negative
(name: str, obj: Union[int, float]) → None¶ Check if number is not negative.
-
is_not_positive
(name: str, obj: Union[int, float]) → None¶ Check if number is not positive.
-
is_positive
(name: str, obj: Union[int, float]) → None¶ Check if number is positive.
-
is_subclass
(name: str, obj: object, ref: Type[Any]) → None¶ Check if object is a subclass of given class.
-
is_subset
(a: str, seta: set, b: str, setb: set) → None¶ Check if a set is a subset of another.
-
is_typehint
(name: str, obj: object) → None¶ Check if object is a supported typeinfo object.
-
no_dublicates
(name: str, coll: Collection[T_co]) → None¶ Check if all elements of a collection are unique.
-
not_empty
(name: str, obj: Sized) → None¶ Check if a sized object is not empty.