def get_cls_kwargs(cls, _set=None):
 toplevel = (_set is None)
 if toplevel:
  _set = set()
 ctr = cls.__dict__.get('__init__', False)
 has_init = (ctr and isinstance(ctr, types.FunctionType) and isinstance(ctr.__code__, types.CodeType))
 if has_init:
  (names, has_kw) = inspect_func_args(ctr)
  _set.update(names)
  if ((not has_kw) and (not toplevel)):
   return None
 if ((not has_init) or has_kw):
  for c in cls.__bases__:
   if (get_cls_kwargs(c, _set) is None):
    break
 _set.discard('self')
 return _set

def get_cls_kwargs ( cls , _set = None ) : toplevel = ( _set is None ) if toplevel : _set = set ( ) ctr = cls . __dict__ . get ( '__init__' , False ) has_init = ( ctr and isinstance ( ctr , types . FunctionType ) and isinstance ( ctr . __code__ , types . CodeType ) ) if has_init : ( names , has_kw ) = inspect_func_args ( ctr ) _set . update ( names ) if ( ( not has_kw ) and ( not toplevel ) ) : return None if ( ( not has_init ) or has_kw ) : for c in cls . __bases__ : if ( get_cls_kwargs ( c , _set ) is None ) : break _set . discard ( 'self' ) return _set
return the full set of inherited kwargs for the given cls .