Skip to main content

Includes decorator "@typecheck" to provide type check on run-time.

Project description

Typechecker

Functionality:

  • Compare typehints against args
  • Compare typehints against key-word args
  • Check parent classes for non-matching type

Works for both functions and class methods.

class Foo:
    @typecheck
    def bar(self, baz: str) -> None:
        print(baz)

foo = Foo()
foo.bar("baz")
# baz
foo.bar(1)
# TypeError: Check function/method input-type(s)

Supported by

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