Interface Method Argument Descriptors

Argument Descriptor

Descriptor for method arguments (inputs and outputs) of interface methods.

This descriptor contains the specifications of:

  • argument kind (depending on the specified type);
  • argument count;
  • associated documentation.
class ORSServiceClass.OrsPlugin.InterfaceMethodArgumentDescriptors.argumentdescriptor.ArgumentDescriptor(valueType, count=1, documentation='')
COUNT_GREATER_OR_EQUAL_THAN_VALUE = 2
COUNT_LESS_OR_EQUAL_THAN_VALUE = 1
COUNT_RANGE = 3
COUNT_SINGLE = 0
canExtractValueFromASTNode(nodeValue)
canIdentifyVariableByValue(singleValue)
canSelectionBeUsedToDefineVariable()
classmethod createFromDocstringDict(dictArgumentFromDocstring, isInput)
classmethod determineCountValue(count)

Method used to determine if the argument is a list of elements of the specified type, or if no list should be used.

It determines also how many elements can be contained in the list.

Parameters:count – a single integer or a list of 2 integers. If given as a single integer, the argument is a list that should contain that number of elements. That number must be greater or equal to 0. Exception: if the value “1”, no list is used. If given as a list of 2 positive integers, the first value gives the minimal acceptable count of elements in the list and the second value gives the maximal acceptable count of elements in the list. The second value must be greater or equal than the first value. The first value can be set as “None”, meaning 0. The second value can be set as “None”, meaning no maximum count.
Returns:output – 1 if the argument should be used directly (no list used), or a list with 2 elements (the minimal and maximal accepted number of elements in the list)
extractValueFromASTNode(nodeValue)
getAsCallable(value)

Gets a callable version of a value of a given type.

This method is to be used when we want to preserve the identity of an immutable variable (ex: int, float, str, …) in the logging process.

Use this method on the argument descriptor.

See also: ArgumentDescriptor.getVariableAsCallable

Parameters:value – the value to get a callable version of
Return:the callable version of the value (if the argument type supports this functionality)
getAvailableTypes()
getCountAsString()

Gets the count as a string. This is a summary string for display information. :return: string of the count :rtype: str

getCountForDocstring()

Gets the count description string. Example: “[2, None]”. This is to be used when writing the file canvas, in the docstring of the interface method.

Return:string to print.
Rtype:str
getCountMax()
getCountMin()
getCountMode()
getDefaultValueAsString()
getDocumentation()
getIsValidValue(valueToValidate)
getPythonObjectFromInputArgument(name, valueToValidate)
getRepresentsFileValue()
getRepresentsORSModelClassValue()
getRepresentsORSObjectValue()
getRepresentsPythonNativeValue()
getSingleElementFromAvailableSelection()
getSingleValueRepresentation(singleValue)
getSingleValueShouldBeDefined(singleValue)
getTypeAsString()

Gets the type of a single argument :return: string of the type :rtype: str

getUniqueIdentifierForSingleValue(singleValue)
getValueFromWidget(descriptorWidget)
classmethod getVariableAsCallable(value, valueType)

Gets a callable version of a value of a given type.

This method is to be used when we want to preserve the identity of an immutable variable (ex: int, float, str, …) in the logging process.

Use this method when the argument descriptor is not known in advance, for example when we want to use the same integer in input of multiple method calls to be logged.

See also: ArgumentDescriptor.getAsCallable

Parameters:
  • value – the value to get a callable version of
  • valueType – the type of the value (ex: bool, int, float, str)
Returns:

output – the callable version of the value (if the argument type supports this functionality)

getWidget(parent)
isAvailableSelectionContainsSingleElement()
isAvailableSelectionShouldConsiderAllVariableUsages()
isCollection()
isValueValidForAllDescriptors(valueToValidate)
setDescriptorsToSatisfyForValidAvailableSelection(listArgumentDescriptors)
setValueInWidget(descriptorWidget, value)

Types of arguments

These are the accepted types to be used in common interface methods.

Python native

Descriptor for arguments of Python native types.

Supported types:

Type to write Accepted argument type Example of argument
bool bool True
int int 5
float float or int 6.48, 5
str str 'Hello world!'
tuple tuple (2, -3.5, 6, True, None)
dict dict {'a': 3, 'b': -10}

Files

Descriptor for arguments specifying files.

Supported types:

Type to write Accepted argument type Example of argument
file a string of a path to an existing file on the disk 'C:/tmp/anExistingFile.png'
file saving a string of a path to a file that may exist or not (used essentially for saving results) 'C:/tmp/aFileToCreate.png'

Instances of Managed

Descriptor for arguments of ORS Managed types.

Supported types:

Type to write Accepted argument type Example of argument

any subclass of ORSModel.ors.Managed, separated by commas.

Example (for an instance of the Channel class): ORSModel.ors.Channel

Example (for an instance of the ROI or MultiROI class): ORSModel.ors.ROI, ORSModel.ors.MultiROI

an instance of this class (recommended) Channel()
a string of the GUID of the instance of this class (in that case, the instance corresponding to this GUID will be given to the method) '8709183874076527723CxvChannel'

Instances of Unmanaged

Descriptor for arguments of ORS Unmanaged types.

Supported types:

Type to write Accepted argument type Example of argument

any subclass of ORSModel.ors.Unmanaged

Example (for an instance of the Vector3 class): ORSModel.ors.Vector3

an instance of this class orsVect(1.0, 0.0, 0.0)

Classes of Managed or Unmanaged

Descriptor for arguments of ORS Managed and ORS Unmanaged classes types.

Supported types:

Type to write Accepted argument type Example of argument

any subclass of ORSModel.ors.Managed or ORSModel.ors.Unmanaged, followed by class.

Example (for the StructuredGrid class): ORSModel.ors.StructuredGrid class

the specified class or any of his subclasses Channel

IntEnum

Descriptor for arguments of IntEnum types.

Supported types:

Type to write Accepted argument type Example of argument

any subclass of IntEnum contained in COMWrapper.ORS_def, preceded by IntEnum.

Example (for the CxvChannel_Data_Type class): IntEnum CxvChannel_Data_Type

an element of the specified IntEnum class (recommended) COMWrapper.ORS_def.CxvChannel_Data_Type.CXVCHANNEL_DATA_TYPE_UNSIGNED_INT
an integer corresponding to an element of the specified IntEnum class. 4

Undefined

Descriptor for arguments of undefined type.

Supported types:

Type to write Accepted argument type Example of argument
undefined anything np.amin