Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions pysmt/typeguard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
from typing import Optional
from typing_extensions import TypeGuard
from pysmt.typing import (
PySMTType,
_BoolType,
_RealType,
_IntType,
_BVType,
_ArrayType,
_StringType,
_FunctionType,
_TypeDecl,
)


def is_bool_type(type: "PySMTType") -> TypeGuard["_BoolType"]:
return type.is_bool_type()


def is_real_type(type: "PySMTType") -> TypeGuard["_RealType"]:
return type.is_real_type()


def is_int_type(type: "PySMTType") -> TypeGuard["_IntType"]:
return type.is_int_type()


def is_bv_type(type: "PySMTType", width: Optional[int] = None) -> TypeGuard["_BVType"]:
return type.is_bv_type(width)


def is_array_type(type: "PySMTType") -> TypeGuard["_ArrayType"]:
return type.is_array_type()


def is_string_type(type: "PySMTType") -> TypeGuard["_StringType"]:
return type.is_string_type()


def is_function_type(type: "PySMTType") -> TypeGuard["_FunctionType"]:
return type.is_function_type()


def is_custom_type(type: "PySMTType") -> TypeGuard["_TypeDecl"]:
return type.custom_type
Loading