Skip to content

Commit 42ea98f

Browse files
committed
Fix Sphinx warnings (issue #305)
1 parent 762bc23 commit 42ea98f

File tree

12 files changed

+79
-48
lines changed

12 files changed

+79
-48
lines changed

doc/api.rst

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,12 +52,13 @@ Schema level API
5252
.. class:: xmlschema.XMLSchema11
5353

5454
The classes for XSD v1.0 and v1.1 schema instances. They are both generated by the
55-
meta-class :class:`XMLSchemaMeta` and take the same API of :class:`XMLSchemaBase`.
55+
meta-class :class:`XMLSchemaMeta` and take the same API of :class:`xmlschema.XMLSchemaBase`.
5656

5757
.. autoclass:: xmlschema.XMLSchema
5858

5959
.. autoclass:: xmlschema.XMLSchemaBase
6060

61+
.. autoattribute:: meta_schema
6162
.. autoattribute:: root
6263
.. automethod:: get_text
6364
.. autoattribute:: name
@@ -85,6 +86,7 @@ Schema level API
8586
.. automethod:: get_locations
8687
.. automethod:: include_schema
8788
.. automethod:: import_schema
89+
.. automethod:: add_schema
8890
.. automethod:: export
8991
.. automethod:: resolve_qname
9092
.. automethod:: iter_globals
@@ -224,6 +226,18 @@ Translation API
224226
.. autofunction:: xmlschema.translation.deactivate
225227

226228

229+
.. _namespace-api:
230+
231+
Namespaces API
232+
==============
233+
234+
Classes for converting namespace representation or for accessing namespace objects:
235+
236+
.. autoclass:: xmlschema.namespaces.NamespaceResourcesMap
237+
.. autoclass:: xmlschema.namespaces.NamespaceMapper
238+
.. autoclass:: xmlschema.namespaces.NamespaceView
239+
240+
227241
.. _xpath-api:
228242

229243
XPath API

doc/conf.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,21 @@
4141
# Option for autodoc: do not add module name as prefix to classes or functions.
4242
add_module_names = False
4343

44+
nitpick_ignore = [
45+
('py:class', 'pathlib.Path'),
46+
('py:class', 'xml.etree.ElementTree.Element'),
47+
('py:class', 'xmlschema.aliases.T'),
48+
('py:class', 'xmlschema.namespaces.T'),
49+
('py:class', 'xmlschema.xpath.E'),
50+
('py:class', 'xmlschema.validators.xsdbase.DT'),
51+
('py:class', 'xmlschema.validators.xsdbase.ST'),
52+
('py:class', 'XsdValidator'),
53+
('py:class', 'XMLSchemaMeta'),
54+
('py:class', 'xmlschema.validators.schemas.XMLSchema10'),
55+
('py:meth', 'read'),
56+
('py:meth', 'write'),
57+
]
58+
4459
# Add any paths that contain templates here, relative to this directory.
4560
templates_path = ['_templates']
4661

@@ -65,14 +80,15 @@
6580
# The short X.Y version.
6681
version = '1.11'
6782
# The full version, including alpha/beta/rc tags.
68-
release = '1.11.2'
83+
release = '1.11.3'
6984

7085
# The language for content autogenerated by Sphinx. Refer to documentation
7186
# for a list of supported languages.
7287
#
7388
# This is also used if you do content translation via gettext catalogs.
7489
# Usually you set "language" from the command line for these cases.
75-
language = None
90+
# language = None
91+
language = 'en' # required by Sphinx v5.0.0
7692

7793
# List of patterns, relative to source directory, that match files and
7894
# directories to ignore when looking for source files.

doc/converters.rst

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ like JSON, because prefixed name is more manageable and readable than expanded f
2626
Available converters
2727
====================
2828

29-
The library includes some converters. The default converter :class:`XMLSchemaConverter`
29+
The library includes some converters. The default converter :class:`xmlschema.XMLSchemaConverter`
3030
is the base class of other converter types. Each derived converter type implements a
3131
well know convention, related to the conversion from XML to JSON data format:
3232

33-
* :class:`ParkerConverter`: `Parker convention <https://developer.mozilla.org/en-US/docs/Archive/JXON#The_Parker_Convention>`_
34-
* :class:`BadgerFishConverter`: `BadgerFish convention <http://www.sklar.com/badgerfish/>`_
35-
* :class:`AbderaConverter`: `Apache Abdera project convention <https://cwiki.apache.org/confluence/display/ABDERA/JSON+Serialization>`_
36-
* :class:`JsonMLConverter`: `JsonML (JSON Mark-up Language) convention <http://www.jsonml.org/>`_
33+
* :class:`xmlschema.ParkerConverter`: `Parker convention <https://developer.mozilla.org/en-US/docs/Archive/JXON#The_Parker_Convention>`_
34+
* :class:`xmlschema.BadgerFishConverter`: `BadgerFish convention <http://www.sklar.com/badgerfish/>`_
35+
* :class:`xmlschema.AbderaConverter`: `Apache Abdera project convention <https://cwiki.apache.org/confluence/display/ABDERA/JSON+Serialization>`_
36+
* :class:`xmlschema.JsonMLConverter`: `JsonML (JSON Mark-up Language) convention <http://www.jsonml.org/>`_
3737

3838
A summary of these and other conventions can be found on the wiki page
3939
`JSON and XML Conversion <http://wiki.open311.org/JSON_and_XML_Conversion/>`_.
@@ -46,18 +46,18 @@ base class options and attributes.
4646

4747
Moreover there are also other two converters useful for specific cases:
4848

49-
* :class:`UnorderedConverter`: like default converter but with unordered decoding and encoding.
50-
* :class:`ColumnarConverter`: a converter that remaps attributes as child elements in a
49+
* :class:`xmlschema.UnorderedConverter`: like default converter but with unordered decoding and encoding.
50+
* :class:`xmlschema.ColumnarConverter`: a converter that remaps attributes as child elements in a
5151
columnar shape (available since release v1.2.0).
52-
* :class:`DataElementConverter`: a converter that converts XML to a tree of
53-
:class:`DataElement` intances, Element-like objects with decoded values and
52+
* :class:`xmlschema.DataElementConverter`: a converter that converts XML to a tree of
53+
:class:`xmlschema.DataElement` instances, Element-like objects with decoded values and
5454
schema bindings (available since release v1.5.0).
5555

5656

5757
Create a custom converter
5858
=========================
5959

60-
To create a new customized converter you have to subclass the :class:`XMLSchemaConverter`
60+
To create a new customized converter you have to subclass the :class:`xmlschema.XMLSchemaConverter`
6161
and redefine the two methods *element_decode* and *element_encode*. These methods are based
6262
on the namedtuple `ElementData`, an Element-like data structure that stores the decoded
6363
Element parts. This namedtuple is used by decoding and encoding methods as an intermediate

doc/extras.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ Code generation with Jinja2 templates
2727
=====================================
2828

2929
The module *xmlschema.extras.codegen* provides an abstract base class
30-
:class:`AbstractGenerator` for generate source code from parsed XSD
31-
schemas. The Jinja2 engine is embedded in that class and is empowered
32-
with a set of custom filters and tests for accessing to defined XSD
33-
schema components.
30+
:class:`xmlschema.extras.codegen.AbstractGenerator` for generate source
31+
code from parsed XSD schemas. The Jinja2 engine is embedded in that class
32+
and is empowered with a set of custom filters and tests for accessing to
33+
defined XSD schema components.
3434

3535

3636
Schema based filters
@@ -90,8 +90,8 @@ Type mapping
9090
------------
9191

9292
Each implementation of a generator class has an additional filter for translating
93-
types using the types map of the instance. For example a :class:`PythonGenerator`
94-
has the filter *python_type*.
93+
types using the types map of the instance.
94+
For example :class:`xmlschema.extras.codegen.PythonGenerator` has the filter *python_type*.
9595

9696
These filters are based on a common method *map_type* that uses an instance
9797
dictionary built at initialization time from a class maps for builtin types
@@ -131,9 +131,9 @@ The module *xmlschema.extras.wsdl* provides a specialized schema-related
131131
XML document for WSDL 1.1.
132132

133133
An example of
134-
specialization is the class :class:`Wsdl11Document`, usable for validating and
135-
parsing WSDL 1.1 documents, that can be imported from *wsdl* module of the *extra*
136-
subpackage:
134+
specialization is the class :class:`xmlschema.extras.wsdl.Wsdl11Document`, usable
135+
for validating and parsing WSDL 1.1 documents, that can be imported from *wsdl*
136+
module of the *extra* subpackage:
137137

138138
.. doctest::
139139

doc/features.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ XSD 1.0 and 1.1 support
1111
=======================
1212

1313
From release v1.0.14 XSD 1.1 support has been added to the library through the class
14-
:class:`XMLSchema11`. You have to use this class for XSD 1.1 schemas instead the default
15-
class :class:`XMLSchema`, that is linked to XSD 1.0 validator :class:`XMLSchema10`.
14+
:class:`xmlschema.XMLSchema11`. You have to use this class for XSD 1.1 schemas instead the default
15+
class :class:`xmlschema.XMLSchema`, that is linked to XSD 1.0 validator :class:`xmlschema.XMLSchema10`.
1616

1717
The XSD 1.1 validator can be used also for validating XSD 1.0 schemas, except for a
1818
restricted set of cases related to content extension in a complexType (the extension
@@ -69,7 +69,7 @@ Lazy validation
6969
===============
7070

7171
From release v1.0.12 the document validation and the decoding API have an optional argument
72-
`lazy=False`, that can be changed to `True` for operating with a lazy :class:`XMLResource`.
72+
`lazy=False`, that can be changed to `True` for operating with a lazy :class:`xmlschema.XMLResource`.
7373
The lazy mode can be useful for validating and decoding big XML data files, consuming
7474
less memory.
7575

doc/usage.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ particurlaly useful when sources have no locations associated:
105105
... open('tests/test_cases/examples/vehicles/types.xsd')]
106106
>>> schema = xmlschema.XMLSchema(sources)
107107

108-
or similarly to the previous example one can use the method :meth:`add_schema()`:
108+
or similarly to the previous example one can use the method :meth:`xmlschema.XMLSchemaBase.add_schema`:
109109

110110
.. doctest::
111111

@@ -129,7 +129,7 @@ Validation
129129

130130
A schema instance has methods to validate an XML document against the schema.
131131

132-
The first method is :meth:`XMLSchema.is_valid`, that returns ``True``
132+
The first method is :meth:`xmlschema.XMLSchemaBase.is_valid`, that returns ``True``
133133
if the XML argument is validated by the schema loaded in the instance,
134134
and returns ``False`` if the document is invalid.
135135

@@ -145,8 +145,8 @@ and returns ``False`` if the document is invalid.
145145
False
146146

147147
An alternative mode for validating an XML document is implemented by the method
148-
:meth:`XMLSchema.validate`, that raises an error when the XML doesn't conforms
149-
to the schema:
148+
:meth:`xmlschema.XMLSchemaBase.validate`, that raises an error when the XML doesn't
149+
conform to the schema:
150150

151151
.. doctest::
152152

@@ -497,9 +497,9 @@ See the :meth:`xmlschema.to_json` and :meth:`xmlschema.from_json` in the
497497
XML resources and documents
498498
===========================
499499

500-
Schemas and XML instances processing are based on the class :class:`XMLResource`,
500+
Schemas and XML instances processing are based on the class :class:`xmlschema.XMLResource`,
501501
that handles the loading and the iteration of XSD/XML data.
502-
Starting from v1.3.0 :class:`XMLResource` has been empowered with ElementTree-like
502+
Starting from v1.3.0 :class:`xmlschema.XMLResource` has been empowered with ElementTree-like
503503
XPath API. From the same release a new class :class:`xmlschema.XmlDocument` is
504504
available for representing XML resources with a related schema:
505505

tox.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ deps =
4646

4747
[testenv:docs]
4848
commands =
49-
make -C doc html
50-
make -C doc latexpdf
51-
make -C doc doctest
49+
make -C doc html SPHINXOPTS="-W -n"
50+
make -C doc latexpdf SPHINXOPTS="-W -n"
51+
make -C doc doctest SPHINXOPTS="-W -n"
52+
sphinx-build -W -n -T -b man doc build/sphinx/man
5253

5354
[flake8]
5455
max-line-length = 100

xmlschema/converters/unordered.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919

2020
class UnorderedConverter(XMLSchemaConverter):
2121
"""
22-
Same as :class:`XMLSchemaConverter` but :meth:`element_encode` returns
23-
a dictionary for the content of the element, that can be used directly
22+
Same as :class:`XMLSchemaConverter` but :meth:`XMLSchemaConverter.element_encode`
23+
returns a dictionary for the content of the element, that can be used directly
2424
for unordered encoding mode. In this mode the order of the elements in
2525
the encoded output is based on the model visitor pattern rather than
2626
the order in which the elements were added to the input dictionary.

xmlschema/documents.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def iter_decode(xml_document: Union[XMLSourceType, XMLResource],
251251
:param timeout: optional argument to pass for construct schema and \
252252
:class:`XMLResource` instances.
253253
:param lazy: optional argument for construct the :class:`XMLResource` instance.
254-
:param kwargs: other optional arguments of :meth:`XMLSchema.iter_decode` \
254+
:param kwargs: other optional arguments of :meth:`XMLSchemaBase.iter_decode` \
255255
as keyword arguments.
256256
:raises: :exc:`XMLSchemaValidationError` if the XML document is invalid and \
257257
``validation='strict'`` is provided.
@@ -334,7 +334,7 @@ def to_json(xml_document: Union[XMLSourceType, XMLResource],
334334
:class:`XMLResource` instances.
335335
:param lazy: optional argument for construct the :class:`XMLResource` instance.
336336
:param json_options: a dictionary with options for the JSON serializer.
337-
:param kwargs: optional arguments of :meth:`XMLSchema.iter_decode` as keyword arguments \
337+
:param kwargs: optional arguments of :meth:`XMLSchemaBase.iter_decode` as keyword arguments \
338338
to variate the decoding process.
339339
:return: a string containing the JSON data if *fp* is `None`, otherwise doesn't \
340340
return anything. If ``validation='lax'`` keyword argument is provided the validation \
@@ -392,7 +392,7 @@ def from_json(source: Union[str, bytes, IO[str]],
392392
:param converter: an :class:`XMLSchemaConverter` subclass or instance to use \
393393
for the encoding.
394394
:param json_options: a dictionary with options for the JSON deserializer.
395-
:param kwargs: other optional arguments of :meth:`XMLSchema.iter_encode` and \
395+
:param kwargs: other optional arguments of :meth:`XMLSchemaBase.iter_encode` and \
396396
options for converter.
397397
:return: An element tree's Element instance. If ``validation='lax'`` keyword argument is \
398398
provided the validation errors are collected and returned coupled in a tuple with the \

xmlschema/extras/wsdl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ class Wsdl11Document(XmlDocument):
464464
:param source: a string containing XML data or a file path or an URL or a \
465465
file like object or an ElementTree or an Element.
466466
:param cls: class to use for building the schema instance (for default \
467-
:class:`XMLSchema10` is used).
467+
:class:`xmlschema.XMLSchema10` is used).
468468
:param validation: the XSD validation mode to use for validating the XML document, \
469469
that can be 'strict' (default), 'lax' or 'skip'.
470470
:param maps: WSDL definitions shared maps.

xmlschema/validators/schemas.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ class XMLSchemaBase(XsdValidator, ElementPathMixin[Union[SchemaType, XsdElement]
226226
*chameleon* definitions.
227227
:ivar validation: validation mode, can be 'strict', 'lax' or 'skip'.
228228
:ivar maps: XSD global declarations/definitions maps. This is an instance of \
229-
:class:`XsdGlobal`, that stores the *global_maps* argument or a new object \
229+
:class:`XsdGlobals`, that stores the *global_maps* argument or a new object \
230230
when this argument is not provided.
231231
:ivar converter: the default converter used for XML data decoding/encoding.
232232
:ivar locations: schema location hints.
@@ -2009,7 +2009,7 @@ def decode(self, source: Union[XMLSourceType, XMLResource],
20092009
validation: str = 'strict',
20102010
*args: Any, **kwargs: Any) -> DecodeType[Any]:
20112011
"""
2012-
Decodes XML data. Takes the same arguments of the method :func:`XMLSchema.iter_decode`.
2012+
Decodes XML data. Takes the same arguments of the method :meth:`iter_decode`.
20132013
"""
20142014
data, errors = [], []
20152015
for result in self.iter_decode(source, path, schema_path, validation, *args, **kwargs):
@@ -2119,7 +2119,7 @@ def iter_encode(self, obj: Any, path: Optional[str] = None, validation: str = 'l
21192119
def encode(self, obj: Any, path: Optional[str] = None, validation: str = 'strict',
21202120
*args: Any, **kwargs: Any) -> EncodeType[Any]:
21212121
"""
2122-
Encodes to XML data. Takes the same arguments of the method :func:`XMLSchema.iter_encode`.
2122+
Encodes to XML data. Takes the same arguments of the method :meth:`iter_encode`.
21232123
21242124
:return: An ElementTree's Element or a list containing a sequence of ElementTree's \
21252125
elements if the argument *path* matches multiple XML data chunks. If *validation* \

xmlschema/validators/xsdbase.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -896,8 +896,8 @@ def validate(self, obj: ST,
896896
validations on XML data. The provided function is called for each traversed \
897897
element, with the XML element as 1st argument and the corresponding XSD \
898898
element as 2nd argument. It can be also a generator function and has to \
899-
raise/yield :exc:`XMLSchemaValidationError` exceptions.
900-
:raises: :exc:`XMLSchemaValidationError` if the XML data instance is invalid.
899+
raise/yield :exc:`xmlschema.XMLSchemaValidationError` exceptions.
900+
:raises: :exc:`xmlschema.XMLSchemaValidationError` if the XML data instance is invalid.
901901
"""
902902
for error in self.iter_errors(obj, use_defaults, namespaces,
903903
max_depth, extra_validator):
@@ -955,7 +955,7 @@ def decode(self, obj: ST, validation: str = 'strict', **kwargs: Any) -> DecodeTy
955955
a simple data type object otherwise. If *validation* argument is 'lax' a 2-items \
956956
tuple is returned, where the first item is the decoded object and the second item \
957957
is a list containing the errors.
958-
:raises: :exc:`XMLSchemaValidationError` if the object is not decodable by \
958+
:raises: :exc:`xmlschema.XMLSchemaValidationError` if the object is not decodable by \
959959
the XSD component, or also if it's invalid when ``validation='strict'`` is provided.
960960
"""
961961
check_validation_mode(validation)
@@ -983,8 +983,8 @@ def encode(self, obj: Any, validation: str = 'strict', **kwargs: Any) -> EncodeT
983983
a string if it's simple type datum. If *validation* argument is 'lax' a 2-items \
984984
tuple is returned, where the first item is the encoded object and the second item \
985985
is a list containing the errors.
986-
:raises: :exc:`XMLSchemaValidationError` if the object is not encodable by the XSD \
987-
component, or also if it's invalid when ``validation='strict'`` is provided.
986+
:raises: :exc:`xmlschema.XMLSchemaValidationError` if the object is not encodable by \
987+
the XSD component, or also if it's invalid when ``validation='strict'`` is provided.
988988
"""
989989
check_validation_mode(validation)
990990
result, errors = None, []

0 commit comments

Comments
 (0)