xylem package

Submodules

xylem.log_utils module

xylem.log_utils.debug(msg, file=None, *args, **kwargs)

Print debug to console or file.

Works like print and optionally uses terminal colors. Can be enabled or disabled with enable_debug().

xylem.log_utils.enable_debug(state=True)

En- or disable printing debug output to console.

xylem.log_utils.error(msg, file=None, exit=False, *args, **kwargs)

Print error statement and optionally exit.

Works like print and optionally uses terminal colors.

xylem.log_utils.info(msg, file=None, *args, **kwargs)

Print info to console or file.

Works like print and optionally uses terminal colors.

xylem.log_utils.warning(msg, file=None, *args, **kwargs)

Print warning to console or file.

Works like print and optionally uses terminal colors.

xylem.terminal_color module

Module to enable color terminal output.

class xylem.terminal_color.ColorTemplate(template)

Bases: string.Template

delimiter = '@'
pattern = <_sre.SRE_Pattern object at 0x7fa855a3b5a0>
xylem.terminal_color.ansi(key)

Return the escape sequence for a given ansi color key.

xylem.terminal_color.disable_ANSI_colors()

Disable output of ANSI color serquences with ansi().

Set all the ANSI escape sequences to empty strings, which effectively disables console colors.

xylem.terminal_color.enable_ANSI_colors()

Enable output of ANSI color serquences with ansi().

Colors are enabled by populating the global module dictionary _ansi with ANSI escape sequences.

xylem.terminal_color.fmt(msg)

Replace color annotations with ansi escape sequences.

xylem.terminal_color.sanitize(msg)

Sanitize the existing msg, use before adding color annotations.

xylem.update module

Implements the update functionality.

This includes the functions to collect and process source files. Part of this process is to load and run the spec parser, which are given by name in the source files.

xylem.update.handle_spec_urls(spec, urls)

Load a given spec parser by spec name and processed all urls.

Returns a list of new rules from parsed urls

Parameters:
  • spec (str) – name of a spec parser to load
  • urls (list of str) – list of urls to load for the given spec parser
xylem.update.load_url(url, retry=2, retry_period=1, timeout=10)

Load a given url with retries, retry_periods, and timeouts.

Based on https://github.com/ros-infrastructure/rosdistro/blob/master/src/rosdistro/loader.py

Parameters:
  • url (str) – URL to load and return contents of
  • retry (int) – number of times to retry the url on 503 or timeout
  • retry_period (float) – time to wait between retries in seconds
  • timeout (float) – timeout for opening the URL in seconds
xylem.update.update(prefix=None, dry_run=False)

Update the xylem cache.

If the prefix is set then the source lists are searched for in the prefix. If the prefix is not set (None) or the source lists are not found in the prefix, then the default, builtin source list is used.

Parameters:
  • prefix (str or None) – The config and cache prefix, usually ‘/’ or someother prefix
  • dry_run (bool) – If True, then no actual action is taken, only pretend to
xylem.update.verify_rules(rules, spec)

Verify that a set of rules are valid for internal storage.

Parameters:rules (dict) – set of nested dictionaries which is the internal DB format

xylem.util module

Provides common utility functions for xylem.

xylem.util.add_global_arguments(parser)
class xylem.util.change_directory(directory='')

Bases: object

xylem.util.create_temporary_directory(prefix_dir=None)

Create a temporary directory and return its location.

xylem.util.custom_exception_handler(type, value, tb)
xylem.util.handle_global_arguments(args)
xylem.util.pdb_hook()
xylem.util.print_exc(exc)
class xylem.util.redirected_stdio

Bases: object

class xylem.util.temporary_directory(prefix='')

Bases: object

Module contents