grepros 1.3.0
grep for ROS bag files and live topics
Loading...
Searching...
No Matches
HtmlSink Class Reference
Inheritance diagram for HtmlSink:
Inheritance graph

Public Member Functions

 __init__ (self, args=None, **kwargs)
 
 close (self)
 
 close_output (self)
 
 emit (self, topic, msg, stamp=None, match=None, index=None)
 
 flush (self)
 
 format_message (self, msg, highlight=False)
 
 is_highlighting (self)
 
 validate (self)
 
- Public Member Functions inherited from Sink
 __enter__ (self)
 
 __exit__ (self, exc_type, exc_value, traceback)
 
 autodetect (cls, target)
 
 bind (self, source)
 
 configure (self, args=None, **kwargs)
 
 emit_meta (self)
 
 thread_excepthook (self, text, exc)
 
- Public Member Functions inherited from RolloverSinkMixin
 ensure_rollover (self, topic, msg, stamp)
 
 format_output_meta (self)
 
 get_write_options (cls, label)
 
 make_filename (self)
 
 size (self)
 
- Public Member Functions inherited from TextSinkMixin
 message_to_yaml (self, val, top=(), typename=None)
 

Public Attributes

 close
 
 filename
 
 valid
 
- Public Attributes inherited from Sink
 args
 
 source
 inputs.Source instance bound to this sink
 
 valid
 Result of validate()
 
- Public Attributes inherited from RolloverSinkMixin
 filename
 Current output file path.
 

Static Public Attributes

 DEFAULT_ARGS
 Constructor argument defaults.
 
tuple FILE_EXTENSIONS = (".htm", ".html")
 Auto-detection file extensions.
 
 TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "html.tpl")
 HTML template path.
 
int WRAP_WIDTH = 120
 Character wrap width for message YAML.
 
- Static Public Attributes inherited from Sink
 DEFAULT_ARGS = dict(META=False)
 Constructor argument defaults.
 
tuple FILE_EXTENSIONS = ()
 Auto-detection file extensions for subclasses, as (".ext", )
 
- Static Public Attributes inherited from RolloverSinkMixin
 DEFAULT_ARGS = dict(WRITE=None, WRITE_OPTIONS={}, VERBOSE=False)
 Constructor argument defaults.
 
str FILE_META_TEMPLATE = "{name} ({size})"
 
str MULTI_META_TEMPLATE = "\n- {name} ({size}, {mcount}, {tcount})"
 
list OPTIONS_TEMPLATES
 Command-line help templates for rollover options, as [(name, text with s label placeholder)].
 
str START_META_TEMPLATE = "{mcount} in {tcount} to "
 
- Static Public Attributes inherited from TextSinkMixin
 DEFAULT_ARGS
 Constructor argument defaults.
 
str NOCOLOR_HIGHLIGHT_WRAPPERS = "**", "**"
 Default highlight wrappers if not color output.
 

Detailed Description

Writes messages to an HTML file.

Definition at line 30 of file html.py.

Constructor & Destructor Documentation

◆ __init__()

__init__ (   self,
  args = None,
**  kwargs 
)
@param   args                       arguments as namespace or dictionary, case-insensitive;
                                    or a single path as the name of HTML file to write
@param   args.write                 name of HTML file to write,
                                    will add counter like .2 to filename if exists
@param   args.write_options         ```
                                    {"template": path to custom HTML template, if any,
                                     "overwrite": whether to overwrite existing file
                                                  (default false),
                                     "rollover-size": bytes limit for individual output files,
                                     "rollover-count": message limit for individual output files,
                                     "rollover-duration": time span limit for individual output files,
                                                          as ROS duration or convertible seconds,
                                     "rollover-template": output filename template, supporting
                                                          strftime format codes like "%H-%M-%S"
                                                          and "%(index)s" as output file index}
                                    ```
@param   args.highlight             highlight matched values (default true)
@param   args.orderby               "topic" or "type" if any to group results by
@param   args.color                 False or "never" for not using colors in replacements
@param   args.emit_field            message fields to emit if not all
@param   args.noemit_field          message fields to skip in output
@param   args.max_field_lines       maximum number of lines to output per field
@param   args.start_line            message line number to start output from
@param   args.end_line              message line number to stop output at
@param   args.max_message_lines     maximum number of lines to output per message
@param   args.lines_around_match    number of message lines around matched fields to output
@param   args.matched_fields_only   output only the fields where match was found
@param   args.wrap_width            character width to wrap message YAML output at
@param   args.match_wrapper         string to wrap around matched values,
                                    both sides if one value, start and end if more than one,
                                    or no wrapping if zero values
@param   args.meta                  whether to emit metainfo
@param   args.verbose               whether to emit debug information
@param   kwargs                     any and all arguments as keyword overrides,
                                    case-insensitive

Reimplemented from Sink.

Definition at line 49 of file html.py.

Member Function Documentation

◆ close()

close (   self)
Closes output file, if any, emits metainfo.

Reimplemented from Sink.

Definition at line 153 of file html.py.

◆ close_output()

close_output (   self)
Closes output file, if any.

Reimplemented from RolloverSinkMixin.

Definition at line 162 of file html.py.

◆ emit()

emit (   self,
  topic,
  msg,
  stamp = None,
  match = None,
  index = None 
)
Writes message to output file.

Reimplemented from Sink.

Definition at line 105 of file html.py.

◆ flush()

flush (   self)
Writes out any pending data to disk.

Reimplemented from Sink.

Definition at line 169 of file html.py.

◆ format_message()

format_message (   self,
  msg,
  highlight = False 
)
Returns message as formatted string, optionally highlighted for matches if configured.

Reimplemented from TextSinkMixin.

Definition at line 173 of file html.py.

◆ is_highlighting()

is_highlighting (   self)
Returns True if sink is configured to highlight matched values.

Reimplemented from Sink.

Definition at line 180 of file html.py.

◆ validate()

validate (   self)
Returns whether write options are valid and ROS environment is set and file is writable,
emits error if not.

Reimplemented from Sink.

Definition at line 117 of file html.py.

Member Data Documentation

◆ close

close

Definition at line 103 of file html.py.

◆ DEFAULT_ARGS

DEFAULT_ARGS
static
Initial value:
= dict(META=False, WRITE_OPTIONS={}, HIGHLIGHT=True, MATCH_WRAPPER=None,
ORDERBY=None, VERBOSE=False, COLOR=True, EMIT_FIELD=(), NOEMIT_FIELD=(),
MAX_FIELD_LINES=None, START_LINE=None, END_LINE=None,
MAX_MESSAGE_LINES=None, LINES_AROUND_MATCH=None, MATCHED_FIELDS_ONLY=False,
WRAP_WIDTH=None)

Constructor argument defaults.

Definition at line 43 of file html.py.

◆ FILE_EXTENSIONS

tuple FILE_EXTENSIONS = (".htm", ".html")
static

Auto-detection file extensions.

Definition at line 34 of file html.py.

◆ filename

filename

Definition at line 195 of file html.py.

◆ TEMPLATE_PATH

TEMPLATE_PATH = os.path.join(os.path.dirname(os.path.abspath(__file__)), "html.tpl")
static

HTML template path.

Definition at line 37 of file html.py.

◆ valid

valid

Definition at line 136 of file html.py.

◆ WRAP_WIDTH

int WRAP_WIDTH = 120
static

Character wrap width for message YAML.

Definition at line 40 of file html.py.


The documentation for this class was generated from the following file: