oslo_reports.views.text package¶
Submodules¶
oslo_reports.views.text.generic module¶
Provides generic text views
This modules provides several generic views for serializing models into human-readable text.
-
class
oslo_reports.views.text.generic.
BasicKeyValueView
¶ Bases:
object
A Basic Key-Value Text View
This view performs a naive serialization of a model into text using a basic key-value method, where each key-value pair is rendered as “key = str(value)”
-
class
oslo_reports.views.text.generic.
KeyValueView
(indent_str=' ', key_sep=' = ', dict_sep=' = ', list_sep=' = ', anon_dict='[dict]', before_dict=None, before_list=None)¶ Bases:
object
A Key-Value Text View
This view performs an advanced serialization of a model into text by following the following set of rules:
- keytext
key = text
- rootkeyMapping
rootkey = serialize(key, value)
- keySequence
key = serialize(item)
- Parameters
indent_str (str) – the string used to represent one “indent”
key_sep (str) – the separator to use between keys and values
dict_sep (str) – the separator to use after a dictionary root key
list_sep (str) – the separator to use after a list root key
anon_dict (str) – the “key” to use when there is a dict in a list (does not automatically use the dict separator)
before_dict (str or None) – content to place on the line(s) before the a dict root key (use None to avoid inserting an extra line)
before_list (str or None) – content to place on the line(s) before the a list root key (use None to avoid inserting an extra line)
-
class
oslo_reports.views.text.generic.
MultiView
¶ Bases:
object
A Text View Containing Multiple Views
This view simply serializes each value in the data model, and then joins them with newlines (ignoring the key values altogether). This is useful for serializing lists of models (as array-like dicts).
-
class
oslo_reports.views.text.generic.
TableView
(column_names, column_values, table_prop_name)¶ Bases:
object
A Basic Table Text View
This view performs serialization of data into a basic table with predefined column names and mappings. Column width is auto-calculated evenly, column values are automatically truncated accordingly. Values are centered in the columns.
- Parameters
column_names ([str]) – the headers for each of the columns
column_values ([str]) – the item name to match each column to in each row
table_prop_name (str) – the name of the property within the model containing the row models
oslo_reports.views.text.header module¶
Text Views With Headers
This package defines several text views with headers
-
class
oslo_reports.views.text.header.
HeaderView
(header)¶ Bases:
object
A Text View With a Header
This view simply serializes the model and places the given header on top.
- Parameters
header – the header (can be anything on which str() can be called)
-
class
oslo_reports.views.text.header.
TitledView
(title)¶ Bases:
oslo_reports.views.text.header.HeaderView
A Text View With a Title
This view simply serializes the model, and places a preformatted header containing the given title text on top. The title text can be up to 64 characters long.
- Parameters
title (str) – the title of the view
-
FORMAT_STR
= '========================================================================\n===={0: ^64}====\n========================================================================'¶
oslo_reports.views.text.process module¶
Provides process view
This module provides a view for visualizing processes in human-readable form
-
class
oslo_reports.views.text.process.
ProcessView
(path=None, text=None)¶ Bases:
oslo_reports.views.jinja_view.JinjaView
A Process View
This view displays process models defined by
oslo_reports.models.process.ProcessModel
-
VIEW_TEXT
= "Process {{ pid }} (under {{ parent_pid }}) [ run by: {{ username }} ({{ uids.real|default('unknown uid') }}), state: {{ state }} ]\n{% for child in children %} {{ child }}{% endfor %}"¶
-
oslo_reports.views.text.threading module¶
Provides thread and stack-trace views
This module provides a collection of views for visualizing threads, green threads, and stack traces in human-readable form.
-
class
oslo_reports.views.text.threading.
GreenThreadView
¶ Bases:
object
A Green Thread View
This view displays a green thread provided by the data model
oslo_reports.models.threading.GreenThreadModel
-
FORMAT_STR
= '------{thread_str: ^60}------\n{stack_trace}'¶
-
-
class
oslo_reports.views.text.threading.
StackTraceView
(path=None, text=None)¶ Bases:
oslo_reports.views.jinja_view.JinjaView
A Stack Trace View
This view displays stack trace models defined by
oslo_reports.models.threading.StackTraceModel
-
VIEW_TEXT
= '{% if root_exception is not none %}Exception: {{ root_exception }}\n------------------------------------\n\n{% endif %}{% for line in lines %}\n{{ line.filename }}:{{ line.line }} in {{ line.name }}\n {% if line.code is not none %}`{{ line.code }}`{% else %}(source not found){% endif %}\n{% else %}\nNo Traceback!\n{% endfor %}'¶
-
-
class
oslo_reports.views.text.threading.
ThreadView
¶ Bases:
object
A Thread Collection View
This view displays a python thread provided by the data model
oslo_reports.models.threading.ThreadModel
# noqa-
FORMAT_STR
= '------{thread_str: ^60}------\n{stack_trace}'¶
-
Module contents¶
Provides basic text views
This module provides several basic views which serialize models into human-readable text.