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/server.py | DeviceServer.request_halt | def request_halt(self, req, msg):
"""Halt the device server.
Returns
-------
success : {'ok', 'fail'}
Whether scheduling the halt succeeded.
Examples
--------
::
?halt
!halt ok
"""
f = Future()
@gen.c... | python | def request_halt(self, req, msg):
"""Halt the device server.
Returns
-------
success : {'ok', 'fail'}
Whether scheduling the halt succeeded.
Examples
--------
::
?halt
!halt ok
"""
f = Future()
@gen.c... | Halt the device server.
Returns
-------
success : {'ok', 'fail'}
Whether scheduling the halt succeeded.
Examples
--------
::
?halt
!halt ok | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1740-L1765 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_help | def request_help(self, req, msg):
"""Return help on the available requests.
Return a description of the available requests using a sequence of
#help informs.
Parameters
----------
request : str, optional
The name of the request to return help for (the defaul... | python | def request_help(self, req, msg):
"""Return help on the available requests.
Return a description of the available requests using a sequence of
#help informs.
Parameters
----------
request : str, optional
The name of the request to return help for (the defaul... | Return help on the available requests.
Return a description of the available requests using a sequence of
#help informs.
Parameters
----------
request : str, optional
The name of the request to return help for (the default is to
return help for all reque... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1767-L1821 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_request_timeout_hint | def request_request_timeout_hint(self, req, request):
"""Return timeout hints for requests
KATCP requests should generally take less than 5s to complete, but some
requests are unavoidably slow. This results in spurious client timeout
errors. This request provides timeout hints that clie... | python | def request_request_timeout_hint(self, req, request):
"""Return timeout hints for requests
KATCP requests should generally take less than 5s to complete, but some
requests are unavoidably slow. This results in spurious client timeout
errors. This request provides timeout hints that clie... | Return timeout hints for requests
KATCP requests should generally take less than 5s to complete, but some
requests are unavoidably slow. This results in spurious client timeout
errors. This request provides timeout hints that clients can use to
select suitable request timeouts.
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1826-L1896 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_log_level | def request_log_level(self, req, msg):
"""Query or set the current logging level.
Parameters
----------
level : {'all', 'trace', 'debug', 'info', 'warn', 'error', 'fatal', \
'off'}, optional
Name of the logging level to set the device server to (the default
... | python | def request_log_level(self, req, msg):
"""Query or set the current logging level.
Parameters
----------
level : {'all', 'trace', 'debug', 'info', 'warn', 'error', 'fatal', \
'off'}, optional
Name of the logging level to set the device server to (the default
... | Query or set the current logging level.
Parameters
----------
level : {'all', 'trace', 'debug', 'info', 'warn', 'error', 'fatal', \
'off'}, optional
Name of the logging level to set the device server to (the default
is to leave the log level unchanged).
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1898-L1932 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_restart | def request_restart(self, req, msg):
"""Restart the device server.
Returns
-------
success : {'ok', 'fail'}
Whether scheduling the restart succeeded.
Examples
--------
::
?restart
!restart ok
"""
if self._res... | python | def request_restart(self, req, msg):
"""Restart the device server.
Returns
-------
success : {'ok', 'fail'}
Whether scheduling the restart succeeded.
Examples
--------
::
?restart
!restart ok
"""
if self._res... | Restart the device server.
Returns
-------
success : {'ok', 'fail'}
Whether scheduling the restart succeeded.
Examples
--------
::
?restart
!restart ok | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1934-L1963 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_client_list | def request_client_list(self, req, msg):
"""Request the list of connected clients.
The list of clients is sent as a sequence of #client-list informs.
Informs
-------
addr : str
The address of the client as host:port with host in dotted quad
notation. If ... | python | def request_client_list(self, req, msg):
"""Request the list of connected clients.
The list of clients is sent as a sequence of #client-list informs.
Informs
-------
addr : str
The address of the client as host:port with host in dotted quad
notation. If ... | Request the list of connected clients.
The list of clients is sent as a sequence of #client-list informs.
Informs
-------
addr : str
The address of the client as host:port with host in dotted quad
notation. If the address of the client could not be determined
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L1965-L2001 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_version_list | def request_version_list(self, req, msg):
"""Request the list of versions of roles and subcomponents.
Informs
-------
name : str
Name of the role or component.
version : str
A string identifying the version of the component. Individual
compone... | python | def request_version_list(self, req, msg):
"""Request the list of versions of roles and subcomponents.
Informs
-------
name : str
Name of the role or component.
version : str
A string identifying the version of the component. Individual
compone... | Request the list of versions of roles and subcomponents.
Informs
-------
name : str
Name of the role or component.
version : str
A string identifying the version of the component. Individual
components may define the structure of this argument as they... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2005-L2054 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_sensor_list | def request_sensor_list(self, req, msg):
"""Request the list of sensors.
The list of sensors is sent as a sequence of #sensor-list informs.
Parameters
----------
name : str, optional
Name of the sensor to list (the default is to list all sensors).
If nam... | python | def request_sensor_list(self, req, msg):
"""Request the list of sensors.
The list of sensors is sent as a sequence of #sensor-list informs.
Parameters
----------
name : str, optional
Name of the sensor to list (the default is to list all sensors).
If nam... | Request the list of sensors.
The list of sensors is sent as a sequence of #sensor-list informs.
Parameters
----------
name : str, optional
Name of the sensor to list (the default is to list all sensors).
If name starts and ends with '/' it is treated as a regula... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2056-L2122 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_sensor_value | def request_sensor_value(self, req, msg):
"""Request the value of a sensor or sensors.
A list of sensor values as a sequence of #sensor-value informs.
Parameters
----------
name : str, optional
Name of the sensor to poll (the default is to send values for all
... | python | def request_sensor_value(self, req, msg):
"""Request the value of a sensor or sensors.
A list of sensor values as a sequence of #sensor-value informs.
Parameters
----------
name : str, optional
Name of the sensor to poll (the default is to send values for all
... | Request the value of a sensor or sensors.
A list of sensor values as a sequence of #sensor-value informs.
Parameters
----------
name : str, optional
Name of the sensor to poll (the default is to send values for all
sensors). If name starts and ends with '/' it i... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2129-L2190 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_sensor_sampling | def request_sensor_sampling(self, req, msg):
"""Configure or query the way a sensor is sampled.
Sampled values are reported asynchronously using the #sensor-status
message.
Parameters
----------
name : str
Name of the sensor whose sampling strategy to query ... | python | def request_sensor_sampling(self, req, msg):
"""Configure or query the way a sensor is sampled.
Sampled values are reported asynchronously using the #sensor-status
message.
Parameters
----------
name : str
Name of the sensor whose sampling strategy to query ... | Configure or query the way a sensor is sampled.
Sampled values are reported asynchronously using the #sensor-status
message.
Parameters
----------
name : str
Name of the sensor whose sampling strategy to query or configure.
strategy : {'none', 'auto', 'event... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2192-L2248 |
ska-sa/katcp-python | katcp/server.py | DeviceServer.request_sensor_sampling_clear | def request_sensor_sampling_clear(self, req):
"""Set all sampling strategies for this client to none.
Returns
-------
success : {'ok', 'fail'}
Whether sending the list of devices succeeded.
Examples
--------
?sensor-sampling-clear
!sensor-sam... | python | def request_sensor_sampling_clear(self, req):
"""Set all sampling strategies for this client to none.
Returns
-------
success : {'ok', 'fail'}
Whether sending the list of devices succeeded.
Examples
--------
?sensor-sampling-clear
!sensor-sam... | Set all sampling strategies for this client to none.
Returns
-------
success : {'ok', 'fail'}
Whether sending the list of devices succeeded.
Examples
--------
?sensor-sampling-clear
!sensor-sampling-clear ok | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2323-L2344 |
ska-sa/katcp-python | katcp/server.py | DeviceLogger.level_name | def level_name(self, level=None):
"""Return the name of the given level value.
If level is None, return the name of the current level.
Parameters
----------
level : logging level constant
The logging level constant whose name to retrieve.
Returns
--... | python | def level_name(self, level=None):
"""Return the name of the given level value.
If level is None, return the name of the current level.
Parameters
----------
level : logging level constant
The logging level constant whose name to retrieve.
Returns
--... | Return the name of the given level value.
If level is None, return the name of the current level.
Parameters
----------
level : logging level constant
The logging level constant whose name to retrieve.
Returns
-------
level_name : str
Th... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2422-L2440 |
ska-sa/katcp-python | katcp/server.py | DeviceLogger.level_from_name | def level_from_name(self, level_name):
"""Return the level constant for a given name.
If the *level_name* is not known, raise a ValueError.
Parameters
----------
level_name : str
The logging level name whose logging level constant
to retrieve.
R... | python | def level_from_name(self, level_name):
"""Return the level constant for a given name.
If the *level_name* is not known, raise a ValueError.
Parameters
----------
level_name : str
The logging level name whose logging level constant
to retrieve.
R... | Return the level constant for a given name.
If the *level_name* is not known, raise a ValueError.
Parameters
----------
level_name : str
The logging level name whose logging level constant
to retrieve.
Returns
-------
level : logging lev... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2442-L2462 |
ska-sa/katcp-python | katcp/server.py | DeviceLogger.set_log_level | def set_log_level(self, level):
"""Set the logging level.
Parameters
----------
level : logging level constant
The value to set the logging level to.
"""
self._log_level = level
if self._python_logger:
try:
level = self.PY... | python | def set_log_level(self, level):
"""Set the logging level.
Parameters
----------
level : logging level constant
The value to set the logging level to.
"""
self._log_level = level
if self._python_logger:
try:
level = self.PY... | Set the logging level.
Parameters
----------
level : logging level constant
The value to set the logging level to. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2464-L2479 |
ska-sa/katcp-python | katcp/server.py | DeviceLogger.log | def log(self, level, msg, *args, **kwargs):
"""Log a message and inform all clients.
Parameters
----------
level : logging level constant
The level to log the message at.
msg : str
The text format for the log message.
args : list of objects
... | python | def log(self, level, msg, *args, **kwargs):
"""Log a message and inform all clients.
Parameters
----------
level : logging level constant
The level to log the message at.
msg : str
The text format for the log message.
args : list of objects
... | Log a message and inform all clients.
Parameters
----------
level : logging level constant
The level to log the message at.
msg : str
The text format for the log message.
args : list of objects
Arguments to pass to log format string. Final mes... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2492-L2536 |
ska-sa/katcp-python | katcp/server.py | DeviceLogger.warn | def warn(self, msg, *args, **kwargs):
"""Log an warning message."""
self.log(self.WARN, msg, *args, **kwargs) | python | def warn(self, msg, *args, **kwargs):
"""Log an warning message."""
self.log(self.WARN, msg, *args, **kwargs) | Log an warning message. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2550-L2552 |
ska-sa/katcp-python | katcp/server.py | DeviceLogger.log_to_python | def log_to_python(cls, logger, msg):
"""Log a KATCP logging message to a Python logger.
Parameters
----------
logger : logging.Logger object
The Python logger to log the given message to.
msg : Message object
The #log message to create a log entry from.
... | python | def log_to_python(cls, logger, msg):
"""Log a KATCP logging message to a Python logger.
Parameters
----------
logger : logging.Logger object
The Python logger to log the given message to.
msg : Message object
The #log message to create a log entry from.
... | Log a KATCP logging message to a Python logger.
Parameters
----------
logger : logging.Logger object
The Python logger to log the given message to.
msg : Message object
The #log message to create a log entry from. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/server.py#L2563-L2581 |
ska-sa/katcp-python | scripts/katcp-exampleserver.py | DeviceExampleServer.request_echo | def request_echo(self, sock, msg):
"""Echo the arguments of the message sent."""
return katcp.Message.reply(msg.name, "ok", *msg.arguments) | python | def request_echo(self, sock, msg):
"""Echo the arguments of the message sent."""
return katcp.Message.reply(msg.name, "ok", *msg.arguments) | Echo the arguments of the message sent. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/scripts/katcp-exampleserver.py#L35-L37 |
ska-sa/katcp-python | katcp/core.py | log_coroutine_exceptions | def log_coroutine_exceptions(coro):
"""Coroutine (or any method that returns a future) decorator to log exceptions
Example
-------
::
import logging
class A(object):
_logger = logging.getLogger(__name__)
@log_coroutine_exceptions
@tornado.gen.coroutine
def ra... | python | def log_coroutine_exceptions(coro):
"""Coroutine (or any method that returns a future) decorator to log exceptions
Example
-------
::
import logging
class A(object):
_logger = logging.getLogger(__name__)
@log_coroutine_exceptions
@tornado.gen.coroutine
def ra... | Coroutine (or any method that returns a future) decorator to log exceptions
Example
-------
::
import logging
class A(object):
_logger = logging.getLogger(__name__)
@log_coroutine_exceptions
@tornado.gen.coroutine
def raiser(self, arg):
yield tornado.... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L59-L99 |
ska-sa/katcp-python | katcp/core.py | log_future_exceptions | def log_future_exceptions(logger, f, ignore=()):
"""Log any exceptions set to a future
Parameters
----------
logger : logging.Logger instance
logger.exception(...) is called if the future resolves with an exception
f : Future object
Future to be monitored for exceptions
ignore :... | python | def log_future_exceptions(logger, f, ignore=()):
"""Log any exceptions set to a future
Parameters
----------
logger : logging.Logger instance
logger.exception(...) is called if the future resolves with an exception
f : Future object
Future to be monitored for exceptions
ignore :... | Log any exceptions set to a future
Parameters
----------
logger : logging.Logger instance
logger.exception(...) is called if the future resolves with an exception
f : Future object
Future to be monitored for exceptions
ignore : Exception or tuple of Exception
Exptected excep... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L101-L127 |
ska-sa/katcp-python | katcp/core.py | steal_docstring_from | def steal_docstring_from(obj):
"""Decorator that lets you steal a docstring from another object
Example
-------
::
@steal_docstring_from(superclass.meth)
def meth(self, arg):
"Extra subclass documentation"
pass
In this case the docstring of the new 'meth' will be copied f... | python | def steal_docstring_from(obj):
"""Decorator that lets you steal a docstring from another object
Example
-------
::
@steal_docstring_from(superclass.meth)
def meth(self, arg):
"Extra subclass documentation"
pass
In this case the docstring of the new 'meth' will be copied f... | Decorator that lets you steal a docstring from another object
Example
-------
::
@steal_docstring_from(superclass.meth)
def meth(self, arg):
"Extra subclass documentation"
pass
In this case the docstring of the new 'meth' will be copied from superclass.meth, and
if an add... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L135-L159 |
ska-sa/katcp-python | katcp/core.py | hashable_identity | def hashable_identity(obj):
"""Generate a hashable ID that is stable for methods etc
Approach borrowed from blinker. Why it matters: see e.g.
http://stackoverflow.com/questions/13348031/python-bound-and-unbound-method-object
"""
if hasattr(obj, '__func__'):
return (id(obj.__func__), id(obj... | python | def hashable_identity(obj):
"""Generate a hashable ID that is stable for methods etc
Approach borrowed from blinker. Why it matters: see e.g.
http://stackoverflow.com/questions/13348031/python-bound-and-unbound-method-object
"""
if hasattr(obj, '__func__'):
return (id(obj.__func__), id(obj... | Generate a hashable ID that is stable for methods etc
Approach borrowed from blinker. Why it matters: see e.g.
http://stackoverflow.com/questions/13348031/python-bound-and-unbound-method-object | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1799-L1813 |
ska-sa/katcp-python | katcp/core.py | until_any | def until_any(*futures, **kwargs):
"""Return a future that resolves when any of the passed futures resolves.
Resolves with the value yielded by the first future to resolve.
Note, this will only work with tornado futures.
"""
timeout = kwargs.get('timeout', None)
ioloop = kwargs.get('ioloop', ... | python | def until_any(*futures, **kwargs):
"""Return a future that resolves when any of the passed futures resolves.
Resolves with the value yielded by the first future to resolve.
Note, this will only work with tornado futures.
"""
timeout = kwargs.get('timeout', None)
ioloop = kwargs.get('ioloop', ... | Return a future that resolves when any of the passed futures resolves.
Resolves with the value yielded by the first future to resolve.
Note, this will only work with tornado futures. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1824-L1861 |
ska-sa/katcp-python | katcp/core.py | future_timeout_manager | def future_timeout_manager(timeout=None, ioloop=None):
"""Create Helper function for yielding with a cumulative timeout if required
Keeps track of time over multiple timeout calls so that a single timeout can
be placed over multiple operations.
Parameters
----------
timeout : int or None
... | python | def future_timeout_manager(timeout=None, ioloop=None):
"""Create Helper function for yielding with a cumulative timeout if required
Keeps track of time over multiple timeout calls so that a single timeout can
be placed over multiple operations.
Parameters
----------
timeout : int or None
... | Create Helper function for yielding with a cumulative timeout if required
Keeps track of time over multiple timeout calls so that a single timeout can
be placed over multiple operations.
Parameters
----------
timeout : int or None
Timeout, or None for no timeout
ioloop : IOLoop instanc... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1863-L1918 |
ska-sa/katcp-python | katcp/core.py | until_some | def until_some(*args, **kwargs):
"""Return a future that resolves when some of the passed futures resolve.
The futures can be passed as either a sequence of *args* or a dict of
*kwargs* (but not both). Some additional keyword arguments are supported,
as described below. Once a specified number of under... | python | def until_some(*args, **kwargs):
"""Return a future that resolves when some of the passed futures resolve.
The futures can be passed as either a sequence of *args* or a dict of
*kwargs* (but not both). Some additional keyword arguments are supported,
as described below. Once a specified number of under... | Return a future that resolves when some of the passed futures resolve.
The futures can be passed as either a sequence of *args* or a dict of
*kwargs* (but not both). Some additional keyword arguments are supported,
as described below. Once a specified number of underlying futures have
resolved, the ret... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1921-L1964 |
ska-sa/katcp-python | katcp/core.py | Message.format_argument | def format_argument(self, arg):
"""Format a Message argument to a string"""
if isinstance(arg, float):
return repr(arg)
elif isinstance(arg, bool):
return str(int(arg))
else:
try:
return str(arg)
except UnicodeEncodeError:
... | python | def format_argument(self, arg):
"""Format a Message argument to a string"""
if isinstance(arg, float):
return repr(arg)
elif isinstance(arg, bool):
return str(int(arg))
else:
try:
return str(arg)
except UnicodeEncodeError:
... | Format a Message argument to a string | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L295-L312 |
ska-sa/katcp-python | katcp/core.py | Message.reply_ok | def reply_ok(self):
"""Return True if this is a reply and its first argument is 'ok'."""
return (self.mtype == self.REPLY and self.arguments and
self.arguments[0] == self.OK) | python | def reply_ok(self):
"""Return True if this is a reply and its first argument is 'ok'."""
return (self.mtype == self.REPLY and self.arguments and
self.arguments[0] == self.OK) | Return True if this is a reply and its first argument is 'ok'. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L380-L383 |
ska-sa/katcp-python | katcp/core.py | Message.request | def request(cls, name, *args, **kwargs):
"""Helper method for creating request messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
Keyword arguments
-----------------
m... | python | def request(cls, name, *args, **kwargs):
"""Helper method for creating request messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
Keyword arguments
-----------------
m... | Helper method for creating request messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
Keyword arguments
-----------------
mid : str or None
Message ID to use or No... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L389-L408 |
ska-sa/katcp-python | katcp/core.py | Message.reply | def reply(cls, name, *args, **kwargs):
"""Helper method for creating reply messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
Keyword Arguments
-----------------
mid :... | python | def reply(cls, name, *args, **kwargs):
"""Helper method for creating reply messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
Keyword Arguments
-----------------
mid :... | Helper method for creating reply messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
Keyword Arguments
-----------------
mid : str or None
Message ID to use or None... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L411-L430 |
ska-sa/katcp-python | katcp/core.py | Message.reply_to_request | def reply_to_request(cls, req_msg, *args):
"""Helper method for creating reply messages to a specific request.
Copies the message name and message identifier from request message.
Parameters
----------
req_msg : katcp.core.Message instance
The request message that t... | python | def reply_to_request(cls, req_msg, *args):
"""Helper method for creating reply messages to a specific request.
Copies the message name and message identifier from request message.
Parameters
----------
req_msg : katcp.core.Message instance
The request message that t... | Helper method for creating reply messages to a specific request.
Copies the message name and message identifier from request message.
Parameters
----------
req_msg : katcp.core.Message instance
The request message that this inform if in reply to
args : list of strin... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L433-L446 |
ska-sa/katcp-python | katcp/core.py | Message.inform | def inform(cls, name, *args, **kwargs):
"""Helper method for creating inform messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
"""
mid = kwargs.pop('mid', None)
if le... | python | def inform(cls, name, *args, **kwargs):
"""Helper method for creating inform messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments.
"""
mid = kwargs.pop('mid', None)
if le... | Helper method for creating inform messages.
Parameters
----------
name : str
The name of the message.
args : list of strings
The message arguments. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L449-L463 |
ska-sa/katcp-python | katcp/core.py | Message.reply_inform | def reply_inform(cls, req_msg, *args):
"""Helper method for creating inform messages in reply to a request.
Copies the message name and message identifier from request message.
Parameters
----------
req_msg : katcp.core.Message instance
The request message that this... | python | def reply_inform(cls, req_msg, *args):
"""Helper method for creating inform messages in reply to a request.
Copies the message name and message identifier from request message.
Parameters
----------
req_msg : katcp.core.Message instance
The request message that this... | Helper method for creating inform messages in reply to a request.
Copies the message name and message identifier from request message.
Parameters
----------
req_msg : katcp.core.Message instance
The request message that this inform if in reply to
args : list of stri... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L466-L479 |
ska-sa/katcp-python | katcp/core.py | MessageParser._unescape_match | def _unescape_match(self, match):
"""Given an re.Match, unescape the escape code it represents."""
char = match.group(1)
if char in self.ESCAPE_LOOKUP:
return self.ESCAPE_LOOKUP[char]
elif not char:
raise KatcpSyntaxError("Escape slash at end of argument.")
... | python | def _unescape_match(self, match):
"""Given an re.Match, unescape the escape code it represents."""
char = match.group(1)
if char in self.ESCAPE_LOOKUP:
return self.ESCAPE_LOOKUP[char]
elif not char:
raise KatcpSyntaxError("Escape slash at end of argument.")
... | Given an re.Match, unescape the escape code it represents. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L509-L517 |
ska-sa/katcp-python | katcp/core.py | MessageParser._parse_arg | def _parse_arg(self, arg):
"""Parse an argument."""
match = self.SPECIAL_RE.search(arg)
if match:
raise KatcpSyntaxError("Unescaped special %r." % (match.group(),))
return self.UNESCAPE_RE.sub(self._unescape_match, arg) | python | def _parse_arg(self, arg):
"""Parse an argument."""
match = self.SPECIAL_RE.search(arg)
if match:
raise KatcpSyntaxError("Unescaped special %r." % (match.group(),))
return self.UNESCAPE_RE.sub(self._unescape_match, arg) | Parse an argument. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L519-L524 |
ska-sa/katcp-python | katcp/core.py | MessageParser.parse | def parse(self, line):
"""Parse a line, return a Message.
Parameters
----------
line : str
The line to parse (should not contain the terminating newline
or carriage return).
Returns
-------
msg : Message object
The resulting M... | python | def parse(self, line):
"""Parse a line, return a Message.
Parameters
----------
line : str
The line to parse (should not contain the terminating newline
or carriage return).
Returns
-------
msg : Message object
The resulting M... | Parse a line, return a Message.
Parameters
----------
line : str
The line to parse (should not contain the terminating newline
or carriage return).
Returns
-------
msg : Message object
The resulting Message. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L526-L570 |
ska-sa/katcp-python | katcp/core.py | ProtocolFlags.parse_version | def parse_version(cls, version_str):
"""Create a :class:`ProtocolFlags` object from a version string.
Parameters
----------
version_str : str
The version string from a #version-connect katcp-protocol
message.
"""
match = cls.VERSION_RE.match(vers... | python | def parse_version(cls, version_str):
"""Create a :class:`ProtocolFlags` object from a version string.
Parameters
----------
version_str : str
The version string from a #version-connect katcp-protocol
message.
"""
match = cls.VERSION_RE.match(vers... | Create a :class:`ProtocolFlags` object from a version string.
Parameters
----------
version_str : str
The version string from a #version-connect katcp-protocol
message. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L662-L679 |
ska-sa/katcp-python | katcp/core.py | DeviceServerMetaclass.check_protocol | def check_protocol(mcs, handler):
"""
True if the current server's protocol flags satisfy handler requirements
"""
protocol_info = mcs.PROTOCOL_INFO
protocol_version = (protocol_info.major, protocol_info.minor)
protocol_flags = protocol_info.flags
# Check if min... | python | def check_protocol(mcs, handler):
"""
True if the current server's protocol flags satisfy handler requirements
"""
protocol_info = mcs.PROTOCOL_INFO
protocol_version = (protocol_info.major, protocol_info.minor)
protocol_flags = protocol_info.flags
# Check if min... | True if the current server's protocol flags satisfy handler requirements | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L749-L771 |
ska-sa/katcp-python | katcp/core.py | Sensor.integer | def integer(cls, name, description=None, unit='', params=None,
default=None, initial_status=None):
"""Instantiate a new integer sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description o... | python | def integer(cls, name, description=None, unit='', params=None,
default=None, initial_status=None):
"""Instantiate a new integer sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description o... | Instantiate a new integer sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. May be the empty string
if there are ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1051-L1075 |
ska-sa/katcp-python | katcp/core.py | Sensor.float | def float(cls, name, description=None, unit='', params=None,
default=None, initial_status=None):
"""Instantiate a new float sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the ... | python | def float(cls, name, description=None, unit='', params=None,
default=None, initial_status=None):
"""Instantiate a new float sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the ... | Instantiate a new float sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. May be the empty string
if there are no... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1078-L1102 |
ska-sa/katcp-python | katcp/core.py | Sensor.boolean | def boolean(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new boolean sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.... | python | def boolean(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new boolean sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.... | Instantiate a new boolean sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. May be the empty string
if there are ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1105-L1127 |
ska-sa/katcp-python | katcp/core.py | Sensor.lru | def lru(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new lru sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
uni... | python | def lru(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new lru sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
uni... | Instantiate a new lru sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. May be the empty string
if there are no a... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1130-L1152 |
ska-sa/katcp-python | katcp/core.py | Sensor.string | def string(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new string sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
... | python | def string(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new string sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
... | Instantiate a new string sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. May be the empty string
if there are n... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1155-L1177 |
ska-sa/katcp-python | katcp/core.py | Sensor.discrete | def discrete(cls, name, description=None, unit='', params=None,
default=None, initial_status=None):
"""Instantiate a new discrete sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short descriptio... | python | def discrete(cls, name, description=None, unit='', params=None,
default=None, initial_status=None):
"""Instantiate a new discrete sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short descriptio... | Instantiate a new discrete sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. May be the empty string
if there are... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1180-L1205 |
ska-sa/katcp-python | katcp/core.py | Sensor.timestamp | def timestamp(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new timestamp sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the s... | python | def timestamp(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new timestamp sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the s... | Instantiate a new timestamp sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. For timestamp sensor may only be the
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1208-L1231 |
ska-sa/katcp-python | katcp/core.py | Sensor.address | def address(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new IP address sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sens... | python | def address(cls, name, description=None, unit='',
default=None, initial_status=None):
"""Instantiate a new IP address sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sens... | Instantiate a new IP address sensor object.
Parameters
----------
name : str
The name of the sensor.
description : str
A short description of the sensor.
units : str
The units of the sensor value. May be the empty string
if there a... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1234-L1257 |
ska-sa/katcp-python | katcp/core.py | Sensor.notify | def notify(self, reading):
"""Notify all observers of changes to this sensor."""
# copy list before iterating in case new observers arrive
for o in list(self._observers):
o.update(self, reading) | python | def notify(self, reading):
"""Notify all observers of changes to this sensor."""
# copy list before iterating in case new observers arrive
for o in list(self._observers):
o.update(self, reading) | Notify all observers of changes to this sensor. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1288-L1292 |
ska-sa/katcp-python | katcp/core.py | Sensor.set | def set(self, timestamp, status, value):
"""Set the current value of the sensor.
Parameters
----------
timestamp : float in seconds
The time at which the sensor value was determined.
status : Sensor status constant
Whether the value represents an error con... | python | def set(self, timestamp, status, value):
"""Set the current value of the sensor.
Parameters
----------
timestamp : float in seconds
The time at which the sensor value was determined.
status : Sensor status constant
Whether the value represents an error con... | Set the current value of the sensor.
Parameters
----------
timestamp : float in seconds
The time at which the sensor value was determined.
status : Sensor status constant
Whether the value represents an error condition or not.
value : object
Th... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1311-L1326 |
ska-sa/katcp-python | katcp/core.py | Sensor.set_formatted | def set_formatted(self, raw_timestamp, raw_status, raw_value,
major=DEFAULT_KATCP_MAJOR):
"""Set the current value of the sensor.
Parameters
----------
timestamp : str
KATCP formatted timestamp string
status : str
KATCP formatted sen... | python | def set_formatted(self, raw_timestamp, raw_status, raw_value,
major=DEFAULT_KATCP_MAJOR):
"""Set the current value of the sensor.
Parameters
----------
timestamp : str
KATCP formatted timestamp string
status : str
KATCP formatted sen... | Set the current value of the sensor.
Parameters
----------
timestamp : str
KATCP formatted timestamp string
status : str
KATCP formatted sensor status string
value : str
KATCP formatted sensor value
major : int, default = 5
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1328-L1347 |
ska-sa/katcp-python | katcp/core.py | Sensor.format_reading | def format_reading(self, reading, major=DEFAULT_KATCP_MAJOR):
"""Format sensor reading as (timestamp, status, value) tuple of strings.
All values are strings formatted as specified in the Sensor Type
Formats in the katcp specification.
Parameters
----------
reading : :c... | python | def format_reading(self, reading, major=DEFAULT_KATCP_MAJOR):
"""Format sensor reading as (timestamp, status, value) tuple of strings.
All values are strings formatted as specified in the Sensor Type
Formats in the katcp specification.
Parameters
----------
reading : :c... | Format sensor reading as (timestamp, status, value) tuple of strings.
All values are strings formatted as specified in the Sensor Type
Formats in the katcp specification.
Parameters
----------
reading : :class:`Reading` object
Sensor reading as returned by :meth:`re... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1373-L1405 |
ska-sa/katcp-python | katcp/core.py | Sensor.set_value | def set_value(self, value, status=NOMINAL, timestamp=None,
major=DEFAULT_KATCP_MAJOR):
"""Check and then set the value of the sensor.
Parameters
----------
value : object
Value of the appropriate type for the sensor.
status : Sensor status constant
... | python | def set_value(self, value, status=NOMINAL, timestamp=None,
major=DEFAULT_KATCP_MAJOR):
"""Check and then set the value of the sensor.
Parameters
----------
value : object
Value of the appropriate type for the sensor.
status : Sensor status constant
... | Check and then set the value of the sensor.
Parameters
----------
value : object
Value of the appropriate type for the sensor.
status : Sensor status constant
Whether the value represents an error condition or not.
timestamp : float in seconds or None
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1418-L1439 |
ska-sa/katcp-python | katcp/core.py | Sensor.parse_type | def parse_type(cls, type_string):
"""Parse KATCP formatted type code into Sensor type constant.
Parameters
----------
type_string : str
KATCP formatted type code.
Returns
-------
sensor_type : Sensor type constant
The corresponding Sensor... | python | def parse_type(cls, type_string):
"""Parse KATCP formatted type code into Sensor type constant.
Parameters
----------
type_string : str
KATCP formatted type code.
Returns
-------
sensor_type : Sensor type constant
The corresponding Sensor... | Parse KATCP formatted type code into Sensor type constant.
Parameters
----------
type_string : str
KATCP formatted type code.
Returns
-------
sensor_type : Sensor type constant
The corresponding Sensor type constant. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1465-L1483 |
ska-sa/katcp-python | katcp/core.py | Sensor.parse_params | def parse_params(cls, sensor_type, formatted_params,
major=DEFAULT_KATCP_MAJOR):
"""Parse KATCP formatted parameters into Python values.
Parameters
----------
sensor_type : Sensor type constant
The type of sensor the parameters are for.
formatted... | python | def parse_params(cls, sensor_type, formatted_params,
major=DEFAULT_KATCP_MAJOR):
"""Parse KATCP formatted parameters into Python values.
Parameters
----------
sensor_type : Sensor type constant
The type of sensor the parameters are for.
formatted... | Parse KATCP formatted parameters into Python values.
Parameters
----------
sensor_type : Sensor type constant
The type of sensor the parameters are for.
formatted_params : list of strings
The formatted parameters that should be parsed.
major : int
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1486-L1511 |
ska-sa/katcp-python | katcp/core.py | AsyncEvent.set | def set(self):
"""Set event flag to true and resolve future(s) returned by until_set()
Notes
-----
A call to set() may result in control being transferred to
done_callbacks attached to the future returned by until_set().
"""
self._flag = True
old_future ... | python | def set(self):
"""Set event flag to true and resolve future(s) returned by until_set()
Notes
-----
A call to set() may result in control being transferred to
done_callbacks attached to the future returned by until_set().
"""
self._flag = True
old_future ... | Set event flag to true and resolve future(s) returned by until_set()
Notes
-----
A call to set() may result in control being transferred to
done_callbacks attached to the future returned by until_set(). | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1569-L1583 |
ska-sa/katcp-python | katcp/core.py | AsyncEvent.wait_with_ioloop | def wait_with_ioloop(self, ioloop, timeout=None):
"""Do blocking wait until condition is event is set.
Parameters
----------
ioloop : tornadio.ioloop.IOLoop instance
MUST be the same ioloop that set() / clear() is called from
timeout : float, int or None
... | python | def wait_with_ioloop(self, ioloop, timeout=None):
"""Do blocking wait until condition is event is set.
Parameters
----------
ioloop : tornadio.ioloop.IOLoop instance
MUST be the same ioloop that set() / clear() is called from
timeout : float, int or None
... | Do blocking wait until condition is event is set.
Parameters
----------
ioloop : tornadio.ioloop.IOLoop instance
MUST be the same ioloop that set() / clear() is called from
timeout : float, int or None
If not None, only wait up to `timeout` seconds for event to b... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1601-L1629 |
ska-sa/katcp-python | katcp/core.py | AsyncState.until_state | def until_state(self, state, timeout=None):
"""Return a tornado Future that will resolve when the requested state is set"""
if state not in self._valid_states:
raise ValueError('State must be one of {0}, not {1}'
.format(self._valid_states, state))
if sta... | python | def until_state(self, state, timeout=None):
"""Return a tornado Future that will resolve when the requested state is set"""
if state not in self._valid_states:
raise ValueError('State must be one of {0}, not {1}'
.format(self._valid_states, state))
if sta... | Return a tornado Future that will resolve when the requested state is set | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1708-L1723 |
ska-sa/katcp-python | katcp/core.py | AsyncState.until_state_in | def until_state_in(self, *states, **kwargs):
"""Return a tornado Future, resolves when any of the requested states is set"""
timeout = kwargs.get('timeout', None)
state_futures = (self.until_state(s, timeout=timeout) for s in states)
return until_any(*state_futures) | python | def until_state_in(self, *states, **kwargs):
"""Return a tornado Future, resolves when any of the requested states is set"""
timeout = kwargs.get('timeout', None)
state_futures = (self.until_state(s, timeout=timeout) for s in states)
return until_any(*state_futures) | Return a tornado Future, resolves when any of the requested states is set | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1725-L1729 |
ska-sa/katcp-python | katcp/core.py | LatencyTimer.check_future | def check_future(self, fut):
"""Call with each future that is to be yielded on"""
done = self.done = fut.done()
if done and not self.prev_done:
self.done_since = self.ioloop.time()
self.prev_done = done | python | def check_future(self, fut):
"""Call with each future that is to be yielded on"""
done = self.done = fut.done()
if done and not self.prev_done:
self.done_since = self.ioloop.time()
self.prev_done = done | Call with each future that is to be yielded on | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1785-L1790 |
ska-sa/katcp-python | katcp/core.py | LatencyTimer.time_to_yield | def time_to_yield(self):
"""Call after check_future(). If True, it is time to yield tornado.gen.moment"""
delta = self.ioloop.time() - self.done_since
if self.done and delta > self.max_loop_latency:
return True
return False | python | def time_to_yield(self):
"""Call after check_future(). If True, it is time to yield tornado.gen.moment"""
delta = self.ioloop.time() - self.done_since
if self.done and delta > self.max_loop_latency:
return True
return False | Call after check_future(). If True, it is time to yield tornado.gen.moment | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/core.py#L1792-L1797 |
ska-sa/katcp-python | katcp/client.py | request_check | def request_check(client, exception, *msg_parms, **kwargs):
"""Make blocking request to client and raise exception if reply is not ok.
Parameters
----------
client : DeviceClient instance
exception: Exception class to raise
*msg_parms : Message parameters sent to the Message.request() call
... | python | def request_check(client, exception, *msg_parms, **kwargs):
"""Make blocking request to client and raise exception if reply is not ok.
Parameters
----------
client : DeviceClient instance
exception: Exception class to raise
*msg_parms : Message parameters sent to the Message.request() call
... | Make blocking request to client and raise exception if reply is not ok.
Parameters
----------
client : DeviceClient instance
exception: Exception class to raise
*msg_parms : Message parameters sent to the Message.request() call
**kwargs : Keyword arguments
Forwards kwargs['timeout'] to ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1469-L1508 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.convert_seconds | def convert_seconds(self, time_seconds):
"""Convert a time in seconds to the device timestamp units.
KATCP v4 and earlier, specified all timestamps in milliseconds. Since
KATCP v5, all timestamps are in seconds. If the device KATCP version
has been detected, this method converts a value... | python | def convert_seconds(self, time_seconds):
"""Convert a time in seconds to the device timestamp units.
KATCP v4 and earlier, specified all timestamps in milliseconds. Since
KATCP v5, all timestamps are in seconds. If the device KATCP version
has been detected, this method converts a value... | Convert a time in seconds to the device timestamp units.
KATCP v4 and earlier, specified all timestamps in milliseconds. Since
KATCP v5, all timestamps are in seconds. If the device KATCP version
has been detected, this method converts a value in seconds to the
appropriate (seconds or m... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L223-L239 |
ska-sa/katcp-python | katcp/client.py | DeviceClient._next_id | def _next_id(self):
"""Return the next available message id."""
assert get_thread_ident() == self.ioloop_thread_id
self._last_msg_id += 1
return str(self._last_msg_id) | python | def _next_id(self):
"""Return the next available message id."""
assert get_thread_ident() == self.ioloop_thread_id
self._last_msg_id += 1
return str(self._last_msg_id) | Return the next available message id. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L241-L245 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.inform_version_connect | def inform_version_connect(self, msg):
"""Process a #version-connect message."""
if len(msg.arguments) < 2:
return
# Store version information.
name = msg.arguments[0]
self.versions[name] = tuple(msg.arguments[1:])
if msg.arguments[0] == "katcp-protocol":
... | python | def inform_version_connect(self, msg):
"""Process a #version-connect message."""
if len(msg.arguments) < 2:
return
# Store version information.
name = msg.arguments[0]
self.versions[name] = tuple(msg.arguments[1:])
if msg.arguments[0] == "katcp-protocol":
... | Process a #version-connect message. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L261-L270 |
ska-sa/katcp-python | katcp/client.py | DeviceClient._get_mid_and_update_msg | def _get_mid_and_update_msg(self, msg, use_mid):
"""Get message ID for current request and assign to msg.mid if needed.
Parameters
----------
msg : katcp.Message ?request message
use_mid : bool or None
If msg.mid is None, a new message ID will be created. msg.mid will b... | python | def _get_mid_and_update_msg(self, msg, use_mid):
"""Get message ID for current request and assign to msg.mid if needed.
Parameters
----------
msg : katcp.Message ?request message
use_mid : bool or None
If msg.mid is None, a new message ID will be created. msg.mid will b... | Get message ID for current request and assign to msg.mid if needed.
Parameters
----------
msg : katcp.Message ?request message
use_mid : bool or None
If msg.mid is None, a new message ID will be created. msg.mid will be
filled with this ID if use_mid is True or if use_m... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L317-L346 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.request | def request(self, msg, use_mid=None):
"""Send a request message, with automatic message ID assignment.
Parameters
----------
msg : katcp.Message request message
use_mid : bool or None, default=None
Returns
-------
mid : string or None
The mes... | python | def request(self, msg, use_mid=None):
"""Send a request message, with automatic message ID assignment.
Parameters
----------
msg : katcp.Message request message
use_mid : bool or None, default=None
Returns
-------
mid : string or None
The mes... | Send a request message, with automatic message ID assignment.
Parameters
----------
msg : katcp.Message request message
use_mid : bool or None, default=None
Returns
-------
mid : string or None
The message id, or None if no msg id is used
If... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L349-L372 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.send_request | def send_request(self, msg):
"""Send a request messsage.
Parameters
----------
msg : Message object
The request Message to send.
"""
assert(msg.mtype == Message.REQUEST)
if msg.mid and not self._server_supports_ids:
raise KatcpVersionErro... | python | def send_request(self, msg):
"""Send a request messsage.
Parameters
----------
msg : Message object
The request Message to send.
"""
assert(msg.mtype == Message.REQUEST)
if msg.mid and not self._server_supports_ids:
raise KatcpVersionErro... | Send a request messsage.
Parameters
----------
msg : Message object
The request Message to send. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L374-L386 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.send_message | def send_message(self, msg):
"""Send any kind of message.
Parameters
----------
msg : Message object
The message to send.
"""
assert get_thread_ident() == self.ioloop_thread_id
data = str(msg) + "\n"
# Log all sent messages here so no one els... | python | def send_message(self, msg):
"""Send any kind of message.
Parameters
----------
msg : Message object
The message to send.
"""
assert get_thread_ident() == self.ioloop_thread_id
data = str(msg) + "\n"
# Log all sent messages here so no one els... | Send any kind of message.
Parameters
----------
msg : Message object
The message to send. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L389-L412 |
ska-sa/katcp-python | katcp/client.py | DeviceClient._connect | def _connect(self):
"""Connect to the server."""
assert get_thread_ident() == self.ioloop_thread_id
if self._stream:
self._logger.warn('Disconnecting existing connection to {0!r} '
'to create a new connection')
self._disconnect()
... | python | def _connect(self):
"""Connect to the server."""
assert get_thread_ident() == self.ioloop_thread_id
if self._stream:
self._logger.warn('Disconnecting existing connection to {0!r} '
'to create a new connection')
self._disconnect()
... | Connect to the server. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L415-L472 |
ska-sa/katcp-python | katcp/client.py | DeviceClient._disconnect | def _disconnect(self, exc_info=False):
"""Disconnect and cleanup."""
if self._stream:
self._stream.close(exc_info=exc_info) | python | def _disconnect(self, exc_info=False):
"""Disconnect and cleanup."""
if self._stream:
self._stream.close(exc_info=exc_info) | Disconnect and cleanup. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L479-L482 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.handle_message | def handle_message(self, msg):
"""Handle a message from the server.
Parameters
----------
msg : Message object
The Message to dispatch to the handler methods.
"""
# log messages received so that no one else has to
if self._logger.isEnabledFor(logging... | python | def handle_message(self, msg):
"""Handle a message from the server.
Parameters
----------
msg : Message object
The Message to dispatch to the handler methods.
"""
# log messages received so that no one else has to
if self._logger.isEnabledFor(logging... | Handle a message from the server.
Parameters
----------
msg : Message object
The Message to dispatch to the handler methods. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L505-L528 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.handle_inform | def handle_inform(self, msg):
"""Dispatch an inform message to the appropriate method.
Parameters
----------
msg : Message object
The inform message to dispatch.
"""
method = self._inform_handlers.get(
msg.name, self.__class__.unhandled_inform)
... | python | def handle_inform(self, msg):
"""Dispatch an inform message to the appropriate method.
Parameters
----------
msg : Message object
The inform message to dispatch.
"""
method = self._inform_handlers.get(
msg.name, self.__class__.unhandled_inform)
... | Dispatch an inform message to the appropriate method.
Parameters
----------
msg : Message object
The inform message to dispatch. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L530-L548 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.handle_reply | def handle_reply(self, msg):
"""Dispatch a reply message to the appropriate method.
Parameters
----------
msg : Message object
The reply message to dispatch.
"""
method = self.__class__.unhandled_reply
if msg.name in self._reply_handlers:
... | python | def handle_reply(self, msg):
"""Dispatch a reply message to the appropriate method.
Parameters
----------
msg : Message object
The reply message to dispatch.
"""
method = self.__class__.unhandled_reply
if msg.name in self._reply_handlers:
... | Dispatch a reply message to the appropriate method.
Parameters
----------
msg : Message object
The reply message to dispatch. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L550-L569 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.handle_request | def handle_request(self, msg):
"""Dispatch a request message to the appropriate method.
Parameters
----------
msg : Message object
The request message to dispatch.
"""
method = self.__class__.unhandled_request
if msg.name in self._request_handlers:
... | python | def handle_request(self, msg):
"""Dispatch a request message to the appropriate method.
Parameters
----------
msg : Message object
The request message to dispatch.
"""
method = self.__class__.unhandled_request
if msg.name in self._request_handlers:
... | Dispatch a request message to the appropriate method.
Parameters
----------
msg : Message object
The request message to dispatch. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L571-L605 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.set_ioloop | def set_ioloop(self, ioloop=None):
"""Set the tornado.ioloop.IOLoop instance to use.
This defaults to IOLoop.current(). If set_ioloop() is never called the
IOLoop is managed: started in a new thread, and will be stopped if
self.stop() is called.
Notes
-----
Must... | python | def set_ioloop(self, ioloop=None):
"""Set the tornado.ioloop.IOLoop instance to use.
This defaults to IOLoop.current(). If set_ioloop() is never called the
IOLoop is managed: started in a new thread, and will be stopped if
self.stop() is called.
Notes
-----
Must... | Set the tornado.ioloop.IOLoop instance to use.
This defaults to IOLoop.current(). If set_ioloop() is never called the
IOLoop is managed: started in a new thread, and will be stopped if
self.stop() is called.
Notes
-----
Must be called before start() is called | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L739-L752 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.enable_thread_safety | def enable_thread_safety(self):
"""Enable thread-safety features.
Must be called before start().
"""
if self.threadsafe:
return # Already done!
if self._running.isSet():
raise RuntimeError('Cannot enable thread safety after start')... | python | def enable_thread_safety(self):
"""Enable thread-safety features.
Must be called before start().
"""
if self.threadsafe:
return # Already done!
if self._running.isSet():
raise RuntimeError('Cannot enable thread safety after start')... | Enable thread-safety features.
Must be called before start(). | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L754-L789 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.start | def start(self, timeout=None):
"""Start the client in a new thread.
Parameters
----------
timeout : float in seconds
Seconds to wait for client thread to start. Do not specify a
timeout if start() is being called from the same ioloop that this
client ... | python | def start(self, timeout=None):
"""Start the client in a new thread.
Parameters
----------
timeout : float in seconds
Seconds to wait for client thread to start. Do not specify a
timeout if start() is being called from the same ioloop that this
client ... | Start the client in a new thread.
Parameters
----------
timeout : float in seconds
Seconds to wait for client thread to start. Do not specify a
timeout if start() is being called from the same ioloop that this
client will be installed on, since it will block ... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L821-L843 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.stop | def stop(self, timeout=None):
"""Stop a running client (from another thread).
Parameters
----------
timeout : float in seconds
Seconds to wait for client thread to have *started*.
"""
ioloop = getattr(self, 'ioloop', None)
if not ioloop:
r... | python | def stop(self, timeout=None):
"""Stop a running client (from another thread).
Parameters
----------
timeout : float in seconds
Seconds to wait for client thread to have *started*.
"""
ioloop = getattr(self, 'ioloop', None)
if not ioloop:
r... | Stop a running client (from another thread).
Parameters
----------
timeout : float in seconds
Seconds to wait for client thread to have *started*. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L860-L880 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.wait_running | def wait_running(self, timeout=None):
"""Wait until the client is running.
Parameters
----------
timeout : float in seconds
Seconds to wait for the client to start running.
Returns
-------
running : bool
Whether the client is running
... | python | def wait_running(self, timeout=None):
"""Wait until the client is running.
Parameters
----------
timeout : float in seconds
Seconds to wait for the client to start running.
Returns
-------
running : bool
Whether the client is running
... | Wait until the client is running.
Parameters
----------
timeout : float in seconds
Seconds to wait for the client to start running.
Returns
-------
running : bool
Whether the client is running
Notes
-----
Do not call this... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L904-L925 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.until_connected | def until_connected(self, timeout=None):
"""Return future that resolves when the client is connected."""
t0 = self.ioloop.time()
yield self.until_running(timeout=timeout)
t1 = self.ioloop.time()
if timeout:
timedelta = timeout - (t1 - t0)
else:
tim... | python | def until_connected(self, timeout=None):
"""Return future that resolves when the client is connected."""
t0 = self.ioloop.time()
yield self.until_running(timeout=timeout)
t1 = self.ioloop.time()
if timeout:
timedelta = timeout - (t1 - t0)
else:
tim... | Return future that resolves when the client is connected. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L939-L949 |
ska-sa/katcp-python | katcp/client.py | DeviceClient.until_protocol | def until_protocol(self, timeout=None):
"""Return future that resolves after receipt of katcp protocol info.
If the returned future resolves, the server's protocol information is
available in the ProtocolFlags instance self.protocol_flags.
"""
t0 = self.ioloop.time()
yi... | python | def until_protocol(self, timeout=None):
"""Return future that resolves after receipt of katcp protocol info.
If the returned future resolves, the server's protocol information is
available in the ProtocolFlags instance self.protocol_flags.
"""
t0 = self.ioloop.time()
yi... | Return future that resolves after receipt of katcp protocol info.
If the returned future resolves, the server's protocol information is
available in the ProtocolFlags instance self.protocol_flags. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L972-L987 |
ska-sa/katcp-python | katcp/client.py | AsyncClient._push_async_request | def _push_async_request(self, msg_id, request, reply_cb, inform_cb,
user_data, timeout_handle):
"""Store reply / inform callbacks for request we've sent."""
assert get_thread_ident() == self.ioloop_thread_id
self._async_queue[msg_id] = (
request, reply_cb,... | python | def _push_async_request(self, msg_id, request, reply_cb, inform_cb,
user_data, timeout_handle):
"""Store reply / inform callbacks for request we've sent."""
assert get_thread_ident() == self.ioloop_thread_id
self._async_queue[msg_id] = (
request, reply_cb,... | Store reply / inform callbacks for request we've sent. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1101-L1110 |
ska-sa/katcp-python | katcp/client.py | AsyncClient._pop_async_request | def _pop_async_request(self, msg_id, msg_name):
"""Pop the set of callbacks for a request.
Return tuple of Nones if callbacks already popped (or don't exist).
"""
assert get_thread_ident() == self.ioloop_thread_id
if msg_id is None:
msg_id = self._msg_id_for_name(ms... | python | def _pop_async_request(self, msg_id, msg_name):
"""Pop the set of callbacks for a request.
Return tuple of Nones if callbacks already popped (or don't exist).
"""
assert get_thread_ident() == self.ioloop_thread_id
if msg_id is None:
msg_id = self._msg_id_for_name(ms... | Pop the set of callbacks for a request.
Return tuple of Nones if callbacks already popped (or don't exist). | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1112-L1127 |
ska-sa/katcp-python | katcp/client.py | AsyncClient._peek_async_request | def _peek_async_request(self, msg_id, msg_name):
"""Peek at the set of callbacks for a request.
Return tuple of Nones if callbacks don't exist.
"""
assert get_thread_ident() == self.ioloop_thread_id
if msg_id is None:
msg_id = self._msg_id_for_name(msg_name)
... | python | def _peek_async_request(self, msg_id, msg_name):
"""Peek at the set of callbacks for a request.
Return tuple of Nones if callbacks don't exist.
"""
assert get_thread_ident() == self.ioloop_thread_id
if msg_id is None:
msg_id = self._msg_id_for_name(msg_name)
... | Peek at the set of callbacks for a request.
Return tuple of Nones if callbacks don't exist. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1129-L1141 |
ska-sa/katcp-python | katcp/client.py | AsyncClient._msg_id_for_name | def _msg_id_for_name(self, msg_name):
"""Find the msg_id for a given request name.
Return None if no message id exists.
"""
if msg_name in self._async_id_stack and self._async_id_stack[msg_name]:
return self._async_id_stack[msg_name][0] | python | def _msg_id_for_name(self, msg_name):
"""Find the msg_id for a given request name.
Return None if no message id exists.
"""
if msg_name in self._async_id_stack and self._async_id_stack[msg_name]:
return self._async_id_stack[msg_name][0] | Find the msg_id for a given request name.
Return None if no message id exists. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1143-L1150 |
ska-sa/katcp-python | katcp/client.py | AsyncClient.callback_request | def callback_request(self, msg, reply_cb=None, inform_cb=None,
user_data=None, timeout=None, use_mid=None):
"""Send a request messsage.
Parameters
----------
msg : Message object
The request message to send.
reply_cb : function
Th... | python | def callback_request(self, msg, reply_cb=None, inform_cb=None,
user_data=None, timeout=None, use_mid=None):
"""Send a request messsage.
Parameters
----------
msg : Message object
The request message to send.
reply_cb : function
Th... | Send a request messsage.
Parameters
----------
msg : Message object
The request message to send.
reply_cb : function
The reply callback with signature reply_cb(msg)
or reply_cb(msg, \*user_data)
inform_cb : function
The inform call... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1153-L1197 |
ska-sa/katcp-python | katcp/client.py | AsyncClient.future_request | def future_request(self, msg, timeout=None, use_mid=None):
"""Send a request messsage, with future replies.
Parameters
----------
msg : Message object
The request Message to send.
timeout : float in seconds
How long to wait for a reply. The default is the... | python | def future_request(self, msg, timeout=None, use_mid=None):
"""Send a request messsage, with future replies.
Parameters
----------
msg : Message object
The request Message to send.
timeout : float in seconds
How long to wait for a reply. The default is the... | Send a request messsage, with future replies.
Parameters
----------
msg : Message object
The request Message to send.
timeout : float in seconds
How long to wait for a reply. The default is the
the timeout set when creating the AsyncClient.
us... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1199-L1240 |
ska-sa/katcp-python | katcp/client.py | AsyncClient.blocking_request | def blocking_request(self, msg, timeout=None, use_mid=None):
"""Send a request messsage and wait for its reply.
Parameters
----------
msg : Message object
The request Message to send.
timeout : float in seconds
How long to wait for a reply. The default is... | python | def blocking_request(self, msg, timeout=None, use_mid=None):
"""Send a request messsage and wait for its reply.
Parameters
----------
msg : Message object
The request Message to send.
timeout : float in seconds
How long to wait for a reply. The default is... | Send a request messsage and wait for its reply.
Parameters
----------
msg : Message object
The request Message to send.
timeout : float in seconds
How long to wait for a reply. The default is the
the timeout set when creating the AsyncClient.
... | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1242-L1299 |
ska-sa/katcp-python | katcp/client.py | AsyncClient.handle_inform | def handle_inform(self, msg):
"""Handle inform messages related to any current requests.
Inform messages not related to the current request go up
to the base class method.
Parameters
----------
msg : Message object
The inform message to dispatch.
""... | python | def handle_inform(self, msg):
"""Handle inform messages related to any current requests.
Inform messages not related to the current request go up
to the base class method.
Parameters
----------
msg : Message object
The inform message to dispatch.
""... | Handle inform messages related to any current requests.
Inform messages not related to the current request go up
to the base class method.
Parameters
----------
msg : Message object
The inform message to dispatch. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1301-L1340 |
ska-sa/katcp-python | katcp/client.py | AsyncClient._do_fail_callback | def _do_fail_callback(
self, reason, msg, reply_cb, inform_cb, user_data, timeout_handle):
"""Do callback for a failed request."""
# this may also result in reply_cb being None if no
# reply_cb was passed to the request method
if reply_cb is None:
# this happens ... | python | def _do_fail_callback(
self, reason, msg, reply_cb, inform_cb, user_data, timeout_handle):
"""Do callback for a failed request."""
# this may also result in reply_cb being None if no
# reply_cb was passed to the request method
if reply_cb is None:
# this happens ... | Do callback for a failed request. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1342-L1364 |
ska-sa/katcp-python | katcp/client.py | AsyncClient._handle_timeout | def _handle_timeout(self, msg_id, start_time):
"""Handle a timed-out callback request.
Parameters
----------
msg_id : uuid.UUID for message
The name of the reply which was expected.
"""
msg, reply_cb, inform_cb, user_data, timeout_handle = \
self... | python | def _handle_timeout(self, msg_id, start_time):
"""Handle a timed-out callback request.
Parameters
----------
msg_id : uuid.UUID for message
The name of the reply which was expected.
"""
msg, reply_cb, inform_cb, user_data, timeout_handle = \
self... | Handle a timed-out callback request.
Parameters
----------
msg_id : uuid.UUID for message
The name of the reply which was expected. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1366-L1390 |
ska-sa/katcp-python | katcp/client.py | AsyncClient.handle_reply | def handle_reply(self, msg):
"""Handle a reply message related to the current request.
Reply messages not related to the current request go up
to the base class method.
Parameters
----------
msg : Message object
The reply message to dispatch.
"""
... | python | def handle_reply(self, msg):
"""Handle a reply message related to the current request.
Reply messages not related to the current request go up
to the base class method.
Parameters
----------
msg : Message object
The reply message to dispatch.
"""
... | Handle a reply message related to the current request.
Reply messages not related to the current request go up
to the base class method.
Parameters
----------
msg : Message object
The reply message to dispatch. | https://github.com/ska-sa/katcp-python/blob/9127c826a1d030c53b84d0e95743e20e5c5ea153/katcp/client.py#L1392-L1437 |
edx/edx-submissions | submissions/serializers.py | SubmissionSerializer.validate_answer | def validate_answer(self, value):
"""
Check that the answer is JSON-serializable and not too long.
"""
# Check that the answer is JSON-serializable
try:
serialized = json.dumps(value)
except (ValueError, TypeError):
raise serializers.ValidationErro... | python | def validate_answer(self, value):
"""
Check that the answer is JSON-serializable and not too long.
"""
# Check that the answer is JSON-serializable
try:
serialized = json.dumps(value)
except (ValueError, TypeError):
raise serializers.ValidationErro... | Check that the answer is JSON-serializable and not too long. | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/serializers.py#L61-L75 |
edx/edx-submissions | submissions/serializers.py | ScoreSerializer.get_annotations | def get_annotations(self, obj):
"""
Inspect ScoreAnnotations to attach all relevant annotations.
"""
annotations = ScoreAnnotation.objects.filter(score_id=obj.id)
return [
ScoreAnnotationSerializer(instance=annotation).data
for annotation in annotations
... | python | def get_annotations(self, obj):
"""
Inspect ScoreAnnotations to attach all relevant annotations.
"""
annotations = ScoreAnnotation.objects.filter(score_id=obj.id)
return [
ScoreAnnotationSerializer(instance=annotation).data
for annotation in annotations
... | Inspect ScoreAnnotations to attach all relevant annotations. | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/serializers.py#L125-L133 |
edx/edx-submissions | submissions/models.py | Score.create_reset_score | def create_reset_score(cls, student_item):
"""
Create a "reset" score (a score with a null submission).
Only scores created after the most recent "reset" score
should be used to determine a student's effective score.
Args:
student_item (StudentItem): The student ite... | python | def create_reset_score(cls, student_item):
"""
Create a "reset" score (a score with a null submission).
Only scores created after the most recent "reset" score
should be used to determine a student's effective score.
Args:
student_item (StudentItem): The student ite... | Create a "reset" score (a score with a null submission).
Only scores created after the most recent "reset" score
should be used to determine a student's effective score.
Args:
student_item (StudentItem): The student item model.
Returns:
Score: The newly created... | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/models.py#L241-L268 |
edx/edx-submissions | submissions/models.py | ScoreSummary.update_score_summary | def update_score_summary(sender, **kwargs):
"""
Listen for new Scores and update the relevant ScoreSummary.
Args:
sender: not used
Kwargs:
instance (Score): The score model whose save triggered this receiver.
"""
score = kwargs['instance']
... | python | def update_score_summary(sender, **kwargs):
"""
Listen for new Scores and update the relevant ScoreSummary.
Args:
sender: not used
Kwargs:
instance (Score): The score model whose save triggered this receiver.
"""
score = kwargs['instance']
... | Listen for new Scores and update the relevant ScoreSummary.
Args:
sender: not used
Kwargs:
instance (Score): The score model whose save triggered this receiver. | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/models.py#L286-L323 |
edx/edx-submissions | submissions/management/commands/update_submissions_uuids.py | Command.add_arguments | def add_arguments(self, parser):
"""
Add arguments to the command parser.
Uses argparse syntax. See documentation at
https://docs.python.org/3/library/argparse.html.
"""
parser.add_argument(
'--start', '-s',
default=0,
type=int,
... | python | def add_arguments(self, parser):
"""
Add arguments to the command parser.
Uses argparse syntax. See documentation at
https://docs.python.org/3/library/argparse.html.
"""
parser.add_argument(
'--start', '-s',
default=0,
type=int,
... | Add arguments to the command parser.
Uses argparse syntax. See documentation at
https://docs.python.org/3/library/argparse.html. | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/management/commands/update_submissions_uuids.py#L31-L55 |
edx/edx-submissions | submissions/management/commands/update_submissions_uuids.py | Command.handle | def handle(self, *args, **options):
"""
By default, we're going to do this in chunks. This way, if there ends up being an error,
we can check log messages and continue from that point after fixing the issue.
"""
# Note that by taking last_id here, we're going to miss any submissi... | python | def handle(self, *args, **options):
"""
By default, we're going to do this in chunks. This way, if there ends up being an error,
we can check log messages and continue from that point after fixing the issue.
"""
# Note that by taking last_id here, we're going to miss any submissi... | By default, we're going to do this in chunks. This way, if there ends up being an error,
we can check log messages and continue from that point after fixing the issue. | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/management/commands/update_submissions_uuids.py#L57-L75 |
edx/edx-submissions | submissions/views.py | get_submissions_for_student_item | def get_submissions_for_student_item(request, course_id, student_id, item_id):
"""Retrieve all submissions associated with the given student item.
Developer utility for accessing all the submissions associated with a
student item. The student item is specified by the unique combination of
course, stude... | python | def get_submissions_for_student_item(request, course_id, student_id, item_id):
"""Retrieve all submissions associated with the given student item.
Developer utility for accessing all the submissions associated with a
student item. The student item is specified by the unique combination of
course, stude... | Retrieve all submissions associated with the given student item.
Developer utility for accessing all the submissions associated with a
student item. The student item is specified by the unique combination of
course, student, and item.
Args:
request (dict): The request.
course_id (str):... | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/views.py#L12-L43 |
edx/edx-submissions | submissions/api.py | create_submission | def create_submission(student_item_dict, answer, submitted_at=None, attempt_number=None):
"""Creates a submission for assessment.
Generic means by which to submit an answer for assessment.
Args:
student_item_dict (dict): The student_item this
submission is associated with. This is used... | python | def create_submission(student_item_dict, answer, submitted_at=None, attempt_number=None):
"""Creates a submission for assessment.
Generic means by which to submit an answer for assessment.
Args:
student_item_dict (dict): The student_item this
submission is associated with. This is used... | Creates a submission for assessment.
Generic means by which to submit an answer for assessment.
Args:
student_item_dict (dict): The student_item this
submission is associated with. This is used to determine which
course, student, and location this submission belongs to.
... | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/api.py#L105-L197 |
edx/edx-submissions | submissions/api.py | _get_submission_model | def _get_submission_model(uuid, read_replica=False):
"""
Helper to retrieve a given Submission object from the database. Helper is needed to centralize logic that fixes
EDUCATOR-1090, because uuids are stored both with and without hyphens.
"""
submission_qs = Submission.objects
if read_replica:
... | python | def _get_submission_model(uuid, read_replica=False):
"""
Helper to retrieve a given Submission object from the database. Helper is needed to centralize logic that fixes
EDUCATOR-1090, because uuids are stored both with and without hyphens.
"""
submission_qs = Submission.objects
if read_replica:
... | Helper to retrieve a given Submission object from the database. Helper is needed to centralize logic that fixes
EDUCATOR-1090, because uuids are stored both with and without hyphens. | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/api.py#L200-L238 |
edx/edx-submissions | submissions/api.py | get_submission | def get_submission(submission_uuid, read_replica=False):
"""Retrieves a single submission by uuid.
Args:
submission_uuid (str): Identifier for the submission.
Kwargs:
read_replica (bool): If true, attempt to use the read replica database.
If no read replica is available, use th... | python | def get_submission(submission_uuid, read_replica=False):
"""Retrieves a single submission by uuid.
Args:
submission_uuid (str): Identifier for the submission.
Kwargs:
read_replica (bool): If true, attempt to use the read replica database.
If no read replica is available, use th... | Retrieves a single submission by uuid.
Args:
submission_uuid (str): Identifier for the submission.
Kwargs:
read_replica (bool): If true, attempt to use the read replica database.
If no read replica is available, use the default database.
Raises:
SubmissionNotFoundError... | https://github.com/edx/edx-submissions/blob/8d531ca25f7c2886dfcb1bb8febe0910e1433ca2/submissions/api.py#L241-L304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.