Skip to content
This repository was archived by the owner on Feb 24, 2023. It is now read-only.

Commit c15671a

Browse files
committed
more doc updates
1 parent d215b59 commit c15671a

File tree

6 files changed

+89
-23
lines changed

6 files changed

+89
-23
lines changed

docs/source/conf.py

+2
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,5 @@
196196

197197
# Example configuration for intersphinx: refer to the Python standard library.
198198
intersphinx_mapping = {'http://docs.python.org/': None}
199+
200+
autoclass_content = 'both'

docs/source/operations.rst

+63-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
:mod:`~ncclient.operations` -- Everything RPC
22
=============================================
33

4-
54
.. module:: ncclient.operations
65
:synopsis: Everything RPC
76

@@ -11,7 +10,7 @@
1110
Base classes
1211
------------
1312

14-
.. autoclass:: RPC(session, async=False, timeout=None, raise_mode="none")
13+
.. autoclass:: RPC
1514
:members: DEPENDS, REPLY_CLS, _assert, _request, request, event, error, reply, raise_mode, is_async, timeout
1615

1716
.. autoclass:: RPCReply
@@ -24,15 +23,74 @@ Base classes
2423
Operations
2524
----------
2625

27-
The operation classes are currently undocumented. See documentation of :class:`~ncclient.manager.Manager` for methods that utilize the operation classes. The parameters accepted by :meth:`~RPC.request` for these classes are the same.
26+
Retrieval
27+
..........
28+
29+
.. autoclass:: Get
30+
:members: request
31+
:show-inheritance:
32+
33+
.. autoattribute:: REPLY_CLS
2834

29-
Replies with data
30-
-----------------
35+
.. autoclass:: GetConfig
36+
:members: request
37+
:show-inheritance:
38+
39+
.. autoattribute:: REPLY_CLS
3140

3241
.. autoclass:: GetReply
3342
:show-inheritance:
3443
:members: data, data_ele, data_xml
3544

45+
Editing
46+
........
47+
48+
.. autoclass:: EditConfig
49+
:members: request
50+
:show-inheritance:
51+
52+
.. autoclass:: DeleteConfig
53+
:members: request
54+
:show-inheritance:
55+
56+
.. autoclass:: CopyConfig
57+
:members: request
58+
:show-inheritance:
59+
60+
.. autoclass:: Validate
61+
:members: request
62+
:show-inheritance:
63+
64+
.. autoclass:: Commit
65+
:members: request
66+
:show-inheritance:
67+
68+
.. autoclass:: DiscardChanges
69+
:members: request
70+
:show-inheritance:
71+
72+
Locking
73+
........
74+
75+
.. autoclass:: Lock
76+
:members: request
77+
:show-inheritance:
78+
79+
.. autoclass:: Unlock
80+
:members: request
81+
:show-inheritance:
82+
83+
Session
84+
........
85+
86+
.. autoclass:: CloseSession
87+
:members: request
88+
:show-inheritance:
89+
90+
.. autoclass:: KillSession
91+
:members: request
92+
:show-inheritance:
93+
3694
Exceptions
3795
----------
3896

ncclient/operations/edit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def request(self, confirmed=False, timeout=None):
123123
124124
*confirmed* whether this is a confirmed commit
125125
126-
*timeout* confirm timeout in seconds"""
126+
*timeout* specifies the confirm timeout in seconds"""
127127
node = new_ele("commit")
128128
if confirmed:
129129
self._assert(":confirmed-commit")

ncclient/operations/retrieve.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,7 @@
2020

2121
class GetReply(RPCReply):
2222

23-
"""Adds attributes for the *data* element to `RPCReply`. This pertains to the `Get` and
24-
`GetConfig` operations."""
23+
"""Adds attributes for the *data* element to `RPCReply`."""
2524

2625
def _parsing_hook(self, root):
2726
self._data = None
@@ -51,6 +50,7 @@ class Get(RPC):
5150
"The *get* RPC."
5251

5352
REPLY_CLS = GetReply
53+
"See :class:`GetReply`."
5454

5555
def request(self, filter=None):
5656
"""Retrieve running configuration and device state information.
@@ -70,6 +70,7 @@ class GetConfig(RPC):
7070
"The *get-config* RPC."
7171

7272
REPLY_CLS = GetReply
73+
"See :class:`GetReply`."
7374

7475
def request(self, source, filter=None):
7576
"""Retrieve all or part of a specified configuration.

ncclient/operations/rpc.py

