small doc cleanup, updated python specific docs to leverage the sphix rtd theme as well

This commit is contained in:
Blake J. Harnden 2017-08-18 11:34:25 -07:00
parent f55d241b36
commit abc9e06fe1
6 changed files with 23 additions and 56 deletions

View file

@ -25,9 +25,6 @@ class ConfigurableManager(object):
def __init__(self): def __init__(self):
""" """
Creates a ConfigurableManager instance. Creates a ConfigurableManager instance.
:param core.session.Session session: session this manager is tied to
:return: nothing
""" """
# configurable key=values, indexed by node number # configurable key=values, indexed by node number
self.configs = {} self.configs = {}
@ -41,10 +38,7 @@ class ConfigurableManager(object):
ConfigurableManager usually is used to: ConfigurableManager usually is used to:
1. Request a list of Configurables (request flag) 1. Request a list of Configurables (request flag)
2. Reset manager and clear configs (reset flag) 2. Reset manager and clear configs (reset flag)
3. Send values that configure the manager or one of its 3. Send values that configure the manager or one of its Configurables
Configurables
Returns any reply messages.
:param core.session.Session session: CORE session object :param core.session.Session session: CORE session object
:param ConfigData config_data: configuration data for carrying out a configuration :param ConfigData config_data: configuration data for carrying out a configuration

View file

@ -465,7 +465,7 @@ class CoreRequestHandler(SocketServer.BaseRequestHandler):
""" """
Dispatch replies by CORE to message msg previously received from the client. Dispatch replies by CORE to message msg previously received from the client.
:param replies: reply messages to dispatch :param list replies: reply messages to dispatch
:param message: message for replies :param message: message for replies
:return: nothing :return: nothing
""" """
@ -1763,12 +1763,6 @@ class BaseAuxRequestHandler(CoreRequestHandler):
self.session.shutdown() self.session.shutdown()
return SocketServer.BaseRequestHandler.finish(self) return SocketServer.BaseRequestHandler.finish(self)
"""
=======================================================================
Concrete AuxRequestHandler classes must redefine the following methods
=======================================================================
"""
def receive_message(self): def receive_message(self):
""" """
Receive data from the client in the supported format. Parse, transform to CORE API format and Receive data from the client in the supported format. Parse, transform to CORE API format and
@ -1783,24 +1777,13 @@ class BaseAuxRequestHandler(CoreRequestHandler):
def dispatch_replies(self, replies, message): def dispatch_replies(self, replies, message):
""" """
Dispatch CORE "replies" to a previously received message "msg" from a client. Dispatch CORE replies to a previously received message msg from a client.
Replies passed to this method follow the CORE API. This method allows transformation to Replies passed to this method follow the CORE API. This method allows transformation to
the form supported by the auxiliary handler and within the context of "msg". the form supported by the auxiliary handler and within the context of "msg".
Add transformation and transmission code here. Add transformation and transmission code here.
EXAMPLE: :param list replies: replies to dispatch
transformed_replies = stateful_transform (replies, msg) # stateful_transform method needs to be defined :param message: message being replied to
if transformed_replies:
for reply in transformed_replies:
try:
self.request.sendall(reply)
except Exception, e:
if self.debug:
logger.info("-"*60)
traceback.print_exc(file=sys.stdout)
logger.info("-"*60)
raise e
:return: nothing :return: nothing
""" """
raise NotImplemented raise NotImplemented
@ -1811,19 +1794,7 @@ class BaseAuxRequestHandler(CoreRequestHandler):
in CORE API format. This method allows transformation to the required format supported by this in CORE API format. This method allows transformation to the required format supported by this
handler prior to transmission. handler prior to transmission.
EXAMPLE: :param data: data to send
msgs = self.transform(data) # transform method needs to be defined
if msgs:
for msg in msgs:
try:
self.request.sendall(reply)
except Exception, e:
if self.debug:
logger.info("-"*60)
traceback.print_exc(file=sys.stdout)
logger.info("-"*60)
raise e
:return: nothing :return: nothing
""" """
raise NotImplemented raise NotImplemented

View file

@ -250,7 +250,7 @@ class PyCoreObj(object):
:param flags: message flags :param flags: message flags
:return: list of link data :return: list of link data
:rtype: link :rtype: core.data.LinkData
""" """
return [] return []
@ -598,7 +598,7 @@ class PyCoreNetIf(object):
""" """
Attach network. Attach network.
:param PyCoreNet net: network to attach to :param core.coreobj.PyCoreNet net: network to attach to
:return:nothing :return:nothing
""" """
if self.net: if self.net:

