I'm trying to specify a type hinting for every function in my code. How I can specify the type hinting for a function which waiting for any pydantic schema (model)?
Here is my code:
def hash_password(password: str, schema = None) -> str:
if schema:
del schema.password if hasattr(schema, 'password') else None
return config.pwd_context.hash(password)
Example model:
my_schema = schemas.UserBase(full_name='a b c') # just a text
type(my_schema) # <class 'app.schemas.UserBase'>