mirror of
https://github.com/ets-labs/python-dependency-injector.git
synced 2024-11-25 19:14:00 +03:00
c4b33749d2
* Update callable provider docs * Update coroutine provider docs * Edit object docs * Edit list provider docs * Edit configuration provider docs * Edit selector provider docs * Fix mypy stub of the ``DeclarativeContainer`` to specify the ``__init__`` interface * Edit Dependency provider docs
19 lines
431 B
Python
19 lines
431 B
Python
"""`Callable` provider example."""
|
|
|
|
import passlib.hash
|
|
|
|
from dependency_injector import providers
|
|
|
|
|
|
password_hasher = providers.Callable(
|
|
passlib.hash.sha256_crypt.hash,
|
|
salt_size=16,
|
|
rounds=10000,
|
|
)
|
|
password_verifier = providers.Callable(passlib.hash.sha256_crypt.verify)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
hashed_password = password_hasher('super secret')
|
|
assert password_verifier('super secret', hashed_password)
|