MCPcopy
hub / github.com/leslievan/semi-utils / process

Method process

processor/generators.py:236–262  ·  view source on GitHub ↗
(self, ctx: PipelineContext)

Source from the content-addressed store, hash-verified

234
235class MultiRichTextGenerator(Generator):
236 def process(self, ctx: PipelineContext):
237 text_segments: List[TextSegment] = TextSegment.from_dicts(ctx.get("text_segments"))
238 text_alignment = ctx.get("text_alignment")
239 text_spacing = ctx.getint("text_spacing")
240 height = ctx.get("height", 100)
241
242 text_images = []
243 for segment in text_segments:
244 segment.height = height
245 context = PipelineContext(asdict(segment))
246 context.set("save_buffer", False)
247 RichTextGenerator().process(context)
248 text_images.extend(context.get_buffer())
249
250 # 使用 start_process 替代直接调用 ConcatMerger,解耦对 Merger 的直接依赖
251 from processor.core import start_process
252 pipeline = [
253 {
254 "processor_name": "concat",
255 "alignment": text_alignment,
256 "spacing": text_spacing,
257 "save_buffer": False,
258 }
259 ]
260 result = start_process(pipeline, initial_buffer=text_images)
261
262 ctx.update_buffer([result]).save_buffer(self.name()).success()
263
264 def name(self) -> str:
265 return "multi_rich_text"

Callers

nothing calls this directly

Calls 13

setMethod · 0.95
get_bufferMethod · 0.95
nameMethod · 0.95
PipelineContextClass · 0.90
start_processFunction · 0.90
RichTextGeneratorClass · 0.85
from_dictsMethod · 0.80
getintMethod · 0.80
successMethod · 0.80
save_bufferMethod · 0.80
update_bufferMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected