colawater.lib.tool#

Type factory for building arcpy tools.

Examples

Foo = toolshed(
    "Foo",
    "Performs arbitrary incantations on your database.",
    some_module.parameters,
    some_module.execute,
)

Module Contents#

Functions#

toolshed(→ type)

Returns a tool class in the shape expected by ArcPy.

colawater.lib.tool.toolshed(label: str, description: str, parameters: Callable[[], list[arcpy.Parameter]], execute: Callable[[list[arcpy.Parameter]], None], category: str | None = None, backgroundable: bool = False, update_parameters: Callable[[list[arcpy.Parameter]], None] = lambda _: ..., update_messages: Callable[[list[arcpy.Parameter]], None] = lambda _: ..., post_execute: Callable[[list[arcpy.Parameter]], None] = lambda _: ...) type#

Returns a tool class in the shape expected by ArcPy.

Parameters:
  • label (str) –

  • description (str) –

  • parameters (Callable[[], list[arcpy.Parameter]]) – A function providing the tool parameters.

  • execute (Callable[[list[arcpy.Parameter]], None]) – The tool’s entry point.

  • category (Optional[str]) – A tool category. Defaults to None.

  • backgroundable (bool) – Whether the tool can be backgrounded. Defaults to False.

  • update_parameters (Callable[[list[arcpy.Parameter]], None]) – A function that updates the parameter values. Defaults to lambda _: None.

  • update_messages (Callable[[list[arcpy.Parameter]], None]) – A function that updates parameter messages. Defaults to lambda _: None.

  • post_execute (Callable[[list[arcpy.Parameter]], None]) – A function to be run after execute runs. Defaults to lambda _: None.

Returns:

A class with all the required attributes and methods for use in a toolbox.

Return type:

type