fiftyone.operators.operator¶
FiftyOne operators.
Classes:
|
A FiftyOne operator. |
|
A configuration for an operator. |
-
class
fiftyone.operators.operator.
OperatorConfig
(name, label=None, description=None, dynamic=False, execute_as_generator=False, unlisted=False, on_startup=False, disable_schema_validation=False, delegation_target=None, icon=None, light_icon=None, dark_icon=None)¶ Bases:
object
A configuration for an operator.
- Parameters
name – the name of the operator
label (name) – a label for the operator
description (None) – a description of the operator
dynamic (False) – whether the operator inputs and outputs should be resolved when the input/output changes
execute_as_generator (False) – whether the operator should be executed as a generator
unlisted (False) – whether the operator should be hidden from the Operator Browser
on_startup (False) – whether the operator should be executed on startup
disable_schema_validation (False) – whether the operator built-in schema validation should be disabled
icon (None) – icon to show for the operator in the Operator Browser
light_icon (None) – icon to show for the operator in the Operator Browser when app is in the light mode
dark_icon (None) – icon to show for the operator in the Operator Browser when app is in the dark mode
Methods:
to_json
()-
to_json
()¶
-
class
fiftyone.operators.operator.
Operator
(_builtin=False)¶ Bases:
object
A FiftyOne operator.
Operators represent an operation and the details of how to execute it.
FiftyOne operators contain enough information for a user interface to render a form or button allowing a user to execute the operation.
Methods:
add_secrets
(secrets)Adds secrets to the operator.
execute
(ctx)Executes the operator.
resolve_definition
(resolve_dynamic, ctx)Returns a resolved definition of the operator.
resolve_delegation
(ctx)Returns the resolved delegation flag.
resolve_input
(ctx)Returns the resolved input property.
resolve_output
(ctx)Returns the resolved output property.
resolve_placement
(ctx)Returns the resolved placement of the operator.
resolve_type
(ctx, type)Returns the resolved input or output property.
to_json
(ctx[, resolve_dynamic])Returns a JSON representation of the operator.
Attributes:
Whether the operator is builtin.
The
OperatorConfig
for the operator.The unique identifier of the operator:
plugin_name/operator_name
.-
property
name
¶
-
property
delegation_target
¶
-
property
uri
¶ The unique identifier of the operator:
plugin_name/operator_name
.
-
property
builtin
¶ Whether the operator is builtin.
-
property
config
¶ The
OperatorConfig
for the operator.
-
resolve_definition
(resolve_dynamic, ctx)¶ Returns a resolved definition of the operator.
The resolved definition is a clone of the default definition using
resolve_input()
andresolve_output()
to resolve the inputs and output properties of the operator.Passing
resolve_dynamic=False
allows resolution of dynamic operators to be deferred to execution time. If the operatoris_dyanmic
andresolve_dynamic
is False, a clone of default definition is returned.- Parameters
resolve_dynamic – whether to resolve dynamic inputs and outputs
- Returns
a definition
fiftyone.operators.types.Object
-
resolve_delegation
(ctx) → bool¶ Returns the resolved delegation flag.
Subclasses can implement this method to define the logic which decides if the operation should be queued for delegation
- Parameters
- Returns
a boolean
-
execute
(ctx)¶ Executes the operator.
Subclasses must implement this method.
- Parameters
-
resolve_type
(ctx, type)¶ Returns the resolved input or output property.
- Parameters
type – the type of property to resolve, either
"inputs"
or"outputs"
- Returns
a
fiftyone.operators.types.Property
, or None
-
resolve_input
(ctx)¶ Returns the resolved input property.
Subclasses can implement this method to define the inputs to the operator. This method should never be called directly. Instead use
resolve_type()
.By default, this method is called once when the operator is created. If the operator is dynamic, this method is called each time the input changes.
- Parameters
- Returns
a
fiftyone.operators.types.Property
, or None
-
resolve_output
(ctx)¶ Returns the resolved output property.
Subclasses can implement this method to define the outputs of the operator.
By default, this method is called once when the operator is created. If the operator is dynamic, this method is called after the operator is executed.
- Parameters
- Returns
a
fiftyone.operators.types.Property
, or None
-
resolve_placement
(ctx)¶ Returns the resolved placement of the operator.
Subclasses can implement this method to define the placement of the operator.
- Parameters
- Returns
a
fiftyone.operators.types.Placement
, or None
-
to_json
(ctx, resolve_dynamic=False)¶ Returns a JSON representation of the operator.
- Parameters
resolve_dynamic (False) – whether to resolve dynamic inputs and outputs
- Returns
a JSON dict
-
add_secrets
(secrets)¶ Adds secrets to the operator.
- Parameters
secrets – a list of secrets
-
property