repository_name stringlengths 5 67 | func_path_in_repository stringlengths 4 234 | func_name stringlengths 0 314 | whole_func_string stringlengths 52 3.87M | language stringclasses 6
values | func_code_string stringlengths 52 3.87M | func_documentation_string stringlengths 1 47.2k | func_code_url stringlengths 85 339 |
|---|---|---|---|---|---|---|---|
ska-sa/katcp-python | katcp/inspecting_client.py | ExponentialRandomBackoff.failed | def failed(self):
"""Call whenever an action has failed, grows delay exponentially
After calling failed(), the `delay` property contains the next delay
"""
try:
self._validate_parameters()
self._base_delay = min(
self._base_delay * self.exp_fac,
... | python | def failed(self):
"""Call whenever an action has failed, grows delay exponentially
After calling failed(), the `delay` property contains the next delay
"""
try:
self._validate_parameters()
self._base_delay = min(
self._base_delay * self.exp_fac,
... | Call whenever an action has failed, grows delay exponentially
After calling failed(), the `delay` property contains the next delay | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L71-L84 |
ska-sa/katcp-python | katcp/inspecting_client.py | _InformHookDeviceClient.hook_inform | def hook_inform(self, inform_name, callback):
"""Hookup a function to be called when an inform is received.
Useful for interface-changed and sensor-status informs.
Parameters
----------
inform_name : str
The name of the inform.
callback : function
... | python | def hook_inform(self, inform_name, callback):
"""Hookup a function to be called when an inform is received.
Useful for interface-changed and sensor-status informs.
Parameters
----------
inform_name : str
The name of the inform.
callback : function
... | Hookup a function to be called when an inform is received.
Useful for interface-changed and sensor-status informs.
Parameters
----------
inform_name : str
The name of the inform.
callback : function
The function to be called. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L135-L150 |
ska-sa/katcp-python | katcp/inspecting_client.py | _InformHookDeviceClient.handle_inform | def handle_inform(self, msg):
"""Call callbacks on hooked informs followed by normal processing"""
try:
for func in self._inform_hooks.get(msg.name, []):
func(msg)
except Exception:
self._logger.warning('Call to function "{0}" with message "{1}".'
... | python | def handle_inform(self, msg):
"""Call callbacks on hooked informs followed by normal processing"""
try:
for func in self._inform_hooks.get(msg.name, []):
func(msg)
except Exception:
self._logger.warning('Call to function "{0}" with message "{1}".'
... | Call callbacks on hooked informs followed by normal processing | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L152-L160 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.inform_hook_client_factory | def inform_hook_client_factory(self, host, port, *args, **kwargs):
"""Return an instance of :class:`_InformHookDeviceClient` or similar
Provided to ease testing. Dynamically overriding this method after instantiation
but before start() is called allows for deep brain surgery. See
:class... | python | def inform_hook_client_factory(self, host, port, *args, **kwargs):
"""Return an instance of :class:`_InformHookDeviceClient` or similar
Provided to ease testing. Dynamically overriding this method after instantiation
but before start() is called allows for deep brain surgery. See
:class... | Return an instance of :class:`_InformHookDeviceClient` or similar
Provided to ease testing. Dynamically overriding this method after instantiation
but before start() is called allows for deep brain surgery. See
:class:`katcp.fake_clients.TBD` | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L260-L268 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.until_state | def until_state(self, desired_state, timeout=None):
"""
Wait until state is desired_state, InspectingClientStateType instance
Returns a future
"""
return self._state.until_state(desired_state, timeout=timeout) | python | def until_state(self, desired_state, timeout=None):
"""
Wait until state is desired_state, InspectingClientStateType instance
Returns a future
"""
return self._state.until_state(desired_state, timeout=timeout) | Wait until state is desired_state, InspectingClientStateType instance
Returns a future | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L336-L343 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.connect | def connect(self, timeout=None):
"""Connect to KATCP interface, starting what is needed
Parameters
----------
timeout : float, None
Time to wait until connected. No waiting if None.
Raises
------
:class:`tornado.gen.TimeoutError` if the connect time... | python | def connect(self, timeout=None):
"""Connect to KATCP interface, starting what is needed
Parameters
----------
timeout : float, None
Time to wait until connected. No waiting if None.
Raises
------
:class:`tornado.gen.TimeoutError` if the connect time... | Connect to KATCP interface, starting what is needed
Parameters
----------
timeout : float, None
Time to wait until connected. No waiting if None.
Raises
------
:class:`tornado.gen.TimeoutError` if the connect timeout expires | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L346-L378 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.inspect | def inspect(self):
"""Inspect device requests and sensors, update model
Returns
-------
Tornado future that resolves with:
model_changes : Nested AttrDict or None
Contains sets of added/removed request/sensor names
Example structure:
{'req... | python | def inspect(self):
"""Inspect device requests and sensors, update model
Returns
-------
Tornado future that resolves with:
model_changes : Nested AttrDict or None
Contains sets of added/removed request/sensor names
Example structure:
{'req... | Inspect device requests and sensors, update model
Returns
-------
Tornado future that resolves with:
model_changes : Nested AttrDict or None
Contains sets of added/removed request/sensor names
Example structure:
{'requests': {
'add... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L541-L590 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.inspect_requests | def inspect_requests(self, name=None, timeout=None):
"""Inspect all or one requests on the device. Update requests index.
Parameters
----------
name : str or None, optional
Name of the request or None to get all requests.
timeout : float or None, optional
... | python | def inspect_requests(self, name=None, timeout=None):
"""Inspect all or one requests on the device. Update requests index.
Parameters
----------
name : str or None, optional
Name of the request or None to get all requests.
timeout : float or None, optional
... | Inspect all or one requests on the device. Update requests index.
Parameters
----------
name : str or None, optional
Name of the request or None to get all requests.
timeout : float or None, optional
Timeout for request inspection, None for no timeout
Re... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L593-L657 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync._get_request_timeout_hints | def _get_request_timeout_hints(self, name=None, timeout=None):
"""Get request timeout hints from device
Parameters
=========
name : str or None, optional
Name of the request or None to get all request timeout hints.
timeout : float seconds
Timeout for ?re... | python | def _get_request_timeout_hints(self, name=None, timeout=None):
"""Get request timeout hints from device
Parameters
=========
name : str or None, optional
Name of the request or None to get all request timeout hints.
timeout : float seconds
Timeout for ?re... | Get request timeout hints from device
Parameters
=========
name : str or None, optional
Name of the request or None to get all request timeout hints.
timeout : float seconds
Timeout for ?request-timeout-hint
Returns
-------
Tornado future... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L660-L704 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.inspect_sensors | def inspect_sensors(self, name=None, timeout=None):
"""Inspect all or one sensor on the device. Update sensors index.
Parameters
----------
name : str or None, optional
Name of the sensor or None to get all sensors.
timeout : float or None, optional
Timeo... | python | def inspect_sensors(self, name=None, timeout=None):
"""Inspect all or one sensor on the device. Update sensors index.
Parameters
----------
name : str or None, optional
Name of the sensor or None to get all sensors.
timeout : float or None, optional
Timeo... | Inspect all or one sensor on the device. Update sensors index.
Parameters
----------
name : str or None, optional
Name of the sensor or None to get all sensors.
timeout : float or None, optional
Timeout for sensors inspection, None for no timeout
Returns... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L707-L769 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.future_check_sensor | def future_check_sensor(self, name, update=None):
"""Check if the sensor exists.
Used internally by future_get_sensor. This method is aware of
synchronisation in progress and if inspection of the server is allowed.
Parameters
----------
name : str
Name of th... | python | def future_check_sensor(self, name, update=None):
"""Check if the sensor exists.
Used internally by future_get_sensor. This method is aware of
synchronisation in progress and if inspection of the server is allowed.
Parameters
----------
name : str
Name of th... | Check if the sensor exists.
Used internally by future_get_sensor. This method is aware of
synchronisation in progress and if inspection of the server is allowed.
Parameters
----------
name : str
Name of the sensor to verify.
update : bool or None, optional
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L772-L802 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.future_get_sensor | def future_get_sensor(self, name, update=None):
"""Get the sensor object.
Check if we have information for this sensor, if not connect to server
and update (if allowed) to get information.
Parameters
----------
name : string
Name of the sensor.
updat... | python | def future_get_sensor(self, name, update=None):
"""Get the sensor object.
Check if we have information for this sensor, if not connect to server
and update (if allowed) to get information.
Parameters
----------
name : string
Name of the sensor.
updat... | Get the sensor object.
Check if we have information for this sensor, if not connect to server
and update (if allowed) to get information.
Parameters
----------
name : string
Name of the sensor.
update : bool or None, optional
True allow inspect c... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L805-L849 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.future_check_request | def future_check_request(self, name, update=None):
"""Check if the request exists.
Used internally by future_get_request. This method is aware of
synchronisation in progress and if inspection of the server is allowed.
Parameters
----------
name : str
Name of... | python | def future_check_request(self, name, update=None):
"""Check if the request exists.
Used internally by future_get_request. This method is aware of
synchronisation in progress and if inspection of the server is allowed.
Parameters
----------
name : str
Name of... | Check if the request exists.
Used internally by future_get_request. This method is aware of
synchronisation in progress and if inspection of the server is allowed.
Parameters
----------
name : str
Name of the request to verify.
update : bool or None, optiona... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L852-L881 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.future_get_request | def future_get_request(self, name, update=None):
"""Get the request object.
Check if we have information for this request, if not connect to server
and update (if allowed).
Parameters
----------
name : string
Name of the request.
update : bool or Non... | python | def future_get_request(self, name, update=None):
"""Get the request object.
Check if we have information for this request, if not connect to server
and update (if allowed).
Parameters
----------
name : string
Name of the request.
update : bool or Non... | Get the request object.
Check if we have information for this request, if not connect to server
and update (if allowed).
Parameters
----------
name : string
Name of the request.
update : bool or None, optional
True allow inspect client to inspect... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L884-L917 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync._cb_inform_sensor_status | def _cb_inform_sensor_status(self, msg):
"""Update received for an sensor."""
timestamp = msg.arguments[0]
num_sensors = int(msg.arguments[1])
assert len(msg.arguments) == 2 + num_sensors * 3
for n in xrange(num_sensors):
name = msg.arguments[2 + n * 3]
st... | python | def _cb_inform_sensor_status(self, msg):
"""Update received for an sensor."""
timestamp = msg.arguments[0]
num_sensors = int(msg.arguments[1])
assert len(msg.arguments) == 2 + num_sensors * 3
for n in xrange(num_sensors):
name = msg.arguments[2 + n * 3]
st... | Update received for an sensor. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L945-L954 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync._cb_inform_interface_change | def _cb_inform_interface_change(self, msg):
"""Update the sensors and requests available."""
self._logger.debug('cb_inform_interface_change(%s)', msg)
self._interface_changed.set() | python | def _cb_inform_interface_change(self, msg):
"""Update the sensors and requests available."""
self._logger.debug('cb_inform_interface_change(%s)', msg)
self._interface_changed.set() | Update the sensors and requests available. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L956-L959 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync.simple_request | def simple_request(self, request, *args, **kwargs):
"""Create and send a request to the server.
This method implements a very small subset of the options
possible to send an request. It is provided as a shortcut to
sending a simple request.
Parameters
----------
... | python | def simple_request(self, request, *args, **kwargs):
"""Create and send a request to the server.
This method implements a very small subset of the options
possible to send an request. It is provided as a shortcut to
sending a simple request.
Parameters
----------
... | Create and send a request to the server.
This method implements a very small subset of the options
possible to send an request. It is provided as a shortcut to
sending a simple request.
Parameters
----------
request : str
The request to call.
*args :... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L966-L1011 |
ska-sa/katcp-python | katcp/inspecting_client.py | InspectingClientAsync._difference | def _difference(self, original_keys, updated_keys, name, item_index):
"""Calculate difference between the original and updated sets of keys.
Removed items will be removed from item_index, new items should have
been added by the discovery process. (?help or ?sensor-list)
This method is ... | python | def _difference(self, original_keys, updated_keys, name, item_index):
"""Calculate difference between the original and updated sets of keys.
Removed items will be removed from item_index, new items should have
been added by the discovery process. (?help or ?sensor-list)
This method is ... | Calculate difference between the original and updated sets of keys.
Removed items will be removed from item_index, new items should have
been added by the discovery process. (?help or ?sensor-list)
This method is for use in inspect_requests and inspect_sensors only.
Returns
--... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/inspecting_client.py#L1013-L1052 |
ska-sa/katcp-python | scratchpad/basic_async_server.py | MyServer.request_pick_fruit | def request_pick_fruit(self, req):
"""Pick a random fruit."""
r = random.choice(self.FRUIT + [None])
if r is None:
return ("fail", "No fruit.")
delay = random.randrange(1,5)
req.inform("Picking will take %d seconds" % delay)
def pick_handler():
se... | python | def request_pick_fruit(self, req):
"""Pick a random fruit."""
r = random.choice(self.FRUIT + [None])
if r is None:
return ("fail", "No fruit.")
delay = random.randrange(1,5)
req.inform("Picking will take %d seconds" % delay)
def pick_handler():
se... | Pick a random fruit. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/scratchpad/basic_async_server.py#L83-L98 |
ska-sa/katcp-python | katcp/sampling.py | update_in_ioloop | def update_in_ioloop(update):
"""Decorator that ensures an update() method is run in the tornado ioloop.
Does this by checking the thread identity. Requires that the object to
which the method is bound has the attributes :attr:`_ioloop_thread_id`
(the result of thread.get_ident() in the ioloop thread) ... | python | def update_in_ioloop(update):
"""Decorator that ensures an update() method is run in the tornado ioloop.
Does this by checking the thread identity. Requires that the object to
which the method is bound has the attributes :attr:`_ioloop_thread_id`
(the result of thread.get_ident() in the ioloop thread) ... | Decorator that ensures an update() method is run in the tornado ioloop.
Does this by checking the thread identity. Requires that the object to
which the method is bound has the attributes :attr:`_ioloop_thread_id`
(the result of thread.get_ident() in the ioloop thread) and :attr:`ioloop`
(the ioloop in... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L41-L59 |
ska-sa/katcp-python | katcp/sampling.py | SampleStrategy.get_strategy | def get_strategy(cls, strategyName, inform_callback, sensor,
*params, **kwargs):
"""Factory method to create a strategy object.
Parameters
----------
strategyName : str
Name of strategy.
inform_callback : callable, signature inform_callback(senso... | python | def get_strategy(cls, strategyName, inform_callback, sensor,
*params, **kwargs):
"""Factory method to create a strategy object.
Parameters
----------
strategyName : str
Name of strategy.
inform_callback : callable, signature inform_callback(senso... | Factory method to create a strategy object.
Parameters
----------
strategyName : str
Name of strategy.
inform_callback : callable, signature inform_callback(sensor, reading)
Callback to receive inform messages.
sensor : Sensor object
Sensor to... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L109-L156 |
ska-sa/katcp-python | katcp/sampling.py | SampleStrategy.get_sampling_formatted | def get_sampling_formatted(self):
"""The current sampling strategy and parameters.
The strategy is returned as a string and the values
in the parameter list are formatted as strings using
the formatter for this sensor type.
Returns
-------
strategy_name : string... | python | def get_sampling_formatted(self):
"""The current sampling strategy and parameters.
The strategy is returned as a string and the values
in the parameter list are formatted as strings using
the formatter for this sensor type.
Returns
-------
strategy_name : string... | The current sampling strategy and parameters.
The strategy is returned as a string and the values
in the parameter list are formatted as strings using
the formatter for this sensor type.
Returns
-------
strategy_name : string
KATCP name for the strategy.
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L196-L214 |
ska-sa/katcp-python | katcp/sampling.py | SampleStrategy.attach | def attach(self):
"""Attach strategy to its sensor and send initial update."""
s = self._sensor
self.update(s, s.read())
self._sensor.attach(self) | python | def attach(self):
"""Attach strategy to its sensor and send initial update."""
s = self._sensor
self.update(s, s.read())
self._sensor.attach(self) | Attach strategy to its sensor and send initial update. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L216-L220 |
ska-sa/katcp-python | katcp/sampling.py | SampleStrategy.cancel | def cancel(self):
"""Detach strategy from its sensor and cancel ioloop callbacks."""
if self.OBSERVE_UPDATES:
self.detach()
self.ioloop.add_callback(self.cancel_timeouts) | python | def cancel(self):
"""Detach strategy from its sensor and cancel ioloop callbacks."""
if self.OBSERVE_UPDATES:
self.detach()
self.ioloop.add_callback(self.cancel_timeouts) | Detach strategy from its sensor and cancel ioloop callbacks. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L226-L230 |
ska-sa/katcp-python | katcp/sampling.py | SampleStrategy.start | def start(self):
"""Start operating the strategy.
Subclasses that override start() should call the super method before
it does anything that uses the ioloop. This will attach to the sensor
as an observer if :attr:`OBSERVE_UPDATES` is True, and sets
:attr:`_ioloop_thread_id` usin... | python | def start(self):
"""Start operating the strategy.
Subclasses that override start() should call the super method before
it does anything that uses the ioloop. This will attach to the sensor
as an observer if :attr:`OBSERVE_UPDATES` is True, and sets
:attr:`_ioloop_thread_id` usin... | Start operating the strategy.
Subclasses that override start() should call the super method before
it does anything that uses the ioloop. This will attach to the sensor
as an observer if :attr:`OBSERVE_UPDATES` is True, and sets
:attr:`_ioloop_thread_id` using `thread.get_ident()`. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L232-L245 |
ska-sa/katcp-python | katcp/sampling.py | SampleStrategy.inform | def inform(self, reading):
"""Inform strategy creator of the sensor status."""
try:
self._inform_callback(self._sensor, reading)
except Exception:
log.exception('Unhandled exception trying to send {!r} '
'for sensor {!r} of type {!r}'
... | python | def inform(self, reading):
"""Inform strategy creator of the sensor status."""
try:
self._inform_callback(self._sensor, reading)
except Exception:
log.exception('Unhandled exception trying to send {!r} '
'for sensor {!r} of type {!r}'
... | Inform strategy creator of the sensor status. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sampling.py#L247-L254 |
ska-sa/katcp-python | katcp/ioloop_manager.py | IOLoopManager.start | def start(self, timeout=None):
"""Start managed ioloop thread, or do nothing if not managed.
If a timeout is passed, it will block until the the event loop is alive
(or the timeout expires) even if the ioloop is not managed.
"""
if not self._ioloop:
raise RuntimeErr... | python | def start(self, timeout=None):
"""Start managed ioloop thread, or do nothing if not managed.
If a timeout is passed, it will block until the the event loop is alive
(or the timeout expires) even if the ioloop is not managed.
"""
if not self._ioloop:
raise RuntimeErr... | Start managed ioloop thread, or do nothing if not managed.
If a timeout is passed, it will block until the the event loop is alive
(or the timeout expires) even if the ioloop is not managed. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/ioloop_manager.py#L99-L117 |
ska-sa/katcp-python | katcp/ioloop_manager.py | IOLoopManager.stop | def stop(self, timeout=None, callback=None):
"""Stop ioloop (if managed) and call callback in ioloop before close.
Parameters
----------
timeout : float or None
Seconds to wait for ioloop to have *started*.
Returns
-------
stopped : thread-safe Futur... | python | def stop(self, timeout=None, callback=None):
"""Stop ioloop (if managed) and call callback in ioloop before close.
Parameters
----------
timeout : float or None
Seconds to wait for ioloop to have *started*.
Returns
-------
stopped : thread-safe Futur... | Stop ioloop (if managed) and call callback in ioloop before close.
Parameters
----------
timeout : float or None
Seconds to wait for ioloop to have *started*.
Returns
-------
stopped : thread-safe Future
Resolves when the callback() is done | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/ioloop_manager.py#L119-L160 |
ska-sa/katcp-python | katcp/ioloop_manager.py | IOLoopManager.join | def join(self, timeout=None):
"""Join managed ioloop thread, or do nothing if not managed."""
if not self._ioloop_managed:
# Do nothing if the loop is not managed
return
try:
self._ioloop_thread.join(timeout)
except AttributeError:
raise Ru... | python | def join(self, timeout=None):
"""Join managed ioloop thread, or do nothing if not managed."""
if not self._ioloop_managed:
# Do nothing if the loop is not managed
return
try:
self._ioloop_thread.join(timeout)
except AttributeError:
raise Ru... | Join managed ioloop thread, or do nothing if not managed. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/ioloop_manager.py#L162-L170 |
ska-sa/katcp-python | katcp/ioloop_manager.py | IOLoopThreadWrapper.decorate_callable | def decorate_callable(self, callable_):
"""Decorate a callable to use call_in_ioloop"""
@wraps(callable_)
def decorated(*args, **kwargs):
# Extract timeout from request itself or use default for ioloop wrapper
timeout = kwargs.get('timeout')
return self.call_i... | python | def decorate_callable(self, callable_):
"""Decorate a callable to use call_in_ioloop"""
@wraps(callable_)
def decorated(*args, **kwargs):
# Extract timeout from request itself or use default for ioloop wrapper
timeout = kwargs.get('timeout')
return self.call_i... | Decorate a callable to use call_in_ioloop | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/ioloop_manager.py#L199-L220 |
ska-sa/katcp-python | katcp/sensortree.py | GenericSensorTree.update | def update(self, sensor, reading):
"""Update callback used by sensors to notify obervers of changes.
Parameters
----------
sensor : :class:`katcp.Sensor` object
The sensor whose value has changed.
reading : (timestamp, status, value) tuple
Sensor reading ... | python | def update(self, sensor, reading):
"""Update callback used by sensors to notify obervers of changes.
Parameters
----------
sensor : :class:`katcp.Sensor` object
The sensor whose value has changed.
reading : (timestamp, status, value) tuple
Sensor reading ... | Update callback used by sensors to notify obervers of changes.
Parameters
----------
sensor : :class:`katcp.Sensor` object
The sensor whose value has changed.
reading : (timestamp, status, value) tuple
Sensor reading as would be returned by sensor.read() | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L41-L54 |
ska-sa/katcp-python | katcp/sensortree.py | GenericSensorTree._add_sensor | def _add_sensor(self, sensor):
"""Add a new sensor to the tree.
Parameters
----------
sensor : :class:`katcp.Sensor` object
New sensor to add to the tree.
"""
self._parent_to_children[sensor] = set()
self._child_to_parents[sensor] = set() | python | def _add_sensor(self, sensor):
"""Add a new sensor to the tree.
Parameters
----------
sensor : :class:`katcp.Sensor` object
New sensor to add to the tree.
"""
self._parent_to_children[sensor] = set()
self._child_to_parents[sensor] = set() | Add a new sensor to the tree.
Parameters
----------
sensor : :class:`katcp.Sensor` object
New sensor to add to the tree. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L77-L87 |
ska-sa/katcp-python | katcp/sensortree.py | GenericSensorTree.add_links | def add_links(self, parent, children):
"""Create dependency links from parent to child.
Any sensors not in the tree are added. After all dependency links have
been created, the parent is recalculated and the tree attaches to any
sensors it was not yet attached to. Links that already exi... | python | def add_links(self, parent, children):
"""Create dependency links from parent to child.
Any sensors not in the tree are added. After all dependency links have
been created, the parent is recalculated and the tree attaches to any
sensors it was not yet attached to. Links that already exi... | Create dependency links from parent to child.
Any sensors not in the tree are added. After all dependency links have
been created, the parent is recalculated and the tree attaches to any
sensors it was not yet attached to. Links that already exist are
ignored.
Parameters
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L101-L130 |
ska-sa/katcp-python | katcp/sensortree.py | GenericSensorTree.remove_links | def remove_links(self, parent, children):
"""Remove dependency links from parent to child.
Any sensors that have no dependency links are removed from the tree and
the tree detaches from each sensor removed. After all dependency links
have been removed the parent is recalculated. Links t... | python | def remove_links(self, parent, children):
"""Remove dependency links from parent to child.
Any sensors that have no dependency links are removed from the tree and
the tree detaches from each sensor removed. After all dependency links
have been removed the parent is recalculated. Links t... | Remove dependency links from parent to child.
Any sensors that have no dependency links are removed from the tree and
the tree detaches from each sensor removed. After all dependency links
have been removed the parent is recalculated. Links that don't exist
are ignored.
Paramet... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L132-L166 |
ska-sa/katcp-python | katcp/sensortree.py | GenericSensorTree.children | def children(self, parent):
"""Return set of children of parent.
Parameters
----------
parent : :class:`katcp.Sensor` object
Parent whose children to return.
Returns
-------
children : set of :class:`katcp.Sensor` objects
The child sensor... | python | def children(self, parent):
"""Return set of children of parent.
Parameters
----------
parent : :class:`katcp.Sensor` object
Parent whose children to return.
Returns
-------
children : set of :class:`katcp.Sensor` objects
The child sensor... | Return set of children of parent.
Parameters
----------
parent : :class:`katcp.Sensor` object
Parent whose children to return.
Returns
-------
children : set of :class:`katcp.Sensor` objects
The child sensors of parent. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L168-L184 |
ska-sa/katcp-python | katcp/sensortree.py | GenericSensorTree.parents | def parents(self, child):
"""Return set of parents of child.
Parameters
----------
child : :class:`katcp.Sensor` object
Child whose parents to return.
Returns
-------
parents : set of :class:`katcp.Sensor` objects
The parent sensors of ch... | python | def parents(self, child):
"""Return set of parents of child.
Parameters
----------
child : :class:`katcp.Sensor` object
Child whose parents to return.
Returns
-------
parents : set of :class:`katcp.Sensor` objects
The parent sensors of ch... | Return set of parents of child.
Parameters
----------
child : :class:`katcp.Sensor` object
Child whose parents to return.
Returns
-------
parents : set of :class:`katcp.Sensor` objects
The parent sensors of child. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L186-L202 |
ska-sa/katcp-python | katcp/sensortree.py | BooleanSensorTree.add | def add(self, parent, child):
"""Add a pair of boolean sensors.
Parent depends on child.
Parameters
----------
parent : boolean instance of :class:`katcp.Sensor`
The sensor that depends on child.
child : boolean instance of :class:`katcp.Sensor`
... | python | def add(self, parent, child):
"""Add a pair of boolean sensors.
Parent depends on child.
Parameters
----------
parent : boolean instance of :class:`katcp.Sensor`
The sensor that depends on child.
child : boolean instance of :class:`katcp.Sensor`
... | Add a pair of boolean sensors.
Parent depends on child.
Parameters
----------
parent : boolean instance of :class:`katcp.Sensor`
The sensor that depends on child.
child : boolean instance of :class:`katcp.Sensor`
The sensor parent depends on. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L244-L265 |
ska-sa/katcp-python | katcp/sensortree.py | BooleanSensorTree.remove | def remove(self, parent, child):
"""Remove a dependency between parent and child.
Parameters
----------
parent : boolean instance of :class:`katcp.Sensor`
The sensor that used to depend on child.
child : boolean instance of :class:`katcp.Sensor` or None
T... | python | def remove(self, parent, child):
"""Remove a dependency between parent and child.
Parameters
----------
parent : boolean instance of :class:`katcp.Sensor`
The sensor that used to depend on child.
child : boolean instance of :class:`katcp.Sensor` or None
T... | Remove a dependency between parent and child.
Parameters
----------
parent : boolean instance of :class:`katcp.Sensor`
The sensor that used to depend on child.
child : boolean instance of :class:`katcp.Sensor` or None
The sensor parent used to depend on. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L267-L282 |
ska-sa/katcp-python | katcp/sensortree.py | BooleanSensorTree.recalculate | def recalculate(self, parent, updates):
"""Re-calculate the value of parent sensor.
Parent's value is the boolean AND of all child sensors.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updates : sequence of... | python | def recalculate(self, parent, updates):
"""Re-calculate the value of parent sensor.
Parent's value is the boolean AND of all child sensors.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updates : sequence of... | Re-calculate the value of parent sensor.
Parent's value is the boolean AND of all child sensors.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updates : sequence of :class:`katcp.Sensor` objects
The chil... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L284-L304 |
ska-sa/katcp-python | katcp/sensortree.py | AggregateSensorTree.add | def add(self, parent, rule_function, children):
"""Create an aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor.
rule_function : f(parent, children)
Function to update the parent sensor value.
childr... | python | def add(self, parent, rule_function, children):
"""Create an aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor.
rule_function : f(parent, children)
Function to update the parent sensor value.
childr... | Create an aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor.
rule_function : f(parent, children)
Function to update the parent sensor value.
children : sequence of :class:`katcp.Sensor` objects
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L365-L382 |
ska-sa/katcp-python | katcp/sensortree.py | AggregateSensorTree.add_delayed | def add_delayed(self, parent, rule_function, child_names):
"""Create an aggregation rule before child sensors are present.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor.
rule_function : f(parent, children)
Function to up... | python | def add_delayed(self, parent, rule_function, child_names):
"""Create an aggregation rule before child sensors are present.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor.
rule_function : f(parent, children)
Function to up... | Create an aggregation rule before child sensors are present.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor.
rule_function : f(parent, children)
Function to update the parent sensor value.
child_names : sequence of str
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L384-L409 |
ska-sa/katcp-python | katcp/sensortree.py | AggregateSensorTree.register_sensor | def register_sensor(self, child):
"""Register a sensor required by an aggregate sensor registered with
add_delayed.
Parameters
----------
child : :class:`katcp.Sensor` object
A child sensor required by one or more delayed aggregate sensors.
"""
child... | python | def register_sensor(self, child):
"""Register a sensor required by an aggregate sensor registered with
add_delayed.
Parameters
----------
child : :class:`katcp.Sensor` object
A child sensor required by one or more delayed aggregate sensors.
"""
child... | Register a sensor required by an aggregate sensor registered with
add_delayed.
Parameters
----------
child : :class:`katcp.Sensor` object
A child sensor required by one or more delayed aggregate sensors. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L411-L438 |
ska-sa/katcp-python | katcp/sensortree.py | AggregateSensorTree._child_from_reference | def _child_from_reference(self, reference):
"""Returns the child sensor from its reference.
Parameters
----------
reference : str
Reference to sensor (typically its name).
Returns
-------
child : :class:`katcp.Sensor` object
A child senso... | python | def _child_from_reference(self, reference):
"""Returns the child sensor from its reference.
Parameters
----------
reference : str
Reference to sensor (typically its name).
Returns
-------
child : :class:`katcp.Sensor` object
A child senso... | Returns the child sensor from its reference.
Parameters
----------
reference : str
Reference to sensor (typically its name).
Returns
-------
child : :class:`katcp.Sensor` object
A child sensor linked to one or more aggregate sensors. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L466-L482 |
ska-sa/katcp-python | katcp/sensortree.py | AggregateSensorTree.remove | def remove(self, parent):
"""Remove an aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor to remove.
"""
if parent not in self._aggregates:
raise ValueError("Sensor %r does not have an aggregate rul... | python | def remove(self, parent):
"""Remove an aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor to remove.
"""
if parent not in self._aggregates:
raise ValueError("Sensor %r does not have an aggregate rul... | Remove an aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The aggregate sensor to remove. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L484-L501 |
ska-sa/katcp-python | katcp/sensortree.py | AggregateSensorTree.recalculate | def recalculate(self, parent, updates):
"""Re-calculate the value of parent sensor.
Parent's value is calculated by calling the associate aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updat... | python | def recalculate(self, parent, updates):
"""Re-calculate the value of parent sensor.
Parent's value is calculated by calling the associate aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updat... | Re-calculate the value of parent sensor.
Parent's value is calculated by calling the associate aggregation rule.
Parameters
----------
parent : :class:`katcp.Sensor` object
The sensor that needs to be updated.
updates : sequence of :class:`katcp.Sensor` objects
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/sensortree.py#L520-L534 |
ska-sa/katcp-python | katcp/kattypes.py | request | def request(*types, **options):
"""Decorator for request handler methods.
The method being decorated should take a req argument followed
by arguments matching the list of types. The decorator will
unpack the request message into the arguments.
Parameters
----------
types : list of kattypes... | python | def request(*types, **options):
"""Decorator for request handler methods.
The method being decorated should take a req argument followed
by arguments matching the list of types. The decorator will
unpack the request message into the arguments.
Parameters
----------
types : list of kattypes... | Decorator for request handler methods.
The method being decorated should take a req argument followed
by arguments matching the list of types. The decorator will
unpack the request message into the arguments.
Parameters
----------
types : list of kattypes
The types of the request messa... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L610-L709 |
ska-sa/katcp-python | katcp/kattypes.py | return_reply | def return_reply(*types, **options):
"""Decorator for returning replies from request handler methods.
The method being decorated should return an iterable of result
values. If the first value is 'ok', the decorator will check the
remaining values against the specified list of types (if any).
If the... | python | def return_reply(*types, **options):
"""Decorator for returning replies from request handler methods.
The method being decorated should return an iterable of result
values. If the first value is 'ok', the decorator will check the
remaining values against the specified list of types (if any).
If the... | Decorator for returning replies from request handler methods.
The method being decorated should return an iterable of result
values. If the first value is 'ok', the decorator will check the
remaining values against the specified list of types (if any).
If the first value is 'fail' or 'error', there mus... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L786-L857 |
ska-sa/katcp-python | katcp/kattypes.py | send_reply | def send_reply(*types, **options):
"""Decorator for sending replies from request callback methods.
This decorator constructs a reply from a list or tuple returned
from a callback method, but unlike the return_reply decorator it
also sends the reply rather than returning it.
The list/tuple returned... | python | def send_reply(*types, **options):
"""Decorator for sending replies from request callback methods.
This decorator constructs a reply from a list or tuple returned
from a callback method, but unlike the return_reply decorator it
also sends the reply rather than returning it.
The list/tuple returned... | Decorator for sending replies from request callback methods.
This decorator constructs a reply from a list or tuple returned
from a callback method, but unlike the return_reply decorator it
also sends the reply rather than returning it.
The list/tuple returned from the callback method must have req (a... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L860-L908 |
ska-sa/katcp-python | katcp/kattypes.py | make_reply | def make_reply(msgname, types, arguments, major):
"""Helper method for constructing a reply message from a list or tuple.
Parameters
----------
msgname : str
Name of the reply message.
types : list of kattypes
The types of the reply message parameters (in order).
arguments : lis... | python | def make_reply(msgname, types, arguments, major):
"""Helper method for constructing a reply message from a list or tuple.
Parameters
----------
msgname : str
Name of the reply message.
types : list of kattypes
The types of the reply message parameters (in order).
arguments : lis... | Helper method for constructing a reply message from a list or tuple.
Parameters
----------
msgname : str
Name of the reply message.
types : list of kattypes
The types of the reply message parameters (in order).
arguments : list of objects
The (unpacked) reply message paramet... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L911-L933 |
ska-sa/katcp-python | katcp/kattypes.py | minimum_katcp_version | def minimum_katcp_version(major, minor=0):
"""Decorator; exclude handler if server's protocol version is too low
Useful for including default handler implementations for KATCP features that
are only present in certain KATCP protocol versions
Examples
--------
>>> class MyDevice(DeviceServer):
... | python | def minimum_katcp_version(major, minor=0):
"""Decorator; exclude handler if server's protocol version is too low
Useful for including default handler implementations for KATCP features that
are only present in certain KATCP protocol versions
Examples
--------
>>> class MyDevice(DeviceServer):
... | Decorator; exclude handler if server's protocol version is too low
Useful for including default handler implementations for KATCP features that
are only present in certain KATCP protocol versions
Examples
--------
>>> class MyDevice(DeviceServer):
... '''This device server will expose ?myr... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L962-L992 |
ska-sa/katcp-python | katcp/kattypes.py | request_timeout_hint | def request_timeout_hint(timeout_hint):
"""Decorator; add recommended client timeout hint to a request for request
Useful for requests that take longer than average to reply. Hint is provided
to clients via ?request-timeout-hint. Note this is only exposed if the
device server sets the protocol version ... | python | def request_timeout_hint(timeout_hint):
"""Decorator; add recommended client timeout hint to a request for request
Useful for requests that take longer than average to reply. Hint is provided
to clients via ?request-timeout-hint. Note this is only exposed if the
device server sets the protocol version ... | Decorator; add recommended client timeout hint to a request for request
Useful for requests that take longer than average to reply. Hint is provided
to clients via ?request-timeout-hint. Note this is only exposed if the
device server sets the protocol version to KATCP v5.1 or higher and enables
the REQ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L1025-L1060 |
ska-sa/katcp-python | katcp/kattypes.py | async_make_reply | def async_make_reply(msgname, types, arguments_future, major):
"""Wrap future that will resolve with arguments needed by make_reply()."""
arguments = yield arguments_future
raise gen.Return(make_reply(msgname, types, arguments, major)) | python | def async_make_reply(msgname, types, arguments_future, major):
"""Wrap future that will resolve with arguments needed by make_reply()."""
arguments = yield arguments_future
raise gen.Return(make_reply(msgname, types, arguments, major)) | Wrap future that will resolve with arguments needed by make_reply(). | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L1063-L1066 |
ska-sa/katcp-python | katcp/kattypes.py | unpack_types | def unpack_types(types, args, argnames, major):
"""Parse arguments according to types list.
Parameters
----------
types : list of kattypes
The types of the arguments (in order).
args : list of strings
The arguments to parse.
argnames : list of strings
The names of the ar... | python | def unpack_types(types, args, argnames, major):
"""Parse arguments according to types list.
Parameters
----------
types : list of kattypes
The types of the arguments (in order).
args : list of strings
The arguments to parse.
argnames : list of strings
The names of the ar... | Parse arguments according to types list.
Parameters
----------
types : list of kattypes
The types of the arguments (in order).
args : list of strings
The arguments to parse.
argnames : list of strings
The names of the arguments.
major : integer
Major version of K... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L1069-L1105 |
ska-sa/katcp-python | katcp/kattypes.py | pack_types | def pack_types(types, args, major):
"""Pack arguments according the the types list.
Parameters
----------
types : list of kattypes
The types of the arguments (in order).
args : list of objects
The arguments to format.
major : integer
Major version of KATCP to use when pa... | python | def pack_types(types, args, major):
"""Pack arguments according the the types list.
Parameters
----------
types : list of kattypes
The types of the arguments (in order).
args : list of objects
The arguments to format.
major : integer
Major version of KATCP to use when pa... | Pack arguments according the the types list.
Parameters
----------
types : list of kattypes
The types of the arguments (in order).
args : list of objects
The arguments to format.
major : integer
Major version of KATCP to use when packing types | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L1108-L1142 |
ska-sa/katcp-python | katcp/kattypes.py | KatcpType.pack | def pack(self, value, nocheck=False, major=DEFAULT_KATCP_MAJOR):
"""Return the value formatted as a KATCP parameter.
Parameters
----------
value : object
The value to pack.
nocheck : bool, optional
Whether to check that the value is valid before
... | python | def pack(self, value, nocheck=False, major=DEFAULT_KATCP_MAJOR):
"""Return the value formatted as a KATCP parameter.
Parameters
----------
value : object
The value to pack.
nocheck : bool, optional
Whether to check that the value is valid before
... | Return the value formatted as a KATCP parameter.
Parameters
----------
value : object
The value to pack.
nocheck : bool, optional
Whether to check that the value is valid before
packing it.
major : int, optional
Major version of KA... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L88-L114 |
ska-sa/katcp-python | katcp/kattypes.py | KatcpType.unpack | def unpack(self, packed_value, major=DEFAULT_KATCP_MAJOR):
"""Parse a KATCP parameter into an object.
Parameters
----------
packed_value : str
The unescaped KATCP string to parse into a value.
major : int, optional
Major version of KATCP to use when inter... | python | def unpack(self, packed_value, major=DEFAULT_KATCP_MAJOR):
"""Parse a KATCP parameter into an object.
Parameters
----------
packed_value : str
The unescaped KATCP string to parse into a value.
major : int, optional
Major version of KATCP to use when inter... | Parse a KATCP parameter into an object.
Parameters
----------
packed_value : str
The unescaped KATCP string to parse into a value.
major : int, optional
Major version of KATCP to use when interpreting types.
Defaults to latest implemented KATCP versio... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L116-L142 |
ska-sa/katcp-python | katcp/kattypes.py | Int.check | def check(self, value, major):
"""Check whether the value is between the minimum and maximum.
Raise a ValueError if it is not.
"""
if self._min is not None and value < self._min:
raise ValueError("Integer %d is lower than minimum %d."
% (value, ... | python | def check(self, value, major):
"""Check whether the value is between the minimum and maximum.
Raise a ValueError if it is not.
"""
if self._min is not None and value < self._min:
raise ValueError("Integer %d is lower than minimum %d."
% (value, ... | Check whether the value is between the minimum and maximum.
Raise a ValueError if it is not. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L172-L183 |
ska-sa/katcp-python | katcp/kattypes.py | Discrete.check | def check(self, value, major):
"""Check whether the value in the set of allowed values.
Raise a ValueError if it is not.
"""
if self._case_insensitive:
value = value.lower()
values = self._valid_values_lower
caseflag = " (case-insensitive)"
e... | python | def check(self, value, major):
"""Check whether the value in the set of allowed values.
Raise a ValueError if it is not.
"""
if self._case_insensitive:
value = value.lower()
values = self._valid_values_lower
caseflag = " (case-insensitive)"
e... | Check whether the value in the set of allowed values.
Raise a ValueError if it is not. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L272-L287 |
ska-sa/katcp-python | katcp/kattypes.py | DiscreteMulti.check | def check(self, value, major):
"""Check that each item in the value list is in the allowed set."""
for v in value:
super(DiscreteMulti, self).check(v, major) | python | def check(self, value, major):
"""Check that each item in the value list is in the allowed set."""
for v in value:
super(DiscreteMulti, self).check(v, major) | Check that each item in the value list is in the allowed set. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L542-L545 |
ska-sa/katcp-python | katcp/kattypes.py | Parameter.unpack | def unpack(self, value):
"""Unpack the parameter using its kattype.
Parameters
----------
packed_value : str
The unescaped KATCP string to unpack.
Returns
-------
value : object
The unpacked value.
"""
# Wrap errors in Fa... | python | def unpack(self, value):
"""Unpack the parameter using its kattype.
Parameters
----------
packed_value : str
The unescaped KATCP string to unpack.
Returns
-------
value : object
The unpacked value.
"""
# Wrap errors in Fa... | Unpack the parameter using its kattype.
Parameters
----------
packed_value : str
The unescaped KATCP string to unpack.
Returns
-------
value : object
The unpacked value. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/kattypes.py#L586-L605 |
ska-sa/katcp-python | katcp/server.py | return_future | def return_future(fn):
"""Decorator that turns a synchronous function into one returning a future.
This should only be applied to non-blocking functions. Will do set_result()
with the return value, or set_exc_info() if an exception is raised.
"""
@wraps(fn)
def decorated(*args, **kwargs):
... | python | def return_future(fn):
"""Decorator that turns a synchronous function into one returning a future.
This should only be applied to non-blocking functions. Will do set_result()
with the return value, or set_exc_info() if an exception is raised.
"""
@wraps(fn)
def decorated(*args, **kwargs):
... | Decorator that turns a synchronous function into one returning a future.
This should only be applied to non-blocking functions. Will do set_result()
with the return value, or set_exc_info() if an exception is raised. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L68-L79 |
ska-sa/katcp-python | katcp/server.py | construct_name_filter | def construct_name_filter(pattern):
"""Return a function for filtering sensor names based on a pattern.
Parameters
----------
pattern : None or str
If None, the returned function matches all names.
If pattern starts and ends with '/' the text between the slashes
is used as a reg... | python | def construct_name_filter(pattern):
"""Return a function for filtering sensor names based on a pattern.
Parameters
----------
pattern : None or str
If None, the returned function matches all names.
If pattern starts and ends with '/' the text between the slashes
is used as a reg... | Return a function for filtering sensor names based on a pattern.
Parameters
----------
pattern : None or str
If None, the returned function matches all names.
If pattern starts and ends with '/' the text between the slashes
is used as a regular expression to search the names.
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L82-L107 |
ska-sa/katcp-python | katcp/server.py | ClientConnection.disconnect | def disconnect(self, reason):
"""Disconnect this client connection for specified reason"""
self._server._disconnect_client(self._conn_key, self, reason) | python | def disconnect(self, reason):
"""Disconnect this client connection for specified reason"""
self._server._disconnect_client(self._conn_key, self, reason) | Disconnect this client connection for specified reason | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L130-L132 |
ska-sa/katcp-python | katcp/server.py | ClientConnection.inform | def inform(self, msg):
"""Send an inform message to a particular client.
Should only be used for asynchronous informs. Informs
that are part of the response to a request should use
:meth:`reply_inform` so that the message identifier
from the original request can be attached to t... | python | def inform(self, msg):
"""Send an inform message to a particular client.
Should only be used for asynchronous informs. Informs
that are part of the response to a request should use
:meth:`reply_inform` so that the message identifier
from the original request can be attached to t... | Send an inform message to a particular client.
Should only be used for asynchronous informs. Informs
that are part of the response to a request should use
:meth:`reply_inform` so that the message identifier
from the original request can be attached to the
inform.
Parame... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L134-L150 |
ska-sa/katcp-python | katcp/server.py | ClientConnection.reply_inform | def reply_inform(self, inform, orig_req):
"""Send an inform as part of the reply to an earlier request.
Parameters
----------
inform : Message object
The inform message to send.
orig_req : Message object
The request message being replied to. The inform me... | python | def reply_inform(self, inform, orig_req):
"""Send an inform as part of the reply to an earlier request.
Parameters
----------
inform : Message object
The inform message to send.
orig_req : Message object
The request message being replied to. The inform me... | Send an inform as part of the reply to an earlier request.
Parameters
----------
inform : Message object
The inform message to send.
orig_req : Message object
The request message being replied to. The inform message's
id is overridden with the id from... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L152-L168 |
ska-sa/katcp-python | katcp/server.py | ClientConnection.mass_inform | def mass_inform(self, msg):
"""Send an inform message to all clients.
Parameters
----------
msg : Message object
The inform message to send.
"""
assert (msg.mtype == Message.INFORM)
return self._mass_send_message(msg) | python | def mass_inform(self, msg):
"""Send an inform message to all clients.
Parameters
----------
msg : Message object
The inform message to send.
"""
assert (msg.mtype == Message.INFORM)
return self._mass_send_message(msg) | Send an inform message to all clients.
Parameters
----------
msg : Message object
The inform message to send. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L170-L180 |
ska-sa/katcp-python | katcp/server.py | ClientConnection.reply | def reply(self, reply, orig_req):
"""Send an asynchronous reply to an earlier request.
Parameters
----------
reply : Message object
The reply message to send.
orig_req : Message object
The request message being replied to. The reply message's
... | python | def reply(self, reply, orig_req):
"""Send an asynchronous reply to an earlier request.
Parameters
----------
reply : Message object
The reply message to send.
orig_req : Message object
The request message being replied to. The reply message's
... | Send an asynchronous reply to an earlier request.
Parameters
----------
reply : Message object
The reply message to send.
orig_req : Message object
The request message being replied to. The reply message's
id is overridden with the id from orig_req be... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L182-L198 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.start | def start(self, timeout=None):
"""Install the server on its IOLoop, optionally starting the IOLoop.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for server thread to start.
"""
if self._running.isSet():
raise Ru... | python | def start(self, timeout=None):
"""Install the server on its IOLoop, optionally starting the IOLoop.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for server thread to start.
"""
if self._running.isSet():
raise Ru... | Install the server on its IOLoop, optionally starting the IOLoop.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for server thread to start. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L369-L394 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.stop | def stop(self, timeout=1.0):
"""Stop a running server (from another thread).
Parameters
----------
timeout : float or None, optional
Seconds to wait for server to have *started*.
Returns
-------
stopped : thread-safe Future
Resolves when ... | python | def stop(self, timeout=1.0):
"""Stop a running server (from another thread).
Parameters
----------
timeout : float or None, optional
Seconds to wait for server to have *started*.
Returns
-------
stopped : thread-safe Future
Resolves when ... | Stop a running server (from another thread).
Parameters
----------
timeout : float or None, optional
Seconds to wait for server to have *started*.
Returns
-------
stopped : thread-safe Future
Resolves when the server is stopped | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L396-L412 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.join | def join(self, timeout=None):
"""Rejoin the server thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for the thread to finish.
Notes
-----
If the ioloop is not managed, this function will block until the server
... | python | def join(self, timeout=None):
"""Rejoin the server thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for the thread to finish.
Notes
-----
If the ioloop is not managed, this function will block until the server
... | Rejoin the server thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for the thread to finish.
Notes
-----
If the ioloop is not managed, this function will block until the server
port is closed, meaning a new serv... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L414-L431 |
ska-sa/katcp-python | katcp/server.py | KATCPServer._bind_socket | def _bind_socket(self, bindaddr):
"""Create a listening server socket."""
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.setblocking(0)
try:
sock.bind(bindaddr)
except Exception:
... | python | def _bind_socket(self, bindaddr):
"""Create a listening server socket."""
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.setblocking(0)
try:
sock.bind(bindaddr)
except Exception:
... | Create a listening server socket. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L441-L452 |
ska-sa/katcp-python | katcp/server.py | KATCPServer._handle_stream | def _handle_stream(self, stream, address):
"""Handle a new connection as a tornado.iostream.IOStream instance."""
try:
assert get_thread_ident() == self.ioloop_thread_id
stream.set_close_callback(partial(self._stream_closed_callback,
... | python | def _handle_stream(self, stream, address):
"""Handle a new connection as a tornado.iostream.IOStream instance."""
try:
assert get_thread_ident() == self.ioloop_thread_id
stream.set_close_callback(partial(self._stream_closed_callback,
... | Handle a new connection as a tornado.iostream.IOStream instance. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L475-L511 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.get_address | def get_address(self, stream):
"""Text representation of the network address of a connection stream.
Notes
-----
This method is thread-safe
"""
try:
addr = ":".join(str(part) for part in stream.KATCPServer_address)
except AttributeError:
... | python | def get_address(self, stream):
"""Text representation of the network address of a connection stream.
Notes
-----
This method is thread-safe
"""
try:
addr = ":".join(str(part) for part in stream.KATCPServer_address)
except AttributeError:
... | Text representation of the network address of a connection stream.
Notes
-----
This method is thread-safe | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L599-L614 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.send_message | def send_message(self, stream, msg):
"""Send an arbitrary message to a particular client.
Parameters
----------
stream : :class:`tornado.iostream.IOStream` object
The stream to send the message to.
msg : Message object
The message to send.
Notes
... | python | def send_message(self, stream, msg):
"""Send an arbitrary message to a particular client.
Parameters
----------
stream : :class:`tornado.iostream.IOStream` object
The stream to send the message to.
msg : Message object
The message to send.
Notes
... | Send an arbitrary message to a particular client.
Parameters
----------
stream : :class:`tornado.iostream.IOStream` object
The stream to send the message to.
msg : Message object
The message to send.
Notes
-----
This method can only be ca... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L616-L646 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.flush_on_close | def flush_on_close(self, stream):
"""Flush tornado iostream write buffer and prevent further writes.
Returns a future that resolves when the stream is flushed.
"""
assert get_thread_ident() == self.ioloop_thread_id
# Prevent futher writes
stream.KATCPServer_closing = Tr... | python | def flush_on_close(self, stream):
"""Flush tornado iostream write buffer and prevent further writes.
Returns a future that resolves when the stream is flushed.
"""
assert get_thread_ident() == self.ioloop_thread_id
# Prevent futher writes
stream.KATCPServer_closing = Tr... | Flush tornado iostream write buffer and prevent further writes.
Returns a future that resolves when the stream is flushed. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L648-L658 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.call_from_thread | def call_from_thread(self, fn):
"""Allow thread-safe calls to ioloop functions.
Uses add_callback if not in the IOLoop thread, otherwise calls
directly. Returns an already resolved `tornado.concurrent.Future` if in
ioloop, otherwise a `concurrent.Future`. Logs unhandled exceptions.
... | python | def call_from_thread(self, fn):
"""Allow thread-safe calls to ioloop functions.
Uses add_callback if not in the IOLoop thread, otherwise calls
directly. Returns an already resolved `tornado.concurrent.Future` if in
ioloop, otherwise a `concurrent.Future`. Logs unhandled exceptions.
... | Allow thread-safe calls to ioloop functions.
Uses add_callback if not in the IOLoop thread, otherwise calls
directly. Returns an already resolved `tornado.concurrent.Future` if in
ioloop, otherwise a `concurrent.Future`. Logs unhandled exceptions.
Resolves with an exception if one occur... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L660-L694 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.send_message_from_thread | def send_message_from_thread(self, stream, msg):
"""Thread-safe version of send_message() returning a Future instance.
Returns
-------
A Future that will resolve without raising an exception as soon as
the call to send_message() completes. This does not guarantee that the
... | python | def send_message_from_thread(self, stream, msg):
"""Thread-safe version of send_message() returning a Future instance.
Returns
-------
A Future that will resolve without raising an exception as soon as
the call to send_message() completes. This does not guarantee that the
... | Thread-safe version of send_message() returning a Future instance.
Returns
-------
A Future that will resolve without raising an exception as soon as
the call to send_message() completes. This does not guarantee that the
message has been delivered yet. If the call to send_messag... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L696-L717 |
ska-sa/katcp-python | katcp/server.py | KATCPServer.mass_send_message | def mass_send_message(self, msg):
"""Send a message to all connected clients.
Notes
-----
This method can only be called in the IOLoop thread.
"""
for stream in self._connections.keys():
if not stream.closed():
# Don't cause noise by trying t... | python | def mass_send_message(self, msg):
"""Send a message to all connected clients.
Notes
-----
This method can only be called in the IOLoop thread.
"""
for stream in self._connections.keys():
if not stream.closed():
# Don't cause noise by trying t... | Send a message to all connected clients.
Notes
-----
This method can only be called in the IOLoop thread. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L719-L730 |
ska-sa/katcp-python | katcp/server.py | ClientRequestConnection.reply_with_message | def reply_with_message(self, rep_msg):
"""Send a pre-created reply message to the client connection.
Will check that rep_msg.name matches the bound request.
"""
self._post_reply()
return self.client_connection.reply(rep_msg, self.msg) | python | def reply_with_message(self, rep_msg):
"""Send a pre-created reply message to the client connection.
Will check that rep_msg.name matches the bound request.
"""
self._post_reply()
return self.client_connection.reply(rep_msg, self.msg) | Send a pre-created reply message to the client connection.
Will check that rep_msg.name matches the bound request. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L763-L770 |
ska-sa/katcp-python | katcp/server.py | MessageHandlerThread.on_message | def on_message(self, client_conn, msg):
"""Handle message.
Returns
-------
ready : Future
A future that will resolve once we're ready, else None.
Notes
-----
*on_message* should not be called again until *ready* has resolved.
"""
MAX... | python | def on_message(self, client_conn, msg):
"""Handle message.
Returns
-------
ready : Future
A future that will resolve once we're ready, else None.
Notes
-----
*on_message* should not be called again until *ready* has resolved.
"""
MAX... | Handle message.
Returns
-------
ready : Future
A future that will resolve once we're ready, else None.
Notes
-----
*on_message* should not be called again until *ready* has resolved. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L810-L833 |
ska-sa/katcp-python | katcp/server.py | MessageHandlerThread.stop | def stop(self, timeout=1.0):
"""Stop the handler thread (from another thread).
Parameters
----------
timeout : float, optional
Seconds to wait for server to have *started*.
"""
if timeout:
self._running.wait(timeout)
self._running.clear()... | python | def stop(self, timeout=1.0):
"""Stop the handler thread (from another thread).
Parameters
----------
timeout : float, optional
Seconds to wait for server to have *started*.
"""
if timeout:
self._running.wait(timeout)
self._running.clear()... | Stop the handler thread (from another thread).
Parameters
----------
timeout : float, optional
Seconds to wait for server to have *started*. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L877-L890 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.create_log_inform | def create_log_inform(self, level_name, msg, name, timestamp=None):
"""Create a katcp logging inform message.
Usually this will be called from inside a DeviceLogger object,
but it is also used by the methods in this class when errors
need to be reported to the client.
"""
... | python | def create_log_inform(self, level_name, msg, name, timestamp=None):
"""Create a katcp logging inform message.
Usually this will be called from inside a DeviceLogger object,
but it is also used by the methods in this class when errors
need to be reported to the client.
"""
... | Create a katcp logging inform message.
Usually this will be called from inside a DeviceLogger object,
but it is also used by the methods in this class when errors
need to be reported to the client. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L977-L992 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.handle_message | def handle_message(self, client_conn, msg):
"""Handle messages of all types from clients.
Parameters
----------
client_conn : ClientConnection object
The client connection the message was from.
msg : Message object
The message to process.
"""
... | python | def handle_message(self, client_conn, msg):
"""Handle messages of all types from clients.
Parameters
----------
client_conn : ClientConnection object
The client connection the message was from.
msg : Message object
The message to process.
"""
... | Handle messages of all types from clients.
Parameters
----------
client_conn : ClientConnection object
The client connection the message was from.
msg : Message object
The message to process. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1005-L1028 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.handle_request | def handle_request(self, connection, msg):
"""Dispatch a request message to the appropriate method.
Parameters
----------
connection : ClientConnection object
The client connection the message was from.
msg : Message object
The request message to process.... | python | def handle_request(self, connection, msg):
"""Dispatch a request message to the appropriate method.
Parameters
----------
connection : ClientConnection object
The client connection the message was from.
msg : Message object
The request message to process.... | Dispatch a request message to the appropriate method.
Parameters
----------
connection : ClientConnection object
The client connection the message was from.
msg : Message object
The request message to process.
Returns
-------
done_future ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1030-L1119 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.handle_inform | def handle_inform(self, connection, msg):
"""Dispatch an inform message to the appropriate method.
Parameters
----------
connection : ClientConnection object
The client connection the message was from.
msg : Message object
The inform message to process.
... | python | def handle_inform(self, connection, msg):
"""Dispatch an inform message to the appropriate method.
Parameters
----------
connection : ClientConnection object
The client connection the message was from.
msg : Message object
The inform message to process.
... | Dispatch an inform message to the appropriate method.
Parameters
----------
connection : ClientConnection object
The client connection the message was from.
msg : Message object
The inform message to process. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1128-L1148 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.inform | def inform(self, connection, msg):
"""Send an inform message to a particular client.
Should only be used for asynchronous informs. Informs
that are part of the response to a request should use
:meth:`reply_inform` so that the message identifier
from the original request can be a... | python | def inform(self, connection, msg):
"""Send an inform message to a particular client.
Should only be used for asynchronous informs. Informs
that are part of the response to a request should use
:meth:`reply_inform` so that the message identifier
from the original request can be a... | Send an inform message to a particular client.
Should only be used for asynchronous informs. Informs
that are part of the response to a request should use
:meth:`reply_inform` so that the message identifier
from the original request can be attached to the
inform.
Parame... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1172-L1196 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.mass_inform | def mass_inform(self, msg):
"""Send an inform message to all clients.
Parameters
----------
msg : Message object
The inform message to send.
"""
assert (msg.mtype == Message.INFORM)
self._server.mass_send_message_from_thread(msg) | python | def mass_inform(self, msg):
"""Send an inform message to all clients.
Parameters
----------
msg : Message object
The inform message to send.
"""
assert (msg.mtype == Message.INFORM)
self._server.mass_send_message_from_thread(msg) | Send an inform message to all clients.
Parameters
----------
msg : Message object
The inform message to send. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1198-L1208 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.reply | def reply(self, connection, reply, orig_req):
"""Send an asynchronous reply to an earlier request.
Parameters
----------
connection : ClientConnection object
The client to send the reply to.
reply : Message object
The reply message to send.
orig_r... | python | def reply(self, connection, reply, orig_req):
"""Send an asynchronous reply to an earlier request.
Parameters
----------
connection : ClientConnection object
The client to send the reply to.
reply : Message object
The reply message to send.
orig_r... | Send an asynchronous reply to an earlier request.
Parameters
----------
connection : ClientConnection object
The client to send the reply to.
reply : Message object
The reply message to send.
orig_req : Message object
The request message being... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1210-L1233 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.reply_inform | def reply_inform(self, connection, inform, orig_req):
"""Send an inform as part of the reply to an earlier request.
Parameters
----------
connection : ClientConnection object
The client to send the inform to.
inform : Message object
The inform message to ... | python | def reply_inform(self, connection, inform, orig_req):
"""Send an inform as part of the reply to an earlier request.
Parameters
----------
connection : ClientConnection object
The client to send the inform to.
inform : Message object
The inform message to ... | Send an inform as part of the reply to an earlier request.
Parameters
----------
connection : ClientConnection object
The client to send the inform to.
inform : Message object
The inform message to send.
orig_req : Message object
The request m... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1235-L1258 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.set_ioloop | def set_ioloop(self, ioloop=None):
"""Set the tornado IOLoop to use.
Sets the tornado.ioloop.IOLoop instance to use, defaulting to
IOLoop.current(). If set_ioloop() is never called the IOLoop is
started in a new thread, and will be stopped if self.stop() is called.
Notes
... | python | def set_ioloop(self, ioloop=None):
"""Set the tornado IOLoop to use.
Sets the tornado.ioloop.IOLoop instance to use, defaulting to
IOLoop.current(). If set_ioloop() is never called the IOLoop is
started in a new thread, and will be stopped if self.stop() is called.
Notes
... | Set the tornado IOLoop to use.
Sets the tornado.ioloop.IOLoop instance to use, defaulting to
IOLoop.current(). If set_ioloop() is never called the IOLoop is
started in a new thread, and will be stopped if self.stop() is called.
Notes
-----
Must be called before start() ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1260-L1273 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.set_concurrency_options | def set_concurrency_options(self, thread_safe=True, handler_thread=True):
"""Set concurrency options for this device server.
Must be called before :meth:`start`.
Parameters
==========
thread_safe : bool
If True, make the server public methods thread safe. Incurs
... | python | def set_concurrency_options(self, thread_safe=True, handler_thread=True):
"""Set concurrency options for this device server.
Must be called before :meth:`start`.
Parameters
==========
thread_safe : bool
If True, make the server public methods thread safe. Incurs
... | Set concurrency options for this device server.
Must be called before :meth:`start`.
Parameters
==========
thread_safe : bool
If True, make the server public methods thread safe. Incurs
performance overhead.
handler_thread : bool
Can only be ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1275-L1307 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.start | def start(self, timeout=None):
"""Start the server in a new thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for server thread to start.
"""
if self._handler_thread and self._handler_thread.isAlive():
raise ... | python | def start(self, timeout=None):
"""Start the server in a new thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for server thread to start.
"""
if self._handler_thread and self._handler_thread.isAlive():
raise ... | Start the server in a new thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for server thread to start. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1309-L1324 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.join | def join(self, timeout=None):
"""Rejoin the server thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for the thread to finish.
"""
self._server.join(timeout)
if self._handler_thread:
self._handler_thr... | python | def join(self, timeout=None):
"""Rejoin the server thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for the thread to finish.
"""
self._server.join(timeout)
if self._handler_thread:
self._handler_thr... | Rejoin the server thread.
Parameters
----------
timeout : float or None, optional
Time in seconds to wait for the thread to finish. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1326-L1337 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.stop | def stop(self, timeout=1.0):
"""Stop a running server (from another thread).
Parameters
----------
timeout : float, optional
Seconds to wait for server to have *started*.
Returns
-------
stopped : thread-safe Future
Resolves when the serv... | python | def stop(self, timeout=1.0):
"""Stop a running server (from another thread).
Parameters
----------
timeout : float, optional
Seconds to wait for server to have *started*.
Returns
-------
stopped : thread-safe Future
Resolves when the serv... | Stop a running server (from another thread).
Parameters
----------
timeout : float, optional
Seconds to wait for server to have *started*.
Returns
-------
stopped : thread-safe Future
Resolves when the server is stopped | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1339-L1357 |
ska-sa/katcp-python | katcp/server.py | DeviceServerBase.sync_with_ioloop | def sync_with_ioloop(self, timeout=None):
"""Block for ioloop to complete a loop if called from another thread.
Returns a future if called from inside the ioloop.
Raises concurrent.futures.TimeoutError if timed out while blocking.
"""
in_ioloop = self._server.in_ioloop_thread(... | python | def sync_with_ioloop(self, timeout=None):
"""Block for ioloop to complete a loop if called from another thread.
Returns a future if called from inside the ioloop.
Raises concurrent.futures.TimeoutError if timed out while blocking.
"""
in_ioloop = self._server.in_ioloop_thread(... | Block for ioloop to complete a loop if called from another thread.
Returns a future if called from inside the ioloop.
Raises concurrent.futures.TimeoutError if timed out while blocking. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1413-L1435 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.on_client_connect | def on_client_connect(self, client_conn):
"""Inform client of build state and version on connect.
Parameters
----------
client_conn : ClientConnection object
The client connection that has been successfully established.
Returns
-------
Future that re... | python | def on_client_connect(self, client_conn):
"""Inform client of build state and version on connect.
Parameters
----------
client_conn : ClientConnection object
The client connection that has been successfully established.
Returns
-------
Future that re... | Inform client of build state and version on connect.
Parameters
----------
client_conn : ClientConnection object
The client connection that has been successfully established.
Returns
-------
Future that resolves when the device is ready to accept messages. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1536-L1565 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.clear_strategies | def clear_strategies(self, client_conn, remove_client=False):
"""Clear the sensor strategies of a client connection.
Parameters
----------
client_connection : ClientConnection instance
The connection that should have its sampling strategies cleared
remove_client : bo... | python | def clear_strategies(self, client_conn, remove_client=False):
"""Clear the sensor strategies of a client connection.
Parameters
----------
client_connection : ClientConnection instance
The connection that should have its sampling strategies cleared
remove_client : bo... | Clear the sensor strategies of a client connection.
Parameters
----------
client_connection : ClientConnection instance
The connection that should have its sampling strategies cleared
remove_client : bool, optional
Remove the client connection from the strategies... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1567-L1587 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.on_client_disconnect | def on_client_disconnect(self, client_conn, msg, connection_valid):
"""Inform client it is about to be disconnected.
Parameters
----------
client_conn : ClientConnection object
The client connection being disconnected.
msg : str
Reason client is being dis... | python | def on_client_disconnect(self, client_conn, msg, connection_valid):
"""Inform client it is about to be disconnected.
Parameters
----------
client_conn : ClientConnection object
The client connection being disconnected.
msg : str
Reason client is being dis... | Inform client it is about to be disconnected.
Parameters
----------
client_conn : ClientConnection object
The client connection being disconnected.
msg : str
Reason client is being disconnected.
connection_valid : bool
True if connection is st... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1589-L1620 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.remove_sensor | def remove_sensor(self, sensor):
"""Remove a sensor from the device.
Also deregisters all clients observing the sensor.
Parameters
----------
sensor : Sensor object or name string
The sensor to remove from the device server.
"""
if isinstance(sensor... | python | def remove_sensor(self, sensor):
"""Remove a sensor from the device.
Also deregisters all clients observing the sensor.
Parameters
----------
sensor : Sensor object or name string
The sensor to remove from the device server.
"""
if isinstance(sensor... | Remove a sensor from the device.
Also deregisters all clients observing the sensor.
Parameters
----------
sensor : Sensor object or name string
The sensor to remove from the device server. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1648-L1670 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.get_sensor | def get_sensor(self, sensor_name):
"""Fetch the sensor with the given name.
Parameters
----------
sensor_name : str
Name of the sensor to retrieve.
Returns
-------
sensor : Sensor object
The sensor with the given name.
"""
... | python | def get_sensor(self, sensor_name):
"""Fetch the sensor with the given name.
Parameters
----------
sensor_name : str
Name of the sensor to retrieve.
Returns
-------
sensor : Sensor object
The sensor with the given name.
"""
... | Fetch the sensor with the given name.
Parameters
----------
sensor_name : str
Name of the sensor to retrieve.
Returns
-------
sensor : Sensor object
The sensor with the given name. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1672-L1689 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.