mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #5413 from jdufresne/six-classtypes
Remove use of six.class_types
This commit is contained in:
commit
5ffce30d75
@ -18,7 +18,7 @@ from os import path, getenv
|
||||
from typing import Any, NamedTuple, Union
|
||||
|
||||
from six import (
|
||||
PY2, PY3, iteritems, string_types, binary_type, text_type, integer_types, class_types
|
||||
PY2, PY3, iteritems, string_types, binary_type, text_type, integer_types
|
||||
)
|
||||
|
||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
||||
@ -38,7 +38,7 @@ if False:
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
CONFIG_FILENAME = 'conf.py'
|
||||
UNSERIALIZABLE_TYPES = class_types + (types.ModuleType, types.FunctionType)
|
||||
UNSERIALIZABLE_TYPES = (type, types.ModuleType, types.FunctionType)
|
||||
copyright_year_re = re.compile(r'^((\d{4}-)?)(\d{4})(?=[ ,])')
|
||||
|
||||
if PY3:
|
||||
|
@ -18,7 +18,7 @@ import warnings
|
||||
from typing import Any
|
||||
|
||||
from docutils.statemachine import ViewList
|
||||
from six import iteritems, itervalues, text_type, class_types, string_types
|
||||
from six import iteritems, itervalues, text_type, string_types
|
||||
|
||||
import sphinx
|
||||
from sphinx.deprecation import RemovedInSphinx30Warning
|
||||
@ -1061,7 +1061,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type:
|
||||
@classmethod
|
||||
def can_document_member(cls, member, membername, isattr, parent):
|
||||
# type: (Any, unicode, bool, Any) -> bool
|
||||
return isinstance(member, class_types)
|
||||
return isinstance(member, type)
|
||||
|
||||
def import_object(self):
|
||||
# type: () -> Any
|
||||
@ -1213,8 +1213,7 @@ class ExceptionDocumenter(ClassDocumenter):
|
||||
@classmethod
|
||||
def can_document_member(cls, member, membername, isattr, parent):
|
||||
# type: (Any, unicode, bool, Any) -> bool
|
||||
return isinstance(member, class_types) and \
|
||||
issubclass(member, BaseException) # type: ignore
|
||||
return isinstance(member, type) and issubclass(member, BaseException)
|
||||
|
||||
|
||||
class DataDocumenter(ModuleLevelDocumenter):
|
||||
@ -1345,7 +1344,7 @@ class AttributeDocumenter(DocstringStripSignatureMixin, ClassLevelDocumenter):
|
||||
# exported anywhere by Python
|
||||
return isdatadesc or (not isinstance(parent, ModuleDocumenter) and
|
||||
not inspect.isroutine(member) and
|
||||
not isinstance(member, class_types))
|
||||
not isinstance(member, type))
|
||||
|
||||
def document_members(self, all_members=False):
|
||||
# type: (bool) -> None
|
||||
|
Loading…
Reference in New Issue
Block a user