Skip to main content

A package that contains some useful decorators for any case.

Project description

ExtraDecorators

This module introduces some handy decorators like @validatetyping.

@validatetyping

# Example 1: Applying to a function
@validatetyping
def add(x: int, y: int) -> int:
    return x + y

result = add(5, 10)  # Valid call
result = add(5, '10') # Invalid call, will raise an ValueError

# Example 2: Applying to a class
class Point:
    @validatetyping
    def __init__(self, x: int, y: int):
        self.x = x
        self.y = y

p = Point(3, 4)  # Valid initialization
p = Point('3', 4) # Invalid initialization, will raise an ValueError

There are some more in there, but not documentet (WIP)

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

extradecorators-0.1.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

extradecorators-0.1-py3-none-any.whl (4.9 kB view hashes)

Uploaded Python 3

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