Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Commit a878202

Browse files
author
Diego Rabatone Oliveira
committed
Merge remote-tracking branch 'macartur/issue-#211' into release-2017.1b3
Fix "more than one target found for cross-reference" Fix #211 Conflicts: CHANGELOG.rst
2 parents bea971b + 76595ea commit a878202

58 files changed

Lines changed: 416 additions & 287 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ Changed
3737
Fixed
3838
=====
3939
- [v0x01] Fixed method to unpack error messages.
40+
- documentation: fixed links and build warnings.
4041
- A few bug fixes.
4142

4243

docs/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
_rebuild
2-
modules.rst
32
python.inv

docs/Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33

44
# You can set these variables from the command line.
5-
SPHINXOPTS =
5+
SPHINXOPTS = -W
66
SPHINXBUILD = sphinx-build
77
PAPER =
88
BUILDDIR = _build
@@ -61,7 +61,7 @@ clean:
6161

6262
.PHONY: html
6363
html:
64-
sphinx-apidoc -o . ../pyof/ -d10 -M
64+
sphinx-apidoc -o . ../pyof/ -d10 -M -T
6565
sed -i "/Submodules/,+1d" *.rst
6666
sed -i "/Subpackages/,+1d" *.rst
6767
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@@ -70,7 +70,7 @@ html:
7070

7171
.PHONY: dirhtml
7272
dirhtml:
73-
sphinx-apidoc -o . ../pyof/ -d10 -M
73+
sphinx-apidoc -o . ../pyof/ -d10 -M -T
7474
sed -i "/Submodules/,+1d" *.rst
7575
sed -i "/Subpackages/,+1d" *.rst
7676
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@@ -242,7 +242,7 @@ dummy:
242242
@echo "Build finished. Dummy builder generates no files."
243243

244244
livehtml:
245-
sphinx-apidoc -o . ../pyof/ -d10 -M
245+
sphinx-apidoc -o . ../pyof/ -d10 -M -T
246246
sed -i "/Submodules/,+1d" *.rst
247247
sed -i "/Subpackages/,+1d" *.rst
248248
sphinx-autobuild -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml -z ../pyof

docs/conf.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@
111111
# If true, keep warnings as "system message" paragraphs in the built documents.
112112
#keep_warnings = False
113113

114+
# Remove nonlocal_uri warnings
115+
suppress_warnings = ['image.nonlocal_uri']
116+
114117
# If true, `todo` and `todoList` produce output, else they produce nothing.
115118
todo_include_todos = False
116119

@@ -370,14 +373,8 @@
370373
# If true, do not generate a @detailmenu in the "Top" node's menu.
371374
#texinfo_no_detailmenu = False
372375

373-
# Example configuration for intersphinx: refer to the Python standard library.
374-
# Note: links to Python doc only work if you are online or have python.inv
375-
# file. To download it, run:
376-
# curl https://docs.python.org/3/objects.inv >python.inv
377-
intersphinx_mapping = {'python': ('https://docs.python.org/3',
378-
(None, 'python.inv')),
379-
'kytos': ('http://docs.kytos.io/kytos',
380-
(None, 'kytos.inv'))}
376+
intersphinx_mapping = {'python': ('https://docs.python.org/3', None),
377+
'kytos': ('http://docs.kytos.io/kytos', None)}
381378

382379
# Napoleon settings from http://www.sphinx-doc.org/en/stable/ext/napoleon.html
383380
napoleon_google_docstring = True

docs/get_involved.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ We'd love for you to contribute to our source code and to make Kytos better
55
than it is today!
66

77
This is one component of the *Kytos* project. For more information on how to get
8-
involved, please, visit the section :doc:`kytos:get_involved` of the *Kytos*
8+
involved, please, visit the section :doc:`kytos:contributing` of the *Kytos*
99
documentation.

docs/hacking.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Hacking
33
#######
44

5-
.. note:: Before reading this file, please read the :doc:`guidelines` section
5+
.. note:: Before reading this file, please read the :doc:`kytos:contributing` section
66
that contains the main guidelines of the project.
77

88
Development Environment Setup

docs/toc/introduction.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:orphan:
2+
13
############
24
Introduction
35
############

pyof/foundation/base.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
structs. You can realize that when you see a message class definition.
66
77
A **struct** here is a group of basic attributes and/or struct attributes (i.e.
8-
:class:`~.common.header.Header`). A **message** here is like a struct, but all
9-
messages have a header attribute (i.e.
10-
:class:`~.asynchronous.packet_in.PacketIn`).
8+
:class:`~pyof.v0x01.common.header.Header`). A **message** here is like a
9+
struct, but all messages have a header attribute (i.e.
10+
:class:`~pyof.v0x01.asynchronous.packet_in.PacketIn`).
11+
1112
1213
The main classes of this module are :class:`GenericStruct`,
1314
:class:`GenericMessage`, :class:`GenericBitMask` and :class:`GenericType`.
@@ -50,7 +51,7 @@ def __init__(self, value=None, enum_ref=None):
5051
5152
Args:
5253
value: The type's value.
53-
enum_ref (:class:`type`): If :attr:`value` is from an Enum, specify
54+
enum_ref (type): If :attr:`value` is from an Enum, specify
5455
its type.
5556
"""
5657
self._value = value
@@ -219,10 +220,10 @@ def is_valid(self):
219220
return False
220221

221222
def isenum(self):
222-
"""Test whether it is an :class:`~Enum`.
223+
"""Test whether it is an :class:`~enum.Enum`.
223224
224225
Returns:
225-
bool: Whether it is an :class:`~Enum`.
226+
bool: Whether it is an :class:`~enum.Enum`.
226227
"""
227228
return self.enum_ref and issubclass(self.enum_ref, (Enum, IntEnum))
228229

