Skip to main content

A handful of useful general-purpose python decorators.

Project description

Decs Build Status codecov PyPI version License: MIT

A handful of useful general-purpose python decorators.

Installing

$ pip install decs

How to use

Verify functions inputs and outputs types:

from decs import accepts, returns


@returns(str)
@accepts(str)
def my_print(string):
    print(string)
    return string

Verify methods inputs and outputs types:

from decs import accepts, returns

class SomeClass:

    @returns(float)
    @accepts('self', int, float)
    def class_method(self, int_arg, float_arg):
        return int_arg + float_arg

Repeat test case N times:

from decs import repeat

N = 42

@repeat(N)
def test_something(arg):
    pass

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

decs-0.0.4.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

decs-0.0.4-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file decs-0.0.4.tar.gz.

File metadata

  • Download URL: decs-0.0.4.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for decs-0.0.4.tar.gz
Algorithm Hash digest
SHA256 bb2291c45a7154e7460f3166a05276972f731786cc21bfd6b7482a079d303b1e
MD5 26ff12d807c3be8a5ca24d2ad449ec8a
BLAKE2b-256 96f7f3c21611ec887d167702aae6b09f191d0b99b1a47e9a0a5657d3d684e248

See more details on using hashes here.

File details

Details for the file decs-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: decs-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.3

File hashes

Hashes for decs-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1cccc3a9cad8f1bf45dca4d7c698e8145e2f042a5749eeef3571286c43266a2e
MD5 91c0ff5307fe71e2f2ab02131f401627
BLAKE2b-256 dc527d7d76b415570419d371b350359bb579c46841c5fb10ea69965d86e440b2

See more details on using hashes here.

Supported by

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