Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:416rehman DeepZero resolve processor class

From Leeroopedia
Knowledge Sources
Domains Pipeline_Orchestration, Extensibility
Last Updated 2026-10-27 00:00 GMT

Overview

Processor class resolution function that maps a pipeline YAML processor reference to a concrete Processor subclass via three resolution strategies: built-in registry, external file, or dotted import.

Description

The resolve_processor_class function is the bridge between pipeline YAML and executable code. It takes a processor reference string and returns the corresponding Processor subclass. Three resolution strategies are supported:

  • Bare name (e.g., "metadata_filter"): looks up the built-in processor registry. Built-in processors are registered at import time.
  • dir/file.py (e.g., "ghidra_decompile/ghidra_decompile.py"): loads an external processor from the processors/ directory relative to CWD. The first Processor subclass in the file is used. Optionally, a specific class can be named: dir/file.py:ClassName.
  • module:Class (e.g., "deepzero.stages.filter:MetadataFilter"): imports a dotted module path and gets the named class.

For external processors, the resolved class's _source_file is set to the absolute path, enabling the processor to locate co-located assets (scripts, rule files) via self.processor_dir.

Usage

  • Referencing a built-in processor in YAML: processor: metadata_filter
  • Referencing an external processor: processor: ghidra_decompile/ghidra_decompile.py
  • Referencing a specific class in an external file: processor: pe_ingest/pe_ingest.py:PEIngest
  • Registering a built-in processor: call register_processor(name, cls) at import time

Code Reference

Source Location

  • Repository: DeepZero
  • File: src/deepzero/engine/registry.py

Signature

def resolve_processor_class(processor_ref: str) -> type[Any]: ...

def register_processor(name: str, cls: type[Any]) -> None: ...

def get_registered_processors() -> dict[str, type[Any]]: ...

Import

from deepzero.engine.registry import resolve_processor_class, register_processor

I/O Contract

Inputs

Name Type Required Description
processor_ref str Yes Bare name, dir/file.py, dir/file.py:Class, or module:Class

Outputs

Name Type Description
returns type[Processor] Resolved processor subclass with _source_file set

Usage Examples

Resolving Built-in vs External

from deepzero.engine.registry import resolve_processor_class

# Built-in (registered in the registry)
cls = resolve_processor_class("metadata_filter")

# External in processors/ directory
cls = resolve_processor_class("ghidra_decompile/ghidra_decompile.py")

# External with explicit class name
cls = resolve_processor_class("pe_ingest/pe_ingest.py:PEIngest")

# The resolved class has _source_file set for asset resolution
instance = cls(spec)
print(f"Processor dir: {instance.processor_dir}")

Registering a Built-in Processor

from deepzero.engine.registry import register_processor
from deepzero.engine.stage import MapProcessor

class MyFilter(MapProcessor):
    ...

register_processor("my_filter", MyFilter)
# Now usable in YAML as: processor: my_filter

Related Pages

Implements Principle

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment