def listeners(): """Show all event listeners/handlers""" log.header("Event listeners/handlers") log.line() #dump(uvicore.events.expanded_sorted_listeners) dump(uvicore.events.listeners)
def list(raw: bool = False): """List all deep merged configs from all packages""" if not raw: log.header("List of all deep merged configs from all packages") log.line() dump(uvicore.config) else: print(uvicore.config)
def connections(): """Show all packages database connections""" log.header( "All deep merged database connections from all defined packages") log.line() log.notice( "Some connections share the same database which means their tables are in the same metedata space. This is what the unique metakey denotes." ) dump(db.connections)
def list(): """List all events""" log.header("Events defined from all packages") log.line() event_bindings = uvicore.ioc.binding(type='event') events = [] for binding in event_bindings.values(): events.append({ 'name': binding.path, 'description': binding.object.__doc__, 'is_async': binding.object.is_async, }) dump(events)
def providers(json: bool): """Show providers graph""" if json: # This json stuff is just experimantal junk print(JSON.dumps(app.providers)) else: log.header("Package provider graph (in exact order of registration dependency)") log.line() for (name, detail) in app.providers.items(): log.info(name) dump(detail) print() log.nl() log.line() log.header("Package providers as seen from the Ioc") bindings = {key:binding for (key, binding) in uvicore.ioc.bindings.items() if binding.type.lower() == 'provider'} dump(bindings)
def get(package: str): """Show detailed info for one package""" if package == 'main': pkg = app.package(main=True) else: pkg = app.package(package) if pkg: log.header("Package object for " + package) log.line() dump(pkg) print() #log.header("Deep merged configs for " + package) #log.line() #dump(pkg.config()) else: exit(f"Package {package} not found")
def get(event: str): """Show detailed info for one event""" log.header("Event details for " + event) log.line() event_bindings = uvicore.ioc.binding(type='event') events = [] for binding in event_bindings.values(): if event == binding.path: events.append({ 'name': binding.path, 'description': binding.object.__doc__, 'is_async': binding.object.is_async, }) if events: dump(events) else: print("Event {} not found".format(event))
def list(): """List all packages""" log.header("List of all Packages (in exact order of registration dependency)") log.line() dump(app.packages)