A Lite Package focuses on making overwrite and mending functions easier and more flexible.

Overview

Overwrite

Make Overwrite More flexible In Python

Build Status

A Lite Package focuses on making overwrite and mending functions easier and more flexible. Certain Method performs differently in Certain Condition in an event queue. Certainly used for mending or expanding finished Projects without modifying existed Codes.

  • No Origin Codes Changes, Injection with Licenses
  • None Invasive Embed Way, More Flexible
  • Easy to use

Package Related

Package ast, inspect, functools Used in Package.

Installation

https://pypi.org/project/Overwrite/0.0.9/

Overwrite requires Python 3.6+ to run.

Simply install with one-line pip command.

pip install Overwrite

How to Use

Set a license Any type of Cipher-text is satisfactory. Set int 0 as example.

_license = 0

Defined function Mending function, used for overwrite previous method.

def func():
    return

Register Function to Event queue.

  1. Event_queue_type (string): Register with the same Event_queue_type will be added to the same event queue (in registration order).
  2. times (integer): The times this function calling is affected. (if affected forever, set times to -1)
  3. __license (any)_: Used to identify whether the modification is valid and distinguish between different overwrite events.
  4. func (function): Mending function, used for overwriting.
Overwrite = Overwrite()
Overwrite.Butler.register('Register_type', times, _license, func)
# Add overwrite entrance to function
@Overwrite.entrance(catalog='Register_type')
def affected_func():
    return

Add the License Claim If the license is valid, the registered function affected_func will be modified and completely overwritten by func.

# Claim above where the function is Called
Overwrite.claim(_license)
affected_func()

The Performance above is same as:

func()

Features

Complex Overwrite

Overwrite.Butler.register('Event_queue_type_A', 1, license_A, func_A)
Overwrite.Butler.register('Event_queue_type_A', 2, license_B, func_B)
Overwrite.Butler.register('Event_queue_type_B', 1, license_B, func_C)
def func_A():
    print('1')
    return
def func_B():
    print('2')
    return
def func_C():
    print('3')
    return
@Overwrite.entrance(catalog='Event_queue_type_A')
def affected_func_A():
    print('A')
    return
@Overwrite.entrance(catalog='Event_queue_type_B')
def affected_func_B():
    print('B')
    return

Different license claiming leads to different way of overwriting. After several times calling set before, the performance of modified function will change back to origin again as a result of event queue gets empty. The program works as below:

@Overwrite.claim(license_B)
affected_func_A() # Output: 2
@Overwrite.claim(license_A)
affected_func_A() # Output: 1
@Overwrite.claim(license_B)
affected_func_A() # Output: 2
@Overwrite.claim(license_A)
affected_func_A() # Output: A
@Overwrite.claim(license_B)
affected_func_A() # Output: A
@Overwrite.claim(license_B)
affected_func_B() # Output: 3
@Overwrite.claim(license_B)
affected_func_B() # Output: B

Get Catalog Name and Available Licenses of Original Function

Overwrite.Butler.get(affected_func)
-> dict {'catalog_name': str, 'available_license': list[str]}

Browse the Event Queue

Print details for Event Queue:

Overwrite.Queue.print(catalog: str)

Get length of Event Queue:

Overwrite.Queue.len(catalog: str)

Get Event Queue as following type:

Overwrite.Queue.get(catalog: str)
[{'times_left': int, 'license': any, 'function_name': str}, 
 {'times_left': int, 'license': any, 'function_name': str},
 {'times_left': int, 'license': any, 'function_name': str},]

Directly manipulate the Event Queue

Class Queue redefined, making it compatible with Pythonic Style Commands as below:

Overwrite.Queue.append(catalog: str, event: list)
Overwrite.Queue.pop(catalog: str, index: int)
Overwrite.Queue.replace(catalog: str, event: list, index: int)
Overwrite.Queue.clear(catalog: str)

Threading

For multi-threaded function overrides, the event queue is cross-threaded, and the order of event completion depends on the total program time sequence, asynchrony may cause event order confusion. Instantiating classes for each individual thread is a reasonable solution.

Development

Version: 2021.11.18 (0.0.9)

Author: Zack the White, Qcmcmc

Email Contact: Zack the White Qcmcmc

License

MIT

Tool that adds githuh profile views to ur acc

Tool that adds githuh profile views to ur acc

Lamp 2 Nov 28, 2021
Visualize Data From Stray Scanner https://keke.dev/blog/2021/03/10/Stray-Scanner.html

StrayVisualizer A set of scripts to work with data collected using Stray Scanner. Usage Installing Dependencies Install dependencies with pip -r requi

Kenneth Blomqvist 45 Dec 30, 2022
A python script made for personal use to monitor for sports card restocks on target.com since they are sold out often

TargetProductMonitor A python script made for personal use to monitor for sports card resocks on target.com since they are sold out often. When a rest

Bryan Lorden 2 Jul 31, 2022
Extrator de dados do jupiterweb

Extrator de dados do jupiterweb O programa é composto de dois arquivos: Um constando apenas de classes complementares que representam as unidades e as

Bruno Aricó 2 Nov 28, 2022
Powerful Assistant

Delta-Assistant Hi I'm Phoenix This project is a smart assistant This is the 1.0 version of this project I am currently working on the third version o

1 Nov 17, 2021
Tc-python - A Python script to receive message from a twitch chat

Twitch-Chat 📜 I did a script in Python to receive messages from a twitch chat.

miyucode 2 May 31, 2022
GWCelery is a simple and reliable package for annotating and orchestrating LIGO/Virgo alerts

GWCelery is a simple and reliable package for annotating and orchestrating LIGO/Virgo alerts, built from widely used open source components.

Min-A Cho Zeno 1 Nov 02, 2021
Fabric mod where anyone can PR anything, concerning or not. I'll merge everything as soon as it works.

Guess What Will Happen In This Fabric mod where anyone can PR anything, concerning or not (Unless it's too concerning). I'll merge everything as soon

anatom 65 Dec 25, 2022
Make your functions return something meaningful, typed, and safe!

Make your functions return something meaningful, typed, and safe! Features Brings functional programming to Python land Provides a bunch of primitives

dry-python 2.5k Jan 03, 2023
1 May 12, 2022
Transform a Google Drive server into a VFX pipeline ready server

Google Drive VFX Server VFX Pipeline About The Project Quick tutorial to setup a Google Drive Server for multiple machines access, and VFX Pipeline on

Valentin Beaumont 17 Jun 27, 2022
Yet another Airflow plugin using CLI command as RESTful api, supports Airflow v2.X.

中文版文档 Airflow Extended API Plugin Airflow Extended API, which export airflow CLI command as REST-ful API to extend the ability of airflow official API

Eric Cao 106 Nov 09, 2022
ToDoListAndroid - To-do list application created using Kivymd

ToDoListAndroid To-do list application created using Kivymd. Version 1.0.0 (1/Jan/2022). Planned to do next: -Add setting (theme selector, etc) -Add f

AghnatHs 1 Jan 01, 2022
Show my read on kindle this year

Show my kindle status on GitHub

yihong 26 Jun 20, 2022
SDX: Software Defined Internet Exchange

Installation steps: Download and import the Internet2-SDX virtual machine (VM) image, below, in VirtualBox and you are all set :) $ wget http://sites.

Software Defined Internet Exchange Point 15 Nov 21, 2021
Anonymous Dark Web Tool

Anonymous Dark Web Tool v1.0 Features Anonymous Mode Darkweb Search Engines Check Onion Url/s Scanning Host/IP Keep eyes on v2.0 soon. Requirement Deb

Mounib Kamhaz 11 Apr 10, 2022
Security-related flags and options for C compilers

Getting the maximum of your C compiler, for security

135 Nov 11, 2022
A Github Action for sending messages to a Matrix Room.

matrix-commit A Github Action for sending messages to a Matrix Room. Screenshot: Example Usage: # .github/workflows/matrix-commit.yml on: push:

3 Sep 11, 2022
A python script developed to process Windows memory images based on triage type.

Overview A python script developed to process Windows memory images based on triage type. Requirements Python3 Bulk Extractor Volatility2 with Communi

CrowdStrike 245 Nov 24, 2022
NASH 2021 project... this may or may not end up working 🤷‍♂️

wavespace synthesiser this is my NASH 2021 project, which may or may not end up working 🤷‍♂️ what is going on? imagine you have a big folder of audio

Ben Hayes 12 May 17, 2022