Hints your function with an existing one.
Project description
hintwith
Hints your function with an existing one.
Installation
$ pip install hintwith
Usage
Use hintwith()
to hint a function with another function:
>>> from hintwith import hintwith
>>> def a(x: int, y: int, z: int = 0) -> int:
... """Sums x, y and z."""
... return x + y + z
...
>>> @hintwith(a)
... def b(*args, **kwargs) -> float:
... return float(a(*args, **kwargs))
...
Also, there is hintwithmethod()
to hint the function with a method rather than a direct callable.
See Also
Github repository
PyPI project
License
This project falls under the BSD 3-Clause License.
History
v0.1.4
- Renamed the positional argument
__is_method=
to__hint_returntype=
for the avoidance of ambiguity.
v0.1.3
- Removed the positional argument
__is_method=
fromhintwith()
andhintwithmethod()
; added a new positional argument__hint_returns=
to them.
v0.1.2
- Updated comments.
v0.1.1
- New optional parameter for
hintwith()
andhintwithmethod()
:__is_method
: determines whether the function to get hinted is a method.
v0.1.0
- Initial release.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file hintwith-0.1.4-py2.py3-none-any.whl
.
File metadata
- Download URL: hintwith-0.1.4-py2.py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.8.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 72e69dc10582c2845e544adba7638dc4f796d2d6a29cdc57608c1748d40bafbb |
|
MD5 | ca963c4cd0bdc1799b42959ff81c14e7 |
|
BLAKE2b-256 | ccab21a39adc76ee95d71a410f071ad2759d466d4971f98ff4535bb422f6a052 |