fishhook-extended-0.0.2
توضیحات
Extended: Allows for runtime hooking of static class functions AND other type slots
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | fishhook-extended-0.0.2 |
| نام | fishhook-extended |
| نسخه کتابخانه | 0.0.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Crowthebird |
| ایمیل نویسنده | nohackingofkrowten@gmail.com |
| آدرس صفحه اصلی | https://github.com/thatbirdguythatuknownot/fishhook-extended |
| آدرس اینترنتی | https://pypi.org/project/fishhook-extended/ |
| مجوز | - |
# Fishhook Extended
This module allows for swapping out the slot pointers contained in static
classes with the **generic** slot pointers used by python for heap classes.
This allows for assigning arbitrary python functions to static class dunders
using *hook* and *hook_cls* and for applying new functionality to previously
unused dunders. A hooked static dunder can be restored to original
functionality using the *unhook* function
Extended from [fishhook](https://pypi.org/project/fishhook/) by [chilaxan](https://github.com/chilaxan)
# Calling original methods
`orig(self, *args, **kwargs)` is a special function that looks up the original implementation of a hooked dunder in the methods cache. It will only work properly when used inside a hooked method where an original implementation existed
Extended: `orig` also now looks up the original attribute of a hooked type slot in the attributes cache. Can work anywhere, provided it is given the hooked class.
### hooking single methods
```py
@hook(int)
def __add__(self, other):
...
return orig(self, other)
```
### hooking multiple methods
```py
@hook_cls(int)
class int_hook:
attr = ...
def __add__(self, other):
...
```
### Extended: hooking type slots
```py
int_dict_hook = {'a': 3}
hook(int, '__dict__')(int_dict_hook)
```
#### Links
[Github](https://github.com/thatbirdguythatuknownot/fishhook)
[PyPi](https://pypi.org/project/fishhook-extended/)
نحوه نصب
نصب پکیج whl fishhook-extended-0.0.2:
pip install fishhook-extended-0.0.2.whl
نصب پکیج tar.gz fishhook-extended-0.0.2:
pip install fishhook-extended-0.0.2.tar.gz