Skip to main content

## extradeco

### parametrized(flat_decorator)

A super-flatter decorator decorator!

One is supposed to decorate what would be your inner "wrapper" function in a decorator with
"parametrized". That "wrapper" can now be used as a paramterized decorator with extra parameters
whatever parameters it takes when decorating are passed along with the func object when the func itself
is called - "*args" and "**kwargs" arguments should be passed down in the call to the original `func`.

### Example of use:

Create a flat decorator which wants parameters by doing:

```
from extradeco import paremetrized

@parametrized
def ubberlog(func, loglevel, *args, **kw):
if loglevel > 2:
print ("doing things")
if loglevel > 1:
print("doing less things")
# Line that calls the original function directly on the decorator body
result = func(*args, **kw)
if loglevel:
print("function returned", result)
return result
```

And then, the new logger decorator is ready to be used like this:


```

@ubberlog(2)
def soma(a, b):
return a + b


@ubberlog(1)
def s1(a, b):
return a + b
```

### Warning
For now, the parameter names in the decorator cannot match any parameter name in the final decorated function.
It is advised that you prefix the parameter names in the decorator with somethign that won't be present in the decorated functions.


Metadata

Release files for extradeco 0.1.2

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

Source distribution (sdist)

Source distribution for extradeco 0.1.2
File Size Uploaded
extradeco-0.1.2.tar.gz 5.9 kB Details

Release files / extradeco-0.1.2.tar.gz

Download URL extradeco-0.1.2.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
50f1a5f938493a53efaa3c6bec77bf8b80e292ba29955cf036fccc2da39bb837
BLAKE2b-256 checksum
How to use checksums
f7e477a8149d56a89e6a0b46eac8f45a55870cede91c23804d5be7949350e2cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

0.1.1

1 release file

0.1.0

1 release file

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