def _get_rh_methods(rh): """Yield all HTTP methods in ``rh`` that are decorated with schema.validate""" for k, v in vars(rh).items(): if all([ k in HTTP_METHODS, is_method(v), hasattr(v, "input_schema") ]): yield (k, v)
def has_method(module, cls_name, method_name): return all([ method_name in vars(getattr(module, cls_name)), is_method(reduce(getattr, [module, cls_name, method_name])) ])