+19-14
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class RPCReply:
9595
9696
.. note::
9797
If the reply has not yet been parsed there is an implicit, one-time parsing overhead to
98-
accessing the attributes defined by this class and any subclasses.
98+
accessing some of the attributes defined by this class.
9999
"""
100100

101101
ERROR_CLS = RPCError
@@ -127,7 +127,7 @@ def parse(self):
127127
self._parsed = True
128128

129129
def _parsing_hook(self, root):
130-
"No-op by default. Gets given the *root* element."
130+
"No-op by default. Gets passed the *root* element for the reply."
131131
pass
132132

133133
@property
@@ -220,17 +220,24 @@ class RaiseMode(object):
220220

221221
class RPC(object):
222222

223-
"""Base class for all operations, directly corresponding to *rpc* requests. Handles making the
224-
request, and taking delivery of the reply."""
223+
"""Base class for all operations, directly corresponding to *rpc* requests. Handles making the request, and taking delivery of the reply."""
225224

226225
DEPENDS = []
227-
"""Subclasses can specify their dependencies on capabilities. List of URI's or abbreviated names, e.g. ':writable-running'. These are verified at the time of instantiation. If the capability is not available, a :exc:`MissingCapabilityError` is raised.
228-
"""
226+
"""Subclasses can specify their dependencies on capabilities as a list of URI's or abbreviated names, e.g. ':writable-running'. These are verified at the time of instantiation. If the capability is not available, :exc:`MissingCapabilityError` is raised."""
229227

230228
REPLY_CLS = RPCReply
231-
"Subclasses can specify a different reply class, but it should be a subclass of `RPCReply`."
229+
"By default :class:`RPCReply`. Subclasses can specify a :class:`RPCReply` subclass."
232230

233231
def __init__(self, session, async=False, timeout=30, raise_mode=RaiseMode.NONE):
232+
"""
233+
*session* is the :class:`~ncclient.transport.Session` instance
234+
235+
*async* specifies whether the request is to be made asynchronously, see :attr:`is_async`
236+
237+
*timeout* is the timeout for a synchronous request, see :attr:`timeout`
238+
239+
*raise_mode* specifies the exception raising mode, see :attr:`raise_mode`
240+
"""
234241
self._session = session
235242
try:
236243
for cap in self.DEPENDS:
@@ -258,11 +265,9 @@ def _request(self, op):
258265
259266
In synchronous mode, blocks until the reply is received and returns :class:`RPCReply`. Depending on the :attr:`raise_mode` a `rpc-error` element in the reply may lead to an :exc:`RPCError` exception.
260267
261-
In asynchronous mode, returns immediately, returning *self*. The :attr:`event` attribute will be set when the reply has been received (see :attr:`reply`) or an error occured (see :attr:`error`).
262-
263-
*op* operation to be requested as an `~xml.etree.ElementTree.Element`
268+
In asynchronous mode, returns immediately, returning `self`. The :attr:`event` attribute will be set when the reply has been received (see :attr:`reply`) or an error occured (see :attr:`error`).
264269
265-
Returns :class:`RPCReply` (sync) or :class:`RPC` (async)
270+
*op* is the operation to be requested as an :class:`~xml.etree.ElementTree.Element`
266271
"""
267272
logger.info('Requesting %r' % self.__class__.__name__)
268273
req = self._wrap(op)
@@ -290,7 +295,7 @@ def _request(self, op):
290295

291296
def request(self):
292297
"""Subclasses must implement this method. Typically only the request needs to be built as an
293-
`~xml.etree.ElementTree.Element` and everything else can be handed off to
298+
:class:`~xml.etree.ElementTree.Element` and everything else can be handed off to
294299
:meth:`_request`."""
295300
pass
296301

@@ -338,7 +343,7 @@ def session(self):
338343

339344
@property
340345
def event(self):
341-
"""`~threading.Event` that is set when reply has been received or when an error preventing
346+
""":class:`~threading.Event` that is set when reply has been received or when an error preventing
342347
delivery of the reply occurs.
343348
"""
344349
return self._event
@@ -359,7 +364,7 @@ def __set_timeout(self, timeout):
359364
"""Depending on this exception raising mode, an `rpc-error` in the reply may be raised as an :exc:`RPCError` exception. Valid values are the constants defined in :class:`RaiseMode`. """
360365

361366
is_async = property(fget=lambda self: self._async, fset=__set_async)
362-
"""Specifies whether this RPC will be / was requested asynchronously. By default RPC's are synchronous. """
367+
"""Specifies whether this RPC will be / was requested asynchronously. By default RPC's are synchronous."""
363368

364369
timeout = property(fget=lambda self: self._timeout, fset=__set_timeout)
365370
"""Timeout in seconds for synchronous waiting defining how long the RPC request will block on a reply before raising :exc:`TimeoutExpiredError`.

ncclient/transport/ssh.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -309,5 +309,5 @@ def run(self):
309309

310310
@property
311311
def transport(self):
312-
"Underlying `paramiko.Transport <http://www.lag.net/paramiko/docs/paramiko.Transport-class.html>`_ object. This makes it possible to call methods like set_keepalive on it."
312+
"Underlying `paramiko.Transport <http://www.lag.net/paramiko/docs/paramiko.Transport-class.html>`_ object. This makes it possible to call methods like :meth:`~paramiko.Transport.set_keepalive` on it."
313313
return self._transport

0 commit comments

Comments
 (0)