pytower.tower

class pytower.tower.PyTowerParser(prog=None, usage=None, description=None, epilog=None, parents=[], formatter_class=<class 'argparse.HelpFormatter'>, prefix_chars='-', fromfile_prefix_chars=None, argument_default=None, conflict_handler='error', add_help=True, allow_abbrev=True, exit_on_error=True)[source]
add_subparsers(**kwargs)[source]
error(message)[source]

Prints a usage message incorporating the message to stderr and exits.

If you override this in a subclass, it should not return – it should either exit or raise an exception.

Parameters:

message (str)

pytower.tower.backup(mode, filename, backends=None, backend='Catbox', force=False)[source]

Prints list of tools

Parameters:
  • mode (str) – Either ‘save’ or ‘restore’

  • filename (str) – Path or file name of the CondoData/.map file to backup

  • backends (Optional[list[ResourceBackend]]) – List of resource backends, if included avoids reloading

  • backend (str) – Backend to use when restoring

  • force (bool) – Whether to force reupload of resources

pytower.tower.config_confirm_show()[source]
Return type:

bool

pytower.tower.convert(filename)[source]

Converts input into .json or vice versa, from the uesave tower-unite-suitebro .json format

Parameters:

filename (str) – Path or file name of the CondoData/.map file to convert

pytower.tower.find_tool(tools, name)[source]
Return type:

tuple[ModuleType | str, ToolMetadata] | None

Parameters:
pytower.tower.fix(filename, backends=None, backend='Catbox', force=False)[source]

Scans a directory for tool scripts and registers detected tool scripts

Parameters:
  • filename (str) – Path or file name of the CondoData/.map file to fix

  • backends (Optional[list[ResourceBackend]]) – List of resource backends, if included avoids reloading

  • backend (str) – Backend to use when fixing

  • force (bool) – Whether to force reupload of resources

pytower.tower.get_parser(tool_names)[source]
Parameters:

tool_names (str) – List of tool names as a string. Used when running pytower

Return type:

PyTowerParser

Returns:

The argparse parser used to parse the program input

pytower.tower.get_resource_backends()[source]
Return type:

list[ResourceBackend]

Returns:

List of ResourceBackends registered with PyTower

pytower.tower.get_tool_names(tools)[source]
Return type:

str

Parameters:

tools (list[tuple[ModuleType | str, ToolMetadata]])

pytower.tower.info_tool(tool_input, tools=None, tool_names='')[source]

Prints information about input tool name

Parameters:
  • tool_input (str) – Name of the tool to print info for

  • tools (Optional[list[tuple[ModuleType | str, ToolMetadata]]]) – List of tools, if included avoids reloading the tool index

  • tool_names (str) – Tool names, if included avoids recalculating

pytower.tower.list_tools(tools=None)[source]

Prints list of tools

Parameters:

tools (Optional[list[tuple[ModuleType | str, ToolMetadata]]]) – List of tools, if included avoids reloading the tool index

pytower.tower.main()[source]

Entrypoint for PyTower

pytower.tower.parse_args(parser=None)[source]
Parameters:

parser (PyTowerParser | None)

pytower.tower.parse_parameters(param_input, meta)[source]

Parse input parameters into a ParameterDict to pass into tool’s main method

Parameters:
  • param_input (list[Any]) – List of strings in the format “parameter=value” to be parsed

  • meta (ToolMetadata) – Accompanying metadata of the tool being run

Return type:

ParameterDict

Returns:

ParameterDict object containing parsed parameters, which can be accessed with dot notation or like a dictionary

pytower.tower.parse_resource_backend(backends, backend_input)[source]
Return type:

ResourceBackend

Parameters:
pytower.tower.parse_selector(selection_input)[source]

Parses a single selector string input into a Selector object

Parameters:

selection_input (str) – Input string to parse

Return type:

Selector | None

Returns:

Parsed Selector object

pytower.tower.parse_selectors(selection_input)[source]

Parses an input string, where each selector is separated with a ‘;’, into a sequence of Selector objects

Parameters:

selection_input (str) – String input to parse

Return type:

Selector

Returns:

Selector object

pytower.tower.run(input_filename, tool, selector=None, params=None)[source]

Mock run for rapid prototyping tools

Parameters:
pytower.tower.scan(path, tools=None)[source]

Scans a directory for tool scripts and registers detected tool scripts

Parameters:
Return type:

list[tuple[ModuleType | str, ToolMetadata]]

pytower.tower.version()[source]

PyTower version

Return type:

str

Returns:

The version as a string, in the format “PyTower {version}”