image_recognition_skybiometry.timeout

Classes

Timeout

Wrap a function and add a timeout (limit) attribute to it.

Functions

_target(queue, function, *args, **kwargs)

Run a function with arguments and return output via a queue.

Module Contents

image_recognition_skybiometry.timeout._target(queue, function, *args, **kwargs)[source]

Run a function with arguments and return output via a queue.

This is a helper function for the Process created in _Timeout. It runs the function with positional arguments and keyword arguments and then returns the function’s output by way of a queue. If an exception gets raised, it is returned to _Timeout to be raised by the value property.

class image_recognition_skybiometry.timeout.Timeout(function, limit)[source]

Bases: object

Wrap a function and add a timeout (limit) attribute to it.

Instances of this class are automatically generated by the add_timeout function defined above. Wrapping a function allows asynchronous calls to be made and termination of execution after a timeout has passed.

Initialize instance in preparation for being called.

__limit
__function
__name__
__doc__
__timeout
__process
__queue
__call__(*args, **kwargs)[source]

Execute the embedded function object asynchronously.

The function given to the constructor is transparently called and requires that “ready” be intermittently polled. If and when it is True, the “value” property may then be checked for returned data.

cancel()[source]

Terminate any possible execution of the embedded function.

property ready

Read-only property indicating status of “value” property.

property value

Read-only property containing data returned from function.