Skip to main content

No project description provided

Project description

strictTyping

Decorator to enforce the correct types for method invocation and definition.


The decorator will help you to validate if the input parameters have a valid type.

With enforce=True (default) it will also enforce that the function has a return type and all parameters have types defined.

Help

Installation

Install using pip install -U strictTyping

Examples

from strictTyping import strictTyping

# full valid function
@strictTyping()
def myFunction(argument: int) -> str:
	return str(argument)
	
myFunction(5) # succeeds
myFunction(5.0) # ValueError

# not enforcing typing
@strictTyping(enforce = False)
def myFunction(argument, argument2: float):
	return str(argument), str(argument2)
	
myFunction(5, 5.0) # succeeds
myFunction(5.0, 5) # ValueError

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

strictTyping-0.1.3.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

strictTyping-0.1.3-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file strictTyping-0.1.3.tar.gz.

File metadata

  • Download URL: strictTyping-0.1.3.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for strictTyping-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3c5db6e14f560705e859e20887bf2f6f805bb968a3c3076279cc9e4140810eb5
MD5 c55ab11803b5047132e024efc89a17de
BLAKE2b-256 9bf29e701413e08671c8e53468ff0937cb911e0750d8f596452954975feff7f3

See more details on using hashes here.

File details

Details for the file strictTyping-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: strictTyping-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.4

File hashes

Hashes for strictTyping-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 252ae82bed9e980cd6f6205db82a76654e84db1cee419054588ca507f2049f9e
MD5 76ef2278cb37b1a7a179a3d0d0320ac1
BLAKE2b-256 7e04a1177af6011ab84f2fffaa5a98ae1784d581d8891d65036d3c4959776301

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