base

class ShellCommand[source]

Bases: object

Base class used to provide commands for exploring a particular datatype. A basic set of commands is provided for all datatypes, but specific datatype classes may provide their own, by overriding the shell_commands attribute.

commands = []
help_text = None
execute(shell, *args, **kwargs)[source]

Execute the command. Get the dataset reader as shell.data.

Parameters:
  • shell – DataShell instance. Reader available as shell.data
  • args – Args given by the user
  • kwargs – Named args given by the user as key=val
class DataShell(data, commands, *args, **kwargs)[source]

Bases: cmd.Cmd

Terminal shell for querying datatypes.

prompt = '>>> '
get_names()[source]
do_EOF(line)[source]

Exits the shell

preloop()[source]

Hook method executed once when the cmdloop() method is called.

postloop()[source]

Hook method executed once when the cmdloop() method is about to return.

emptyline()[source]

Don’t repeat the last command (default): ignore empty lines

default(line)[source]

We use this to handle commands that can’t be handled using the do_ pattern. Also handles the default fallback, which is to execute Python.

cmdloop(intro=None)[source]

Repeatedly issue a prompt, accept input, parse an initial prefix off the received input, and dispatch to action methods, passing them the remainder of the line as argument.

exception ShellError[source]

Bases: Exception