Skip to main content

Fishhook

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

it is possible to hook descriptors using hook.property, and an example can be seen below

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

hooking single methods

@hook(int)
def __add__(self, other):
  ...
  return orig(self, other)

hooking multiple methods

@hook.cls(int)
class int_hook:
  attr = ...

  def __add__(self, other):
    ...

hooking descriptors

@hook.property(int)
def imag(self):
  ...
  return orig.imag

Github

PyPi

Metadata

Release files for fishhook 0.2.8.post10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fishhook 0.2.8.post10
File Size Uploaded Provenance
fishhook-0.2.8.post10.tar.gz 8.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fishhook 0.2.8.post10
File Interpreter ABI Platform
fishhook-0.2.8.post10-py3-none-any.whl Python 3 none any Details

Total release size: 22.3 kB

Release files / fishhook-0.2.8.post10.tar.gz

Download URL fishhook-0.2.8.post10.tar.gz
Size 8.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ca74f84fd380c3f3ead47405405ef355343a9ebacf4f5d14043576c8294359b7
BLAKE2b-256 checksum
How to use checksums
a76ca9f5c93f5074c704ff7d3ad8902f9cc531e87d02a5388edf38df63ed5b80
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.8

Release files / fishhook-0.2.8.post10-py3-none-any.whl

Download URL fishhook-0.2.8.post10-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
890b1d8b618bd49fda13e3aa851acbfa35cbc013439327cbd2bf9be3cb0ff7f7
BLAKE2b-256 checksum
How to use checksums
c831470706d8417d5da83234b839d68a91dc1e853dd3c838db2868b9bc446d33
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.8

Security for fishhook 0.2.8.post10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page