aptdetector/utils/typecheck.py
def typed(fn):
    """Interpret Python3 function annotations as type signatures.

    This decorator enables use of Python3 syntactic sugar for specifying
    type signatures in a more readable way than using decorators.

    Argument annotations are treated as arguments to @params. Return value
    annotation is treated as argument to @returns. Either are optional, but
    at least one should be given if this decorator is used.
    """

    if not hasattr(fn, '__annotations__'):
        raise TypeError("Function not annotated with Python3 annotations")

    return_type = fn.__annotations__.get('return')
    param_types = fn.__annotations__.copy()

    if return_type:
        del param_types['return']

    if param_types:
        fn = params(**param_types)(fn)

    if return_type:
        fn = returns(return_type)(fn)

    fn.__annotations__ = {}
    return fn
Interpret Python3 function annotations as type signatures.

    This decorator enables use of Python3 syntactic sugar for specifying
    type signatures in a more readable way than using decorators.

    Argument annotations are treated as arguments to @params. Return value
    annotation is treated as argument to @returns. Either are optional, but
    at least one should be given if this decorator is used.
    
Interpret Python3 function annotations as type signatures.
This decorator enables use of Python3 syntactic sugar for specifying
type signatures in a more readable way than using decorators.

Argument annotations are treated as arguments to @params. Return value
annotation is treated as argument to @returns. Either are optional, but
at least one should be given if this decorator is used.
Interpret Python3 function annotations as type signatures . This decorator enables use of Python3 syntactic sugar for specifying type signatures in a more readable way than using decorators . Argument annotations are treated as arguments to @params . Return value annotation is treated as argument to @returns . Either are optional but at least one should be given if this decorator is used .
def typed(fn):
    if not hasattr(fn, '__annotations__'):
        raise TypeError("Function not annotated with Python3 annotations")
    return_type = fn.__annotations__.get('return')
    param_types = fn.__annotations__.copy()
    if return_type:
        del param_types['return']
    if param_types:
        fn = params(**param_types)(fn)
    if return_type:
        fn = returns(return_type)(fn)
    fn.__annotations__ = {}
    return fn
def typed ( fn ) : if not hasattr ( fn , '__annotations__' ) : raise TypeError ( "Function not annotated with Python3 annotations" ) return_type = fn . __annotations__ . get ( 'return' ) param_types = fn . __annotations__ . copy ( ) if return_type : del param_types [ 'return' ] if param_types : fn = params ( ** param_types ) ( fn ) if return_type : fn = returns ( return_type ) ( fn ) fn . __annotations__ = { } return fn
Interpret Python3 function annotations as type signatures.
Interpret Python3 function annotations as type signatures .
"""Interpret Python3 function annotations as type signatures.

    This decorator enables use of Python3 syntactic sugar for specifying
    type signatures in a more readable way than using decorators.

    Argument annotations are treated as arguments to @params. Return value
    annotation is treated as argument to @returns. Either are optional, but
    at least one should be given if this decorator is used.
    """
fn