omero.scripts module¶
- Scripting types
- Classes:
Type – Top of parameter type hierarchy
Long –
String –
Bool –
List
Map
Set
- Functions:
- client – Produces an omero.client object with given
input/output constraints.
- class scripts.Bool(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an rbool
- PROTOTYPE_DEFAULT = False¶
- class scripts.Double(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an rdouble
- PROTOTYPE_DEFAULT = 0.0¶
- class scripts.Float(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an rfloat
- PROTOTYPE_DEFAULT = 0.0¶
- class scripts.Int(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an rint
- PROTOTYPE_DEFAULT = 0¶
- class scripts.List(*args: Any, **kwargs: Any)[source]¶
Bases:
__Coll
Wraps an rlist. To add values to the contents of the list, use “append” or “extend” since set.val is of type list.
- class scripts.Long(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an rlong
- PROTOTYPE_DEFAULT = 0¶
- class scripts.Map(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an rmap. To add values to the contents of the map, use “update” since map.val is of type dict.
- PROTOTYPE_DEFAULT¶
alias of
dict
- class scripts.Object(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an robject
- PROTOTYPE_DEFAULT = None¶
- exception scripts.ParseExit(params)[source]¶
Bases:
Exception
Raised when this script should just parse parameters and return.
- class scripts.Set(*args: Any, **kwargs: Any)[source]¶
Bases:
__Coll
Wraps an rset. To add values to the contents of the set, use “append” or “extend” since set.val is of type list.
- class scripts.String(*args: Any, **kwargs: Any)[source]¶
Bases:
Type
Wraps an rstring
- PROTOTYPE_DEFAULT = ''¶
- class scripts.Type(*args: Any, **kwargs: Any)[source]¶
Bases:
Param
omero.grid.Param subclass which provides convenience methods for input/output specification. Further subclasses are responsible for creating proper prototypes.
kwargs
- PROTOTYPE_DEFAULT = None¶
- PROTOTYPE_FUNCTION = None¶
- PROTOTYPE_MAX = None¶
- PROTOTYPE_MIN = None¶
- PROTOTYPE_VALUES = None¶
- scripts.client(*args, **kwargs)[source]¶
Entry point for all script engine scripts.
Typical usage consists of:
client = omero.scripts.client("name","description", omero.scripts.Long("name"),...)
where the returned client is created via the empty constructor to omero.client using only –Ice.Config or ICE_CONFIG, and the function arguments are taken as metadata about the current script. With this information, all script consumers should be able to determine the required types for execution.
Possible types are all subclasses of omero.scripts.Type
To change the omero.model.Format of the stdout and stderr produced by this script, use the constructor arguments:
client = omero.scripts.client(..., stdoutFormat = "text/plain", stderrFormat = "text/plain")
If you would like to prevent stdout and/or stderr from being uploaded, set the corresponding value to None. If you would like to overwrite the value with another file, use client.setOutput(). Though it is possible to attach any RType to “stdout” or “stderr”, there is an assumption that the value will be an robject(OriginalFileI())
Providing your own client is possible via the kwarg “client = …”, but be careful since this may break usage with the rest of the scripting framework. The client should not have a session, and must be configured for the argumentless version of createSession()
- scripts.group_params(params)[source]¶
Walks through the inputs of the given JobParams and returns a map-of-maps with Param names as the leaf nodes.
For example, for the following:
Params(“1”, grouping = “A”) # “A.” is equivalent Params(“2”, grouping = “A.B”) Params(“3”, grouping = “A.C”)
this function returns:
{“A” : {“”: “1”, “B” : “2”, “C” : “3”} }
while:
Params(“1”, grouping = “A”)
returns:
{“A” : “1”}
- scripts.handleParse(c)[source]¶
Raises ParseExit if the client has the configuration property “omero.scripts.parse”. If the value is anything other than “only”, then the parameters will also be sent to the server.
- scripts.parse_file(filename)[source]¶
Parses the given script file with “omero.scripts.parse” set and catches the exception. The parameters are returned.
WARNING: This method calls “exec” on the given file’s contents. Do NOT use this on data you don’t trust.
- scripts.parse_inputs(inputs_strings, params)[source]¶
Parses a command-line like string representation of input parameters into an RDict (a map from string to RType). The input should be an iterable of arguments of the form “key=value”.
For example, “a=1” gets mapped to {“a”:1}
- scripts.parse_text(scriptText)[source]¶
Parses the given script text with “omero.scripts.parse” set and catches the exception. The parameters are returned.
WARNING: This method calls “exec” on the given text. Do NOT use this on data you don’t trust.
- scripts.validate_inputs(params, inputs, svc=None, session=None)[source]¶
Method used by processor.py to check the input values provided by the user launching the script. If a non-empty errors string is returned, then the inputs fail validation.
A service instance can be provided in order to add default values to the session. If no service instance is provided, values with a default which are missing will be counted as errors.