GPToolbox

GPTool Parameter Builder

The GPTool Parameter Builder is responsible for creating code blocks to be placed into the main GPTool template. Each create method corresponds to a GPTool method that must be defined in order for it to be a valid tool. These methods implement the GetParameterInfo, UpdateParameter, and Execute methods of the GPTool Python class.

For example, to define a GPTool in a Python toolbox, start out with a class definition and implement the methods arcpy expects:

class myTool(Object):
    def __init__(self):
        self.label = "My Tool"
        self.description = "Tool description"
        self.canRunInBackground = True

    def getParameterInfo(self):
        # builder.create_param_info() goes here

    def is Licensed(self):
        return True

    def updateParameters(self, parameters):
        # builder.create_update_parameter goes here

    def updateMessages(self, parameters):
        return

    def execute(self, parameters, messages):
        # builder.create_pre_execute goes here
        # submit job
        # builder.create_post_execute goes here
exception gsfarc.gptool.parameter.builder.UnknownDataTypeError[source]

Error class for raising unknown datatypes

gsfarc.gptool.parameter.builder.convert_list(in_list)[source]

Converts a list of strings to a printable list of object names

gsfarc.gptool.parameter.builder.create_param_info(task_params)[source]

Builds the code block for the GPTool GetParameterInfo method based on the input task_params.

Parameters:task_params – A list of task parameters to map to GPTool parameters.
Returns:A string representing the code block to the GPTool GetParameterInfo method.
gsfarc.gptool.parameter.builder.create_post_execute(task_params)[source]

Builds the code block for the GPTool Execute method after the GSF job is submitted based on the input task_params.

Parameters:task_params – A list of task parameters from the task info structure.
Returns:A string representing the code block to the GPTool Execute method.
gsfarc.gptool.parameter.builder.create_pre_execute(task_params)[source]

Builds the code block for the GPTool Execute method before the GSF job is submitted based on the input task_params.

Parameters:task_params – A list of task parameters from the task info structure.
Returns:A string representing the code block to the GPTool Execute method.
gsfarc.gptool.parameter.builder.create_update_parameter(task_params)[source]

Builds the code block for the GPTool UpdateParameter method based on the input task_params.

Parameters:task_params – A list of task parameters from the task info structure.
Returns:A string representing the code block to the GPTool UpdateParameter method.

GPTool Parameter Template

class gsfarc.gptool.parameter.template.Template(data_type)[source]

Interface class for mapping ESE parameters to ArcGIS GPTool parameters.

default_value()[source]

Defines the code block for this parameter data type in the GPTool GetParameterInfo if a default value exists.

Returns:Returns the string.Template object.
get_parameter(task_param)[source]

Defines the code block for this parameter data type in the GPTool GetParameterInfo method. All code returned must begin with 2 indents. The template is substituted against the GP parameter dictionary.

Parameters:task_param – The ESE task parameter information.
Returns:Returns the string.Template object.
parameter_names(task_param)[source]

Defines the code block for the parameter variable names in the GPTool GetParameterInfo method.

Parameters:task_param – The ESE task parameter
Returns:A list of string.Template objects representing the parameter variable names defined in get_parameter.
post_execute()[source]

Defines the code block for this parameter data type in the GPTool Execute method after the job is submitted to GSF

Returns:Returns the the string.Template object
pre_execute()[source]

Defines the code block for this parameter data type in the GPTool Execute method before the job is submitted to GSF

Returns:Returns the string.Template object
update_parameter()[source]

Defines the code block for this parameter data type in the GPTool UpdateParameter method.

Returns:Returns the string.Template object.