@@ -346,8 +347,8 @@ def get_pyof_version(module_fullname):
346347
(e.g.: pyof.v0x01.common.header)
347348
348349
Returns:
349-
version (str): The module version, on the format 'v0x0?' if any. Or
350-
None (None): If there isn't a version on the fullname.
350+
str: The module version, on the format 'v0x0?' if any. Or None
351+
if there isn't a version on the fullname.
351352
"""
352353
ver_module_re = re.compile(r'(pyof\.)(v0x\d+)(\..*)')
353354
matched = ver_module_re.match(module_fullname)
@@ -366,15 +367,16 @@ def replace_pyof_version(module_fullname, version):
366367
367368
Args:
368369
module_fullname (str): The fullname of the module
369-
(e.g.: pyof.v0x01.common.header)
370+
(e.g.: pyof.v0x01.common.header)
370371
version (str): The version to be 'inserted' on the module fullname.
371372
372373
Returns:
373-
None (None): if the requested version is the same as the one of the
374-
module_fullname or if the module_fullname is not a 'OF version'
375-
specific module.
376-
new_module_fullname (str): The new module fullname, with the
377-
replaced version, on the format "pyof.v0x01.common.header".
374+
str: module fullname
375+
The new module fullname, with the replaced version,
376+
on the format "pyof.v0x01.common.header". If the requested
377+
version is the same as the one of the module_fullname or if
378+
the module_fullname is not a 'OF version' specific module,
379+
returns None.
378380
"""
379381
module_version = MetaStruct.get_pyof_version(module_fullname)
380382
if not module_version or module_version == version:
@@ -413,7 +415,7 @@ def get_pyof_obj_new_version(name, obj, new_version):
413415
'obj'.
414416
415417
Return:
416-
(name, obj): A tuple in which the first item is the name of the
418+
(str, obj): A tuple in which the first item is the name of the
417419
class attribute (the same that was passed), and the second item
418420
is a instance of the passed class attribute. If the class
419421
attribute is not a pyof versioned attribute, then the same
@@ -655,8 +657,9 @@ def is_valid(self):
655657
656658
This method will check whether all struct attributes have a proper
657659
value according to the OpenFlow specification. For instance, if you
658-
have a struct with an attribute of type :class:`UBInt8()`
659-
and you assign a string value to it, this method will return False.
660+
have a struct with an attribute of type
661+
:class:`~pyof.foundation.basic_types.UBInt8` and you assign a string
662+
value to it, this method will return False.
660663
661664
Returns:
662665
bool: Whether the struct is valid.

pyof/foundation/basic_types.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,11 @@ def is_broadcast(self):
401401
class BinaryData(GenericType):
402402
"""Class to create objects that represent binary data.
403403
404-
This is used in the ``data`` attribute from :class:`.PacketIn` and
405-
:class:`.PacketOut` messages. Both the :meth:`pack` and :meth:`unpack`
406-
methods will return the binary data itself. :meth:`get_size` method will
404+
This is used in the ``data`` attribute from
405+
:class:`~pyof.v0x01.asynchronous.packet_in.PacketIn` and
406+
:class:`~pyof.v0x01.controller2switch.packet_out.PacketOut` messages.
407+
Both the :meth:`pack` and :meth:`unpack` methods will return the
408+
binary data itself. :meth:`get_size` method will
407409
return the size of the instance using Python's :func:`len`.
408410
"""
409411

pyof/v0x01/asynchronous/error_msg.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class ErrorMsg(GenericMessage):
170170
This message does not contain a body in addition to the OpenFlow Header.
171171
"""
172172

173-
#: :class:`~.header.Header`: OpenFlow Header
173+
#: :class:`~pyof.v0x01.common.header.Header`: OpenFlow Header
174174
header = Header(message_type=Type.OFPT_ERROR)
175175
error_type = UBInt16(enum_ref=ErrorType)
176176
code = UBInt16()
@@ -181,10 +181,9 @@ def __init__(self, xid=None, error_type=None, code=None, data=b''):
181181
182182
Args:
183183
xid (int): To be included in the message header.
184-
error_type (ErrorType): Error type.
185-
code (Enum): Error code.
186-
data (:func:`bytes` or packable): Its content is based on the error
187-
type and code.
184+
error_type (:class:`ErrorType`): Error type.
185+
code (enum.IntEnum): Error code.
186+
data (bytes): Its content is based on the error type and code.
188187
"""
189188
super().__init__(xid)
190189
self.error_type = error_type
@@ -217,7 +216,18 @@ def pack(self, value=None):
217216
raise PackException(msg)
218217

219218
def unpack(self, buff, offset=0):
220-
"""Unpack binary data into python object."""
219+
"""Unpack *buff* into this object.
220+
221+
This method will convert a binary data into a readable value according
222+
to the attribute format.
223+
224+
Args:
225+
buff (bytes): Binary buffer.
226+
offset (int): Where to begin unpacking.
227+
228+
Raises:
229+
:exc:`~.exceptions.UnpackException`: If unpack fails.
230+
"""
221231
super().unpack(buff, offset)
222232
CodeClass = ErrorType(self.error_type).get_class()
223233
self.code = CodeClass(self.code)

0 commit comments

Comments
 (0)