Namespaces | Functions | Variables
grepros.plugins Namespace Reference

Namespaces

 auto
 
 embag
 
 mcap
 
 parquet
 
 sql
 

Functions

def add_output_label (label, flags)
 
def add_write_format (name, cls, label=None, options=())
 
def configure (args=None, **kwargs)
 
def get_argument (name, group=None)
 
def init (args=None, **kwargs)
 
def load (category, args, collect=False)
 
def populate_known_plugins ()
 
def populate_output_arguments ()
 
def populate_write_formats ()
 

Variables

list __all__
 
 DEFAULT_ARGS = dict(PLUGIN=[], STOP_ON_ERROR=False)
 Function argument defaults. More...
 
dictionary OUTPUT_LABELS = {}
 Added output labels to insert into argument texts, as {label: [argument flag, ]}. More...
 
dictionary PLUGINS = {}
 {"some.module" or "some.module.Cls": <module 'some.module' from ..> or <class 'some.module.Cls'>} More...
 
dictionary WRITE_OPTIONS = {}
 Added write options, as {plugin label: [(name, help), ]}. More...
 

Function Documentation

◆ add_output_label()

def grepros.plugins.add_output_label (   label,
  flags 
)
Adds plugin label to outputs enumerated in given argument help texts.

@param   label  output label to add, like "Parquet"
@param   flags  list of argument flags like "--emit-field" to add the output label to

Definition at line 141 of file src/grepros/plugins/__init__.py.

◆ add_write_format()

def grepros.plugins.add_write_format (   name,
  cls,
  label = None,
  options = () 
)
Adds plugin to `--write` in main.ARGUMENTS and MultiSink formats.

@param   name     format name like "csv", added to `--write .. format=FORMAT`
@param   cls      class providing Sink interface
@param   label    plugin label; if multiple plugins add the same option,
                  "label output" in help text is replaced with "label1/label2/.. output"
@param   options  a sequence of (name, help) to add to --write help, like
                  [("template=/my/path.tpl", "custom template to use for HTML output")]

Definition at line 151 of file src/grepros/plugins/__init__.py.

◆ configure()

def grepros.plugins.configure (   args = None,
**  kwargs 
)
Imports plugin Python packages, invokes init(args) if any, raises on error.

@param   args          arguments as namespace or dictionary, case-insensitive
@param   args.plugin   list of Python modules or classes to import,
                       as ["my.module", "other.module.SomeClass", ],
                       or module or class instances
@param   kwargs        any and all arguments as keyword overrides, case-insensitive

Definition at line 91 of file src/grepros/plugins/__init__.py.

◆ get_argument()

def grepros.plugins.get_argument (   name,
  group = None 
)
Returns a command-line argument dictionary, or None if not found.

@param   name   argument name like "--write"
@param   group  argument group like "Output control", if any

Definition at line 166 of file src/grepros/plugins/__init__.py.

◆ init()

def grepros.plugins.init (   args = None,
**  kwargs 
)
Imports and initializes all plugins from auto and from given arguments.

@param   args                arguments as namespace or dictionary, case-insensitive
@param   args.plugin         list of Python modules or classes to import,
                             as ["my.module", "other.module.SomeClass", ],
                             or module or class instances
@param   args.stop_on_error  stop execution on any error like failing to load plugin
@param   kwargs              any and all arguments as keyword overrides, case-insensitive

Definition at line 60 of file src/grepros/plugins/__init__.py.

◆ load()

def grepros.plugins.load (   category,
  args,
  collect = False 
)
Returns a plugin category instance loaded from any configured plugin, or None.

@param   category  item category like "source", "sink", or "scan"
@param   args      arguments as namespace or dictionary, case-insensitive
@param   collect   if true, returns a list of instances,
                   using all plugins that return something

Definition at line 116 of file src/grepros/plugins/__init__.py.

◆ populate_known_plugins()

def grepros.plugins.populate_known_plugins ( )
Adds known non-auto plugins to `--plugin` argument help.

Definition at line 209 of file src/grepros/plugins/__init__.py.

◆ populate_output_arguments()

def grepros.plugins.populate_output_arguments ( )
Populates argument texts with added output labels.

Definition at line 181 of file src/grepros/plugins/__init__.py.

◆ populate_write_formats()

def grepros.plugins.populate_write_formats ( )
Populates main.ARGUMENTS with added write formats and options.

Definition at line 233 of file src/grepros/plugins/__init__.py.

Variable Documentation

◆ __all__

list grepros.plugins.__all__
private
Initial value:
1 = [
2  "PLUGINS", "init", "configure", "load", "add_write_format", "get_argument",
3  "populate_known_plugins", "populate_write_formats",
4 ]

Definition at line 284 of file src/grepros/plugins/__init__.py.

◆ DEFAULT_ARGS

grepros.plugins.DEFAULT_ARGS = dict(PLUGIN=[], STOP_ON_ERROR=False)

Function argument defaults.

Definition at line 57 of file src/grepros/plugins/__init__.py.

◆ OUTPUT_LABELS

dictionary grepros.plugins.OUTPUT_LABELS = {}

Added output labels to insert into argument texts, as {label: [argument flag, ]}.

Definition at line 51 of file src/grepros/plugins/__init__.py.

◆ PLUGINS

dictionary grepros.plugins.PLUGINS = {}

{"some.module" or "some.module.Cls": <module 'some.module' from ..> or <class 'some.module.Cls'>}

Definition at line 48 of file src/grepros/plugins/__init__.py.

◆ WRITE_OPTIONS

dictionary grepros.plugins.WRITE_OPTIONS = {}

Added write options, as {plugin label: [(name, help), ]}.

Definition at line 54 of file src/grepros/plugins/__init__.py.



grepros
Author(s): Erki Suurjaak
autogenerated on Sat Jan 6 2024 03:11:30