Skip to main content
=======
Deckor
=======

Decorate your functions and with 'deckor'ators. A module created while learning decorators.

Installation
=============

pip install deckor


Decorators Supported:
======================

* timer : Measure execution time of functions

@deckor.timer
def fact(x):
if x <= 0:
return 1
return x*fact(x-1)

* cacheit : Cache intermediate results

@deckor.cacheit
def fact(x):
if x <= 0:
return 1
return x*fact(x-1)

* trace : Print the pretty recursion trace

@deckor.trace
def fib(x):
if x < 2:
return x
return fib(x-1)+fib(x-2)

fib(10)

Now, try trace with cacheit

@deckor.cacheit
@deckor.trace
def fib(x):
if x < 2:
return x
return fib(x-1)+fib(x-2)

fib(10)

* with_retries : function signature: with_retries(tries=5, delay=0, increment=0). Try execution of function with retries. Retry'tries' no of times. Delay of 'delay' seconds between retries. Increase the delay by 'increment' between retries

@with_retries(5)
def random_f():
try: r = requests.get("random")
except: return

* syncronize : Provides very basic syncronization. Note: Not free from race condition only for basic usage

import threading

lock = threading.Lock()
sample_list = []

@deckor.syncronize(lock)
def sample(sample_list):
sample_list.append(1)

#sample list is modified only after lock is acquired
#so, mdification is sample_list os thread safe

Metadata

Release files for deckor 0.0.1

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

Source distribution (sdist)

Source distribution for deckor 0.0.1
File Size Uploaded Provenance Actions
deckor-0.0.1.tar.gz 2.3 kB Without provenance Details for deckor-0.0.1.tar.gz

Release files / deckor-0.0.1.tar.gz

Download URL deckor-0.0.1.tar.gz
Size 2.3 kB
Tags Source
SHA-256 checksum
How to use checksums
28b026c6e238c5315cbdc216492bb68a83d1809111daa967fad99030fb1574d9
BLAKE2b-256 checksum
How to use checksums
652d6f2c6bc21795ee46579a786ffb79472a9041a3e74ffe9be30956a3a4fe5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for deckor 0.0.1

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

0.0.1 This release

1 release file No provenance

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