Skip to content

Commit

Permalink
Fix docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
phil-dileo committed Feb 16, 2016
1 parent efea4b6 commit b87534b
Show file tree
Hide file tree
Showing 8 changed files with 135 additions and 114 deletions.
9 changes: 6 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import sys
import os
import re
import sphinx_rtd_theme

# If extensions (or modules to document with autodoc) are in another directory,
Expand Down Expand Up @@ -58,9 +59,11 @@
# built documents.
#
# The short X.Y version.
version = '1.0.0'
# The full version, including alpha/beta/rc tags.
release = '0.2.1'
release = open('../VERSION').read().split()[0].strip()
# Assume PEP 440 version strings
p = re.compile(r'(\d+!)?((\d+)(.\d+)*(.\d+)*)(.?[a|b|rc]\d*)?(.post\d*)?(.dev\d*)?', re.IGNORECASE)
vers = p.search(release)
version = vers.group(2)

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand Down
22 changes: 12 additions & 10 deletions docs/configfile.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,20 @@ The following configuration options are available for defining node entries:

:transport: Configures the type of transport connection to use. Valid
values are:
- socket (default, available in EOS 4.14.5 or later)
- http_local (available in EOS 4.14.5 or later)
- http
- https

- socket (default, available in EOS 4.14.5 or later)
- http_local (available in EOS 4.14.5 or later)
- http
- https

:port: Configures the port to use for the eAPI connection. A default
port is used if this parameter is absent, based on the transport setting
using the following values:
- transport: http, default port: 80
- transport: https, deafult port: 443
- transport: http_local, default port: 8080
- transport: socket, default port: n/a
port is used if this parameter is absent, based on the transport setting
using the following values:

- transport: http, default port: 80
- transport: https, deafult port: 443
- transport: http_local, default port: 8080
- transport: socket, default port: n/a

*********************************
When is an eapi.conf file needed?
Expand Down
1 change: 1 addition & 0 deletions docs/generate_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ def get_module_names(p):
mods = list()
mods = [f.split('.')[0] for f in listdir(p)
if isfile(join(p, f)) and not f.endswith('.pyc') and not f.startswith('__')]
print len(mods)
return mods

def process_modules(modules):
Expand Down
15 changes: 8 additions & 7 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ code in the develop branch.

**Step 1:** Clone the pyeapi Github repo

.. code-block:: console
.. code-block:: shell
# Go to a directory where you'd like to keep the source
admin:~ admin$ cd ~/projects
Expand All @@ -99,7 +99,7 @@ code in the develop branch.
**Step 2:** Check out the desired version or branch

.. code-block:: console
.. code-block:: shell
# Go to a directory where you'd like to keep the source
admin:~ admin$ cd ~/projects/pyeapi
Expand All @@ -113,7 +113,7 @@ code in the develop branch.
**Step 3:** Install pyeapi using Pip with -e switch

.. code-block:: console
.. code-block:: shell
# Go to a directory where you'd like to keep the source
admin:~ admin$ cd ~/projects/pyeapi
Expand All @@ -123,18 +123,19 @@ code in the develop branch.
**Step 4:** Install pyeapi requirements

.. code-block:: console
.. code-block:: shell
# Go to a directory where you'd like to keep the source
admin:~ admin$ pip install -r dev-requirements.txt
.. Tip:: If you start using pyeapi and get import errors, make sure your
PYTHONPATH is set to include the path to pyeapi.

Development - Upgrade Pyeapi
============================

.. code-block:: console
Development - Upgrade Pyeapi
============================

.. code-block:: shell
admin:~ admin$ cd ~/projects/pyeapi
admin:~ admin$ git pull
Expand Down
1 change: 1 addition & 0 deletions docs/quickstart.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Enable EOS Command API
Refer to your official Arista EOS Configuration Guide to learn how to enable
EOS Command API. Depending upon your software version, the options available
include:

