Skip to main content

An easy and nice decorator package

Project description

NiceDecorator

An easy and nice decorator package

Use:

Model

from NiceDecorator.model import Deco_Timer

decor = Deco_Timer()

@decor
def f():
    print(1)

a = f()
print(a)

result

$ python 3.11.4 $
1
1.9600032828748226e-05

Decorator

No.1

decor = decorator.Deco_aFunction(wrap=(timecount.time_start_ns, FUNCTION, timecount.time_end_ns))
@decor
def f():
    print(1)

a = f()
b = f()
print(a, b)

result

$ python 3.11.4 $
181000 168600

No.2

class DECORATOR(decorator.Deco_iFunction):
    def begin(self):
        print("start")
    def end(self):
        print("end")
    def adef(self):
        print("def")

@DECORATOR()
def g():
    print(2)

g()
g()

result

$ python 3.11.4 $
def
start
2
end
start
2
end

No.3

@decorator.Deco_wFunction
def decor2(func, *args, **kwargs):
    print("===")
    res = func(*args, **kwargs)
    print("===")
    return res

@decor2
def h():
    print(3)

h()
h()

result

$ python 3.11.4 $
===
3
===
===
3
===

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

NiceDecorator-1.0.3.tar.gz (8.7 kB view details)

Uploaded Source

File details

Details for the file NiceDecorator-1.0.3.tar.gz.

File metadata

  • Download URL: NiceDecorator-1.0.3.tar.gz
  • Upload date:
  • Size: 8.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for NiceDecorator-1.0.3.tar.gz
Algorithm Hash digest
SHA256 480a664761e071ef51b771b096b87f74ddcaebd22a1eb76f9030838726e62e65
MD5 50d04dfc1478acdd989f07af49c20364
BLAKE2b-256 12bcd2346e5155ebd0883c95244379c5291722393322dcd7cb62eaa6d561acf8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page