datakit package

Submodules

datakit.command_helpers module

class datakit.command_helpers.CommandHelpers[source]

Bases: object

Mixin class containing common helper methods for Datakit plugins. Intended to be sub-classed alongside Cliff Command.

Usage:

Note

default_configs is a property. Please do not forget to use the decorator when you override in a subclass!

Example:
from cliff.command import Command
from datakit import CommandHelpers

class SomeCommand(CommandHelpers, Command):

    plugin_slug = 'my-plugin'

    def take_action(self, parsed):
        print('do stuff')

    @property
    def default_configs(self):
        return { 'foo' : 'bar' }
configs
default_configs
log = <Logger datakit.command_helpers (WARNING)>
plugin_config_parent_dir
plugin_config_path
plugin_slug = None
update_configs(new_configs)[source]
write_configs(configs)[source]

datakit.datakit_app module

class datakit.datakit_app.Datakit(*args, **kwargs)[source]

Bases: cliff.app.App

build_option_parser(description, version, argparse_kwargs=None)[source]

Return an argparse option parser for this application. Subclasses may override this method to extend the parser with more global options. :param description: full description of the application :paramtype description: str :param version: version number for the application :paramtype version: str :param argparse_kwargs: extra keyword argument passed to the

ArgumentParser constructor
print_help_if_requested()[source]

Print help and exits if deferred help is enabled and requested. ‘–help’ shows the help message and exits:

  • without calling initialize_app if not self.deferred_help (default),
  • after initialize_app call if self.deferred_help,
  • during initialize_app call if self.deferred_help and subclass calls explicitly this method in initialize_app.

datakit.help module

class datakit.help.HelpAction(option_strings, dest, nargs=None, const=None, default=None, type=None, choices=None, required=False, help=None, metavar=None)[source]

Bases: argparse.Action

Provide a custom action so the -h and –help options to the main app will print a list of the commands.

The commands are determined by checking the CommandManager instance, passed in as the “default” value for the action.

class datakit.help.HelpCommand(app, app_args, cmd_name=None)[source]

Bases: cliff.command.Command

print detailed help for another command

get_parser(prog_name)[source]

Return an argparse.ArgumentParser.

take_action(parsed_args)[source]

Override to do something useful.

The returned value will be returned by the program.

datakit.main module

datakit.main.main(argv=['-T', '-E', '-b', 'html', '-d', '_build/doctrees', '-D', 'language=en', '.', '_build/html'])[source]

datakit.utils module

datakit.utils.dist_for_obj(obj)[source]
datakit.utils.home_dir()[source]
datakit.utils.makedirs(basepath, dirs=[])[source]
datakit.utils.mkdir_p(path)[source]
datakit.utils.read_json(path)[source]
datakit.utils.write_json(path, data, indent=4)[source]

Module contents