- HTTP
- HTTPS
- HTTP Local
Expand Down
7 changes: 4 additions & 3 deletions pyeapi/api/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ def command_builder(self, string, value=None, default=None, disable=None):
Negating a command string by overriding 'value' with None or an
assigned value that evalutates to false has been deprecated.
Please use 'disable' to negate a command.
Parameters are evaluated in the order 'default', 'disable', 'value'
Args:
string (str): The command string
value: The configuration setting to subsititue into the command
string. If value is a boolean and True, just the command
string is used
value (str): The configuration setting to subsititue into the
command string. If value is a boolean and True, just the
command string is used
default (bool): Specifies the command should use the default
keyword argument. Default preempts disable and value.
disable (bool): Specifies the command should use the no
Expand Down
99 changes: 51 additions & 48 deletions pyeapi/api/staticroute.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
StaticRoute Attributes:
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
next_hop_ip (string): The next hop address on destination interface
distance (int): Administrative distance for this route
Expand Down Expand Up @@ -91,7 +92,8 @@ def get(self, name):
form of A.B.C.D/E
Returns:
dict: An dict object of static route entries in the form
dict: An dict object of static route entries in the form::
{ ip_dest:
{ next_hop:
{ next_hop_ip:
Expand Down Expand Up @@ -122,7 +124,8 @@ def getall(self):
"""Return all ip routes configured on the switch as a resource dict
Returns:
dict: An dict object of static route entries in the form
dict: An dict object of static route entries in the form::
{ ip_dest:
{ next_hop:
{ next_hop_ip:
Expand Down Expand Up @@ -183,12 +186,12 @@ def create(self, ip_dest, next_hop, **kwargs):
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
kwargs (dict): A key/value dictionary containing
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
**kwargs['next_hop_ip'] (string): The next hop address on
destination interface
**kwargs['distance'] (string): Administrative distance for this
route
**kwargs['tag'] (string): Route tag
**kwargs['route_name'] (string): Route name
Returns:
True if the operation succeeds, otherwise False.
Expand All @@ -204,12 +207,12 @@ def delete(self, ip_dest, next_hop, **kwargs):
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
kwargs (dict): A key/value dictionary containing
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
**kwargs['next_hop_ip'] (string): The next hop address on
destination interface
**kwargs['distance'] (string): Administrative distance for this
route
**kwargs['tag'] (string): Route tag
**kwargs['route_name'] (string): Route name
Returns:
True if the operation succeeds, otherwise False.
Expand All @@ -226,12 +229,12 @@ def default(self, ip_dest, next_hop, **kwargs):
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
kwargs (dict): A key/value dictionary containing
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
**kwargs['next_hop_ip'] (string): The next hop address on
destination interface
**kwargs['distance'] (string): Administrative distance for this
route
**kwargs['tag'] (string): Route tag
**kwargs['route_name'] (string): Route name
Returns:
True if the operation succeeds, otherwise False.
Expand All @@ -248,12 +251,12 @@ def set_tag(self, ip_dest, next_hop, **kwargs):
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
kwargs (dict): A key/value dictionary containing
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
**kwargs['next_hop_ip'] (string): The next hop address on
destination interface
**kwargs['distance'] (string): Administrative distance for this
route
**kwargs['tag'] (string): Route tag
**kwargs['route_name'] (string): Route name
Returns:
True if the operation succeeds, otherwise False.
Expand All @@ -274,12 +277,12 @@ def set_route_name(self, ip_dest, next_hop, **kwargs):
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
kwargs (dict): A key/value dictionary containing
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
**kwargs['next_hop_ip'] (string): The next hop address on
destination interface
**kwargs['distance'] (string): Administrative distance for this
route
**kwargs['tag'] (string): Route tag
**kwargs['route_name'] (string): Route name
Returns:
True if the operation succeeds, otherwise False.
Expand All @@ -300,12 +303,12 @@ def _build_commands(self, ip_dest, next_hop, **kwargs):
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
kwargs (dict): A key/value dictionary containing
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
**kwargs['next_hop_ip'] (string): The next hop address on
destination interface
**kwargs['distance'] (string): Administrative distance for this
route
**kwargs['tag'] (string): Route tag
**kwargs['route_name'] (string): Route name
Returns the ip route command string to be sent to the switch for
the given set of parameters.
Expand Down Expand Up @@ -336,16 +339,16 @@ def _set_route(self, ip_dest, next_hop, **kwargs):
ip_dest (string): The ip address of the destination in the
form of A.B.C.D/E
next_hop (string): The next hop interface or ip address
kwargs (dict): A key/value dictionary containing
next_hop_ip (string): The next hop address on destination
interface
distance (string): Administrative distance for this route
tag (string): Route tag
route_name (string): Route name
delete (boolean): If true, deletes the specified route
instead of creating or setting values for the route
default (boolean): If true, defaults the specified route
instead of creating or setting values for the route
**kwargs['next_hop_ip'] (string): The next hop address on
destination interface
**kwargs['distance'] (string): Administrative distance for this
route
**kwargs['tag'] (string): Route tag
**kwargs['route_name'] (string): Route name
**kwargs['delete'] (boolean): If true, deletes the specified route
instead of creating or setting values for the route
**kwargs['default'] (boolean): If true, defaults the specified
route instead of creating or setting values for the route
Returns:
True if the operation succeeds, otherwise False.
Expand Down

0 comments on commit b87534b

Please sign in to comment.