MCPcopy
hub / github.com/nonebot/nonebot2 / _resolve_combine_expr

Function _resolve_combine_expr

nonebot/__init__.py:254–267  ·  view source on GitHub ↗
(obj_str: str)

Source from the content-addressed store, hash-verified

252
253
254def _resolve_combine_expr(obj_str: str) -> type[Driver]:
255 drivers = obj_str.split("+")
256 DriverClass = resolve_dot_notation(
257 drivers[0], "Driver", default_prefix="nonebot.drivers."
258 )
259 if len(drivers) == 1:
260 logger.trace(f"Detected driver {DriverClass} with no mixins.")
261 return DriverClass
262 mixins = [
263 resolve_dot_notation(mixin, "Mixin", default_prefix="nonebot.drivers.")
264 for mixin in drivers[1:]
265 ]
266 logger.trace(f"Detected driver {DriverClass} with mixins {mixins}.")
267 return combine_driver(DriverClass, *mixins)
268
269
270def _log_patcher(record: "loguru.Record"):

Callers 2

load_driverFunction · 0.90
initFunction · 0.85

Calls 2

resolve_dot_notationFunction · 0.90
combine_driverFunction · 0.85

Tested by 1

load_driverFunction · 0.72