Skip to content

Commit

Permalink
Fix sphinx warnings (issue #45)
Browse files Browse the repository at this point in the history
  - Set autodoc_typehints = 'none' in conf.py (for the moment,
    type aliases expansion is huge, reconsider for the v3.0.0
    after a refactoring of type hints)
  • Loading branch information
brunato committed May 30, 2022
1 parent c3a34af commit bf869d9
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
12 changes: 9 additions & 3 deletions doc/conf.py
Expand Up @@ -48,8 +48,13 @@
'sphinx.ext.doctest',
]

# Option for autodoc: do not add module name as prefix to classes or functions.
add_module_names = False
# Options for autodoc
add_module_names = False # do not add module name as prefix to classes or functions.
autodoc_typehints = 'none' # do not add type annotations

nitpick_ignore = [
('py:class', 'XMLSchemaProxy')
]

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand All @@ -68,7 +73,8 @@
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = None
# language = None
language = 'en' # required by Sphinx v5.0.0

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
Expand Down
9 changes: 6 additions & 3 deletions doc/xpath_api.rst
Expand Up @@ -90,7 +90,7 @@ XML Schema proxy

The XPath 2.0 parser can be interfaced with an XML Schema processor through a schema proxy.
An :class:`XMLSchemaProxy` class is defined for interfacing schemas created with the *xmlschema* package.
This class is based on an abstract class :class:`AbstractSchemaProxy`, that can be used for
This class is based on an abstract class :class:`elementpath.AbstractSchemaProxy`, that can be used for
implementing concrete interfaces to other types of XML Schema processors.

.. autoclass:: elementpath.AbstractSchemaProxy
Expand All @@ -110,7 +110,10 @@ implementing concrete interfaces to other types of XML Schema processors.
XPath nodes
===========

XPath nodes are processed using a set of classes derived from :class:`XPathNode`:
XPath nodes are processed using a set of classes derived from
:class:`elementpath.XPathNode`:

.. autoclass:: elementpath.XPathNode

.. autoclass:: elementpath.AttributeNode
.. autoclass:: elementpath.TextNode
Expand All @@ -133,7 +136,7 @@ Exception classes
.. autoexception:: elementpath.RegexError

There are also other exceptions, multiple derived from the base exception
:class:`ElementPathError` and Python built-in exceptions:
:class:`elementpath.ElementPathError` and Python built-in exceptions:

.. autoexception:: elementpath.ElementPathKeyError
.. autoexception:: elementpath.ElementPathLocaleError
Expand Down
4 changes: 2 additions & 2 deletions elementpath/xpath30/xpath30_parser.py
Expand Up @@ -30,9 +30,9 @@ class XPath30Parser(XPath2Parser):
arguments, but the *strict* option is ignored because XPath 3.0+ has braced
URI literals and the expanded name syntax is not compatible.
:param args: the same positional arguments of class :class:`XPath2Parser`.
:param args: the same positional arguments of class :class:`elementpath.XPath2Parser`.
:param decimal_formats: a mapping with statically known decimal formats.
:param kwargs: the same keyword arguments of class :class:`XPath2Parser`.
:param kwargs: the same keyword arguments of class :class:`elementpath.XPath2Parser`.
"""
version = '3.0'

Expand Down
3 changes: 2 additions & 1 deletion elementpath/xpath_selectors.py
Expand Up @@ -8,6 +8,7 @@
# @author Davide Brunato <brunato@sissa.it>
#
from typing import TYPE_CHECKING, Any, Dict, Optional, Iterator, Union, Type
import typing

from .namespaces import NamespacesType
from .xpath_context import ContextRootType, XPathContext
Expand All @@ -17,7 +18,7 @@
from .xpath1 import XPath1Parser
from .xpath30 import XPath30Parser

ParserType = Union[Type[XPath1Parser], Type[XPath2Parser], Type[XPath30Parser]]
ParserType = typing.Union[Type[XPath1Parser], Type[XPath2Parser], Type[XPath30Parser]]
else:
ParserType = XPath2Parser

Expand Down
1 change: 1 addition & 0 deletions tox.ini
Expand Up @@ -29,6 +29,7 @@ commands =
make -C doc html
make -C doc latexpdf
make -C doc doctest
sphinx-build -n -T -b man doc build/sphinx/man

[flake8]
max-line-length = 100
Expand Down

0 comments on commit bf869d9

Please sign in to comment.