mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Remove unnecessary object from class definitions
In Python 3, all classes are new-style classes. The object in the definition is redundant and unnecessary.
This commit is contained in:
@@ -178,7 +178,7 @@ class ExampleError(Exception):
|
|||||||
self.code = code
|
self.code = code
|
||||||
|
|
||||||
|
|
||||||
class ExampleClass(object):
|
class ExampleClass:
|
||||||
"""The summary line for a class docstring should fit on one line.
|
"""The summary line for a class docstring should fit on one line.
|
||||||
|
|
||||||
If the class has public attributes, they may be documented here
|
If the class has public attributes, they may be documented here
|
||||||
|
@@ -223,7 +223,7 @@ class ExampleError(Exception):
|
|||||||
self.code = code
|
self.code = code
|
||||||
|
|
||||||
|
|
||||||
class ExampleClass(object):
|
class ExampleClass:
|
||||||
"""The summary line for a class docstring should fit on one line.
|
"""The summary line for a class docstring should fit on one line.
|
||||||
|
|
||||||
If the class has public attributes, they may be documented here
|
If the class has public attributes, they may be documented here
|
||||||
|
@@ -54,7 +54,7 @@ It adds this directive:
|
|||||||
E D F
|
E D F
|
||||||
"""
|
"""
|
||||||
|
|
||||||
class A(object):
|
class A:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class B(A):
|
class B(A):
|
||||||
|
2
setup.py
2
setup.py
@@ -56,7 +56,7 @@ extras_require = {
|
|||||||
cmdclass = {}
|
cmdclass = {}
|
||||||
|
|
||||||
|
|
||||||
class Tee(object):
|
class Tee:
|
||||||
def __init__(self, stream):
|
def __init__(self, stream):
|
||||||
self.stream = stream
|
self.stream = stream
|
||||||
self.buffer = StringIO()
|
self.buffer = StringIO()
|
||||||
|
@@ -20,7 +20,7 @@ if False:
|
|||||||
from typing import List, Sequence # NOQA
|
from typing import List, Sequence # NOQA
|
||||||
|
|
||||||
|
|
||||||
class translatable(object):
|
class translatable:
|
||||||
"""Node which supports translation.
|
"""Node which supports translation.
|
||||||
|
|
||||||
The translation goes forward with following steps:
|
The translation goes forward with following steps:
|
||||||
@@ -53,7 +53,7 @@ class translatable(object):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class not_smartquotable(object):
|
class not_smartquotable:
|
||||||
"""A node which does not support smart-quotes."""
|
"""A node which does not support smart-quotes."""
|
||||||
support_smartquotes = False
|
support_smartquotes = False
|
||||||
|
|
||||||
|
@@ -118,7 +118,7 @@ ENV_PICKLE_FILENAME = 'environment.pickle'
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Sphinx(object):
|
class Sphinx:
|
||||||
"""The main application class and extensibility interface.
|
"""The main application class and extensibility interface.
|
||||||
|
|
||||||
:ivar srcdir: Directory containing source.
|
:ivar srcdir: Directory containing source.
|
||||||
@@ -1208,7 +1208,7 @@ class Sphinx(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class TemplateBridge(object):
|
class TemplateBridge:
|
||||||
"""
|
"""
|
||||||
This class defines the interface for a "template bridge", that is, a class
|
This class defines the interface for a "template bridge", that is, a class
|
||||||
that renders templates given a template name and a context.
|
that renders templates given a template name and a context.
|
||||||
|
@@ -52,7 +52,7 @@ if False:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Builder(object):
|
class Builder:
|
||||||
"""
|
"""
|
||||||
Builds target formats from the reST sources.
|
Builds target formats from the reST sources.
|
||||||
"""
|
"""
|
||||||
|
@@ -62,7 +62,7 @@ msgstr ""
|
|||||||
"""[1:]
|
"""[1:]
|
||||||
|
|
||||||
|
|
||||||
class Catalog(object):
|
class Catalog:
|
||||||
"""Catalog of translatable messages."""
|
"""Catalog of translatable messages."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -84,7 +84,7 @@ class Catalog(object):
|
|||||||
self.metadata[msg].append((origin.source, origin.line, origin.uid))
|
self.metadata[msg].append((origin.source, origin.line, origin.uid))
|
||||||
|
|
||||||
|
|
||||||
class MsgOrigin(object):
|
class MsgOrigin:
|
||||||
"""
|
"""
|
||||||
Origin holder for Catalog message origin.
|
Origin holder for Catalog message origin.
|
||||||
"""
|
"""
|
||||||
|
@@ -169,7 +169,7 @@ class JavaScript(text_type):
|
|||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
class BuildInfo(object):
|
class BuildInfo:
|
||||||
"""buildinfo file manipulator.
|
"""buildinfo file manipulator.
|
||||||
|
|
||||||
HTMLBuilder and its family are storing their own envdata to ``.buildinfo``.
|
HTMLBuilder and its family are storing their own envdata to ``.buildinfo``.
|
||||||
|
@@ -59,7 +59,7 @@ BUILDERS = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
class Make(object):
|
class Make:
|
||||||
|
|
||||||
def __init__(self, srcdir, builddir, opts):
|
def __init__(self, srcdir, builddir, opts):
|
||||||
# type: (unicode, unicode, List[unicode]) -> None
|
# type: (unicode, unicode, List[unicode]) -> None
|
||||||
|
@@ -49,7 +49,7 @@ ConfigValue = NamedTuple('ConfigValue', [('name', str),
|
|||||||
('rebuild', Union[bool, unicode])])
|
('rebuild', Union[bool, unicode])])
|
||||||
|
|
||||||
|
|
||||||
class ENUM(object):
|
class ENUM:
|
||||||
"""represents the config value should be a one of candidates.
|
"""represents the config value should be a one of candidates.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@@ -72,7 +72,7 @@ if PY2:
|
|||||||
string_classes.append(binary_type) # => [str, unicode]
|
string_classes.append(binary_type) # => [str, unicode]
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config:
|
||||||
"""Configuration file abstraction.
|
"""Configuration file abstraction.
|
||||||
|
|
||||||
The config object makes the values of all config values available as
|
The config object makes the values of all config values available as
|
||||||
|
@@ -177,7 +177,7 @@ class CodeBlock(SphinxDirective):
|
|||||||
return [literal]
|
return [literal]
|
||||||
|
|
||||||
|
|
||||||
class LiteralIncludeReader(object):
|
class LiteralIncludeReader:
|
||||||
INVALID_OPTIONS_PAIR = [
|
INVALID_OPTIONS_PAIR = [
|
||||||
('lineno-match', 'lineno-start'),
|
('lineno-match', 'lineno-start'),
|
||||||
('lineno-match', 'append'),
|
('lineno-match', 'append'),
|
||||||
|
@@ -28,7 +28,7 @@ if False:
|
|||||||
from sphinx.util.typing import RoleFunction # NOQA
|
from sphinx.util.typing import RoleFunction # NOQA
|
||||||
|
|
||||||
|
|
||||||
class ObjType(object):
|
class ObjType:
|
||||||
"""
|
"""
|
||||||
An ObjType is the description for a type of object that a domain can
|
An ObjType is the description for a type of object that a domain can
|
||||||
document. In the object_types attribute of Domain subclasses, object type
|
document. In the object_types attribute of Domain subclasses, object type
|
||||||
@@ -55,7 +55,7 @@ class ObjType(object):
|
|||||||
self.attrs.update(attrs)
|
self.attrs.update(attrs)
|
||||||
|
|
||||||
|
|
||||||
class Index(object):
|
class Index:
|
||||||
"""
|
"""
|
||||||
An Index is the description for a domain-specific index. To add an index to
|
An Index is the description for a domain-specific index. To add an index to
|
||||||
a domain, subclass Index, overriding the three name attributes:
|
a domain, subclass Index, overriding the three name attributes:
|
||||||
@@ -113,7 +113,7 @@ class Index(object):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
|
|
||||||
class Domain(object):
|
class Domain:
|
||||||
"""
|
"""
|
||||||
A Domain is meant to be a group of "object" description directives for
|
A Domain is meant to be a group of "object" description directives for
|
||||||
objects of a similar nature, and corresponding roles to create references to
|
objects of a similar nature, and corresponding roles to create references to
|
||||||
|
@@ -3592,7 +3592,7 @@ class ASTNamespace(ASTBase):
|
|||||||
self.templatePrefix = templatePrefix
|
self.templatePrefix = templatePrefix
|
||||||
|
|
||||||
|
|
||||||
class SymbolLookupResult(object):
|
class SymbolLookupResult:
|
||||||
def __init__(self, symbols, parentSymbol, identOrOp, templateParams, templateArgs):
|
def __init__(self, symbols, parentSymbol, identOrOp, templateParams, templateArgs):
|
||||||
# type: (Iterator[Symbol], Symbol, Union[ASTIdentifier, ASTOperator], Any, ASTTemplateArgs) -> None # NOQA
|
# type: (Iterator[Symbol], Symbol, Union[ASTIdentifier, ASTOperator], Any, ASTTemplateArgs) -> None # NOQA
|
||||||
self.symbols = symbols
|
self.symbols = symbols
|
||||||
@@ -3602,7 +3602,7 @@ class SymbolLookupResult(object):
|
|||||||
self.templateArgs = templateArgs
|
self.templateArgs = templateArgs
|
||||||
|
|
||||||
|
|
||||||
class Symbol(object):
|
class Symbol:
|
||||||
debug_lookup = False
|
debug_lookup = False
|
||||||
|
|
||||||
def _assert_invariants(self):
|
def _assert_invariants(self):
|
||||||
@@ -4293,7 +4293,7 @@ class Symbol(object):
|
|||||||
return ''.join(res)
|
return ''.join(res)
|
||||||
|
|
||||||
|
|
||||||
class DefinitionParser(object):
|
class DefinitionParser:
|
||||||
# those without signedness and size modifiers
|
# those without signedness and size modifiers
|
||||||
# see http://en.cppreference.com/w/cpp/language/types
|
# see http://en.cppreference.com/w/cpp/language/types
|
||||||
_simple_fundemental_types = (
|
_simple_fundemental_types = (
|
||||||
@@ -6585,7 +6585,7 @@ class CPPXRefRole(XRefRole):
|
|||||||
return title, target
|
return title, target
|
||||||
|
|
||||||
|
|
||||||
class CPPExprRole(object):
|
class CPPExprRole:
|
||||||
def __init__(self, asCode):
|
def __init__(self, asCode):
|
||||||
if asCode:
|
if asCode:
|
||||||
# render the expression as inline code
|
# render the expression as inline code
|
||||||
@@ -6597,7 +6597,7 @@ class CPPExprRole(object):
|
|||||||
self.node_type = nodes.inline
|
self.node_type = nodes.inline
|
||||||
|
|
||||||
def __call__(self, typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
def __call__(self, typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
||||||
class Warner(object):
|
class Warner:
|
||||||
def warn(self, msg):
|
def warn(self, msg):
|
||||||
inliner.reporter.warning(msg, line=lineno)
|
inliner.reporter.warning(msg, line=lineno)
|
||||||
text = utils.unescape(text).replace('\n', ' ')
|
text = utils.unescape(text).replace('\n', ' ')
|
||||||
@@ -6716,7 +6716,7 @@ class CPPDomain(Domain):
|
|||||||
target, node, contnode, emitWarnings=True):
|
target, node, contnode, emitWarnings=True):
|
||||||
# type: (BuildEnvironment, unicode, Builder, unicode, unicode, nodes.Node, nodes.Node, bool) -> nodes.Node # NOQA
|
# type: (BuildEnvironment, unicode, Builder, unicode, unicode, nodes.Node, nodes.Node, bool) -> nodes.Node # NOQA
|
||||||
|
|
||||||
class Warner(object):
|
class Warner:
|
||||||
def warn(self, msg):
|
def warn(self, msg):
|
||||||
if emitWarnings:
|
if emitWarnings:
|
||||||
logger.warning(msg, location=node)
|
logger.warning(msg, location=node)
|
||||||
|
@@ -114,7 +114,7 @@ def _pseudo_parse_arglist(signode, arglist):
|
|||||||
|
|
||||||
# This override allows our inline type specifiers to behave like :class: link
|
# This override allows our inline type specifiers to behave like :class: link
|
||||||
# when it comes to handling "." and "~" prefixes.
|
# when it comes to handling "." and "~" prefixes.
|
||||||
class PyXrefMixin(object):
|
class PyXrefMixin:
|
||||||
def make_xref(self,
|
def make_xref(self,
|
||||||
rolename, # type: unicode
|
rolename, # type: unicode
|
||||||
domain, # type: unicode
|
domain, # type: unicode
|
||||||
@@ -536,7 +536,7 @@ class PyClassmember(PyObject):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
class PyDecoratorMixin(object):
|
class PyDecoratorMixin:
|
||||||
"""
|
"""
|
||||||
Mixin for decorator directives.
|
Mixin for decorator directives.
|
||||||
"""
|
"""
|
||||||
|
@@ -91,7 +91,7 @@ class NoUri(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BuildEnvironment(object):
|
class BuildEnvironment:
|
||||||
"""
|
"""
|
||||||
The environment in which the ReST files are translated.
|
The environment in which the ReST files are translated.
|
||||||
Stores an inventory of cross-file targets and provides doctree
|
Stores an inventory of cross-file targets and provides doctree
|
||||||
|
@@ -14,7 +14,7 @@ if False:
|
|||||||
from sphinx.environment import BuildEnvironment # NOQA
|
from sphinx.environment import BuildEnvironment # NOQA
|
||||||
|
|
||||||
|
|
||||||
class ImageAdapter(object):
|
class ImageAdapter:
|
||||||
def __init__(self, env):
|
def __init__(self, env):
|
||||||
# type: (BuildEnvironment) -> None
|
# type: (BuildEnvironment) -> None
|
||||||
self.env = env
|
self.env = env
|
||||||
|
@@ -27,7 +27,7 @@ if False:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class IndexEntries(object):
|
class IndexEntries:
|
||||||
def __init__(self, env):
|
def __init__(self, env):
|
||||||
# type: (BuildEnvironment) -> None
|
# type: (BuildEnvironment) -> None
|
||||||
self.env = env
|
self.env = env
|
||||||
|
@@ -27,7 +27,7 @@ if False:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class TocTree(object):
|
class TocTree:
|
||||||
def __init__(self, env):
|
def __init__(self, env):
|
||||||
# type: (BuildEnvironment) -> None
|
# type: (BuildEnvironment) -> None
|
||||||
self.env = env
|
self.env = env
|
||||||
|
@@ -19,7 +19,7 @@ if False:
|
|||||||
from sphinx.environment import BuildEnvironment # NOQA
|
from sphinx.environment import BuildEnvironment # NOQA
|
||||||
|
|
||||||
|
|
||||||
class EnvironmentCollector(object):
|
class EnvironmentCollector:
|
||||||
"""An EnvironmentCollector is a specific data collector from each document.
|
"""An EnvironmentCollector is a specific data collector from each document.
|
||||||
|
|
||||||
It gathers data and stores :py:class:`BuildEnvironment
|
It gathers data and stores :py:class:`BuildEnvironment
|
||||||
|
@@ -45,7 +45,7 @@ core_events = {
|
|||||||
} # type: Dict[unicode, unicode]
|
} # type: Dict[unicode, unicode]
|
||||||
|
|
||||||
|
|
||||||
class EventManager(object):
|
class EventManager:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.events = core_events.copy()
|
self.events = core_events.copy()
|
||||||
|
@@ -199,7 +199,7 @@ class Options(dict):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class Documenter(object):
|
class Documenter:
|
||||||
"""
|
"""
|
||||||
A Documenter knows how to autodocument a single object type. When
|
A Documenter knows how to autodocument a single object type. When
|
||||||
registered with the AutoDirective, it will be used to document objects
|
registered with the AutoDirective, it will be used to document objects
|
||||||
@@ -916,7 +916,7 @@ class ClassLevelDocumenter(Documenter):
|
|||||||
return modname, parents + [base]
|
return modname, parents + [base]
|
||||||
|
|
||||||
|
|
||||||
class DocstringSignatureMixin(object):
|
class DocstringSignatureMixin:
|
||||||
"""
|
"""
|
||||||
Mixin for FunctionDocumenter and MethodDocumenter to provide the
|
Mixin for FunctionDocumenter and MethodDocumenter to provide the
|
||||||
feature of reading the signature from the docstring.
|
feature of reading the signature from the docstring.
|
||||||
|
@@ -34,7 +34,7 @@ AUTODOC_DEFAULT_OPTIONS = ['members', 'undoc-members', 'inherited-members',
|
|||||||
'ignore-module-all', 'exclude-members']
|
'ignore-module-all', 'exclude-members']
|
||||||
|
|
||||||
|
|
||||||
class DummyOptionSpec(object):
|
class DummyOptionSpec:
|
||||||
"""An option_spec allows any options."""
|
"""An option_spec allows any options."""
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
@@ -42,7 +42,7 @@ class DummyOptionSpec(object):
|
|||||||
return lambda x: x
|
return lambda x: x
|
||||||
|
|
||||||
|
|
||||||
class DocumenterBridge(object):
|
class DocumenterBridge:
|
||||||
"""A parameters container for Documenters."""
|
"""A parameters container for Documenters."""
|
||||||
|
|
||||||
def __init__(self, env, reporter, options, lineno):
|
def __init__(self, env, reporter, options, lineno):
|
||||||
|
@@ -28,7 +28,7 @@ if False:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class _MockObject(object):
|
class _MockObject:
|
||||||
"""Used by autodoc_mock_imports."""
|
"""Used by autodoc_mock_imports."""
|
||||||
|
|
||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
@@ -93,7 +93,7 @@ class _MockModule(ModuleType):
|
|||||||
return o
|
return o
|
||||||
|
|
||||||
|
|
||||||
class _MockImporter(object):
|
class _MockImporter:
|
||||||
def __init__(self, names):
|
def __init__(self, names):
|
||||||
# type: (List[str]) -> None
|
# type: (List[str]) -> None
|
||||||
self.names = names
|
self.names = names
|
||||||
|
@@ -51,7 +51,7 @@ if False:
|
|||||||
from sphinx.ext.autodoc import Documenter # NOQA
|
from sphinx.ext.autodoc import Documenter # NOQA
|
||||||
|
|
||||||
|
|
||||||
class DummyApplication(object):
|
class DummyApplication:
|
||||||
"""Dummy Application class for sphinx-autogen command."""
|
"""Dummy Application class for sphinx-autogen command."""
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@@ -203,7 +203,7 @@ parser = doctest.DocTestParser()
|
|||||||
|
|
||||||
# helper classes
|
# helper classes
|
||||||
|
|
||||||
class TestGroup(object):
|
class TestGroup:
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
# type: (unicode) -> None
|
# type: (unicode) -> None
|
||||||
self.name = name
|
self.name = name
|
||||||
@@ -236,7 +236,7 @@ class TestGroup(object):
|
|||||||
self.name, self.setup, self.cleanup, self.tests)
|
self.name, self.setup, self.cleanup, self.tests)
|
||||||
|
|
||||||
|
|
||||||
class TestCode(object):
|
class TestCode:
|
||||||
def __init__(self, code, type, filename, lineno, options=None):
|
def __init__(self, code, type, filename, lineno, options=None):
|
||||||
# type: (unicode, unicode, Optional[str], int, Optional[Dict]) -> None
|
# type: (unicode, unicode, Optional[str], int, Optional[Dict]) -> None
|
||||||
self.code = code
|
self.code = code
|
||||||
|
@@ -44,7 +44,7 @@ class GraphvizError(SphinxError):
|
|||||||
category = 'Graphviz error'
|
category = 'Graphviz error'
|
||||||
|
|
||||||
|
|
||||||
class ClickableMapDefinition(object):
|
class ClickableMapDefinition:
|
||||||
"""A manipulator for clickable map file of graphviz."""
|
"""A manipulator for clickable map file of graphviz."""
|
||||||
maptag_re = re.compile('<map id="(.*?)"')
|
maptag_re = re.compile('<map id="(.*?)"')
|
||||||
href_re = re.compile('href=".*?"')
|
href_re = re.compile('href=".*?"')
|
||||||
|
@@ -129,7 +129,7 @@ class InheritanceException(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class InheritanceGraph(object):
|
class InheritanceGraph:
|
||||||
"""
|
"""
|
||||||
Given a list of classes, determines the set of classes that they inherit
|
Given a list of classes, determines the set of classes that they inherit
|
||||||
from all the way to the root "object", and then is able to generate a
|
from all the way to the root "object", and then is able to generate a
|
||||||
|
@@ -58,7 +58,7 @@ if False:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class InventoryAdapter(object):
|
class InventoryAdapter:
|
||||||
"""Inventory adapter for environment"""
|
"""Inventory adapter for environment"""
|
||||||
|
|
||||||
def __init__(self, env):
|
def __init__(self, env):
|
||||||
@@ -387,11 +387,11 @@ def inspect_main(argv):
|
|||||||
file=sys.stderr)
|
file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
class MockConfig(object):
|
class MockConfig:
|
||||||
intersphinx_timeout = None # type: int
|
intersphinx_timeout = None # type: int
|
||||||
tls_verify = False
|
tls_verify = False
|
||||||
|
|
||||||
class MockApp(object):
|
class MockApp:
|
||||||
srcdir = ''
|
srcdir = ''
|
||||||
config = MockConfig()
|
config = MockConfig()
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ if False:
|
|||||||
from typing import Any, Dict, List # NOQA
|
from typing import Any, Dict, List # NOQA
|
||||||
|
|
||||||
|
|
||||||
class Config(object):
|
class Config:
|
||||||
"""Sphinx napoleon extension settings in `conf.py`.
|
"""Sphinx napoleon extension settings in `conf.py`.
|
||||||
|
|
||||||
Listed below are all the settings used by napoleon and their default
|
Listed below are all the settings used by napoleon and their default
|
||||||
|
@@ -18,7 +18,7 @@ if False:
|
|||||||
from typing import Any, Iterable # NOQA
|
from typing import Any, Iterable # NOQA
|
||||||
|
|
||||||
|
|
||||||
class peek_iter(object):
|
class peek_iter:
|
||||||
"""An iterator object that supports peeking ahead.
|
"""An iterator object that supports peeking ahead.
|
||||||
|
|
||||||
Parameters
|
Parameters
|
||||||
|
@@ -24,7 +24,7 @@ if False:
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class Extension(object):
|
class Extension:
|
||||||
def __init__(self, name, module, **kwargs):
|
def __init__(self, name, module, **kwargs):
|
||||||
# type: (unicode, Any, Any) -> None
|
# type: (unicode, Any, Any) -> None
|
||||||
self.name = name
|
self.name = name
|
||||||
|
@@ -62,7 +62,7 @@ _LATEX_ADD_STYLES = r'''
|
|||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
class PygmentsBridge(object):
|
class PygmentsBridge:
|
||||||
# Set these attributes if you want to have different Pygments formatters
|
# Set these attributes if you want to have different Pygments formatters
|
||||||
# than the default ones.
|
# than the default ones.
|
||||||
html_formatter = HtmlFormatter
|
html_formatter = HtmlFormatter
|
||||||
|
@@ -98,7 +98,7 @@ def accesskey(context, key):
|
|||||||
return ''
|
return ''
|
||||||
|
|
||||||
|
|
||||||
class idgen(object):
|
class idgen:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.id = 0
|
self.id = 0
|
||||||
|
@@ -25,7 +25,7 @@ if False:
|
|||||||
from typing import Any, Callable, Dict, Iterator, List, Tuple # NOQA
|
from typing import Any, Callable, Dict, Iterator, List, Tuple # NOQA
|
||||||
|
|
||||||
|
|
||||||
class _TranslationProxy(UserString, object):
|
class _TranslationProxy(UserString):
|
||||||
"""
|
"""
|
||||||
Class for proxy strings from gettext translations. This is a helper for the
|
Class for proxy strings from gettext translations. This is a helper for the
|
||||||
lazy_* functions from this module.
|
lazy_* functions from this module.
|
||||||
@@ -36,7 +36,6 @@ class _TranslationProxy(UserString, object):
|
|||||||
This inherits from UserString because some docutils versions use UserString
|
This inherits from UserString because some docutils versions use UserString
|
||||||
for their Text nodes, which then checks its argument for being either a
|
for their Text nodes, which then checks its argument for being either a
|
||||||
basestring or UserString, otherwise calls str() -- not unicode() -- on it.
|
basestring or UserString, otherwise calls str() -- not unicode() -- on it.
|
||||||
This also inherits from object to make the __new__ method work.
|
|
||||||
"""
|
"""
|
||||||
__slots__ = ('_func', '_args')
|
__slots__ = ('_func', '_args')
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ if False:
|
|||||||
from typing import Any, Dict, IO, List, Tuple # NOQA
|
from typing import Any, Dict, IO, List, Tuple # NOQA
|
||||||
|
|
||||||
|
|
||||||
class ModuleAnalyzer(object):
|
class ModuleAnalyzer:
|
||||||
# cache for analyzer objects -- caches both by module and file name
|
# cache for analyzer objects -- caches both by module and file name
|
||||||
cache = {} # type: Dict[Tuple[unicode, unicode], Any]
|
cache = {} # type: Dict[Tuple[unicode, unicode], Any]
|
||||||
|
|
||||||
|
@@ -107,7 +107,7 @@ def dedent_docstring(s):
|
|||||||
return docstring.lstrip("\r\n").rstrip("\r\n")
|
return docstring.lstrip("\r\n").rstrip("\r\n")
|
||||||
|
|
||||||
|
|
||||||
class Token(object):
|
class Token:
|
||||||
"""Better token wrapper for tokenize module."""
|
"""Better token wrapper for tokenize module."""
|
||||||
|
|
||||||
def __init__(self, kind, value, start, end, source):
|
def __init__(self, kind, value, start, end, source):
|
||||||
@@ -145,7 +145,7 @@ class Token(object):
|
|||||||
self.value.strip())
|
self.value.strip())
|
||||||
|
|
||||||
|
|
||||||
class TokenProcessor(object):
|
class TokenProcessor:
|
||||||
def __init__(self, buffers):
|
def __init__(self, buffers):
|
||||||
# type: (List[unicode]) -> None
|
# type: (List[unicode]) -> None
|
||||||
lines = iter(buffers)
|
lines = iter(buffers)
|
||||||
@@ -464,7 +464,7 @@ class DefinitionFinder(TokenProcessor):
|
|||||||
self.context.pop()
|
self.context.pop()
|
||||||
|
|
||||||
|
|
||||||
class Parser(object):
|
class Parser:
|
||||||
"""Python source code parser to pick up variable comments.
|
"""Python source code parser to pick up variable comments.
|
||||||
|
|
||||||
This is a better wrapper for ``VariableCommentPicker``.
|
This is a better wrapper for ``VariableCommentPicker``.
|
||||||
|
@@ -54,7 +54,7 @@ EXTENSION_BLACKLIST = {
|
|||||||
} # type: Dict[unicode, unicode]
|
} # type: Dict[unicode, unicode]
|
||||||
|
|
||||||
|
|
||||||
class SphinxComponentRegistry(object):
|
class SphinxComponentRegistry:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
#: special attrgetter for autodoc; class object -> attrgetter
|
#: special attrgetter for autodoc; class object -> attrgetter
|
||||||
|
@@ -45,7 +45,7 @@ generic_docroles = {
|
|||||||
|
|
||||||
# -- generic cross-reference role ----------------------------------------------
|
# -- generic cross-reference role ----------------------------------------------
|
||||||
|
|
||||||
class XRefRole(object):
|
class XRefRole:
|
||||||
"""
|
"""
|
||||||
A generic cross-referencing role. To create a callable that can be used as
|
A generic cross-referencing role. To create a callable that can be used as
|
||||||
a role function, create an instance of this class.
|
a role function, create an instance of this class.
|
||||||
|
@@ -28,7 +28,7 @@ if False:
|
|||||||
from sphinx.environment import BuildEnvironment # NOQA
|
from sphinx.environment import BuildEnvironment # NOQA
|
||||||
|
|
||||||
|
|
||||||
class SearchLanguage(object):
|
class SearchLanguage:
|
||||||
"""
|
"""
|
||||||
This class is the base class for search natural language preprocessors. If
|
This class is the base class for search natural language preprocessors. If
|
||||||
you want to add support for a new language, you should override the methods
|
you want to add support for a new language, you should override the methods
|
||||||
@@ -155,7 +155,7 @@ languages = {
|
|||||||
} # type: Dict[unicode, Any]
|
} # type: Dict[unicode, Any]
|
||||||
|
|
||||||
|
|
||||||
class _JavaScriptIndex(object):
|
class _JavaScriptIndex:
|
||||||
"""
|
"""
|
||||||
The search index as javascript file that calls a function
|
The search index as javascript file that calls a function
|
||||||
on the documentation search object to register the index.
|
on the documentation search object to register the index.
|
||||||
@@ -236,7 +236,7 @@ class WordCollector(NodeVisitor):
|
|||||||
self.found_words.extend(keywords)
|
self.found_words.extend(keywords)
|
||||||
|
|
||||||
|
|
||||||
class IndexBuilder(object):
|
class IndexBuilder:
|
||||||
"""
|
"""
|
||||||
Helper class that creates a searchindex based on the doctrees
|
Helper class that creates a searchindex based on the doctrees
|
||||||
passed to the `feed` method.
|
passed to the `feed` method.
|
||||||
|
@@ -46,7 +46,7 @@ if False:
|
|||||||
from typing import Any, Dict, List # NOQA
|
from typing import Any, Dict, List # NOQA
|
||||||
|
|
||||||
|
|
||||||
class BaseSplitter(object):
|
class BaseSplitter:
|
||||||
|
|
||||||
def __init__(self, options):
|
def __init__(self, options):
|
||||||
# type: (Dict) -> None
|
# type: (Dict) -> None
|
||||||
|
@@ -173,7 +173,7 @@ def make_app(test_params, monkeypatch):
|
|||||||
app_.cleanup()
|
app_.cleanup()
|
||||||
|
|
||||||
|
|
||||||
class SharedResult(object):
|
class SharedResult:
|
||||||
cache = {} # type: Dict[str, Dict[str, str]]
|
cache = {} # type: Dict[str, Dict[str, str]]
|
||||||
|
|
||||||
def store(self, key, app_):
|
def store(self, key, app_):
|
||||||
|
@@ -92,7 +92,7 @@ def etree_parse(path):
|
|||||||
return ElementTree.parse(path) # type: ignore
|
return ElementTree.parse(path) # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class Struct(object):
|
class Struct:
|
||||||
def __init__(self, **kwds):
|
def __init__(self, **kwds):
|
||||||
# type: (Any) -> None
|
# type: (Any) -> None
|
||||||
self.__dict__.update(kwds)
|
self.__dict__.update(kwds)
|
||||||
@@ -163,7 +163,7 @@ class SphinxTestApp(application.Sphinx):
|
|||||||
return '<%s buildername=%r>' % (self.__class__.__name__, self.builder.name)
|
return '<%s buildername=%r>' % (self.__class__.__name__, self.builder.name)
|
||||||
|
|
||||||
|
|
||||||
class SphinxTestAppWrapperForSkipBuilding(object):
|
class SphinxTestAppWrapperForSkipBuilding:
|
||||||
"""
|
"""
|
||||||
This class is a wrapper for SphinxTestApp to speed up the test by skipping
|
This class is a wrapper for SphinxTestApp to speed up the test by skipping
|
||||||
`app.build` process if it is already built and there is even one output
|
`app.build` process if it is already built and there is even one output
|
||||||
|
@@ -51,7 +51,7 @@ def extract_zip(filename, targetdir):
|
|||||||
fp.write(archive.read(name))
|
fp.write(archive.read(name))
|
||||||
|
|
||||||
|
|
||||||
class Theme(object):
|
class Theme:
|
||||||
"""A Theme is a set of HTML templates and configurations.
|
"""A Theme is a set of HTML templates and configurations.
|
||||||
|
|
||||||
This class supports both theme directory and theme archive (zipped theme)."""
|
This class supports both theme directory and theme archive (zipped theme)."""
|
||||||
@@ -159,7 +159,7 @@ def is_archived_theme(filename):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class HTMLThemeFactory(object):
|
class HTMLThemeFactory:
|
||||||
"""A factory class for HTML Themes."""
|
"""A factory class for HTML Themes."""
|
||||||
|
|
||||||
def __init__(self, app):
|
def __init__(self, app):
|
||||||
|
@@ -403,7 +403,7 @@ def detect_encoding(readline):
|
|||||||
|
|
||||||
# Low-level utility functions and classes.
|
# Low-level utility functions and classes.
|
||||||
|
|
||||||
class Tee(object):
|
class Tee:
|
||||||
"""
|
"""
|
||||||
File-like object writing to two streams.
|
File-like object writing to two streams.
|
||||||
"""
|
"""
|
||||||
@@ -535,7 +535,7 @@ def format_exception_cut_frames(x=1):
|
|||||||
return ''.join(res)
|
return ''.join(res)
|
||||||
|
|
||||||
|
|
||||||
class PeekableIterator(object):
|
class PeekableIterator:
|
||||||
"""
|
"""
|
||||||
An iterator which wraps any iterable and makes it possible to peek to see
|
An iterator which wraps any iterable and makes it possible to peek to see
|
||||||
what's the next item.
|
what's the next item.
|
||||||
|
@@ -36,7 +36,7 @@ def _is_single_paragraph(node):
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class Field(object):
|
class Field:
|
||||||
"""A doc field that is never grouped. It can have an argument or not, the
|
"""A doc field that is never grouped. It can have an argument or not, the
|
||||||
argument can be linked using a specified *rolename*. Field should be used
|
argument can be linked using a specified *rolename*. Field should be used
|
||||||
for doc fields that usually don't occur more than once.
|
for doc fields that usually don't occur more than once.
|
||||||
@@ -235,7 +235,7 @@ class TypedField(GroupedField):
|
|||||||
return nodes.field('', fieldname, fieldbody)
|
return nodes.field('', fieldname, fieldbody)
|
||||||
|
|
||||||
|
|
||||||
class DocFieldTransformer(object):
|
class DocFieldTransformer:
|
||||||
"""
|
"""
|
||||||
Transforms field lists in "doc field" syntax into better-looking
|
Transforms field lists in "doc field" syntax into better-looking
|
||||||
equivalents, using the field type definitions given on a domain.
|
equivalents, using the field type definitions given on a domain.
|
||||||
|
@@ -148,7 +148,7 @@ class ElementLookupError(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class sphinx_domains(object):
|
class sphinx_domains:
|
||||||
"""Monkey-patch directive and role dispatch, so that domain-specific
|
"""Monkey-patch directive and role dispatch, so that domain-specific
|
||||||
markup takes precedence.
|
markup takes precedence.
|
||||||
"""
|
"""
|
||||||
@@ -223,7 +223,7 @@ class sphinx_domains(object):
|
|||||||
return self.role_func(name, lang_module, lineno, reporter)
|
return self.role_func(name, lang_module, lineno, reporter)
|
||||||
|
|
||||||
|
|
||||||
class WarningStream(object):
|
class WarningStream:
|
||||||
def write(self, text):
|
def write(self, text):
|
||||||
# type: (unicode) -> None
|
# type: (unicode) -> None
|
||||||
matched = report_re.search(text) # type: ignore
|
matched = report_re.search(text) # type: ignore
|
||||||
|
@@ -317,7 +317,7 @@ def is_builtin_class_method(obj, attr_name):
|
|||||||
return getattr(builtins, safe_getattr(cls, '__name__', '')) is cls # type: ignore
|
return getattr(builtins, safe_getattr(cls, '__name__', '')) is cls # type: ignore
|
||||||
|
|
||||||
|
|
||||||
class Parameter(object):
|
class Parameter:
|
||||||
"""Fake parameter class for python2."""
|
"""Fake parameter class for python2."""
|
||||||
POSITIONAL_ONLY = 0
|
POSITIONAL_ONLY = 0
|
||||||
POSITIONAL_OR_KEYWORD = 1
|
POSITIONAL_OR_KEYWORD = 1
|
||||||
@@ -334,7 +334,7 @@ class Parameter(object):
|
|||||||
self.annotation = self.empty
|
self.annotation = self.empty
|
||||||
|
|
||||||
|
|
||||||
class Signature(object):
|
class Signature:
|
||||||
"""The Signature object represents the call signature of a callable object and
|
"""The Signature object represents the call signature of a callable object and
|
||||||
its return annotation.
|
its return annotation.
|
||||||
"""
|
"""
|
||||||
|
@@ -32,7 +32,7 @@ BUFSIZE = 16 * 1024
|
|||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class InventoryFileReader(object):
|
class InventoryFileReader:
|
||||||
"""A file reader for inventory file.
|
"""A file reader for inventory file.
|
||||||
|
|
||||||
This reader supports mixture of texts and compressed texts.
|
This reader supports mixture of texts and compressed texts.
|
||||||
@@ -94,7 +94,7 @@ class InventoryFileReader(object):
|
|||||||
pos = buf.find(b'\n')
|
pos = buf.find(b'\n')
|
||||||
|
|
||||||
|
|
||||||
class InventoryFile(object):
|
class InventoryFile:
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, stream, uri, joinfunc):
|
def load(cls, stream, uri, joinfunc):
|
||||||
# type: (IO, unicode, Callable) -> Inventory
|
# type: (IO, unicode, Callable) -> Inventory
|
||||||
|
@@ -315,7 +315,7 @@ def skip_warningiserror(skip=True):
|
|||||||
handler.removeFilter(disabler)
|
handler.removeFilter(disabler)
|
||||||
|
|
||||||
|
|
||||||
class LogCollector(object):
|
class LogCollector:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
self.logs = [] # type: List[logging.LogRecord]
|
self.logs = [] # type: List[logging.LogRecord]
|
||||||
@@ -495,7 +495,7 @@ class ColorizeFormatter(logging.Formatter):
|
|||||||
return message
|
return message
|
||||||
|
|
||||||
|
|
||||||
class SafeEncodingWriter(object):
|
class SafeEncodingWriter:
|
||||||
"""Stream writer which ignores UnicodeEncodeError silently"""
|
"""Stream writer which ignores UnicodeEncodeError silently"""
|
||||||
def __init__(self, stream):
|
def __init__(self, stream):
|
||||||
# type: (IO) -> None
|
# type: (IO) -> None
|
||||||
@@ -517,7 +517,7 @@ class SafeEncodingWriter(object):
|
|||||||
self.stream.flush()
|
self.stream.flush()
|
||||||
|
|
||||||
|
|
||||||
class LastMessagesWriter(object):
|
class LastMessagesWriter:
|
||||||
"""Stream writer which memories last 10 messages to save trackback"""
|
"""Stream writer which memories last 10 messages to save trackback"""
|
||||||
def __init__(self, app, stream):
|
def __init__(self, app, stream):
|
||||||
# type: (Sphinx, IO) -> None
|
# type: (Sphinx, IO) -> None
|
||||||
|
@@ -68,7 +68,7 @@ def compile_matchers(patterns):
|
|||||||
return [re.compile(_translate_pattern(pat)).match for pat in patterns]
|
return [re.compile(_translate_pattern(pat)).match for pat in patterns]
|
||||||
|
|
||||||
|
|
||||||
class Matcher(object):
|
class Matcher:
|
||||||
"""A pattern matcher for Multiple shell-style glob patterns.
|
"""A pattern matcher for Multiple shell-style glob patterns.
|
||||||
|
|
||||||
Note: this modifies the patterns to work with copy_asset().
|
Note: this modifies the patterns to work with copy_asset().
|
||||||
|
@@ -34,7 +34,7 @@ explicit_title_re = re.compile(r'^(.+?)\s*(?<!\x00)<(.*?)>$', re.DOTALL)
|
|||||||
caption_ref_re = explicit_title_re # b/w compat alias
|
caption_ref_re = explicit_title_re # b/w compat alias
|
||||||
|
|
||||||
|
|
||||||
class NodeMatcher(object):
|
class NodeMatcher:
|
||||||
"""A helper class for Node.traverse().
|
"""A helper class for Node.traverse().
|
||||||
|
|
||||||
It checks that given node is an instance of specified node-classes and it has
|
It checks that given node is an instance of specified node-classes and it has
|
||||||
|
@@ -260,7 +260,7 @@ def cd(target_dir):
|
|||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
|
||||||
class FileAvoidWrite(object):
|
class FileAvoidWrite:
|
||||||
"""File-like object that buffers output and only writes if content changed.
|
"""File-like object that buffers output and only writes if content changed.
|
||||||
|
|
||||||
Use this class like when writing to a file to avoid touching the original
|
Use this class like when writing to a file to avoid touching the original
|
||||||
|
@@ -36,7 +36,7 @@ logger = logging.getLogger(__name__)
|
|||||||
parallel_available = multiprocessing and (os.name == 'posix')
|
parallel_available = multiprocessing and (os.name == 'posix')
|
||||||
|
|
||||||
|
|
||||||
class SerialTasks(object):
|
class SerialTasks:
|
||||||
"""Has the same interface as ParallelTasks, but executes tasks directly."""
|
"""Has the same interface as ParallelTasks, but executes tasks directly."""
|
||||||
|
|
||||||
def __init__(self, nproc=1):
|
def __init__(self, nproc=1):
|
||||||
@@ -57,7 +57,7 @@ class SerialTasks(object):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ParallelTasks(object):
|
class ParallelTasks:
|
||||||
"""Executes *nproc* tasks in parallel after forking."""
|
"""Executes *nproc* tasks in parallel after forking."""
|
||||||
|
|
||||||
def __init__(self, nproc):
|
def __init__(self, nproc):
|
||||||
|
@@ -91,14 +91,14 @@ else:
|
|||||||
|
|
||||||
# UnicodeMixin
|
# UnicodeMixin
|
||||||
if PY3:
|
if PY3:
|
||||||
class UnicodeMixin(object):
|
class UnicodeMixin:
|
||||||
"""Mixin class to handle defining the proper __str__/__unicode__
|
"""Mixin class to handle defining the proper __str__/__unicode__
|
||||||
methods in Python 2 or 3."""
|
methods in Python 2 or 3."""
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.__unicode__()
|
return self.__unicode__()
|
||||||
else:
|
else:
|
||||||
class UnicodeMixin(object):
|
class UnicodeMixin:
|
||||||
"""Mixin class to handle defining the proper __str__/__unicode__
|
"""Mixin class to handle defining the proper __str__/__unicode__
|
||||||
methods in Python 2 or 3."""
|
methods in Python 2 or 3."""
|
||||||
|
|
||||||
|
@@ -18,7 +18,7 @@ except ImportError:
|
|||||||
PYSTEMMER = False
|
PYSTEMMER = False
|
||||||
|
|
||||||
|
|
||||||
class BaseStemmer(object):
|
class BaseStemmer:
|
||||||
def stem(self, word):
|
def stem(self, word):
|
||||||
# type: (unicode) -> unicode
|
# type: (unicode) -> unicode
|
||||||
raise NotImplementedError()
|
raise NotImplementedError()
|
||||||
|
@@ -29,7 +29,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
class PorterStemmer(object):
|
class PorterStemmer:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# type: () -> None
|
# type: () -> None
|
||||||
|
@@ -46,7 +46,7 @@ class BooleanParser(Parser):
|
|||||||
return node
|
return node
|
||||||
|
|
||||||
|
|
||||||
class Tags(object):
|
class Tags:
|
||||||
def __init__(self, tags=None):
|
def __init__(self, tags=None):
|
||||||
# type: (List[unicode]) -> None
|
# type: (List[unicode]) -> None
|
||||||
self.tags = dict.fromkeys(tags or [], True)
|
self.tags = dict.fromkeys(tags or [], True)
|
||||||
|
@@ -23,7 +23,7 @@ if False:
|
|||||||
from jinja2.loaders import BaseLoader # NOQA
|
from jinja2.loaders import BaseLoader # NOQA
|
||||||
|
|
||||||
|
|
||||||
class BaseRenderer(object):
|
class BaseRenderer:
|
||||||
def __init__(self, loader=None):
|
def __init__(self, loader=None):
|
||||||
# type: (BaseLoader) -> None
|
# type: (BaseLoader) -> None
|
||||||
self.env = SandboxedEnvironment(loader=loader, extensions=['jinja2.ext.i18n'])
|
self.env = SandboxedEnvironment(loader=loader, extensions=['jinja2.ext.i18n'])
|
||||||
|
@@ -265,7 +265,7 @@ class ExtBabel(Babel):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class Table(object):
|
class Table:
|
||||||
"""A table data"""
|
"""A table data"""
|
||||||
|
|
||||||
def __init__(self, node):
|
def __init__(self, node):
|
||||||
@@ -386,7 +386,7 @@ class Table(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
class TableCell(object):
|
class TableCell:
|
||||||
"""A cell data of tables."""
|
"""A cell data of tables."""
|
||||||
|
|
||||||
def __init__(self, table, row, col):
|
def __init__(self, table, row, col):
|
||||||
|
@@ -45,7 +45,7 @@ class ManualPageWriter(Writer):
|
|||||||
self.output = visitor.astext()
|
self.output = visitor.astext()
|
||||||
|
|
||||||
|
|
||||||
class NestedInlineTransform(object):
|
class NestedInlineTransform:
|
||||||
"""
|
"""
|
||||||
Flatten nested inline nodes:
|
Flatten nested inline nodes:
|
||||||
|
|
||||||
|
@@ -247,7 +247,7 @@ class CustomEx(Exception):
|
|||||||
"""Exception method."""
|
"""Exception method."""
|
||||||
|
|
||||||
|
|
||||||
class CustomDataDescriptor(object):
|
class CustomDataDescriptor:
|
||||||
"""Descriptor class docstring."""
|
"""Descriptor class docstring."""
|
||||||
|
|
||||||
def __init__(self, doc):
|
def __init__(self, doc):
|
||||||
@@ -275,7 +275,7 @@ def _funky_classmethod(name, b, c, d, docstring=None):
|
|||||||
return classmethod(function)
|
return classmethod(function)
|
||||||
|
|
||||||
|
|
||||||
class Base(object):
|
class Base:
|
||||||
def inheritedmeth(self):
|
def inheritedmeth(self):
|
||||||
"""Inherited function."""
|
"""Inherited function."""
|
||||||
|
|
||||||
|
@@ -216,7 +216,7 @@ def test_format_signature():
|
|||||||
class D:
|
class D:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class E(object):
|
class E:
|
||||||
pass
|
pass
|
||||||
# no signature for classes without __init__
|
# no signature for classes without __init__
|
||||||
for C in (D, E):
|
for C in (D, E):
|
||||||
@@ -226,7 +226,7 @@ def test_format_signature():
|
|||||||
def __init__(self, a, b=None):
|
def __init__(self, a, b=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
class G(F, object):
|
class G(F):
|
||||||
pass
|
pass
|
||||||
for C in (F, G):
|
for C in (F, G):
|
||||||
assert formatsig('class', 'C', C, None, None) == '(a, b=None)'
|
assert formatsig('class', 'C', C, None, None) == '(a, b=None)'
|
||||||
@@ -243,7 +243,7 @@ def test_format_signature():
|
|||||||
|
|
||||||
some docstring for __init__.
|
some docstring for __init__.
|
||||||
'''
|
'''
|
||||||
class G2(F2, object):
|
class G2(F2):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
assert formatsig('class', 'F2', F2, None, None) == \
|
assert formatsig('class', 'F2', F2, None, None) == \
|
||||||
@@ -399,7 +399,7 @@ def test_get_doc():
|
|||||||
assert getdocl('class', E) == ['Class docstring', '', 'Init docstring']
|
assert getdocl('class', E) == ['Class docstring', '', 'Init docstring']
|
||||||
|
|
||||||
# class does not have __init__ method
|
# class does not have __init__ method
|
||||||
class F(object):
|
class F:
|
||||||
"""Class docstring"""
|
"""Class docstring"""
|
||||||
|
|
||||||
# docstring in the __init__ method of base class will be discard
|
# docstring in the __init__ method of base class will be discard
|
||||||
@@ -413,7 +413,7 @@ def test_get_doc():
|
|||||||
assert getdocl('class', F) == ['Class docstring']
|
assert getdocl('class', F) == ['Class docstring']
|
||||||
|
|
||||||
# class has __init__ method with no docstring
|
# class has __init__ method with no docstring
|
||||||
class G(object):
|
class G:
|
||||||
"""Class docstring"""
|
"""Class docstring"""
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
@@ -28,7 +28,7 @@ def runnable(command):
|
|||||||
return p.returncode == 0
|
return p.returncode == 0
|
||||||
|
|
||||||
|
|
||||||
class EPUBElementTree(object):
|
class EPUBElementTree:
|
||||||
"""Test helper for content.opf and toc.ncx"""
|
"""Test helper for content.opf and toc.ncx"""
|
||||||
namespaces = {
|
namespaces = {
|
||||||
'idpf': 'http://www.idpf.org/2007/opf',
|
'idpf': 'http://www.idpf.org/2007/opf',
|
||||||
|
@@ -218,7 +218,7 @@ def test_builtin_conf(app, status, warning):
|
|||||||
|
|
||||||
|
|
||||||
# example classes for type checking
|
# example classes for type checking
|
||||||
class A(object):
|
class A:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@@ -22,7 +22,7 @@ from sphinx.domains.cpp import Symbol, _max_id, _id_prefix
|
|||||||
|
|
||||||
|
|
||||||
def parse(name, string):
|
def parse(name, string):
|
||||||
class Config(object):
|
class Config:
|
||||||
cpp_id_attributes = ["id_attr"]
|
cpp_id_attributes = ["id_attr"]
|
||||||
cpp_paren_attributes = ["paren_attr"]
|
cpp_paren_attributes = ["paren_attr"]
|
||||||
parser = DefinitionParser(string, None, Config())
|
parser = DefinitionParser(string, None, Config())
|
||||||
@@ -804,7 +804,7 @@ not found in `{test}`
|
|||||||
assert result, expect
|
assert result, expect
|
||||||
return set(result.group('classes').split())
|
return set(result.group('classes').split())
|
||||||
|
|
||||||
class RoleClasses(object):
|
class RoleClasses:
|
||||||
"""Collect the classes from the layout that was generated for a given role."""
|
"""Collect the classes from the layout that was generated for a given role."""
|
||||||
|
|
||||||
def __init__(self, role, root, contents):
|
def __init__(self, role, root, contents):
|
||||||
|
@@ -37,7 +37,7 @@ def __special_undoc__():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class SampleClass(object):
|
class SampleClass:
|
||||||
def _private_doc(self):
|
def _private_doc(self):
|
||||||
"""SampleClass._private_doc.DOCSTRING"""
|
"""SampleClass._private_doc.DOCSTRING"""
|
||||||
pass
|
pass
|
||||||
|
@@ -22,7 +22,7 @@ from sphinx.util import jsdump
|
|||||||
DummyEnvironment = namedtuple('DummyEnvironment', ['version', 'domains'])
|
DummyEnvironment = namedtuple('DummyEnvironment', ['version', 'domains'])
|
||||||
|
|
||||||
|
|
||||||
class DummyDomain(object):
|
class DummyDomain:
|
||||||
def __init__(self, data):
|
def __init__(self, data):
|
||||||
self.data = data
|
self.data = data
|
||||||
self.object_types = {}
|
self.object_types = {}
|
||||||
|
@@ -206,7 +206,7 @@ def test_Signature_methods():
|
|||||||
def test_Signature_partialmethod():
|
def test_Signature_partialmethod():
|
||||||
from functools import partialmethod
|
from functools import partialmethod
|
||||||
|
|
||||||
class Foo(object):
|
class Foo:
|
||||||
def meth1(self, arg1, arg2, arg3=None, arg4=None):
|
def meth1(self, arg1, arg2, arg3=None, arg4=None):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@@ -309,7 +309,7 @@ def test_Signature_annotations():
|
|||||||
|
|
||||||
|
|
||||||
def test_safe_getattr_with_default():
|
def test_safe_getattr_with_default():
|
||||||
class Foo(object):
|
class Foo:
|
||||||
def __getattr__(self, item):
|
def __getattr__(self, item):
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
@@ -321,7 +321,7 @@ def test_safe_getattr_with_default():
|
|||||||
|
|
||||||
|
|
||||||
def test_safe_getattr_with_exception():
|
def test_safe_getattr_with_exception():
|
||||||
class Foo(object):
|
class Foo:
|
||||||
def __getattr__(self, item):
|
def __getattr__(self, item):
|
||||||
raise Exception
|
raise Exception
|
||||||
|
|
||||||
@@ -336,7 +336,7 @@ def test_safe_getattr_with_exception():
|
|||||||
|
|
||||||
|
|
||||||
def test_safe_getattr_with_property_exception():
|
def test_safe_getattr_with_property_exception():
|
||||||
class Foo(object):
|
class Foo:
|
||||||
@property
|
@property
|
||||||
def bar(self):
|
def bar(self):
|
||||||
raise Exception
|
raise Exception
|
||||||
@@ -352,7 +352,7 @@ def test_safe_getattr_with_property_exception():
|
|||||||
|
|
||||||
|
|
||||||
def test_safe_getattr_with___dict___override():
|
def test_safe_getattr_with___dict___override():
|
||||||
class Foo(object):
|
class Foo:
|
||||||
@property
|
@property
|
||||||
def __dict__(self):
|
def __dict__(self):
|
||||||
raise Exception
|
raise Exception
|
||||||
@@ -410,7 +410,7 @@ def test_frozenset_sorting_fallback():
|
|||||||
|
|
||||||
|
|
||||||
def test_dict_customtype():
|
def test_dict_customtype():
|
||||||
class CustomType(object):
|
class CustomType:
|
||||||
def __init__(self, value):
|
def __init__(self, value):
|
||||||
self._value = value
|
self._value = value
|
||||||
|
|
||||||
|
@@ -84,7 +84,7 @@ def processing(message):
|
|||||||
print('done')
|
print('done')
|
||||||
|
|
||||||
|
|
||||||
class Changes(object):
|
class Changes:
|
||||||
def __init__(self, path):
|
def __init__(self, path):
|
||||||
self.path = path
|
self.path = path
|
||||||
self.fetch_version()
|
self.fetch_version()
|
||||||
|
Reference in New Issue
Block a user