Package translate :: Package misc :: Package typecheck
[hide private]
[frames] | no frames]

Package typecheck

source code

Submodules [hide private]

Classes [hide private]
  _TC_Exception
  _TC_LengthError
  _TC_TypeError
  _TC_NestedError
  _TC_IndexError
  _TC_DictError
  _TC_KeyError
  _TC_KeyValError
  _TC_GeneratorError
  _TC_AttrException
  _TC_AttrError
  _TC_MissingAttrError
  _TC_YieldCountError
  _TC_XorError
  _TC_FunctionError
  _TC_ExactError
  _TS_Exception
  _TS_TupleError
  _TS_ExtraKeywordError
  _TS_ExtraPositionalError
  _TS_MissingTypeError
  _TS_TwiceTypedError
  CheckType
  Single
  Empty
  Dict
  List
  Tuple
  TypeVariables
  Function
  Any
  _Boolean
  Or
  And
  Not
  Xor
  IsCallable
  HasAttr
  IsIterable
  YieldSeq
  Exact
  Length
  Class
  Typeclass
  IsOneOf
  IsAllOf
  IsNoneOf
  IsOnlyOneOf
  TypeCheckException
  TypeCheckError
  TypeSignatureError
  Fake_generator
  c
Functions [hide private]
 
check_type(type, func, val) source code
 
_manage_registration(add_remove, reg_type) source code
 
register_type(reg_type) source code
 
unregister_type(reg_type) source code
 
is_registered_type(reg_type) source code
 
Type(obj) source code
 
__checking(start_stop, *args) source code
 
start_checking(function) source code
 
stop_checking(function) source code
 
switch_checking(from_func, to_func) source code
 
calculate_type(obj) source code
 
Self() source code
 
_rec_tuple(obj) source code
 
_rec_tuple_str(obj) source code
 
_gen_arg_to_param(func, (posargs, varargs, varkw, defaults)) source code
 
_validate_tuple(ref, obj) source code
 
_param_to_type((params, varg_name, kwarg_name), vargs, kwargs) source code
 
_make_fake_function(func) source code
 
typecheck_args(*v_sig, **kw_sig) source code
 
_decorator(signature, conflict_field, twice_field, check_result_func) source code
 
typecheck_return(*signature) source code
 
typecheck_yield(*signature) source code
 
_null_decorator(*args, **kwargs) source code
 
typecheck(*args, **kwargs) source code
 
accepts(*args, **kwargs) source code
 
returns(*args, **kwargs) source code
 
yields(*args, **kwargs) source code
 
enable_typechecking() source code
Variables [hide private]
  enable_checking = True
  _hooks = ('__typesig__', '__startchecking__', '__stopchecking_...
  _registered_types = set([<class 'translate.misc.typecheck.Yiel...
  _registered_hooks = {'__startchecking__': set([<class 'transla...
  _Self = TypeVariable(this is the class of the invocant)
  _h = '__switchchecking__'

Imports: inspect, types, GeneratorType, FunctionType, MethodType, ClassType, TypeType, sys, os, typeclasses


Variables Details [hide private]

_hooks

Value:
('__typesig__',
 '__startchecking__',
 '__stopchecking__',
 '__switchchecking__')

_registered_types

Value:
set([<class 'translate.misc.typecheck.YieldSeq'>,
     <class 'translate.misc.typecheck.CheckType'>,
     <class 'translate.misc.typecheck.Single'>,
     <class 'translate.misc.typecheck.Dict'>,
     <class 'translate.misc.typecheck.List'>,
     <class 'translate.misc.typecheck.Tuple'>,
     <class 'translate.misc.typecheck.TypeVariables'>,
     <class 'translate.misc.typecheck.Function'>,
...

_registered_hooks

Value:
{'__startchecking__': set([<class 'translate.misc.typecheck.YieldSeq'>\
,
                           <class 'translate.misc.typecheck.TypeVariab\
les'>]),
 '__stopchecking__': set([<class 'translate.misc.typecheck.YieldSeq'>,
                          <class 'translate.misc.typecheck.TypeVariabl\
es'>]),
 '__switchchecking__': set([<class 'translate.misc.typecheck.TypeVaria\
...