sphinx_rtd_theme icon indicating copy to clipboard operation
sphinx_rtd_theme copied to clipboard

Doc in original code missing in version 0.5.1

Open HansBug opened this issue 4 years ago • 1 comments
trafficstars

This is my code, package location is nervex.interaction.exception.base, my python version is 3.8.1

from abc import ABCMeta
from typing import Mapping, Any

from requests.exceptions import HTTPError

from ..base import get_values_from_response


class _IResponseInformation(metaclass=ABCMeta):
    """
    Overview:
        Response information basic structure interface
    """

    @property
    def success(self) -> bool:
        """
        Overview:
            Get response success or not
        Returns:
            - success (:obj:`bool`): Response success or not
        """
        raise NotImplementedError

    @property
    def code(self) -> int:
        """
        Overview:
            Get response error code (`0` means success)
        Returns:
            - code (:obj:`int`): Response error code
        """
        raise NotImplementedError

    @property
    def message(self) -> str:
        """
        Overview:
            Get response message
        Returns:
            - message (:obj:`str`): Response message
        """
        raise NotImplementedError

    @property
    def data(self) -> Mapping[str, Any]:
        """
        Overview:
            Get response data
        Returns:
            - data (:obj:`Mapping[str, Any]`): Response data
        """
        raise NotImplementedError


# exception class for processing response
class ResponseException(Exception, _IResponseInformation, metaclass=ABCMeta):

    def __init__(self, error: HTTPError):
        self.__error = error
        self.__status_code, self.__success, self.__code, self.__message, self.__data = \
            get_values_from_response(error.response)
        Exception.__init__(self, self.__message)

    @property
    def status_code(self) -> int:
        return self.__status_code

    @property
    def success(self) -> bool:
        return self.__success

    @property
    def code(self) -> int:
        return self.__code

    @property
    def message(self) -> str:
        return self.__message

    @property
    def data(self) -> Mapping[str, Any]:
        return self.__data

When we use this environment

sphinx-autodoc-typehints      1.11.1                                                                                                                                                
sphinx-prompt                 1.4.0                                                                                                                                                                         
sphinx-rtd-theme              0.5.1                                                                                                                                                                         
sphinx-tabs                   2.0.1                                                                                                                                                                         
sphinx-toolbox                2.12.1                                                                                                                                                                        
sphinxcontrib-applehelp       1.0.2                                                                                                                                                                         
sphinxcontrib-devhelp         1.0.2                                                                                                                                                                         
sphinxcontrib-htmlhelp        1.0.3                                                                                                                                                                         
sphinxcontrib-jsmath          1.0.1                                                                                                                                                                         
sphinxcontrib-qthelp          1.0.3                                                                                                                                                                         
sphinxcontrib-serializinghtml 1.1.4

Its documentation page and source code page is

image

image

Repeated for several times (make clean --> make html), still like the images above.

So, we downgrade the sphinx_rtd_theme package to version 0.4.3., this time the environment is

sphinx-autodoc-typehints      1.11.1
sphinx-prompt                 1.4.0
sphinx-rtd-theme              0.4.3
sphinx-tabs                   2.0.1
sphinx-toolbox                2.12.1
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        1.0.3
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.4

And the page became normal.

image

image

Just like this.

HansBug avatar Jun 25 '21 02:06 HansBug

You can try again with 1.0.0rc1, it's not clear that there is a bug with the theme here. If anything, you're probably noticing an issue with Sphinx HTML4 vs HTML5, that would be also worth testing.

agjohnson avatar Aug 18 '21 18:08 agjohnson

Feel free to re-open if this is still an issue.

humitos avatar Aug 18 '23 10:08 humitos