View file

@ -112,12 +112,11 @@ class EmaneManager(ConfigurableManager):
def initeventservice(self, filename=None, shutdown=False): def initeventservice(self, filename=None, shutdown=False):
""" """
(Re-)initialize the EMANE Event service. Re-initialize the EMANE Event service.
The multicast group and/or port may be configured. The multicast group and/or port may be configured.
- For versions < 0.9.1 this can be changed via XML config file - For versions < 0.9.1 this can be changed via XML config file and an environment variable
and an environment variable pointing to that file. pointing to that file.
- For version >= 0.9.1 this is passed into the EventService - For version >= 0.9.1 this is passed into the EventService constructor.
constructor.
""" """
logger.info("initializing emane event service: %s", emane.VERSIONSTR) logger.info("initializing emane event service: %s", emane.VERSIONSTR)

View file

@ -73,10 +73,12 @@ class EmaneModel(WirelessModel):
def buildplatformxmlnementry(self, doc, n, ifc): def buildplatformxmlnementry(self, doc, n, ifc):
""" """
Build the NEM definition that goes into the platform.xml file. Build the NEM definition that goes into the platform.xml file.
This returns an XML element that will be added to the <platform/> element. This returns an XML element that will be added to the <platform/> element.
This default method supports per-interface config
(e.g. <nem definition="n2_0_63emane_rfpipe.xml" id="1"> or per-EmaneNode This default method supports per-interface config (e.g. <nem definition="n2_0_63emane_rfpipe.xml" id="1">
config (e.g. <nem definition="n1emane_rfpipe.xml" id="1">. or per-EmaneNode config (e.g. <nem definition="n1emane_rfpipe.xml" id="1">.
This can be overriden by a model for NEM flexibility; n is the EmaneNode. This can be overriden by a model for NEM flexibility; n is the EmaneNode.
""" """
nem = doc.createElement("nem") nem = doc.createElement("nem")

View file

@ -12,6 +12,7 @@
# serve to show the default. # serve to show the default.
import sys, os import sys, os
import sphinx_rtd_theme
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
@ -25,7 +26,7 @@ import sys, os
# Add any Sphinx extension module names here, as strings. They can be extensions # Add any Sphinx extension module names here, as strings. They can be extensions
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones. # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig'] extensions = ['sphinx.ext.autodoc', 'sphinx.ext.todo', 'sphinx.ext.imgmath', 'sphinx.ext.ifconfig']
# Add any paths that contain templates here, relative to this directory. # Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates'] templates_path = ['_templates']
@ -41,7 +42,7 @@ master_doc = 'index'
# General information about the project. # General information about the project.
project = u'CORE Python modules' project = u'CORE Python modules'
copyright = u'2012, core-dev' copyright = u'2017, core-dev'
# The version info for the project you're documenting, acts as replacement for # The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the # |version| and |release|, also used in various other places throughout the
@ -91,7 +92,7 @@ pygments_style = 'sphinx'
# The theme to use for HTML and HTML Help pages. See the documentation for # The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes. # a list of builtin themes.
html_theme = 'default' html_theme = 'sphinx_rtd_theme'
# Theme options are theme-specific and customize the look and feel of a theme # Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the # further. For a list of options available for each theme, see the
@ -99,7 +100,7 @@ html_theme = 'default'
#html_theme_options = {} #html_theme_options = {}
# Add any paths that contain custom themes here, relative to this directory. # Add any paths that contain custom themes here, relative to this directory.
#html_theme_path = [] html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
# The name for this set of Sphinx documents. If None, it defaults to # The name for this set of Sphinx documents. If None, it defaults to
# "<project> v<release> documentation". # "<project> v<release> documentation".
@ -222,7 +223,7 @@ man_pages = [
epub_title = u'CORE Python' epub_title = u'CORE Python'
epub_author = u'core-dev' epub_author = u'core-dev'
epub_publisher = u'core-dev' epub_publisher = u'core-dev'
epub_copyright = u'2012, core-dev' epub_copyright = u'2017, core-dev'
# The language of the text. It defaults to the language option # The language of the text. It defaults to the language option
# or en if the language is not set. # or en if the language is not set.