A way to hijack python methods and functions and attach callbacks or alter functionality.
Project description
The pyjack contains two basic functions – pyjack.connect and pyjack.disconnect – which allow you to connect to other functions and methods. This can be used to:
attach observers or callbacks to functions/methods: Connect a callback ‘observer’ functions to be called whenever the pyjacked function is called. The callback is called with both the original arguments and the pyjacked function.
filter function/method arguments: A filter function can be provided which is used to alter the arguments passed to the function.
entirely replace existing function/method with your own function/method: pyjack allows you to ‘block’ the original function being called. In essence, this allows you to use pyjack to replace a function with your own callback (or filter) function.
Simple Example: Adding Callbacks To Functions
pyjack can be used to connect callbacks to functions:
import pyjack
def max_callback(input, pyjack_org_fn):
print 'Someone is trying to max ' + str(input)
print 'Also got some pyjack_org_fn ' + str(pyjack_org_fn)
pyjack.connect(max, callback = max_callback, filter = None, block = False)
print max([10, 20])
# When you are done, disconnect and everything is back to normal ...
pyjack.disconnect(max, callback = max_callback, filter = None, block = False)
More Uses
For more information …
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyjack-0.0.1.zip.
File metadata
- Download URL: pyjack-0.0.1.zip
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1d52cd22177863a1711801a6dd6900151e6149ae9fa4706a5be7ef25cfccdbf
|
|
| MD5 |
9a40569f659a982a8105dbac2b87ff5d
|
|
| BLAKE2b-256 |
05bb6dfe0e392bc0c1f1cfbd58e33a7e919906a98dee39affa46ec3e5744993e
|
File details
Details for the file pyjack-0.0.1.win32-py2.6.exe.
File metadata
- Download URL: pyjack-0.0.1.win32-py2.6.exe
- Upload date:
- Size: 201.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bbe3eb331130031dfb5606418d1a5ab16d0b5d6f8b4712014cf48177d307dd7
|
|
| MD5 |
8986a293e944762e41c263d429311c17
|
|
| BLAKE2b-256 |
69fdf51a1b13e2593a613f9809ad120a9302df89e495db45542ec55335773b09
|
File details
Details for the file pyjack-0.0.1.win32-py2.5.exe.
File metadata
- Download URL: pyjack-0.0.1.win32-py2.5.exe
- Upload date:
- Size: 67.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b416cc097a151203adad28396d1d29e4aac2d7556c47882aa4f7fe45f0a0632e
|
|
| MD5 |
035883f0597c88eb5d7a668f737c1c09
|
|
| BLAKE2b-256 |
3b15db76fedc2f858a3d53f197d42f6dad856dfdc15ca0a7efaf865538f786ff
|
File details
Details for the file pyjack-0.0.1.win32-py2.4.exe.
File metadata
- Download URL: pyjack-0.0.1.win32-py2.4.exe
- Upload date:
- Size: 67.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a437c40923ff361b95168f9149142d830518ec33f76d8ba730aa3421c6a80da7
|
|
| MD5 |
80f9ab630dd7c4992a54196a42e59783
|
|
| BLAKE2b-256 |
cadad7ca9e2ac178d9825f656ddc39ed64390c738a5fa635e4267558cf0f1f64
|
File details
Details for the file pyjack-0.0.1-py2.6.egg.
File metadata
- Download URL: pyjack-0.0.1-py2.6.egg
- Upload date:
- Size: 5.3 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8c2dbe0742bd15a9a2d6c51255f2c0bb3a2d1ef087d30bfad7e6466430528033
|
|
| MD5 |
58f5e21a502f635fcd8809ca089683db
|
|
| BLAKE2b-256 |
f9d765794a1b9ad36eb379437c8a2863e726813ef4af6ef5490dd588f4bd836a
|
File details
Details for the file pyjack-0.0.1-py2.5.egg.
File metadata
- Download URL: pyjack-0.0.1-py2.5.egg
- Upload date:
- Size: 5.3 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7405d62bfc0cf8a7ce1cceecb34b17b3db2367f2b6475e0fa92f961975bd130d
|
|
| MD5 |
6f69aff7edc35dee743c39f671f5c23d
|
|
| BLAKE2b-256 |
0992227b67bad4cd366abcb19f94b3c71f3a816512d1e0630ebf12f33083edaf
|
File details
Details for the file pyjack-0.0.1-py2.4.egg.
File metadata
- Download URL: pyjack-0.0.1-py2.4.egg
- Upload date:
- Size: 5.3 kB
- Tags: Egg
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab95f7f60f2247abec6267d877633a3fba900ef0c844a37c36a83b79fa8c62a0
|
|
| MD5 |
872369c9c7e802555fca2387a4c9000f
|
|
| BLAKE2b-256 |
6a67f828795a19a68e7edcb1b057513fcd840fb83b9ab817b9ebd89777a2ffb8
|