MCPcopy Create free account
hub / github.com/dot-agent/nextpy / format_event

Function format_event

nextpy/utils/format.py:440–469  ·  view source on GitHub ↗

Format an event. Args: event_spec: The event to format. Returns: The compiled event.

(event_spec: EventSpec)

Source from the content-addressed store, hash-verified

438
439
440def format_event(event_spec: EventSpec) -> str:
441 """Format an event.
442
443 Args:
444 event_spec: The event to format.
445
446 Returns:
447 The compiled event.
448 """
449 args = ",".join(
450 [
451 ":".join(
452 (
453 name._var_name,
454 wrap(json.dumps(val._var_name).strip('"').replace("`", "\\`"), "`")
455 if val._var_is_string
456 else val._var_full_name,
457 )
458 )
459 for name, val in event_spec.args
460 ]
461 )
462 event_args = [
463 wrap(format_event_handler(event_spec.handler), '"'),
464 ]
465 event_args.append(wrap(args, "{"))
466
467 if event_spec.client_handler_name:
468 event_args.append(wrap(event_spec.client_handler_name, '"'))
469 return f"Event({', '.join(event_args)})"
470
471
472def format_event_chain(

Callers 2

format_propFunction · 0.85
format_event_chainFunction · 0.85

Calls 4

wrapFunction · 0.85
format_event_handlerFunction · 0.85
joinMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected