MCPcopy Index your code
hub / github.com/hugapi/hug / extend

Method extend

hug/api.py:600–614  ·  view source on GitHub ↗

Adds handlers from a different Hug API to this one - to create a single API

(self, api, route="", base_url="", http=True, cli=True, **kwargs)

Source from the content-addressed store, hash-verified

598 return self._context
599
600 def extend(self, api, route="", base_url="", http=True, cli=True, **kwargs):
601 """Adds handlers from a different Hug API to this one - to create a single API"""
602 api = API(api)
603
604 if http and hasattr(api, "_http"):
605 self.http.extend(api.http, route, base_url, **kwargs)
606
607 if cli and hasattr(api, "_cli"):
608 self.cli.extend(api.cli, **kwargs)
609
610 for directive in getattr(api, "_directives", {}).values():
611 self.add_directive(directive)
612
613 for startup_handler in api.startup_handlers or ():
614 self.add_startup_handler(startup_handler)
615
616 def add_startup_handler(self, handler):
617 """Adds a startup handler to the hug api"""

Callers 4

test_api_pass_alongFunction · 0.45
decoratorFunction · 0.45
__call__Method · 0.45

Calls 3

add_directiveMethod · 0.95
add_startup_handlerMethod · 0.95
APIClass · 0.70

Tested by 2

test_api_pass_alongFunction · 0.36