update documentation

This commit is contained in:
Michael Davidsaver
2014-06-16 17:55:15 -04:00
parent 9b5b9687b4
commit ee2cb409c2
11 changed files with 121 additions and 33 deletions

View File

@ -53,29 +53,28 @@ class _Record(object):
def scan(self, sync=False, reason=None, force=0):
"""Scan this record.
:param sync: scan in current thread (``True``), or queue (``False``).
:param sync: scan in current thread (``True``), or queue to a worker (``False``).
:param reason: Reason object passed to :meth:`process <DeviceSupport.process>` (sync=True only)
:param force: Record processing condtion (0=Passive, 1=Force, 2=I/O Intr)
:throws: ``RuntimeError`` when ``sync=True``, but ``force`` prevents scanning.
If ``sync`` is False then a
scan request is queued to run in another thread..
If ``sync`` is True then the record
is scannined immidately on the current thread.
If ``sync`` is False then a scan request is queued to run in another thread..
If ``sync`` is True then the record is scanned immediately on the current thread.
For ``reason`` argument must be used in conjunction with ``sync=True``
on records with Python device support. This provides a means
of providing extra contextual information to the record's
:meth:`process <DeviceSupport.process>` method.
``force`` is used to decide if the record will actuall be processed,
``force`` is used to decide if the record will actually be processed,
``force=0`` will only process records with SCAN=Passive.
``force=1`` will process any record if at all possible.
``force=2`` will only process records with Python device support and
SCAN=I/O Intr.
It is **never** safe to use ``sync=True`` while holding record locks,
including from within a *process* method.
.. important::
It is **never** safe to use ``sync=True`` while holding record locks,
including from within a *process* method.
"""
def asyncStart(self):
@ -154,7 +153,7 @@ class _Field(object):
def putval(self, val):
"""Update the field value
Must be an Int, Float or str. Strings will be truncated to 39 charactors.
Must be an Int, Float or str. Strings will be truncated to 39 characters.
"""
def getarray(self):
@ -179,11 +178,11 @@ class _Field(object):
"""Set the number of active elements in field's array.
Requires that the underlying field be an array.
Must be less than the maximum length of the field.
Must be greater than one and less than or equal to the maximum length of the field.
"""
def getAlarm(self):
"""Returns a tuple (severity, status) with the condtion of the linked field.
"""Returns a tuple (severity, status) with the condition of the linked field.
Only works for fields of type DBF_INLINK.
"""

View File

@ -23,7 +23,7 @@ def getRecord(name):
full record name.
The result is cached so the future calls will return the same instance.
This is the prefered way to get :class:`Record` instances.
This is the preferred way to get :class:`Record` instances.
>>> R = getRecord("my:record:name")
Record("my:record:name")
@ -38,7 +38,7 @@ def getRecord(name):
class IOScanListBlock(object):
"""A list of records which will be processed together.
This convienence class to handle the accounting to
This convenience class to handle the accounting to
maintain a list of records.
"""
def __init__(self):
@ -218,7 +218,7 @@ class Record(_dbapi._Record):
"""Lookup field in this record
:rtype: :class:`Field`
:throws: KeyError for non-existant fields.
:throws: KeyError for non-existent fields.
The returned object is cached so future calls will
return the same instance.
@ -248,6 +248,9 @@ class Record(_dbapi._Record):
Has not effect if the TSE field is not set to -2.
All inputs must be referenced to the posix epoch.
If a datetime is provided, it must use the local system
timezone.
"""
if hasattr(ts, 'timetuple'):
ts = time.mktime(ts.timetuple())
@ -296,7 +299,7 @@ class Field(_dbapi._Field):
"""Get timestamp of link target.
Only works for DBF_INLINK fields.
Returns the time in seconds since the posix epoch.
Returns the time in seconds since the POSIX epoch.
:rtype: float
"""

View File

@ -17,7 +17,7 @@ __all__ = [
'build'
]
# Reason code to cause a record to read a new value from a table paramter
# Reason code to cause a record to read a new value from a table parameter
_INTERNAL = object()
# action types
@ -40,7 +40,7 @@ def _add_action(self, act, fn):
class Parameter(object):
"""Define a parameter in a table.
When a sub-class of TableBase is instancianted, parameters become
When a sub-class of TableBase is instantiated, parameters become
py:class:`_ParamInstance` instances.
>>> class MyTable(TableBase):
@ -100,7 +100,7 @@ class Parameter(object):
class ParameterGroup(object):
"""A helper for defining actions on groups of parameters
When a sub-class of TableBase is instancianted, parameter groups become
When a sub-class of TableBase is instantiated, parameter groups become
py:class:`_ParamGroupInstance` instances.
>>> class MyTable(TableBase):
@ -116,7 +116,7 @@ class ParameterGroup(object):
self.params, self.name = params, name
def onproc(self, fn):
"""Decorator run a member function action whenever
a device support attached to any paramter in the group processes.
a device support attached to any parameter in the group processes.
>>> class MyTable(TableBase):
A, B = Parameter(), Parameter()
@ -133,7 +133,7 @@ class ParameterGroup(object):
"Decorator to run an action when any parameters has an invalid value"
return _add_action(self, (any, lambda p:not p.isvalid), fn)
def oncondition(self, fmap, freduce=all):
"""Decorator for a custom condtion.
"""Decorator for a custom condition.
The condition is specified in two parts, a map function, and a reduce function.
The map function is applied to each parameter in the group. Then a list
@ -265,7 +265,7 @@ class TableBase(object):
Sub-class this and populate with :py:class:`Parameter` and :py:class:`ParameterGroup`.
When a table is instanciated it must be given a unique name.
#When a table is instantiated it must be given a unique name.
>>> class MyTable(TableBase):
...
@ -282,7 +282,7 @@ class TableBase(object):
self._parameters = {}
# Find Parameters and ParameterGroup in the class dictionary
# and place approprate things in the instance dictionary
# and place appropriate things in the instance dictionary
rparams = {}
rgroups = {}
for k,v in self.__class__.__dict__.items():