diff options
111 files changed, 273 insertions, 164 deletions
diff --git a/.travis.yml b/.travis.yml index c957c7c7f..dce32f965 100644 --- a/.travis.yml +++ b/.travis.yml @@ -46,7 +46,7 @@ install: - pip install -U pip setuptools - pip install docutils==$DOCUTILS - pip install -r test-reqs.txt - - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then python3.6 -m pip install 'mypy==0.471' 'typed-ast<1.0'; fi + - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then python3.6 -m pip install mypy typed-ast; fi script: - flake8 - if [[ $TRAVIS_PYTHON_VERSION == '3.6' ]]; then make style-check type-check test-async; fi diff --git a/sphinx/__init__.py b/sphinx/__init__.py index e98d2cdf0..42cf99c70 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -21,6 +21,10 @@ from os import path from .deprecation import RemovedInNextVersionWarning +if False: + # For type annotation + from typing import List # NOQA + # by default, all DeprecationWarning under sphinx package will be emit. # Users can avoid this by using environment variable: PYTHONWARNINGS= if 'PYTHONWARNINGS' not in os.environ: diff --git a/sphinx/addnodes.py b/sphinx/addnodes.py index 1cadb27e5..b104f014c 100644 --- a/sphinx/addnodes.py +++ b/sphinx/addnodes.py @@ -13,7 +13,7 @@ from docutils import nodes if False: # For type annotation - from typing import Sequence # NOQA + from typing import List, Sequence # NOQA class translatable(object): diff --git a/sphinx/apidoc.py b/sphinx/apidoc.py index 11d2994ef..4533e5103 100644 --- a/sphinx/apidoc.py +++ b/sphinx/apidoc.py @@ -29,7 +29,7 @@ from sphinx.quickstart import EXTENSIONS if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, List, Tuple # NOQA # automodule options if 'SPHINX_APIDOC_OPTIONS' in os.environ: @@ -274,7 +274,7 @@ def is_excluded(root, excludes): e.g. an exlude "foo" also accidentally excluding "foobar". """ for exclude in excludes: - if fnmatch(root, exclude): # type: ignore + if fnmatch(root, exclude): return True return False @@ -427,6 +427,7 @@ Note: By default this script will not overwrite already created files.""") qs.generate(d, silent=True, overwrite=opts.force) elif not opts.notoc: create_modules_toc_file(modules, opts) + return 0 # So program can be started with "python -m sphinx.apidoc ..." diff --git a/sphinx/application.py b/sphinx/application.py index 1f88c1291..85d730726 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -51,7 +51,7 @@ from sphinx.util.i18n import find_catalog_source_files if False: # For type annotation - from typing import Any, Callable, IO, Iterable, Iterator, Tuple, Type, Union # NOQA + from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Tuple, Type, Union # NOQA from docutils.parsers import Parser # NOQA from docutils.transform import Transform # NOQA from sphinx.builders import Builder # NOQA diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py index 35280f45f..f421b0517 100644 --- a/sphinx/builders/__init__.py +++ b/sphinx/builders/__init__.py @@ -32,7 +32,7 @@ from sphinx import directives # noqa if False: # For type annotation - from typing import Any, Callable, Iterable, Sequence, Tuple, Union # NOQA + from typing import Any, Callable, Dict, Iterable, List, Sequence, Set, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.config import Config # NOQA from sphinx.environment import BuildEnvironment # NOQA @@ -49,11 +49,11 @@ class Builder(object): """ # builder's name, for the -b command line options - name = '' + name = '' # type: unicode # builder's output format, or '' if no document output is produced - format = '' + format = '' # type: unicode # doctree versioning method - versioning_method = 'none' + versioning_method = 'none' # type: unicode versioning_compare = False # allow parallel write_doc() calls allow_parallel = False @@ -88,7 +88,7 @@ class Builder(object): # basename of images directory self.imagedir = "" # relative path to image directory from current docname (used at writing docs) - self.imgpath = "" + self.imgpath = "" # type: unicode # these get set later self.parallel_ok = False diff --git a/sphinx/builders/applehelp.py b/sphinx/builders/applehelp.py index 6337f96da..f1062f896 100644 --- a/sphinx/builders/applehelp.py +++ b/sphinx/builders/applehelp.py @@ -31,7 +31,7 @@ import subprocess if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/changes.py b/sphinx/builders/changes.py index 1dc22f4ae..b6a6d57be 100644 --- a/sphinx/builders/changes.py +++ b/sphinx/builders/changes.py @@ -26,7 +26,7 @@ from sphinx.util.pycompat import htmlescape if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/devhelp.py b/sphinx/builders/devhelp.py index 36a604188..f0bd0d647 100644 --- a/sphinx/builders/devhelp.py +++ b/sphinx/builders/devhelp.py @@ -31,7 +31,7 @@ except ImportError: if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, List # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/dummy.py b/sphinx/builders/dummy.py index 2ba6337a6..74a3d4187 100644 --- a/sphinx/builders/dummy.py +++ b/sphinx/builders/dummy.py @@ -14,7 +14,7 @@ from sphinx.builders import Builder if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, Set # NOQA from docutils import nodes # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/epub.py b/sphinx/builders/epub.py index eebd905b9..41253b77d 100644 --- a/sphinx/builders/epub.py +++ b/sphinx/builders/epub.py @@ -38,7 +38,7 @@ from sphinx.util.smartypants import sphinx_smarty_pants as ssp if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/epub3.py b/sphinx/builders/epub3.py index 0107e3da9..8d5118a6d 100644 --- a/sphinx/builders/epub3.py +++ b/sphinx/builders/epub3.py @@ -22,7 +22,7 @@ from sphinx.util.fileutil import copy_asset_file if False: # For type annotation - from typing import Any, Iterable # NOQA + from typing import Any, Dict, Iterable, List # NOQA from docutils import nodes # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/gettext.py b/sphinx/builders/gettext.py index fa0e1368d..a1eb5bae4 100644 --- a/sphinx/builders/gettext.py +++ b/sphinx/builders/gettext.py @@ -31,7 +31,7 @@ from sphinx.locale import pairindextypes if False: # For type annotation - from typing import Any, Iterable, Tuple # NOQA + from typing import Any, Dict, Iterable, List, Set, Tuple # NOQA from docutils import nodes # NOQA from sphinx.util.i18n import CatalogInfo # NOQA from sphinx.application import Sphinx # NOQA @@ -258,7 +258,7 @@ class MessageCatalogBuilder(I18nBuilder): version = self.config.version, copyright = self.config.copyright, project = self.config.project, - ctime = datetime.fromtimestamp( # type: ignore + ctime = datetime.fromtimestamp( timestamp, ltz).strftime('%Y-%m-%d %H:%M%z'), ) for textdomain, catalog in status_iterator(iteritems(self.catalogs), # type: ignore diff --git a/sphinx/builders/html.py b/sphinx/builders/html.py index 11eca44c4..b241a7a60 100644 --- a/sphinx/builders/html.py +++ b/sphinx/builders/html.py @@ -52,7 +52,7 @@ from sphinx.environment.adapters.indexentries import IndexEntries if False: # For type annotation - from typing import Any, Iterable, Iterator, Type, Tuple, Union # NOQA + from typing import Any, Dict, Iterable, Iterator, List, Type, Tuple, Union # NOQA from sphinx.domains import Domain, Index # NOQA from sphinx.application import Sphinx # NOQA @@ -96,7 +96,7 @@ class StandaloneHTMLBuilder(Builder): allow_parallel = True out_suffix = '.html' link_suffix = '.html' # defaults to matching out_suffix - indexer_format = js_index + indexer_format = js_index # type: Any indexer_dumps_unicode = True # create links to original images from images [True/False] html_scaled_image_link = True @@ -1180,7 +1180,7 @@ class SerializingHTMLBuilder(StandaloneHTMLBuilder): implementation = None # type: Any implementation_dumps_unicode = False #: additional arguments for dump() - additional_dump_args = () + additional_dump_args = () # type: Tuple #: the filename for the global context file globalcontext_filename = None # type: unicode diff --git a/sphinx/builders/htmlhelp.py b/sphinx/builders/htmlhelp.py index 338015aca..7bea56ba3 100644 --- a/sphinx/builders/htmlhelp.py +++ b/sphinx/builders/htmlhelp.py @@ -26,7 +26,7 @@ from sphinx.util.pycompat import htmlescape if False: # For type annotation - from typing import Any, IO, Tuple # NOQA + from typing import Any, Dict, IO, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/latex.py b/sphinx/builders/latex.py index 72da4bfeb..2208ecfe0 100644 --- a/sphinx/builders/latex.py +++ b/sphinx/builders/latex.py @@ -36,7 +36,7 @@ from sphinx.writers.latex import LaTeXWriter if False: # For type annotation - from typing import Any, Iterable, Tuple, Union # NOQA + from typing import Any, Dict, Iterable, List, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.config import Config # NOQA diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py index c7bca9de2..99778cddf 100644 --- a/sphinx/builders/linkcheck.py +++ b/sphinx/builders/linkcheck.py @@ -39,7 +39,7 @@ from sphinx.util.requests import is_ssl_error if False: # For type annotation - from typing import Any, Tuple, Union # NOQA + from typing import Any, Dict, List, Set, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.util.requests.requests import Response # NOQA diff --git a/sphinx/builders/manpage.py b/sphinx/builders/manpage.py index 20034b3f8..a08f70ee2 100644 --- a/sphinx/builders/manpage.py +++ b/sphinx/builders/manpage.py @@ -27,7 +27,7 @@ from sphinx.writers.manpage import ManualPageWriter if False: # For type annotation - from typing import Any, Union # NOQA + from typing import Any, Dict, List, Set, Union # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/qthelp.py b/sphinx/builders/qthelp.py index eeb3fdb73..018444a95 100644 --- a/sphinx/builders/qthelp.py +++ b/sphinx/builders/qthelp.py @@ -28,7 +28,7 @@ from sphinx.util.pycompat import htmlescape if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/texinfo.py b/sphinx/builders/texinfo.py index b8a3a38d7..b25325c85 100644 --- a/sphinx/builders/texinfo.py +++ b/sphinx/builders/texinfo.py @@ -31,7 +31,7 @@ from sphinx.writers.texinfo import TexinfoWriter if False: # For type annotation from sphinx.application import Sphinx # NOQA - from typing import Any, Iterable, Tuple, Union # NOQA + from typing import Any, Dict, Iterable, List, Tuple, Union # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/builders/text.py b/sphinx/builders/text.py index bf70f6fdb..fdba2bc06 100644 --- a/sphinx/builders/text.py +++ b/sphinx/builders/text.py @@ -21,7 +21,7 @@ from sphinx.writers.text import TextWriter if False: # For type annotation - from typing import Any, Iterator # NOQA + from typing import Any, Dict, Iterator, Set # NOQA from docutils import nodes # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/websupport.py b/sphinx/builders/websupport.py index 1982b92cd..d38626e2b 100644 --- a/sphinx/builders/websupport.py +++ b/sphinx/builders/websupport.py @@ -22,7 +22,7 @@ from sphinx.writers.websupport import WebSupportTranslator if False: # For type annotation - from typing import Any, Iterable, Tuple # NOQA + from typing import Any, Dict, Iterable, Tuple # NOQA from docutils import nodes # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/builders/xml.py b/sphinx/builders/xml.py index c149df83c..7c664fbf6 100644 --- a/sphinx/builders/xml.py +++ b/sphinx/builders/xml.py @@ -22,7 +22,7 @@ from sphinx.writers.xml import XMLWriter, PseudoXMLWriter if False: # For type annotation - from typing import Any, Iterator # NOQA + from typing import Any, Dict, Iterator, Set # NOQA from sphinx.application import Sphinx # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/cmdline.py b/sphinx/cmdline.py index 70828c635..d30956d6e 100644 --- a/sphinx/cmdline.py +++ b/sphinx/cmdline.py @@ -30,7 +30,7 @@ from sphinx.util.pycompat import terminal_safe if False: # For type annotation - from typing import Any, IO, Union # NOQA + from typing import Any, IO, List, Union # NOQA USAGE = """\ @@ -220,12 +220,12 @@ def main(argv): # handle remaining filename arguments filenames = args[2:] - err = 0 # type: ignore + errored = False for filename in filenames: if not path.isfile(filename): print('Error: Cannot find file %r.' % filename, file=sys.stderr) - err = 1 # type: ignore - if err: + errored = True + if errored: return 1 # likely encoding used for command-line arguments diff --git a/sphinx/config.py b/sphinx/config.py index 3207b829b..26efa9f33 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -24,7 +24,7 @@ from sphinx.util.pycompat import execfile_, NoneType if False: # For type annotation - from typing import Any, Callable, Iterable, Iterator, Tuple # NOQA + from typing import Any, Callable, Dict, Iterable, Iterator, List, Tuple # NOQA from sphinx.util.tags import Tags # NOQA logger = logging.getLogger(__name__) @@ -237,10 +237,10 @@ class Config(object): 'ignoring (use %r to set individual elements)' % (name, name + '.key=value')) elif isinstance(defvalue, list): - return value.split(',') # type: ignore + return value.split(',') elif isinstance(defvalue, integer_types): try: - return int(value) # type: ignore + return int(value) except ValueError: raise ValueError('invalid number %r for config value %r, ignoring' % (value, name)) diff --git a/sphinx/directives/__init__.py b/sphinx/directives/__init__.py index 58efd68a5..6f3dc10c7 100644 --- a/sphinx/directives/__init__.py +++ b/sphinx/directives/__init__.py @@ -31,7 +31,7 @@ from sphinx.directives.patches import ( # noqa if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, List # NOQA from sphinx.application import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/directives/code.py b/sphinx/directives/code.py index f6a328582..058c95913 100644 --- a/sphinx/directives/code.py +++ b/sphinx/directives/code.py @@ -23,7 +23,7 @@ from sphinx.util.nodes import set_source_info if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.config import Config # NOQA diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py index 801fd8cad..8601645f2 100644 --- a/sphinx/directives/other.py +++ b/sphinx/directives/other.py @@ -24,7 +24,7 @@ from sphinx.util.matching import patfilter if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/directives/patches.py b/sphinx/directives/patches.py index 00e1fa53a..1159a3ce7 100644 --- a/sphinx/directives/patches.py +++ b/sphinx/directives/patches.py @@ -16,6 +16,7 @@ from sphinx.util.nodes import set_source_info if False: # For type annotation + from typing import Dict, List # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/domains/__init__.py b/sphinx/domains/__init__.py index f0c866afb..48d7453ab 100644 --- a/sphinx/domains/__init__.py +++ b/sphinx/domains/__init__.py @@ -19,11 +19,13 @@ from sphinx.locale import _ if False: # For type annotation - from typing import Any, Callable, Iterable, Tuple, Type, Union # NOQA + from typing import Any, Callable, Dict, Iterable, List, Tuple, Type, Union # NOQA from docutils import nodes # NOQA from docutils.parsers.rst.states import Inliner # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA + from sphinx.roles import XRefRole # NOQA + from sphinx.util.typing import RoleFunction # NOQA class ObjType(object): @@ -143,7 +145,7 @@ class Domain(object): #: directive name -> directive class directives = {} # type: Dict[unicode, Any] #: role name -> role callable - roles = {} # type: Dict[unicode, Callable] + roles = {} # type: Dict[unicode, Union[RoleFunction, XRefRole]] #: a list of Index subclasses indices = [] # type: List[Type[Index]] #: role name -> a warning message if reference is missing diff --git a/sphinx/domains/c.py b/sphinx/domains/c.py index 8afff5716..1dcc96f73 100644 --- a/sphinx/domains/c.py +++ b/sphinx/domains/c.py @@ -24,7 +24,7 @@ from sphinx.util.docfields import Field, TypedField if False: # For type annotation - from typing import Any, Iterator, Tuple # NOQA + from typing import Any, Dict, Iterator, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/domains/cpp.py b/sphinx/domains/cpp.py index 824ea42fc..f1b8832f1 100644 --- a/sphinx/domains/cpp.py +++ b/sphinx/domains/cpp.py @@ -29,7 +29,7 @@ from sphinx.util.docfields import Field, GroupedField if False: # For type annotation - from typing import Any, Iterator, Match, Pattern, Tuple, Union # NOQA + from typing import Any, Callable, Dict, Iterator, List, Match, Pattern, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.config import Config # NOQA @@ -539,7 +539,7 @@ class ASTBase(UnicodeMixin): # type: (Any) -> bool return not self.__eq__(other) - __hash__ = None # type: None + __hash__ = None # type: Callable[[], int] def clone(self): # type: () -> ASTBase @@ -3292,7 +3292,7 @@ class DefinitionParser(object): return DefinitionError(''.join(result)) def status(self, msg): - # type: (unicode) -> unicode + # type: (unicode) -> None # for debugging indicator = '-' * self.pos + '^' print("%s\n%s\n%s" % (msg, self.definition, indicator)) @@ -3373,6 +3373,8 @@ class DefinitionParser(object): # type: () -> unicode if self.last_match is not None: return self.last_match.group() + else: + return None def read_rest(self): # type: () -> unicode diff --git a/sphinx/domains/javascript.py b/sphinx/domains/javascript.py index 4cd0eda6e..b64206238 100644 --- a/sphinx/domains/javascript.py +++ b/sphinx/domains/javascript.py @@ -20,7 +20,7 @@ from sphinx.util.docfields import Field, GroupedField, TypedField if False: # For type annotation - from typing import Any, Iterator, Tuple # NOQA + from typing import Any, Dict, Iterator, List, Tuple # NOQA from docutils import nodes # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py index 25ce4c648..943c77234 100644 --- a/sphinx/domains/python.py +++ b/sphinx/domains/python.py @@ -27,7 +27,7 @@ from sphinx.util.docfields import Field, GroupedField, TypedField if False: # For type annotation - from typing import Any, Iterable, Iterator, Tuple, Union # NOQA + from typing import Any, Dict, Iterable, Iterator, List, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/domains/rst.py b/sphinx/domains/rst.py index 450b0faa2..6a91a2a31 100644 --- a/sphinx/domains/rst.py +++ b/sphinx/domains/rst.py @@ -22,7 +22,7 @@ from sphinx.util.nodes import make_refnode if False: # For type annotation - from typing import Any, Iterator, Tuple # NOQA + from typing import Any, Dict, Iterator, List, Tuple # NOQA from docutils import nodes # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py index 9f8f96c71..b442f4b36 100644 --- a/sphinx/domains/std.py +++ b/sphinx/domains/std.py @@ -29,17 +29,10 @@ from sphinx.util.nodes import clean_astext, make_refnode if False: # For type annotation from typing import Any, Callable, Dict, Iterator, List, Tuple, Type, Union # NOQA - from docutils.parsers.rst.states import Inliner # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA - from sphinx.util.typing import Role # NOQA - - if PY3: - unicode = str - - RoleFunction = Callable[[unicode, unicode, unicode, int, Inliner, Dict, List[unicode]], - Tuple[List[nodes.Node], List[nodes.Node]]] + from sphinx.util.typing import RoleFunction # NOQA logger = logging.getLogger(__name__) @@ -54,7 +47,7 @@ class GenericObject(ObjectDescription): """ A generic x-ref directive registered with Sphinx.add_object_type(). """ - indextemplate = '' + indextemplate = '' # type: unicode parse_node = None # type: Callable[[GenericObject, BuildEnvironment, unicode, addnodes.desc_signature], unicode] # NOQA def handle_signature(self, sig, signode): diff --git a/sphinx/environment/__init__.py b/sphinx/environment/__init__.py index 3e6e49ff3..3a46fa809 100644 --- a/sphinx/environment/__init__.py +++ b/sphinx/environment/__init__.py @@ -51,7 +51,7 @@ from sphinx.environment.adapters.toctree import TocTree if False: # For type annotation - from typing import Any, Callable, Iterator, Pattern, Tuple, Type, Union # NOQA + from typing import Any, Callable, Dict, Iterator, List, Pattern, Set, Tuple, Type, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.config import Config # NOQA @@ -320,8 +320,8 @@ class BuildEnvironment(object): if filename.startswith(self.srcdir): filename = filename[len(self.srcdir) + 1:] for suffix in self.config.source_suffix: - if fnmatch.fnmatch(filename, '*' + suffix): # type: ignore - return filename[:-len(suffix)] # type: ignore + if fnmatch.fnmatch(filename, '*' + suffix): + return filename[:-len(suffix)] else: # the file does not have docname return None @@ -338,14 +338,14 @@ class BuildEnvironment(object): docname = docname.replace(SEP, path.sep) if suffix is None: candidate_suffix = None # type: unicode - for candidate_suffix in self.config.source_suffix: # type: ignore + for candidate_suffix in self.config.source_suffix: if path.isfile(path.join(self.srcdir, docname) + candidate_suffix): suffix = candidate_suffix break else: # document does not exist - suffix = self.config.source_suffix[0] # type: ignore + suffix = self.config.source_suffix[0] if base is True: return path.join(self.srcdir, docname) + suffix elif base is None: diff --git a/sphinx/environment/adapters/indexentries.py b/sphinx/environment/adapters/indexentries.py index 13a128546..31ec58301 100644 --- a/sphinx/environment/adapters/indexentries.py +++ b/sphinx/environment/adapters/indexentries.py @@ -20,7 +20,7 @@ from sphinx.util import iteritems, split_into, logging if False: # For type annotation - from typing import Any, Pattern, Tuple # NOQA + from typing import Any, Dict, Pattern, List, Tuple # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/adapters/toctree.py b/sphinx/environment/adapters/toctree.py index bde8d1ac4..458eefd77 100644 --- a/sphinx/environment/adapters/toctree.py +++ b/sphinx/environment/adapters/toctree.py @@ -19,7 +19,7 @@ from sphinx.util.nodes import clean_astext, process_only_nodes if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, List # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/__init__.py b/sphinx/environment/collectors/__init__.py index b8d73ad1f..45add6c4e 100644 --- a/sphinx/environment/collectors/__init__.py +++ b/sphinx/environment/collectors/__init__.py @@ -13,6 +13,7 @@ from six import itervalues if False: # For type annotation + from typing import Dict, List, Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/asset.py b/sphinx/environment/collectors/asset.py index 38deeeca4..73dd16869 100644 --- a/sphinx/environment/collectors/asset.py +++ b/sphinx/environment/collectors/asset.py @@ -26,7 +26,7 @@ from sphinx.util.images import guess_mimetype if False: # For type annotation - from typing import Tuple # NOQA + from typing import Dict, List, Set, Tuple # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/dependencies.py b/sphinx/environment/collectors/dependencies.py index b4d35caf7..ebfefe154 100644 --- a/sphinx/environment/collectors/dependencies.py +++ b/sphinx/environment/collectors/dependencies.py @@ -18,6 +18,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/indexentries.py b/sphinx/environment/collectors/indexentries.py index c9aeda7e1..596c98c09 100644 --- a/sphinx/environment/collectors/indexentries.py +++ b/sphinx/environment/collectors/indexentries.py @@ -15,6 +15,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.applicatin import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/metadata.py b/sphinx/environment/collectors/metadata.py index 7a15cc614..4c700b4f2 100644 --- a/sphinx/environment/collectors/metadata.py +++ b/sphinx/environment/collectors/metadata.py @@ -15,6 +15,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/title.py b/sphinx/environment/collectors/title.py index a5316fe94..fca394c35 100644 --- a/sphinx/environment/collectors/title.py +++ b/sphinx/environment/collectors/title.py @@ -16,6 +16,7 @@ from sphinx.transforms import SphinxContentsFilter if False: # For type annotation + from typing import Set # NOQA from docutils import nodes # NOQA from sphinx.sphinx import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/environment/collectors/toctree.py b/sphinx/environment/collectors/toctree.py index 5c9ed5472..bd3298391 100644 --- a/sphinx/environment/collectors/toctree.py +++ b/sphinx/environment/collectors/toctree.py @@ -21,7 +21,7 @@ from sphinx.environment.collectors import EnvironmentCollector if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Set, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/ext/autodoc.py b/sphinx/ext/autodoc.py index 606953811..61b6197ca 100644 --- a/sphinx/ext/autodoc.py +++ b/sphinx/ext/autodoc.py @@ -40,7 +40,7 @@ from sphinx.util.docstrings import prepare_docstring if False: # For type annotation - from typing import Any, Callable, Iterator, Sequence, Tuple, Type, Union # NOQA + from typing import Any, Callable, Dict, Iterator, List, Sequence, Set, Tuple, Type, Union # NOQA from types import ModuleType # NOQA from docutils.utils import Reporter # NOQA from sphinx.application import Sphinx # NOQA @@ -482,7 +482,7 @@ class Documenter(object): #: true if the generated content may contain titles titles_allowed = False - option_spec = {'noindex': bool_option} + option_spec = {'noindex': bool_option} # type: Dict[unicode, Callable] @staticmethod def get_attr(obj, name, *defargs): @@ -1081,7 +1081,7 @@ class ModuleDocumenter(Documenter): 'member-order': identity, 'exclude-members': members_set_option, 'private-members': bool_option, 'special-members': members_option, 'imported-members': bool_option, - } + } # type: Dict[unicode, Callable] @classmethod def can_document_member(cls, member, membername, isattr, parent): @@ -1333,7 +1333,7 @@ class ClassDocumenter(DocstringSignatureMixin, ModuleLevelDocumenter): # type: 'show-inheritance': bool_option, 'member-order': identity, 'exclude-members': members_set_option, 'private-members': bool_option, 'special-members': members_option, - } + } # type: Dict[unicode, Callable] @classmethod def can_document_member(cls, member, membername, isattr, parent): diff --git a/sphinx/ext/autosummary/__init__.py b/sphinx/ext/autosummary/__init__.py index 7bf5ad5b8..7e29bf2ef 100644 --- a/sphinx/ext/autosummary/__init__.py +++ b/sphinx/ext/autosummary/__init__.py @@ -76,7 +76,7 @@ from sphinx.ext.autodoc import Options if False: # For type annotation - from typing import Any, Tuple, Type, Union # NOQA + from typing import Any, Dict, List, Tuple, Type, Union # NOQA from docutils.utils import Inliner # NOQA from sphinx.application import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA @@ -546,8 +546,7 @@ def _import_by_name(name): # -- :autolink: (smart default role) ------------------------------------------- -def autolink_role(typ, rawtext, etext, lineno, inliner, - options={}, content=[]): +def autolink_role(typ, rawtext, etext, lineno, inliner, options={}, content=[]): # type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA """Smart linking role. @@ -555,6 +554,7 @@ def autolink_role(typ, rawtext, etext, lineno, inliner, otherwise expands to '*text*'. """ env = inliner.document.settings.env + r = None # type: Tuple[List[nodes.Node], List[nodes.Node]] r = env.get_domain('py').role('obj')( 'obj', rawtext, etext, lineno, inliner, options, content) pnode = r[0][0] @@ -563,9 +563,9 @@ def autolink_role(typ, rawtext, etext, lineno, inliner, try: name, obj, parent, modname = import_by_name(pnode['reftarget'], prefixes) except ImportError: - content = pnode[0] - r[0][0] = nodes.emphasis(rawtext, content[0].astext(), # type: ignore - classes=content['classes']) # type: ignore + content_node = pnode[0] + r[0][0] = nodes.emphasis(rawtext, content_node[0].astext(), + classes=content_node['classes']) return r @@ -581,7 +581,7 @@ def get_rst_suffix(app): return parser_class.supported suffix = None # type: unicode - for suffix in app.config.source_suffix: # type: ignore + for suffix in app.config.source_suffix: if 'restructuredtext' in get_supported_format(suffix): return suffix diff --git a/sphinx/ext/autosummary/generate.py b/sphinx/ext/autosummary/generate.py index 1ef6628ac..a36eb3161 100644 --- a/sphinx/ext/autosummary/generate.py +++ b/sphinx/ext/autosummary/generate.py @@ -51,7 +51,7 @@ add_documenter(InstanceAttributeDocumenter) if False: # For type annotation - from typing import Any, Callable, Tuple, List # NOQA + from typing import Any, Callable, Dict, Tuple, List # NOQA from jinja2 import BaseLoader # NOQA from sphinx import addnodes # NOQA from sphinx.builders import Builder # NOQA diff --git a/sphinx/ext/coverage.py b/sphinx/ext/coverage.py index 1698f936b..3bf4ae2c4 100644 --- a/sphinx/ext/coverage.py +++ b/sphinx/ext/coverage.py @@ -25,7 +25,7 @@ from sphinx.util.inspect import safe_getattr if False: # For type annotation - from typing import Any, Callable, IO, Pattern, Tuple # NOQA + from typing import Any, Callable, Dict, IO, List, Pattern, Set, Tuple # NOQA from sphinx.application import Sphinx # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/ext/doctest.py b/sphinx/ext/doctest.py index 73ce1a87c..38c1844ea 100644 --- a/sphinx/ext/doctest.py +++ b/sphinx/ext/doctest.py @@ -35,7 +35,7 @@ from sphinx.locale import _ if False: # For type annotation - from typing import Any, Callable, IO, Iterable, Sequence, Tuple # NOQA + from typing import Any, Callable, Dict, IO, Iterable, List, Sequence, Set, Tuple # NOQA from sphinx.application import Sphinx # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/ext/graphviz.py b/sphinx/ext/graphviz.py index 7df115ea0..bb8d76e21 100644 --- a/sphinx/ext/graphviz.py +++ b/sphinx/ext/graphviz.py @@ -32,7 +32,7 @@ from sphinx.util.osutil import ensuredir, ENOENT, EPIPE, EINVAL if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/ext/ifconfig.py b/sphinx/ext/ifconfig.py index 430cc9325..eb50002ed 100644 --- a/sphinx/ext/ifconfig.py +++ b/sphinx/ext/ifconfig.py @@ -28,7 +28,7 @@ from sphinx.util.nodes import set_source_info if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, List # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/ext/imgmath.py b/sphinx/ext/imgmath.py index 7b817d615..c95df0f37 100644 --- a/sphinx/ext/imgmath.py +++ b/sphinx/ext/imgmath.py @@ -33,7 +33,7 @@ from sphinx.ext.mathbase import setup_math as mathbase_setup, wrap_displaymath if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.ext.mathbase import math as math_node, displaymath # NOQA diff --git a/sphinx/ext/inheritance_diagram.py b/sphinx/ext/inheritance_diagram.py index 3b23c845a..5ca939f93 100644 --- a/sphinx/ext/inheritance_diagram.py +++ b/sphinx/ext/inheritance_diagram.py @@ -45,7 +45,7 @@ except ImportError: from md5 import md5 # type: ignore from six import text_type -from six.moves import builtins # type: ignore +from six.moves import builtins from docutils import nodes from docutils.parsers.rst import Directive, directives @@ -58,7 +58,7 @@ from sphinx.util import force_decode if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index 4c8941134..246d69626 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -47,7 +47,7 @@ from sphinx.util import requests, logging if False: # For type annotation - from typing import Any, Callable, Dict, IO, Iterator, Tuple, Union # NOQA + from typing import Any, Callable, Dict, IO, Iterator, List, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.config import Config # NOQA from sphinx.environment import BuildEnvironment # NOQA @@ -173,6 +173,8 @@ def read_inventory(f, uri, join, bufsize=16 * 1024): return read_inventory_v1(f, uri, join) elif line == '# Sphinx inventory version 2': return read_inventory_v2(f, uri, join, bufsize=bufsize) + else: + raise ValueError('unknown inventory header: %s' % line) def _strip_basic_auth(url): diff --git a/sphinx/ext/linkcode.py b/sphinx/ext/linkcode.py index a9693299e..db8f2ea71 100644 --- a/sphinx/ext/linkcode.py +++ b/sphinx/ext/linkcode.py @@ -18,7 +18,7 @@ from sphinx.errors import SphinxError if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, Set # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/ext/mathbase.py b/sphinx/ext/mathbase.py index 4e12f62f7..299b4bf9a 100644 --- a/sphinx/ext/mathbase.py +++ b/sphinx/ext/mathbase.py @@ -19,7 +19,7 @@ from sphinx.util.nodes import make_refnode, set_source_info if False: # For type annotation - from typing import Any, Callable, Iterable, Tuple # NOQA + from typing import Any, Callable, Dict, Iterable, List, Tuple # NOQA from docutils.parsers.rst.states import Inliner # NOQA from sphinx.application import Sphinx # NOQA from sphinx.builders import Builder # NOQA diff --git a/sphinx/ext/napoleon/__init__.py b/sphinx/ext/napoleon/__init__.py index 118316f07..87005736f 100644 --- a/sphinx/ext/napoleon/__init__.py +++ b/sphinx/ext/napoleon/__init__.py @@ -19,7 +19,7 @@ from sphinx.ext.napoleon.docstring import GoogleDocstring, NumpyDocstring if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict, List # NOQA class Config(object): diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py index c5736b8ec..704d94ff4 100644 --- a/sphinx/ext/napoleon/docstring.py +++ b/sphinx/ext/napoleon/docstring.py @@ -23,7 +23,7 @@ from sphinx.util.pycompat import UnicodeMixin if False: # For type annotation - from typing import Any, Callable, Tuple, Union # NOQA + from typing import Any, Callable, Dict, List, Tuple, Union # NOQA from sphinx.application import Sphinx # NOQA from sphinx.config import Config as SphinxConfig # NOQA @@ -234,9 +234,9 @@ class GoogleDocstring(UnicodeMixin): if prefer_type and not _type: _type, _name = _name, _type indent = self._get_indent(line) + 1 - _desc = [_desc] + self._dedent(self._consume_indented_block(indent)) # type: ignore - _desc = self.__class__(_desc, self._config).lines() - return _name, _type, _desc # type: ignore + _descs = [_desc] + self._dedent(self._consume_indented_block(indent)) + _descs = self.__class__(_descs, self._config).lines() + return _name, _type, _descs def _consume_fields(self, parse_type=True, prefer_type=False): # type: (bool, bool) -> List[Tuple[unicode, unicode, List[unicode]]] @@ -254,9 +254,9 @@ class GoogleDocstring(UnicodeMixin): _type, colon, _desc = self._partition_field_on_colon(line) if not colon: _type, _desc = _desc, _type - _desc = [_desc] + self._dedent(self._consume_to_end()) # type: ignore - _desc = self.__class__(_desc, self._config).lines() - return _type, _desc # type: ignore + _descs = [_desc] + self._dedent(self._consume_to_end()) + _descs = self.__class__(_descs, self._config).lines() + return _type, _descs def _consume_returns_section(self): # type: () -> List[Tuple[unicode, unicode, List[unicode]]] @@ -326,13 +326,13 @@ class GoogleDocstring(UnicodeMixin): def _fix_field_desc(self, desc): # type: (List[unicode]) -> List[unicode] if self._is_list(desc): - desc = [''] + desc # type: ignore + desc = [u''] + desc elif desc[0].endswith('::'): desc_block = desc[1:] indent = self._get_indent(desc[0]) block_indent = self._get_initial_indent(desc_block) if block_indent > indent: - desc = [''] + desc # type: ignore + desc = [u''] + desc else: desc = ['', desc[0]] + self._indent(desc_block, 4) return desc @@ -344,9 +344,9 @@ class GoogleDocstring(UnicodeMixin): return ['.. %s:: %s' % (admonition, lines[0].strip()), ''] elif lines: lines = self._indent(self._dedent(lines), 3) - return ['.. %s::' % admonition, ''] + lines + [''] # type: ignore + return [u'.. %s::' % admonition, u''] + lines + [u''] else: - return ['.. %s::' % admonition, ''] + return [u'.. %s::' % admonition, u''] def _format_block(self, prefix, lines, padding=None): # type: (unicode, List[unicode], unicode) -> List[unicode] @@ -566,8 +566,8 @@ class GoogleDocstring(UnicodeMixin): lines.append(':vartype %s: %s' % (_name, _type)) else: lines.extend(['.. attribute:: ' + _name, '']) - field = self._format_field('', _type, _desc) # type: ignore - lines.extend(self._indent(field, 3)) # type: ignore + fields = self._format_field('', _type, _desc) + lines.extend(self._indent(fields, 3)) lines.append('') if self._config.napoleon_use_ivar: lines.append('') @@ -617,7 +617,7 @@ class GoogleDocstring(UnicodeMixin): for _name, _, _desc in self._consume_fields(parse_type=False): lines.append('.. method:: %s' % _name) if _desc: - lines.extend([''] + self._indent(_desc, 3)) # type: ignore + lines.extend([u''] + self._indent(_desc, 3)) lines.append('') return lines diff --git a/sphinx/ext/pngmath.py b/sphinx/ext/pngmath.py index 98a4d2513..4b1743e51 100644 --- a/sphinx/ext/pngmath.py +++ b/sphinx/ext/pngmath.py @@ -33,7 +33,7 @@ from sphinx.ext.mathbase import setup_math as mathbase_setup, wrap_displaymath if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.ext.mathbase import math as math_node, displaymath # NOQA diff --git a/sphinx/ext/todo.py b/sphinx/ext/todo.py index 430135721..98bd24ee7 100644 --- a/sphinx/ext/todo.py +++ b/sphinx/ext/todo.py @@ -25,7 +25,7 @@ from docutils.parsers.rst.directives.admonitions import BaseAdmonition if False: # For type annotation - from typing import Any, Iterable # NOQA + from typing import Any, Dict, Iterable, List # NOQA from sphinx.application import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py index c6b666a0a..0a4738b09 100644 --- a/sphinx/ext/viewcode.py +++ b/sphinx/ext/viewcode.py @@ -24,7 +24,7 @@ from sphinx.util.nodes import make_refnode if False: # For type annotation - from typing import Any, Iterable, Iterator, Tuple # NOQA + from typing import Any, Dict, Iterable, Iterator, Set, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/highlighting.py b/sphinx/highlighting.py index 8996fb4a4..6c0cf8aee 100644 --- a/sphinx/highlighting.py +++ b/sphinx/highlighting.py @@ -29,7 +29,7 @@ from sphinx.pygments_styles import SphinxStyle, NoneStyle if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict # NOQA from pygments.formatter import Formatter # NOQA diff --git a/sphinx/io.py b/sphinx/io.py index 52b5b1729..2e1e25599 100644 --- a/sphinx/io.py +++ b/sphinx/io.py @@ -28,7 +28,7 @@ from sphinx.util.docutils import LoggingReporter if False: # For type annotation - from typing import Any, Tuple, Union # NOQA + from typing import Any, Dict, List, Tuple, Union # NOQA from docutils import nodes # NOQA from docutils.io import Input # NOQA from docutils.parsers import Parser # NOQA diff --git a/sphinx/jinja2glue.py b/sphinx/jinja2glue.py index f85bd77e7..4c783ad24 100644 --- a/sphinx/jinja2glue.py +++ b/sphinx/jinja2glue.py @@ -24,7 +24,7 @@ from sphinx.util.osutil import mtimes_of_files if False: # For type annotation - from typing import Any, Callable, Iterator, Tuple # NOQA + from typing import Any, Callable, Dict, List, Iterator, Tuple # NOQA from jinja2.environment import Environment # NOQA from sphinx.builders import Builder # NOQA from sphinx.themes import Theme # NOQA diff --git a/sphinx/locale/__init__.py b/sphinx/locale/__init__.py index f814b665c..6c112b6df 100644 --- a/sphinx/locale/__init__.py +++ b/sphinx/locale/__init__.py @@ -16,7 +16,7 @@ from six.moves import UserString if False: # For type annotation - from typing import Any, Callable, Iterator, Tuple # NOQA + from typing import Any, Callable, Dict, Iterator, List, Tuple # NOQA class _TranslationProxy(UserString, object): diff --git a/sphinx/make_mode.py b/sphinx/make_mode.py index 4f55d71aa..2eaed2797 100644 --- a/sphinx/make_mode.py +++ b/sphinx/make_mode.py @@ -25,6 +25,10 @@ from sphinx import cmdline from sphinx.util.console import bold, blue # type: ignore from sphinx.util.osutil import cd, rmtree +if False: + # For type annotation + from typing import List # NOQA + proj_name = os.getenv('SPHINXPROJ', '<project>') @@ -79,6 +83,7 @@ class Make(object): print("Removing everything under %r..." % self.builddir) for item in os.listdir(self.builddir): rmtree(self.builddir_join(item)) + return 0 def build_help(self): # type: () -> None @@ -94,6 +99,7 @@ class Make(object): return 1 print() print('Build finished. The HTML pages are in %s.' % self.builddir_join('html')) + return 0 def build_dirhtml(self): # type: () -> int @@ -102,6 +108,7 @@ class Make(object): print() print('Build finished. The HTML pages are in %s.' % self.builddir_join('dirhtml')) + return 0 def build_singlehtml(self): # type: () -> int @@ -110,6 +117,7 @@ class Make(object): print() print('Build finished. The HTML page is in %s.' % self.builddir_join('singlehtml')) + return 0 def build_pickle(self): # type: () -> int @@ -117,6 +125,7 @@ class Make(object): return 1 print() print('Build finished; now you can process the pickle files.') + return 0 def build_json(self): # type: () -> int @@ -124,6 +133,7 @@ class Make(object): return 1 print() print('Build finished; now you can process the JSON files.') + return 0 def build_htmlhelp(self): # type: () -> int @@ -132,6 +142,7 @@ class Make(object): print() print('Build finished; now you can run HTML Help Workshop with the ' '.hhp project file in %s.' % self.builddir_join('htmlhelp')) + return 0 def build_qthelp(self): # type: () -> int @@ -144,6 +155,7 @@ class Make(object): print('To view the help file:') print('$ assistant -collectionFile %s.qhc' % self.builddir_join('qthelp', proj_name)) + return 0 def build_devhelp(self): # type: () -> int @@ -156,6 +168,7 @@ class Make(object): print("$ ln -s %s $HOME/.local/share/devhelp/%s" % (self.builddir_join('devhelp'), proj_name)) print("$ devhelp") + return 0 def build_epub(self): # type: () -> int @@ -163,6 +176,7 @@ class Make(object): return 1 print() print('Build finished. The ePub file is in %s.' % self.builddir_join('epub')) + return 0 def build_latex(self): # type: () -> int @@ -172,6 +186,7 @@ class Make(object): if os.name == 'posix': print("Run `make' in that directory to run these through (pdf)latex") print("(use `make latexpdf' here to do that automatically).") + return 0 def build_latexpdf(self): # type: () -> int @@ -179,6 +194,7 @@ class Make(object): return 1 with cd(self.builddir_join('latex')): os.system('%s all-pdf' % self.makecmd) + return 0 def build_latexpdfja(self): # type: () -> int @@ -186,6 +202,7 @@ class Make(object): return 1 with cd(self.builddir_join('latex')): os.system('%s all-pdf-ja' % self.makecmd) + return 0 def build_text(self): # type: () -> int @@ -193,6 +210,7 @@ class Make(object): return 1 print() print('Build finished. The text files are in %s.' % self.builddir_join('text')) + return 0 def build_texinfo(self): # type: () -> int @@ -203,6 +221,7 @@ class Make(object): if os.name == 'posix': print("Run `make' in that directory to run these through makeinfo") print("(use `make info' here to do that automatically).") + return 0 def build_info(self): # type: () -> int @@ -210,6 +229,7 @@ class Make(object): return 1 with cd(self.builddir_join('texinfo')): os.system('%s info' % self.makecmd) + return 0 def build_gettext(self): # type: () -> int @@ -219,6 +239,7 @@ class Make(object): print() print('Build finished. The message catalogs are in %s.' % self.builddir_join('gettext')) + return 0 def build_changes(self): # type: () -> int @@ -227,6 +248,7 @@ class Make(object): print() print('Build finished. The overview file is in %s.' % self.builddir_join('changes')) + return 0 def build_linkcheck(self): # type: () -> int @@ -251,6 +273,7 @@ class Make(object): print() print("Testing of coverage in the sources finished, look at the " "results in %s." % self.builddir_join('coverage')) + return 0 def build_xml(self): # type: () -> int @@ -258,6 +281,7 @@ class Make(object): return 1 print() print('Build finished. The XML files are in %s.' % self.builddir_join('xml')) + return 0 def build_pseudoxml(self): # type: () -> int @@ -266,6 +290,7 @@ class Make(object): print() print('Build finished. The pseudo-XML files are in %s.' % self.builddir_join('pseudoxml')) + return 0 def run_generic_build(self, builder, doctreedir=None): # type: (unicode, unicode) -> int diff --git a/sphinx/pycode/__init__.py b/sphinx/pycode/__init__.py index d7c81e6f0..48c62ecf7 100644 --- a/sphinx/pycode/__init__.py +++ b/sphinx/pycode/__init__.py @@ -26,7 +26,7 @@ from sphinx.util.docstrings import prepare_docstring, prepare_commentdoc if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA # load the Python grammar diff --git a/sphinx/pycode/nodes.py b/sphinx/pycode/nodes.py index 099fc2cf2..b4b681d78 100644 --- a/sphinx/pycode/nodes.py +++ b/sphinx/pycode/nodes.py @@ -9,6 +9,10 @@ :license: BSD, see LICENSE for details. """ +if False: + # For type annotation + from typing import Callable # NOQA + class BaseNode(object): """ @@ -29,7 +33,7 @@ class BaseNode(object): return NotImplemented return not self._eq(other) - __hash__ = None # type: str + __hash__ = None # type: Callable[[object], int] def get_prev_sibling(self): """Return previous child in parent's children, or None.""" diff --git a/sphinx/pycode/pgen2/grammar.py b/sphinx/pycode/pgen2/grammar.py index cd6a435d5..ac276776e 100644 --- a/sphinx/pycode/pgen2/grammar.py +++ b/sphinx/pycode/pgen2/grammar.py @@ -21,7 +21,7 @@ from sphinx.pycode.pgen2 import token if False: # For type annotation - from typing import Tuple # NOQA + from typing import Dict, List, Tuple # NOQA class Grammar(object): diff --git a/sphinx/pycode/pgen2/parse.py b/sphinx/pycode/pgen2/parse.py index 43b88b519..660a47e68 100644 --- a/sphinx/pycode/pgen2/parse.py +++ b/sphinx/pycode/pgen2/parse.py @@ -15,7 +15,7 @@ from sphinx.pycode.pgen2 import token if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, List, Set, Tuple # NOQA class ParseError(Exception): """Exception to signal the parser is stuck.""" diff --git a/sphinx/pycode/pgen2/pgen.py b/sphinx/pycode/pgen2/pgen.py index 0106763d0..8d9cc786a 100644 --- a/sphinx/pycode/pgen2/pgen.py +++ b/sphinx/pycode/pgen2/pgen.py @@ -11,7 +11,7 @@ from sphinx.pycode.pgen2 import grammar, token, tokenize if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA class PgenGrammar(grammar.Grammar): diff --git a/sphinx/pycode/pgen2/tokenize.py b/sphinx/pycode/pgen2/tokenize.py index cbe64a581..8b533d422 100644 --- a/sphinx/pycode/pgen2/tokenize.py +++ b/sphinx/pycode/pgen2/tokenize.py @@ -37,6 +37,10 @@ from six import PY3 from sphinx.pycode.pgen2.token import * from sphinx.pycode.pgen2 import token +if False: + # For type annotation + from typing import List # NOQA + __all__ = [x for x in dir(token) if x[0] != '_'] + ["tokenize", "generate_tokens", "untokenize"] del token diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index c599f079a..0280e1e1f 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -44,7 +44,7 @@ from sphinx.util import texescape if False: # For type annotation - from typing import Any, Callable, Pattern # NOQA + from typing import Any, Callable, Dict, List, Pattern # NOQA TERM_ENCODING = getattr(sys.stdin, 'encoding', None) @@ -108,11 +108,11 @@ def nonempty(x): def choice(*l): - # type: (List[unicode]) -> Callable[[unicode], unicode] + # type: (unicode) -> Callable[[unicode], unicode] def val(x): # type: (unicode) -> unicode if x not in l: - raise ValidationError('Please enter one of %s.' % ', '.join(l)) # type: ignore + raise ValidationError('Please enter one of %s.' % ', '.join(l)) return x return val @@ -708,6 +708,7 @@ def main(argv=sys.argv): print('Invalid template variable: %s' % variable) generate(d, templatedir=opts.templatedir) + return 0 if __name__ == '__main__': diff --git a/sphinx/roles.py b/sphinx/roles.py index eb37b7ac7..fc1826535 100644 --- a/sphinx/roles.py +++ b/sphinx/roles.py @@ -23,7 +23,7 @@ from sphinx.util.nodes import split_explicit_title, process_index_entry, \ if False: # For type annotation - from typing import Any, Tuple, Type # NOQA + from typing import Any, Dict, List, Tuple, Type # NOQA from docutils.parsers.rst.states import Inliner # NOQA from sphinx.application import Sphinx # NOQA from sphinx.environment import BuildEnvironment # NOQA @@ -180,8 +180,7 @@ class AnyXRefRole(XRefRole): return result -def indexmarkup_role(typ, rawtext, text, lineno, inliner, - options={}, content=[]): +def indexmarkup_role(typ, rawtext, text, lineno, inliner, options={}, content=[]): # type: (unicode, unicode, unicode, int, Inliner, Dict, List[unicode]) -> Tuple[List[nodes.Node], List[nodes.Node]] # NOQA """Role for PEP/RFC references that generate an index entry.""" env = inliner.document.settings.env @@ -241,6 +240,8 @@ def indexmarkup_role(typ, rawtext, text, lineno, inliner, classes=[typ]) rn += sn return [indexnode, targetnode, rn], [] + else: + raise ValueError('unknown role type: %s' % typ) _amp_re = re.compile(r'(?<!&)&(?![&\s])') diff --git a/sphinx/search/__init__.py b/sphinx/search/__init__.py index 976225aea..83b2953b7 100644 --- a/sphinx/search/__init__.py +++ b/sphinx/search/__init__.py @@ -23,7 +23,7 @@ from sphinx.search.jssplitter import splitter_code if False: # For type annotation - from typing import Any, IO, Iterable, Tuple, Type # NOQA + from typing import Any, Dict, IO, Iterable, List, Tuple, Type, Set # NOQA from docutils import nodes # NOQA from sphinx.environment import BuildEnvironment # NOQA @@ -63,7 +63,7 @@ var Stemmer = function() { return w; } } -""" +""" # type: unicode _word_re = re.compile(r'\w+(?u)') @@ -287,7 +287,7 @@ class IndexBuilder(object): # type: (IO, Any) -> None """Reconstruct from frozen data.""" if isinstance(format, string_types): - format = self.formats[format] # type: ignore + format = self.formats[format] frozen = format.load(stream) # if an old index is present, we treat it as not existing. if not isinstance(frozen, dict) or \ @@ -315,7 +315,7 @@ class IndexBuilder(object): # type: (IO, Any) -> None """Dump the frozen index to a stream.""" if isinstance(format, string_types): - format = self.formats[format] # type: ignore + format = self.formats[format] format.dump(self.freeze(), stream) def get_objects(self, fn2index): @@ -456,3 +456,5 @@ class IndexBuilder(object): 'non-minified-js', self.lang.js_stemmer_rawcode ) + else: + return None diff --git a/sphinx/search/en.py b/sphinx/search/en.py index c6658ffdc..fbee9ba60 100644 --- a/sphinx/search/en.py +++ b/sphinx/search/en.py @@ -12,7 +12,11 @@ from sphinx.search import SearchLanguage from sphinx.util.stemmer import get_stemmer -english_stopwords = set(""" +if False: + # For type annotation + from typing import Dict # NOQA + +english_stopwords = set(u""" a and are as at be but by for diff --git a/sphinx/search/ja.py b/sphinx/search/ja.py index cf3b67c00..3677b76f3 100644 --- a/sphinx/search/ja.py +++ b/sphinx/search/ja.py @@ -39,6 +39,10 @@ from sphinx.errors import SphinxError, ExtensionError from sphinx.search import SearchLanguage from sphinx.util import import_object +if False: + # For type annotation + from typing import Dict, List # NOQA + class BaseSplitter(object): diff --git a/sphinx/search/ro.py b/sphinx/search/ro.py index f44f38e34..b4beced2d 100644 --- a/sphinx/search/ro.py +++ b/sphinx/search/ro.py @@ -13,6 +13,10 @@ from sphinx.search import SearchLanguage import snowballstemmer +if False: + # For type annotation + from typing import Dict, Set # NOQA + js_stemmer = u""" var JSX={};(function(j){function l(b,e){var a=function(){};a.prototype=e.prototype;var c=new a;for(var d in b){b[d].prototype=c}}function L(c,b){for(var a in b.prototype)if(b.prototype.hasOwnProperty(a))c.prototype[a]=b.prototype[a]}function h(a,b,d){function c(a,b,c){delete a[b];a[b]=c;return c}Object.defineProperty(a,b,{get:function(){return c(a,b,d())},set:function(d){c(a,b,d)},enumerable:true,configurable:true})}function M(a,b,c){return a[b]=a[b]/c|0}var E=parseInt;var C=parseFloat;function N(a){return a!==a}var A=isFinite;var z=encodeURIComponent;var y=decodeURIComponent;var x=encodeURI;var w=decodeURI;var u=Object.prototype.toString;var D=Object.prototype.hasOwnProperty;function k(){}j.require=function(b){var a=r[b];return a!==undefined?a:null};j.profilerIsRunning=function(){return k.getResults!=null};j.getProfileResults=function(){return(k.getResults||function(){return{}})()};j.postProfileResults=function(a,b){if(k.postResults==null)throw new Error('profiler has not been turned on');return k.postResults(a,b)};j.resetProfileResults=function(){if(k.resetResults==null)throw new Error('profiler has not been turned on');return k.resetResults()};j.DEBUG=false;function t(){};l([t],Error);function a(a,b,c){this.F=a.length;this.K=a;this.L=b;this.I=c;this.H=null;this.P=null};l([a],Object);function n(){};l([n],Object);function g(){var a;var b;var c;this.G={};a=this.E='';b=this._=0;c=this.A=a.length;this.D=0;this.B=b;this.C=c};l([g],n);function v(a,b){a.E=b.E;a._=b._;a.A=b.A;a.D=b.D;a.B=b.B;a.C=b.C};function d(b,d,c,e){var a;if(b._>=b.A){return false}a=b.E.charCodeAt(b._);if(a>e||a<c){return false}a-=c;if((d[a>>>3]&1<<(a&7))===0){return false}b._++;return true};function e(a,d,c,e){var b;if(a._>=a.A){return false}b=a.E.charCodeAt(a._);if(b>e||b<c){a._++;return true}b-=c;if((d[b>>>3]&1<<(b&7))===0){a._++;return true}return false};function p(a,d,c,e){var b;if(a._<=a.D){return false}b=a.E.charCodeAt(a._-1);if(b>e||b<c){a._--;return true}b-=c;if((d[b>>>3]&1<<(b&7))===0){a._--;return true}return false};function m(a,b,d){var c;if(a.A-a._<b){return false}if(a.E.slice(c=a._,c+b)!==d){return false}a._+=b;return true};function i(a,b,d){var c;if(a._-a.D<b){return false}if(a.E.slice((c=a._)-b,c)!==d){return false}a._-=b;return true};function q(f,m,p){var b;var d;var e;var n;var g;var k;var l;var i;var h;var c;var a;var j;var o;b=0;d=p;e=f._;n=f.A;g=0;k=0;l=false;while(true){i=b+(d-b>>>1);h=0;c=g<k?g:k;a=m[i];for(j=c;j<a.F;j++){if(e+c===n){h=-1;break}h=f.E.charCodeAt(e+c)-a.K.charCodeAt(j);if(h!==0){break}c++}if(h<0){d=i;k=c}else{b=i;g=c}if(d-b<=1){if(b>0){break}if(d===b){break}if(l){break}l=true}}while(true){a=m[b];if(g>=a.F){f._=e+a.F|0;if(a.H==null){return a.I}o=a.H(a.P);f._=e+a.F|0;if(o){return a.I}}b=a.L;if(b<0){return 0}}return-1};function f(d,m,p){var b;var g;var e;var n;var f;var k;var l;var i;var h;var c;var a;var j;var o;b=0;g=p;e=d._;n=d.D;f=0;k=0;l=false;while(true){i=b+(g-b>>1);h=0;c=f<k?f:k;a=m[i];for(j=a.F-1-c;j>=0;j--){if(e-c===n){h=-1;break}h=d.E.charCodeAt(e-1-c)-a.K.charCodeAt(j);if(h!==0){break}c++}if(h<0){g=i;k=c}else{b=i;f=c}if(g-b<=1){if(b>0){break}if(g===b){break}if(l){break}l=true}}while(true){a=m[b];if(f>=a.F){d._=e-a.F|0;if(a.H==null){return a.I}o=a.H(d);d._=e-a.F|0;if(o){return a.I}}b=a.L;if(b<0){return 0}}return-1};function s(a,b,d,e){var c;c=e.length-(d-b);a.E=a.E.slice(0,b)+e+a.E.slice(d);a.A+=c|0;if(a._>=d){a._+=c|0}else if(a._>b){a._=b}return c|0};function c(a,f){var b;var c;var d;var e;b=false;if((c=a.B)<0||c>(d=a.C)||d>(e=a.A)||e>a.E.length?false:true){s(a,a.B,a.C,f);b=true}return b};g.prototype.J=function(){return false};g.prototype.b=function(b){var a;var c;var d;var e;a=this.G['.'+b];if(a==null){c=this.E=b;d=this._=0;e=this.A=c.length;this.D=0;this.B=d;this.C=e;this.J();a=this.E;this.G['.'+b]=a}return a};g.prototype.stemWord=g.prototype.b;g.prototype.c=function(e){var d;var b;var c;var a;var f;var g;var h;d=[];for(b=0;b<e.length;b++){c=e[b];a=this.G['.'+c];if(a==null){f=this.E=c;g=this._=0;h=this.A=f.length;this.D=0;this.B=g;this.C=h;this.J();a=this.E;this.G['.'+c]=a}d.push(a)}return d};g.prototype.stemWords=g.prototype.c;function b(){g.call(this);this.B_standard_suffix_removed=false;this.I_p2=0;this.I_p1=0;this.I_pV=0};l([b],g);b.prototype.M=function(a){this.B_standard_suffix_removed=a.B_standard_suffix_removed;this.I_p2=a.I_p2;this.I_p1=a.I_p1;this.I_pV=a.I_pV;v(this,a)};b.prototype.copy_from=b.prototype.M;b.prototype.W=function(){var i;var a;var j;var e;var f;var g;var h;var k;b:while(true){i=this._;e=true;d:while(e===true){e=false;e:while(true){a=this._;f=true;a:while(f===true){f=false;if(!d(this,b.g_v,97,259)){break a}this.B=this._;g=true;f:while(g===true){g=false;j=this._;h=true;c:while(h===true){h=false;if(!m(this,1,'u')){break c}this.C=this._;if(!d(this,b.g_v,97,259)){break c}if(!c(this,'U')){return false}break f}this._=j;if(!m(this,1,'i')){break a}this.C=this._;if(!d(this,b.g_v,97,259)){break a}if(!c(this,'I')){return false}}this._=a;break e}k=this._=a;if(k>=this.A){break d}this._++}continue b}this._=i;break b}return true};b.prototype.r_prelude=b.prototype.W;function G(a){var j;var e;var k;var f;var g;var h;var i;var l;b:while(true){j=a._;f=true;d:while(f===true){f=false;e:while(true){e=a._;g=true;a:while(g===true){g=false;if(!d(a,b.g_v,97,259)){break a}a.B=a._;h=true;f:while(h===true){h=false;k=a._;i=true;c:while(i===true){i=false;if(!m(a,1,'u')){break c}a.C=a._;if(!d(a,b.g_v,97,259)){break c}if(!c(a,'U')){return false}break f}a._=k;if(!m(a,1,'i')){break a}a.C=a._;if(!d(a,b.g_v,97,259)){break a}if(!c(a,'I')){return false}}a._=e;break e}l=a._=e;if(l>=a.A){break d}a._++}continue b}a._=j;break b}return true};b.prototype.U=function(){var u;var w;var x;var y;var t;var l;var f;var g;var h;var i;var c;var j;var k;var a;var m;var n;var o;var p;var q;var r;var s;var v;this.I_pV=s=this.A;this.I_p1=s;this.I_p2=s;u=this._;l=true;a:while(l===true){l=false;f=true;g:while(f===true){f=false;w=this._;g=true;b:while(g===true){g=false;if(!d(this,b.g_v,97,259)){break b}h=true;f:while(h===true){h=false;x=this._;i=true;c:while(i===true){i=false;if(!e(this,b.g_v,97,259)){break c}d:while(true){c=true;e:while(c===true){c=false;if(!d(this,b.g_v,97,259)){break e}break d}if(this._>=this.A){break c}this._++}break f}this._=x;if(!d(this,b.g_v,97,259)){break b}c:while(true){j=true;d:while(j===true){j=false;if(!e(this,b.g_v,97,259)){break d}break c}if(this._>=this.A){break b}this._++}}break g}this._=w;if(!e(this,b.g_v,97,259)){break a}k=true;c:while(k===true){k=false;y=this._;a=true;b:while(a===true){a=false;if(!e(this,b.g_v,97,259)){break b}e:while(true){m=true;d:while(m===true){m=false;if(!d(this,b.g_v,97,259)){break d}break e}if(this._>=this.A){break b}this._++}break c}this._=y;if(!d(this,b.g_v,97,259)){break a}if(this._>=this.A){break a}this._++}}this.I_pV=this._}v=this._=u;t=v;n=true;a:while(n===true){n=false;b:while(true){o=true;c:while(o===true){o=false;if(!d(this,b.g_v,97,259)){break c}break b}if(this._>=this.A){break a}this._++}b:while(true){p=true;c:while(p===true){p=false;if(!e(this,b.g_v,97,259)){break c}break b}if(this._>=this.A){break a}this._++}this.I_p1=this._;b:while(true){q=true;c:while(q===true){q=false;if(!d(this,b.g_v,97,259)){break c}break b}if(this._>=this.A){break a}this._++}c:while(true){r=true;b:while(r===true){r=false;if(!e(this,b.g_v,97,259)){break b}break c}if(this._>=this.A){break a}this._++}this.I_p2=this._}this._=t;return true};b.prototype.r_mark_regions=b.prototype.U;function H(a){var x;var y;var z;var u;var v;var l;var f;var g;var h;var i;var j;var k;var c;var m;var n;var o;var p;var q;var r;var s;var t;var w;a.I_pV=t=a.A;a.I_p1=t;a.I_p2=t;x=a._;l=true;a:while(l===true){l=false;f=true;g:while(f===true){f=false;y=a._;g=true;b:while(g===true){g=false;if(!d(a,b.g_v,97,259)){break b}h=true;f:while(h===true){h=false;z=a._;i=true;c:while(i===true){i=false;if(!e(a,b.g_v,97,259)){break c}d:while(true){j=true;e:while(j===true){j=false;if(!d(a,b.g_v,97,259)){break e}break d}if(a._>=a.A){break c}a._++}break f}a._=z;if(!d(a,b.g_v,97,259)){break b}c:while(true){k=true;d:while(k===true){k=false;if(!e(a,b.g_v,97,259)){break d}break c}if(a._>=a.A){break b}a._++}}break g}a._=y;if(!e(a,b.g_v,97,259)){break a}c=true;c:while(c===true){c=false;u=a._;m=true;b:while(m===true){m=false;if(!e(a,b.g_v,97,259)){break b}e:while(true){n=true;d:while(n===true){n=false;if(!d(a,b.g_v,97,259)){break d}break e}if(a._>=a.A){break b}a._++}break c}a._=u;if(!d(a,b.g_v,97,259)){break a}if(a._>=a.A){break a}a._++}}a.I_pV=a._}w=a._=x;v=w;o=true;a:while(o===true){o=false;b:while(true){p=true;c:while(p===true){p=false;if(!d(a,b.g_v,97,259)){break c}break b}if(a._>=a.A){break a}a._++}b:while(true){q=true;c:while(q===true){q=false;if(!e(a,b.g_v,97,259)){break c}break b}if(a._>=a.A){break a}a._++}a.I_p1=a._;b:while(true){r=true;c:while(r===true){r=false;if(!d(a,b.g_v,97,259)){break c}break b}if(a._>=a.A){break a}a._++}c:while(true){s=true;b:while(s===true){s=false;if(!e(a,b.g_v,97,259)){break b}break c}if(a._>=a.A){break a}a._++}a.I_p2=a._}a._=v;return true};b.prototype.V=function(){var a;var e;var d;b:while(true){e=this._;d=true;a:while(d===true){d=false;this.B=this._;a=q(this,b.a_0,3);if(a===0){break a}this.C=this._;switch(a){case 0:break a;case 1:if(!c(this,'i')){return false}break;case 2:if(!c(this,'u')){return false}break;case 3:if(this._>=this.A){break a}this._++;break}continue b}this._=e;break b}return true};b.prototype.r_postlude=b.prototype.V;function I(a){var d;var f;var e;b:while(true){f=a._;e=true;a:while(e===true){e=false;a.B=a._;d=q(a,b.a_0,3);if(d===0){break a}a.C=a._;switch(d){case 0:break a;case 1:if(!c(a,'i')){return false}break;case 2:if(!c(a,'u')){return false}break;case 3:if(a._>=a.A){break a}a._++;break}continue b}a._=f;break b}return true};b.prototype.S=function(){return!(this.I_pV<=this._)?false:true};b.prototype.r_RV=b.prototype.S;b.prototype.Q=function(){return!(this.I_p1<=this._)?false:true};b.prototype.r_R1=b.prototype.Q;b.prototype.R=function(){return!(this.I_p2<=this._)?false:true};b.prototype.r_R2=b.prototype.R;b.prototype.Y=function(){var a;var e;var d;var g;this.C=this._;a=f(this,b.a_1,16);if(a===0){return false}this.B=g=this._;if(!(!(this.I_p1<=g)?false:true)){return false}switch(a){case 0:return false;case 1:if(!c(this,'')){return false}break;case 2:if(!c(this,'a')){return false}break;case 3:if(!c(this,'e')){return false}break;case 4:if(!c(this,'i')){return false}break;case 5:e=this.A-this._;d=true;a:while(d===true){d=false;if(!i(this,2,'ab')){break a}return false}this._=this.A-e;if(!c(this,'i')){return false}break;case 6:if(!c(this,'at')){return false}break;case 7:if(!c(this,'aţi')){return false}break}return true};b.prototype.r_step_0=b.prototype.Y;function J(a){var d;var g;var e;var h;a.C=a._;d=f(a,b.a_1,16);if(d===0){return false}a.B=h=a._;if(!(!(a.I_p1<=h)?false:true)){return false}switch(d){case 0:return false;case 1:if(!c(a,'')){return false}break;case 2:if(!c(a,'a')){return false}break;case 3:if(!c(a,'e')){return false}break;case 4:if(!c(a,'i')){return false}break;case 5:g=a.A-a._;e=true;a:while(e===true){e=false;if(!i(a,2,'ab')){break a}return false}a._=a.A-g;if(!c(a,'i')){return false}break;case 6:if(!c(a,'at')){return false}break;case 7:if(!c(a,'aţi')){return false}break}return true};b.prototype.T=function(){var a;var d;var e;var g;d=this.A-(e=this._);this.C=e;a=f(this,b.a_2,46);if(a===0){return false}this.B=g=this._;if(!(!(this.I_p1<=g)?false:true)){return false}switch(a){case 0:return false;case 1:if(!c(this,'abil')){return false}break;case 2:if(!c(this,'ibil')){return false}break;case 3:if(!c(this,'iv')){return false}break;case 4:if(!c(this,'ic')){return false}break;case 5:if(!c(this,'at')){return false}break;case 6:if(!c(this,'it')){return false}break}this.B_standard_suffix_removed=true;this._=this.A-d;return true};b.prototype.r_combo_suffix=b.prototype.T;function o(a){var d;var e;var g;var h;e=a.A-(g=a._);a.C=g;d=f(a,b.a_2,46);if(d===0){return false}a.B=h=a._;if(!(!(a.I_p1<=h)?false:true)){return false}switch(d){case 0:return false;case 1:if(!c(a,'abil')){return false}break;case 2:if(!c(a,'ibil')){return false}break;case 3:if(!c(a,'iv')){return false}break;case 4:if(!c(a,'ic')){return false}break;case 5:if(!c(a,'at')){return false}break;case 6:if(!c(a,'it')){return false}break}a.B_standard_suffix_removed=true;a._=a.A-e;return true};b.prototype.X=function(){var a;var e;var d;var g;this.B_standard_suffix_removed=false;a:while(true){e=this.A-this._;d=true;b:while(d===true){d=false;if(!o(this)){break b}continue a}this._=this.A-e;break a}this.C=this._;a=f(this,b.a_3,62);if(a===0){return false}this.B=g=this._;if(!(!(this.I_p2<=g)?false:true)){return false}switch(a){case 0:return false;case 1:if(!c(this,'')){return false}break;case 2:if(!i(this,1,'ţ')){return false}this.B=this._;if(!c(this,'t')){return false}break;case 3:if(!c(this,'ist')){return false}break}this.B_standard_suffix_removed=true;return true};b.prototype.r_standard_suffix=b.prototype.X;function K(a){var d;var g;var e;var h;a.B_standard_suffix_removed=false;a:while(true){g=a.A-a._;e=true;b:while(e===true){e=false;if(!o(a)){break b}continue a}a._=a.A-g;break a}a.C=a._;d=f(a,b.a_3,62);if(d===0){return false}a.B=h=a._;if(!(!(a.I_p2<=h)?false:true)){return false}switch(d){case 0:return false;case 1:if(!c(a,'')){return false}break;case 2:if(!i(a,1,'ţ')){return false}a.B=a._;if(!c(a,'t')){return false}break;case 3:if(!c(a,'ist')){return false}break}a.B_standard_suffix_removed=true;return true};b.prototype.Z=function(){var d;var h;var a;var j;var e;var g;var k;var l;var m;h=this.A-(k=this._);if(k<this.I_pV){return false}l=this._=this.I_pV;a=this.D;this.D=l;m=this._=this.A-h;this.C=m;d=f(this,b.a_4,94);if(d===0){this.D=a;return false}this.B=this._;switch(d){case 0:this.D=a;return false;case 1:e=true;a:while(e===true){e=false;j=this.A-this._;g=true;b:while(g===true){g=false;if(!p(this,b.g_v,97,259)){break b}break a}this._=this.A-j;if(!i(this,1,'u')){this.D=a;return false}}if(!c(this,'')){return false}break;case 2:if(!c(this,'')){return false}break}this.D=a;return true};b.prototype.r_verb_suffix=b.prototype.Z;function F(a){var e;var l;var d;var j;var g;var h;var m;var n;var k;l=a.A-(m=a._);if(m<a.I_pV){return false}n=a._=a.I_pV;d=a.D;a.D=n;k=a._=a.A-l;a.C=k;e=f(a,b.a_4,94);if(e===0){a.D=d;return false}a.B=a._;switch(e){case 0:a.D=d;return false;case 1:g=true;a:while(g===true){g=false;j=a.A-a._;h=true;b:while(h===true){h=false;if(!p(a,b.g_v,97,259)){break b}break a}a._=a.A-j;if(!i(a,1,'u')){a.D=d;return false}}if(!c(a,'')){return false}break;case 2:if(!c(a,'')){return false}break}a.D=d;return true};b.prototype.a=function(){var a;var d;this.C=this._;a=f(this,b.a_5,5);if(a===0){return false}this.B=d=this._;if(!(!(this.I_pV<=d)?false:true)){return false}switch(a){case 0:return false;case 1:if(!c(this,'')){return false}break}return true};b.prototype.r_vowel_suffix=b.prototype.a;function B(a){var d;var e;a.C=a._;d=f(a,b.a_5,5);if(d===0){return false}a.B=e=a._;if(!(!(a.I_pV<=e)?false:true)){return false}switch(d){case 0:return false;case 1:if(!c(a,'')){return false}break}return true};b.prototype.J=function(){var n;var j;var k;var l;var m;var o;var p;var b;var c;var d;var e;var f;var a;var g;var h;var i;var r;var s;var t;var u;var v;var w;var x;var y;var q;n=this._;b=true;a:while(b===true){b=false;if(!G(this)){break a}}r=this._=n;j=r;c=true;a:while(c===true){c=false;if(!H(this)){break a}}s=this._=j;this.D=s;u=this._=t=this.A;k=t-u;d=true;a:while(d===true){d=false;if(!J(this)){break a}}w=this._=(v=this.A)-k;l=v-w;e=true;a:while(e===true){e=false;if(!K(this)){break a}}y=this._=(x=this.A)-l;m=x-y;f=true;a:while(f===true){f=false;a=true;b:while(a===true){a=false;o=this.A-this._;g=true;c:while(g===true){g=false;if(!this.B_standard_suffix_removed){break c}break b}this._=this.A-o;if(!F(this)){break a}}}this._=this.A-m;h=true;a:while(h===true){h=false;if(!B(this)){break a}}q=this._=this.D;p=q;i=true;a:while(i===true){i=false;if(!I(this)){break a}}this._=p;return true};b.prototype.stem=b.prototype.J;b.prototype.N=function(a){return a instanceof b};b.prototype.equals=b.prototype.N;b.prototype.O=function(){var c;var a;var b;var d;c='RomanianStemmer';a=0;for(b=0;b<c.length;b++){d=c.charCodeAt(b);a=(a<<5)-a+d;a=a&a}return a|0};b.prototype.hashCode=b.prototype.O;b.serialVersionUID=1;h(b,'methodObject',function(){return new b});h(b,'a_0',function(){return[new a('',-1,3),new a('I',0,1),new a('U',0,2)]});h(b,'a_1',function(){return[new a('ea',-1,3),new a('aţia',-1,7),new a('aua',-1,2),new a('iua',-1,4),new a('aţie',-1,7),new a('ele',-1,3),new a('ile',-1,5),new a('iile',6,4),new a('iei',-1,4),new a('atei',-1,6),new a('ii',-1,4),new a('ului',-1,1),new a('ul',-1,1),new a('elor',-1,3),new a('ilor',-1,4),new a('iilor',14,4)]});h(b,'a_2',function(){return[new a('icala',-1,4),new a('iciva',-1,4),new a('ativa',-1,5),new a('itiva',-1,6),new a('icale',-1,4),new a('aţiune',-1,5),new a('iţiune',-1,6),new a('atoare',-1,5),new a('itoare',-1,6),new a('ătoare',-1,5),new a('icitate',-1,4),new a('abilitate',-1,1),new a('ibilitate',-1,2),new a('ivitate',-1,3),new a('icive',-1,4),new a('ative',-1,5),new a('itive',-1,6),new a('icali',-1,4),new a('atori',-1,5),new a('icatori',18,4),new a('itori',-1,6),new a('ători',-1,5),new a('icitati',-1,4),new a('abilitati',-1,1),new a('ivitati',-1,3),new a('icivi',-1,4),new a('ativi',-1,5),new a('itivi',-1,6),new a('icităi',-1,4),new a('abilităi',-1,1),new a('ivităi',-1,3),new a('icităţi',-1,4),new a('abilităţi',-1,1),new a('ivităţi',-1,3),new a('ical',-1,4),new a('ator',-1,5),new a('icator',35,4),new a('itor',-1,6),new a('ător',-1,5),new a('iciv',-1,4),new a('ativ',-1,5),new a('itiv',-1,6),new a('icală',-1,4),new a('icivă',-1,4),new a('ativă',-1,5),new a('itivă',-1,6)]});h(b,'a_3',function(){return[new a('ica',-1,1),new a('abila',-1,1),new a('ibila',-1,1),new a('oasa',-1,1),new a('ata',-1,1),new a('ita',-1,1),new a('anta',-1,1),new a('ista',-1,3),new a('uta',-1,1),new a('iva',-1,1),new a('ic',-1,1),new a('ice',-1,1),new a('abile',-1,1),new a('ibile',-1,1),new a('isme',-1,3),new a('iune',-1,2),new a('oase',-1,1),new a('ate',-1,1),new a('itate',17,1),new a('ite',-1,1),new a('ante',-1,1),new a('iste',-1,3),new a('ute',-1,1),new a('ive',-1,1),new a('ici',-1,1),new a('abili',-1,1),new a('ibili',-1,1),new a('iuni',-1,2),new a('atori',-1,1),new a('osi',-1,1),new a('ati',-1,1),new a('itati',30,1),new a('iti',-1,1),new a('anti',-1,1),new a('isti',-1,3),new a('uti',-1,1),new a('işti',-1,3),new a('ivi',-1,1),new a('ităi',-1,1),new a('oşi',-1,1),new a('ităţi',-1,1),new a('abil',-1,1),new a('ibil',-1,1),new a('ism',-1,3),new a('ator',-1,1),new a('os',-1,1),new a('at',-1,1),new a('it',-1,1),new a('ant',-1,1),new a('ist',-1,3),new a('ut',-1,1),new a('iv',-1,1),new a('ică',-1,1),new a('abilă',-1,1),new a('ibilă',-1,1),new a('oasă',-1,1),new a('ată',-1,1),new a('ită',-1,1),new a('antă',-1,1),new a('istă',-1,3),new a('ută',-1,1),new a('ivă',-1,1)]});h(b,'a_4',function(){return[new a('ea',-1,1),new a('ia',-1,1),new a('esc',-1,1),new a('ăsc',-1,1),new a('ind',-1,1),new a('ând',-1,1),new a('are',-1,1),new a('ere',-1,1),new a('ire',-1,1),new a('âre',-1,1),new a('se',-1,2),new a('ase',10,1),new a('sese',10,2),new a('ise',10,1),new a('use',10,1),new a('âse',10,1),new a('eşte',-1,1),new a('ăşte',-1,1),new a('eze',-1,1),new a('ai',-1,1),new a('eai',19,1),new a('iai',19,1),new a('sei',-1,2),new a('eşti',-1,1),new a('ăşti',-1,1),new a('ui',-1,1),new a('ezi',-1,1),new a('âi',-1,1),new a('aşi',-1,1),new a('seşi',-1,2),new a('aseşi',29,1),new a('seseşi',29,2),new a('iseşi',29,1),new a('useşi',29,1),new a('âseşi',29,1),new a('işi',-1,1),new a('uşi',-1,1),new a('âşi',-1,1),new a('aţi',-1,2),new a('eaţi',38,1),new a('iaţi',38,1),new a('eţi',-1,2),new a('iţi',-1,2),new a('âţi',-1,2),new a('arăţi',-1,1),new a('serăţi',-1,2),new a('aserăţi',45,1),new a('seserăţi',45,2),new a('iserăţi',45,1),new a('userăţi',45,1),new a('âserăţi',45,1),new a('irăţi',-1,1),new a('urăţi',-1,1),new a('ârăţi',-1,1),new a('am',-1,1),new a('eam',54,1),new a('iam',54,1),new a('em',-1,2),new a('asem',57,1),new a('sesem',57,2),new a('isem',57,1),new a('usem',57,1),new a('âsem',57,1),new a('im',-1,2),new a('âm',-1,2),new a('ăm',-1,2),new a('arăm',65,1),new a('serăm',65,2),new a('aserăm',67,1),new a('seserăm',67,2),new a('iserăm',67,1),new a('userăm',67,1),new a('âserăm',67,1),new a('irăm',65,1),new a('urăm',65,1),new a('ârăm',65,1),new a('au',-1,1),new a('eau',76,1),new a('iau',76,1),new a('indu',-1,1),new a('ându',-1,1),new a('ez',-1,1),new a('ească',-1,1),new a('ară',-1,1),new a('seră',-1,2),new a('aseră',84,1),new a('seseră',84,2),new a('iseră',84,1),new a('useră',84,1),new a('âseră',84,1),new a('iră',-1,1),new a('ură',-1,1),new a('âră',-1,1),new a('ează',-1,1)]});h(b,'a_5',function(){return[new a('a',-1,1),new a('e',-1,1),new a('ie',1,1),new a('i',-1,1),new a('ă',-1,1)]});h(b,'g_v',function(){return[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,2,32,0,0,4]});var r={'src/stemmer.jsx':{Stemmer:n},'src/romanian-stemmer.jsx':{RomanianStemmer:b}}}(JSX)) var Stemmer = JSX.require("src/romanian-stemmer.jsx").RomanianStemmer; @@ -24,7 +28,7 @@ class SearchRomanian(SearchLanguage): language_name = 'Romanian' js_stemmer_rawcode = 'romanian-stemmer.js' js_stemmer_code = js_stemmer - stopwords = [] # type: List[unicode] + stopwords = set() # type: Set[unicode] def init(self, options): # type: (Dict) -> None diff --git a/sphinx/search/tr.py b/sphinx/search/tr.py index 14cc710f8..4ce42dd76 100644 --- a/sphinx/search/tr.py +++ b/sphinx/search/tr.py @@ -13,6 +13,10 @@ from sphinx.search import SearchLanguage import snowballstemmer +if False: + # For type annotation + from typing import Dict, Set # NOQA + js_stemmer = u""" var JSX={};(function(q){function r(b,e){var a=function(){};a.prototype=e.prototype;var c=new a;for(var d in b){b[d].prototype=c}}function Q(c,b){for(var a in b.prototype)if(b.prototype.hasOwnProperty(a))c.prototype[a]=b.prototype[a]}function j(a,b,d){function c(a,b,c){delete a[b];a[b]=c;return c}Object.defineProperty(a,b,{get:function(){return c(a,b,d())},set:function(d){c(a,b,d)},enumerable:true,configurable:true})}function R(a,b,c){return a[b]=a[b]/c|0}var M=parseInt;var K=parseFloat;function P(a){return a!==a}var A=isFinite;var G=encodeURIComponent;var F=decodeURIComponent;var E=encodeURI;var D=decodeURI;var C=Object.prototype.toString;var H=Object.prototype.hasOwnProperty;function p(){}q.require=function(b){var a=y[b];return a!==undefined?a:null};q.profilerIsRunning=function(){return p.getResults!=null};q.getProfileResults=function(){return(p.getResults||function(){return{}})()};q.postProfileResults=function(a,b){if(p.postResults==null)throw new Error('profiler has not been turned on');return p.postResults(a,b)};q.resetProfileResults=function(){if(p.resetResults==null)throw new Error('profiler has not been turned on');return p.resetResults()};q.DEBUG=false;function I(){};r([I],Error);function d(a,b,c){this.G=a.length;this.A_=a;this.D_=b;this.J=c;this.I=null;this.E_=null};r([d],Object);function u(){};r([u],Object);function m(){var a;var b;var c;this.F={};a=this.E='';b=this._=0;c=this.A=a.length;this.D=0;this.B=b;this.C=c};r([m],u);function B(a,b){a.E=b.E;a._=b._;a.A=b.A;a.D=b.D;a.B=b.B;a.C=b.C};function v(b,d,c,e){var a;if(b._>=b.A){return false}a=b.E.charCodeAt(b._);if(a>e||a<c){return false}a-=c;if((d[a>>>3]&1<<(a&7))===0){return false}b._++;return true};function f(b,d,c,e){var a;if(b._<=b.D){return false}a=b.E.charCodeAt(b._-1);if(a>e||a<c){return false}a-=c;if((d[a>>>3]&1<<(a&7))===0){return false}b._--;return true};function t(a,d,c,e){var b;if(a._<=a.D){return false}b=a.E.charCodeAt(a._-1);if(b>e||b<c){a._--;return true}b-=c;if((d[b>>>3]&1<<(b&7))===0){a._--;return true}return false};function s(a,b,d){var c;if(a.A-a._<b){return false}if(a.E.slice(c=a._,c+b)!==d){return false}a._+=b;return true};function g(a,b,d){var c;if(a._-a.D<b){return false}if(a.E.slice((c=a._)-b,c)!==d){return false}a._-=b;return true};function b(d,m,p){var b;var g;var e;var n;var f;var k;var l;var i;var h;var c;var a;var j;var o;b=0;g=p;e=d._;n=d.D;f=0;k=0;l=false;while(true){i=b+(g-b>>1);h=0;c=f<k?f:k;a=m[i];for(j=a.G-1-c;j>=0;j--){if(e-c===n){h=-1;break}h=d.E.charCodeAt(e-1-c)-a.A_.charCodeAt(j);if(h!==0){break}c++}if(h<0){g=i;k=c}else{b=i;f=c}if(g-b<=1){if(b>0){break}if(g===b){break}if(l){break}l=true}}while(true){a=m[b];if(f>=a.G){d._=e-a.G|0;if(a.I==null){return a.J}o=a.I(d);d._=e-a.G|0;if(o){return a.J}}b=a.D_;if(b<0){return 0}}return-1};function n(a,b,d,e){var c;c=e.length-(d-b);a.E=a.E.slice(0,b)+e+a.E.slice(d);a.A+=c|0;if(a._>=d){a._+=c|0}else if(a._>b){a._=b}return c|0};function e(a,f){var b;var c;var d;var e;b=false;if((c=a.B)<0||c>(d=a.C)||d>(e=a.A)||e>a.E.length?false:true){n(a,a.B,a.C,f);b=true}return b};m.prototype.H=function(){return false};m.prototype.B_=function(b){var a;var c;var d;var e;a=this.F['.'+b];if(a==null){c=this.E=b;d=this._=0;e=this.A=c.length;this.D=0;this.B=d;this.C=e;this.H();a=this.E;this.F['.'+b]=a}return a};m.prototype.stemWord=m.prototype.B_;m.prototype.C_=function(e){var d;var b;var c;var a;var f;var g;var h;d=[];for(b=0;b<e.length;b++){c=e[b];a=this.F['.'+c];if(a==null){f=this.E=c;g=this._=0;h=this.A=f.length;this.D=0;this.B=g;this.C=h;this.H();a=this.E;this.F['.'+c]=a}d.push(a)}return d};m.prototype.stemWords=m.prototype.C_;function a(){m.call(this);this.B_continue_stemming_noun_suffixes=false;this.I_strlen=0};r([a],m);a.prototype.K=function(a){this.B_continue_stemming_noun_suffixes=a.B_continue_stemming_noun_suffixes;this.I_strlen=a.I_strlen;B(this,a)};a.prototype.copy_from=a.prototype.K;a.prototype.O=function(){var E;var q;var b;var e;var h;var i;var j;var k;var l;var m;var n;var o;var p;var c;var r;var s;var t;var u;var d;var v;var w;var x;var y;var z;var A;var B;var C;var D;var G;var H;var I;var J;var K;var L;var M;var N;var F;E=this.A-this._;b:while(true){q=this.A-this._;o=true;a:while(o===true){o=false;if(!f(this,a.g_vowel,97,305)){break a}this._=this.A-q;break b}G=this._=this.A-q;if(G<=this.D){return false}this._--}p=true;a:while(p===true){p=false;b=this.A-this._;c=true;b:while(c===true){c=false;if(!g(this,1,'a')){break b}c:while(true){e=this.A-this._;r=true;d:while(r===true){r=false;if(!f(this,a.g_vowel1,97,305)){break d}this._=this.A-e;break c}H=this._=this.A-e;if(H<=this.D){break b}this._--}break a}this._=this.A-b;s=true;b:while(s===true){s=false;if(!g(this,1,'e')){break b}c:while(true){h=this.A-this._;t=true;d:while(t===true){t=false;if(!f(this,a.g_vowel2,101,252)){break d}this._=this.A-h;break c}I=this._=this.A-h;if(I<=this.D){break b}this._--}break a}this._=this.A-b;u=true;b:while(u===true){u=false;if(!g(this,1,'ı')){break b}c:while(true){i=this.A-this._;d=true;d:while(d===true){d=false;if(!f(this,a.g_vowel3,97,305)){break d}this._=this.A-i;break c}J=this._=this.A-i;if(J<=this.D){break b}this._--}break a}this._=this.A-b;v=true;b:while(v===true){v=false;if(!g(this,1,'i')){break b}c:while(true){j=this.A-this._;w=true;d:while(w===true){w=false;if(!f(this,a.g_vowel4,101,105)){break d}this._=this.A-j;break c}K=this._=this.A-j;if(K<=this.D){break b}this._--}break a}this._=this.A-b;x=true;b:while(x===true){x=false;if(!g(this,1,'o')){break b}c:while(true){k=this.A-this._;y=true;d:while(y===true){y=false;if(!f(this,a.g_vowel5,111,117)){break d}this._=this.A-k;break c}L=this._=this.A-k;if(L<=this.D){break b}this._--}break a}this._=this.A-b;z=true;b:while(z===true){z=false;if(!g(this,1,'ö')){break b}c:while(true){l=this.A-this._;A=true;d:while(A===true){A=false;if(!f(this,a.g_vowel6,246,252)){break d}this._=this.A-l;break c}M=this._=this.A-l;if(M<=this.D){break b}this._--}break a}this._=this.A-b;B=true;b:while(B===true){B=false;if(!g(this,1,'u')){break b}c:while(true){m=this.A-this._;C=true;d:while(C===true){C=false;if(!f(this,a.g_vowel5,111,117)){break d}this._=this.A-m;break c}N=this._=this.A-m;if(N<=this.D){break b}this._--}break a}this._=this.A-b;if(!g(this,1,'ü')){return false}b:while(true){n=this.A-this._;D=true;c:while(D===true){D=false;if(!f(this,a.g_vowel6,246,252)){break c}this._=this.A-n;break b}F=this._=this.A-n;if(F<=this.D){return false}this._--}}this._=this.A-E;return true};a.prototype.r_check_vowel_harmony=a.prototype.O;function c(b){var F;var r;var c;var e;var h;var i;var j;var k;var l;var m;var n;var o;var p;var q;var d;var s;var t;var u;var v;var w;var x;var y;var z;var A;var B;var C;var D;var E;var H;var I;var J;var K;var L;var M;var N;var O;var G;F=b.A-b._;b:while(true){r=b.A-b._;o=true;a:while(o===true){o=false;if(!f(b,a.g_vowel,97,305)){break a}b._=b.A-r;break b}H=b._=b.A-r;if(H<=b.D){return false}b._--}p=true;a:while(p===true){p=false;c=b.A-b._;q=true;b:while(q===true){q=false;if(!g(b,1,'a')){break b}c:while(true){e=b.A-b._;d=true;d:while(d===true){d=false;if(!f(b,a.g_vowel1,97,305)){break d}b._=b.A-e;break c}I=b._=b.A-e;if(I<=b.D){break b}b._--}break a}b._=b.A-c;s=true;b:while(s===true){s=false;if(!g(b,1,'e')){break b}c:while(true){h=b.A-b._;t=true;d:while(t===true){t=false;if(!f(b,a.g_vowel2,101,252)){break d}b._=b.A-h;break c}J=b._=b.A-h;if(J<=b.D){break b}b._--}break a}b._=b.A-c;u=true;b:while(u===true){u=false;if(!g(b,1,'ı')){break b}c:while(true){i=b.A-b._;v=true;d:while(v===true){v=false;if(!f(b,a.g_vowel3,97,305)){break d}b._=b.A-i;break c}K=b._=b.A-i;if(K<=b.D){break b}b._--}break a}b._=b.A-c;w=true;b:while(w===true){w=false;if(!g(b,1,'i')){break b}c:while(true){j=b.A-b._;x=true;d:while(x===true){x=false;if(!f(b,a.g_vowel4,101,105)){break d}b._=b.A-j;break c}L=b._=b.A-j;if(L<=b.D){break b}b._--}break a}b._=b.A-c;y=true;b:while(y===true){y=false;if(!g(b,1,'o')){break b}c:while(true){k=b.A-b._;z=true;d:while(z===true){z=false;if(!f(b,a.g_vowel5,111,117)){break d}b._=b.A-k;break c}M=b._=b.A-k;if(M<=b.D){break b}b._--}break a}b._=b.A-c;A=true;b:while(A===true){A=false;if(!g(b,1,'ö')){break b}c:while(true){l=b.A-b._;B=true;d:while(B===true){B=false;if(!f(b,a.g_vowel6,246,252)){break d}b._=b.A-l;break c}N=b._=b.A-l;if(N<=b.D){break b}b._--}break a}b._=b.A-c;C=true;b:while(C===true){C=false;if(!g(b,1,'u')){break b}c:while(true){m=b.A-b._;D=true;d:while(D===true){D=false;if(!f(b,a.g_vowel5,111,117)){break d}b._=b.A-m;break c}O=b._=b.A-m;if(O<=b.D){break b}b._--}break a}b._=b.A-c;if(!g(b,1,'ü')){return false}b:while(true){n=b.A-b._;E=true;c:while(E===true){E=false;if(!f(b,a.g_vowel6,246,252)){break c}b._=b.A-n;break b}G=b._=b.A-n;if(G<=b.D){return false}b._--}}b._=b.A-F;return true};a.prototype.j=function(){var k;var h;var l;var i;var m;var j;var b;var e;var d;var n;var o;var p;var q;var c;b=true;b:while(b===true){b=false;k=this.A-this._;e=true;a:while(e===true){e=false;h=this.A-this._;if(!g(this,1,'n')){break a}n=this._=this.A-h;if(n<=this.D){break a}this._--;l=this.A-this._;if(!f(this,a.g_vowel,97,305)){break a}this._=this.A-l;break b}p=this._=(o=this.A)-k;i=o-p;d=true;a:while(d===true){d=false;m=this.A-this._;if(!g(this,1,'n')){break a}this._=this.A-m;return false}c=this._=(q=this.A)-i;j=q-c;if(c<=this.D){return false}this._--;if(!f(this,a.g_vowel,97,305)){return false}this._=this.A-j}return true};a.prototype.r_mark_suffix_with_optional_n_consonant=a.prototype.j;function o(b){var i;var m;var l;var j;var n;var k;var c;var e;var d;var o;var p;var q;var r;var h;c=true;b:while(c===true){c=false;i=b.A-b._;e=true;a:while(e===true){e=false;m=b.A-b._;if(!g(b,1,'n')){break a}o=b._=b.A-m;if(o<=b.D){break a}b._--;l=b.A-b._;if(!f(b,a.g_vowel,97,305)){break a}b._=b.A-l;break b}q=b._=(p=b.A)-i;j=p-q;d=true;a:while(d===true){d=false;n=b.A-b._;if(!g(b,1,'n')){break a}b._=b.A-n;return false}h=b._=(r=b.A)-j;k=r-h;if(h<=b.D){return false}b._--;if(!f(b,a.g_vowel,97,305)){return false}b._=b.A-k}return true};a.prototype.k=function(){var k;var h;var l;var i;var m;var j;var b;var e;var d;var n;var o;var p;var q;var c;b=true;b:while(b===true){b=false;k=this.A-this._;e=true;a:while(e===true){e=false;h=this.A-this._;if(!g(this,1,'s')){break a}n=this._=this.A-h;if(n<=this.D){break a}this._--;l=this.A-this._;if(!f(this,a.g_vowel,97,305)){break a}this._=this.A-l;break b}p=this._=(o=this.A)-k;i=o-p;d=true;a:while(d===true){d=false;m=this.A-this._;if(!g(this,1,'s')){break a}this._=this.A-m;return false}c=this._=(q=this.A)-i;j=q-c;if(c<=this.D){return false}this._--;if(!f(this,a.g_vowel,97,305)){return false}this._=this.A-j}return true};a.prototype.r_mark_suffix_with_optional_s_consonant=a.prototype.k;function l(b){var i;var m;var l;var j;var n;var k;var c;var e;var d;var o;var p;var q;var r;var h;c=true;b:while(c===true){c=false;i=b.A-b._;e=true;a:while(e===true){e=false;m=b.A-b._;if(!g(b,1,'s')){break a}o=b._=b.A-m;if(o<=b.D){break a}b._--;l=b.A-b._;if(!f(b,a.g_vowel,97,305)){break a}b._=b.A-l;break b}q=b._=(p=b.A)-i;j=p-q;d=true;a:while(d===true){d=false;n=b.A-b._;if(!g(b,1,'s')){break a}b._=b.A-n;return false}h=b._=(r=b.A)-j;k=r-h;if(h<=b.D){return false}b._--;if(!f(b,a.g_vowel,97,305)){return false}b._=b.A-k}return true};a.prototype.l=function(){var k;var h;var l;var i;var m;var j;var b;var e;var d;var n;var o;var p;var q;var c;b=true;b:while(b===true){b=false;k=this.A-this._;e=true;a:while(e===true){e=false;h=this.A-this._;if(!g(this,1,'y')){break a}n=this._=this.A-h;if(n<=this.D){break a}this._--;l=this.A-this._;if(!f(this,a.g_vowel,97,305)){break a}this._=this.A-l;break b}p=this._=(o=this.A)-k;i=o-p;d=true;a:while(d===true){d=false;m=this.A-this._;if(!g(this,1,'y')){break a}this._=this.A-m;return false}c=this._=(q=this.A)-i;j=q-c;if(c<=this.D){return false}this._--;if(!f(this,a.g_vowel,97,305)){return false}this._=this.A-j}return true};a.prototype.r_mark_suffix_with_optional_y_consonant=a.prototype.l;function h(b){var i;var m;var l;var j;var n;var k;var c;var e;var d;var o;var p;var q;var r;var h;c=true;b:while(c===true){c=false;i=b.A-b._;e=true;a:while(e===true){e=false;m=b.A-b._;if(!g(b,1,'y')){break a}o=b._=b.A-m;if(o<=b.D){break a}b._--;l=b.A-b._;if(!f(b,a.g_vowel,97,305)){break a}b._=b.A-l;break b}q=b._=(p=b.A)-i;j=p-q;d=true;a:while(d===true){d=false;n=b.A-b._;if(!g(b,1,'y')){break a}b._=b.A-n;return false}h=b._=(r=b.A)-j;k=r-h;if(h<=b.D){return false}b._--;if(!f(b,a.g_vowel,97,305)){return false}b._=b.A-k}return true};a.prototype.i=function(){var j;var g;var k;var h;var l;var i;var b;var e;var d;var m;var n;var o;var p;var c;b=true;b:while(b===true){b=false;j=this.A-this._;e=true;a:while(e===true){e=false;g=this.A-this._;if(!f(this,a.g_U,105,305)){break a}m=this._=this.A-g;if(m<=this.D){break a}this._--;k=this.A-this._;if(!t(this,a.g_vowel,97,305)){break a}this._=this.A-k;break b}o=this._=(n=this.A)-j;h=n-o;d=true;a:while(d===true){d=false;l=this.A-this._;if(!f(this,a.g_U,105,305)){break a}this._=this.A-l;return false}c=this._=(p=this.A)-h;i=p-c;if(c<=this.D){return false}this._--;if(!t(this,a.g_vowel,97,305)){return false}this._=this.A-i}return true};a.prototype.r_mark_suffix_with_optional_U_vowel=a.prototype.i;function k(b){var h;var l;var k;var i;var m;var j;var c;var e;var d;var n;var o;var p;var q;var g;c=true;b:while(c===true){c=false;h=b.A-b._;e=true;a:while(e===true){e=false;l=b.A-b._;if(!f(b,a.g_U,105,305)){break a}n=b._=b.A-l;if(n<=b.D){break a}b._--;k=b.A-b._;if(!t(b,a.g_vowel,97,305)){break a}b._=b.A-k;break b}p=b._=(o=b.A)-h;i=o-p;d=true;a:while(d===true){d=false;m=b.A-b._;if(!f(b,a.g_U,105,305)){break a}b._=b.A-m;return false}g=b._=(q=b.A)-i;j=q-g;if(g<=b.D){return false}b._--;if(!t(b,a.g_vowel,97,305)){return false}b._=b.A-j}return true};a.prototype.e=function(){return b(this,a.a_0,10)===0?false:!k(this)?false:true};a.prototype.r_mark_possessives=a.prototype.e;a.prototype.f=function(){return!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true};a.prototype.r_mark_sU=a.prototype.f;a.prototype.W=function(){return b(this,a.a_1,2)===0?false:true};a.prototype.r_mark_lArI=a.prototype.W;a.prototype.o=function(){return!c(this)?false:!f(this,a.g_U,105,305)?false:!h(this)?false:true};a.prototype.r_mark_yU=a.prototype.o;a.prototype.Y=function(){return!c(this)?false:b(this,a.a_2,4)===0?false:true};a.prototype.r_mark_nU=a.prototype.Y;a.prototype.Z=function(){return!c(this)?false:b(this,a.a_3,4)===0?false:!o(this)?false:true};a.prototype.r_mark_nUn=a.prototype.Z;a.prototype.m=function(){return!c(this)?false:b(this,a.a_4,2)===0?false:!h(this)?false:true};a.prototype.r_mark_yA=a.prototype.m;a.prototype.X=function(){return!c(this)?false:b(this,a.a_5,2)===0?false:true};a.prototype.r_mark_nA=a.prototype.X;a.prototype.Q=function(){return!c(this)?false:b(this,a.a_6,4)===0?false:true};a.prototype.r_mark_DA=a.prototype.Q;a.prototype.c=function(){return!c(this)?false:b(this,a.a_7,2)===0?false:true};a.prototype.r_mark_ndA=a.prototype.c;a.prototype.R=function(){return!c(this)?false:b(this,a.a_8,4)===0?false:true};a.prototype.r_mark_DAn=a.prototype.R;a.prototype.d=function(){return!c(this)?false:b(this,a.a_9,2)===0?false:true};a.prototype.r_mark_ndAn=a.prototype.d;a.prototype.s=function(){return!c(this)?false:b(this,a.a_10,2)===0?false:!h(this)?false:true};a.prototype.r_mark_ylA=a.prototype.s;a.prototype.U=function(){return!g(this,2,'ki')?false:true};a.prototype.r_mark_ki=a.prototype.U;a.prototype.b=function(){return!c(this)?false:b(this,a.a_11,2)===0?false:!o(this)?false:true};a.prototype.r_mark_ncA=a.prototype.b;a.prototype.p=function(){return!c(this)?false:b(this,a.a_12,4)===0?false:!h(this)?false:true};a.prototype.r_mark_yUm=a.prototype.p;a.prototype.g=function(){return!c(this)?false:b(this,a.a_13,4)===0?false:true};a.prototype.r_mark_sUn=a.prototype.g;a.prototype.q=function(){return!c(this)?false:b(this,a.a_14,4)===0?false:!h(this)?false:true};a.prototype.r_mark_yUz=a.prototype.q;a.prototype.h=function(){return b(this,a.a_15,4)===0?false:true};a.prototype.r_mark_sUnUz=a.prototype.h;a.prototype.V=function(){return!c(this)?false:b(this,a.a_16,2)===0?false:true};a.prototype.r_mark_lAr=a.prototype.V;a.prototype.a=function(){return!c(this)?false:b(this,a.a_17,4)===0?false:true};a.prototype.r_mark_nUz=a.prototype.a;a.prototype.S=function(){return!c(this)?false:b(this,a.a_18,8)===0?false:true};a.prototype.r_mark_DUr=a.prototype.S;a.prototype.T=function(){return b(this,a.a_19,2)===0?false:true};a.prototype.r_mark_cAsInA=a.prototype.T;a.prototype.n=function(){return!c(this)?false:b(this,a.a_20,32)===0?false:!h(this)?false:true};a.prototype.r_mark_yDU=a.prototype.n;a.prototype.u=function(){return b(this,a.a_21,8)===0?false:!h(this)?false:true};a.prototype.r_mark_ysA=a.prototype.u;a.prototype.t=function(){return!c(this)?false:b(this,a.a_22,4)===0?false:!h(this)?false:true};a.prototype.r_mark_ymUs_=a.prototype.t;a.prototype.r=function(){return!g(this,3,'ken')?false:!h(this)?false:true};a.prototype.r_mark_yken=a.prototype.r;a.prototype.y=function(){var i;var j;var d;var Y;var k;var X;var l;var W;var V;var f;var r;var s;var t;var u;var v;var w;var x;var y;var z;var A;var B;var C;var m;var E;var F;var G;var H;var I;var J;var K;var L;var M;var N;var O;var P;var Q;var R;var S;var T;var U;var p;var o;var D;var n;var q;this.C=this._;this.B_continue_stemming_noun_suffixes=true;r=true;a:while(r===true){r=false;i=this.A-this._;s=true;d:while(s===true){s=false;t=true;b:while(t===true){t=false;j=this.A-this._;u=true;c:while(u===true){u=false;if(!(!c(this)?false:b(this,a.a_22,4)===0?false:!h(this)?false:true)){break c}break b}this._=this.A-j;v=true;c:while(v===true){v=false;if(!(!c(this)?false:b(this,a.a_20,32)===0?false:!h(this)?false:true)){break c}break b}this._=this.A-j;w=true;c:while(w===true){w=false;if(!(b(this,a.a_21,8)===0?false:!h(this)?false:true)){break c}break b}this._=this.A-j;if(!(!g(this,3,'ken')?false:!h(this)?false:true)){break d}}break a}this._=this.A-i;x=true;c:while(x===true){x=false;if(!(b(this,a.a_19,2)===0?false:true)){break c}y=true;b:while(y===true){y=false;d=this.A-this._;z=true;d:while(z===true){z=false;if(!(b(this,a.a_15,4)===0?false:true)){break d}break b}this._=this.A-d;A=true;d:while(A===true){A=false;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){break d}break b}this._=this.A-d;B=true;d:while(B===true){B=false;if(!(!c(this)?false:b(this,a.a_12,4)===0?false:!h(this)?false:true)){break d}break b}this._=this.A-d;C=true;d:while(C===true){C=false;if(!(!c(this)?false:b(this,a.a_13,4)===0?false:true)){break d}break b}this._=this.A-d;m=true;d:while(m===true){m=false;if(!(!c(this)?false:b(this,a.a_14,4)===0?false:!h(this)?false:true)){break d}break b}this._=this.A-d}if(!(!c(this)?false:b(this,a.a_22,4)===0?false:!h(this)?false:true)){break c}break a}this._=this.A-i;E=true;c:while(E===true){E=false;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){break c}this.B=this._;if(!e(this,'')){return false}Y=this.A-this._;F=true;d:while(F===true){F=false;this.C=this._;G=true;b:while(G===true){G=false;k=this.A-this._;H=true;e:while(H===true){H=false;if(!(!c(this)?false:b(this,a.a_18,8)===0?false:true)){break e}break b}this._=this.A-k;I=true;e:while(I===true){I=false;if(!(!c(this)?false:b(this,a.a_20,32)===0?false:!h(this)?false:true)){break e}break b}this._=this.A-k;J=true;e:while(J===true){J=false;if(!(b(this,a.a_21,8)===0?false:!h(this)?false:true)){break e}break b}this._=this.A-k;if(!(!c(this)?false:b(this,a.a_22,4)===0?false:!h(this)?false:true)){this._=this.A-Y;break d}}}this.B_continue_stemming_noun_suffixes=false;break a}this._=this.A-i;K=true;b:while(K===true){K=false;if(!(!c(this)?false:b(this,a.a_17,4)===0?false:true)){break b}L=true;c:while(L===true){L=false;X=this.A-this._;M=true;d:while(M===true){M=false;if(!(!c(this)?false:b(this,a.a_20,32)===0?false:!h(this)?false:true)){break d}break c}this._=this.A-X;if(!(b(this,a.a_21,8)===0?false:!h(this)?false:true)){break b}}break a}this._=this.A-i;N=true;c:while(N===true){N=false;O=true;b:while(O===true){O=false;l=this.A-this._;P=true;d:while(P===true){P=false;if(!(b(this,a.a_15,4)===0?false:true)){break d}break b}this._=this.A-l;Q=true;d:while(Q===true){Q=false;if(!(!c(this)?false:b(this,a.a_14,4)===0?false:!h(this)?false:true)){break d}break b}this._=this.A-l;R=true;d:while(R===true){R=false;if(!(!c(this)?false:b(this,a.a_13,4)===0?false:true)){break d}break b}this._=this.A-l;if(!(!c(this)?false:b(this,a.a_12,4)===0?false:!h(this)?false:true)){break c}}this.B=this._;if(!e(this,'')){return false}W=this.A-this._;S=true;b:while(S===true){S=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_22,4)===0?false:!h(this)?false:true)){this._=this.A-W;break b}}break a}this._=this.A-i;if(!(!c(this)?false:b(this,a.a_18,8)===0?false:true)){return false}this.B=this._;if(!e(this,'')){return false}V=this.A-this._;T=true;d:while(T===true){T=false;this.C=this._;U=true;b:while(U===true){U=false;f=this.A-this._;p=true;c:while(p===true){p=false;if(!(b(this,a.a_15,4)===0?false:true)){break c}break b}this._=this.A-f;o=true;c:while(o===true){o=false;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){break c}break b}this._=this.A-f;D=true;c:while(D===true){D=false;if(!(!c(this)?false:b(this,a.a_12,4)===0?false:!h(this)?false:true)){break c}break b}this._=this.A-f;n=true;c:while(n===true){n=false;if(!(!c(this)?false:b(this,a.a_13,4)===0?false:true)){break c}break b}this._=this.A-f;q=true;c:while(q===true){q=false;if(!(!c(this)?false:b(this,a.a_14,4)===0?false:!h(this)?false:true)){break c}break b}this._=this.A-f}if(!(!c(this)?false:b(this,a.a_22,4)===0?false:!h(this)?false:true)){this._=this.A-V;break d}}}this.B=this._;return!e(this,'')?false:true};a.prototype.r_stem_nominal_verb_suffixes=a.prototype.y;function J(d){var f;var k;var i;var Z;var l;var Y;var m;var X;var W;var j;var s;var t;var u;var v;var w;var x;var y;var z;var A;var B;var C;var n;var E;var F;var G;var H;var I;var J;var K;var L;var M;var N;var O;var P;var Q;var R;var S;var T;var U;var V;var q;var p;var D;var o;var r;d.C=d._;d.B_continue_stemming_noun_suffixes=true;s=true;a:while(s===true){s=false;f=d.A-d._;t=true;d:while(t===true){t=false;u=true;b:while(u===true){u=false;k=d.A-d._;v=true;c:while(v===true){v=false;if(!(!c(d)?false:b(d,a.a_22,4)===0?false:!h(d)?false:true)){break c}break b}d._=d.A-k;w=true;c:while(w===true){w=false;if(!(!c(d)?false:b(d,a.a_20,32)===0?false:!h(d)?false:true)){break c}break b}d._=d.A-k;x=true;c:while(x===true){x=false;if(!(b(d,a.a_21,8)===0?false:!h(d)?false:true)){break c}break b}d._=d.A-k;if(!(!g(d,3,'ken')?false:!h(d)?false:true)){break d}}break a}d._=d.A-f;y=true;c:while(y===true){y=false;if(!(b(d,a.a_19,2)===0?false:true)){break c}z=true;b:while(z===true){z=false;i=d.A-d._;A=true;d:while(A===true){A=false;if(!(b(d,a.a_15,4)===0?false:true)){break d}break b}d._=d.A-i;B=true;d:while(B===true){B=false;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){break d}break b}d._=d.A-i;C=true;d:while(C===true){C=false;if(!(!c(d)?false:b(d,a.a_12,4)===0?false:!h(d)?false:true)){break d}break b}d._=d.A-i;n=true;d:while(n===true){n=false;if(!(!c(d)?false:b(d,a.a_13,4)===0?false:true)){break d}break b}d._=d.A-i;E=true;d:while(E===true){E=false;if(!(!c(d)?false:b(d,a.a_14,4)===0?false:!h(d)?false:true)){break d}break b}d._=d.A-i}if(!(!c(d)?false:b(d,a.a_22,4)===0?false:!h(d)?false:true)){break c}break a}d._=d.A-f;F=true;c:while(F===true){F=false;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){break c}d.B=d._;if(!e(d,'')){return false}Z=d.A-d._;G=true;d:while(G===true){G=false;d.C=d._;H=true;b:while(H===true){H=false;l=d.A-d._;I=true;e:while(I===true){I=false;if(!(!c(d)?false:b(d,a.a_18,8)===0?false:true)){break e}break b}d._=d.A-l;J=true;e:while(J===true){J=false;if(!(!c(d)?false:b(d,a.a_20,32)===0?false:!h(d)?false:true)){break e}break b}d._=d.A-l;K=true;e:while(K===true){K=false;if(!(b(d,a.a_21,8)===0?false:!h(d)?false:true)){break e}break b}d._=d.A-l;if(!(!c(d)?false:b(d,a.a_22,4)===0?false:!h(d)?false:true)){d._=d.A-Z;break d}}}d.B_continue_stemming_noun_suffixes=false;break a}d._=d.A-f;L=true;b:while(L===true){L=false;if(!(!c(d)?false:b(d,a.a_17,4)===0?false:true)){break b}M=true;c:while(M===true){M=false;Y=d.A-d._;N=true;d:while(N===true){N=false;if(!(!c(d)?false:b(d,a.a_20,32)===0?false:!h(d)?false:true)){break d}break c}d._=d.A-Y;if(!(b(d,a.a_21,8)===0?false:!h(d)?false:true)){break b}}break a}d._=d.A-f;O=true;c:while(O===true){O=false;P=true;b:while(P===true){P=false;m=d.A-d._;Q=true;d:while(Q===true){Q=false;if(!(b(d,a.a_15,4)===0?false:true)){break d}break b}d._=d.A-m;R=true;d:while(R===true){R=false;if(!(!c(d)?false:b(d,a.a_14,4)===0?false:!h(d)?false:true)){break d}break b}d._=d.A-m;S=true;d:while(S===true){S=false;if(!(!c(d)?false:b(d,a.a_13,4)===0?false:true)){break d}break b}d._=d.A-m;if(!(!c(d)?false:b(d,a.a_12,4)===0?false:!h(d)?false:true)){break c}}d.B=d._;if(!e(d,'')){return false}X=d.A-d._;T=true;b:while(T===true){T=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_22,4)===0?false:!h(d)?false:true)){d._=d.A-X;break b}}break a}d._=d.A-f;if(!(!c(d)?false:b(d,a.a_18,8)===0?false:true)){return false}d.B=d._;if(!e(d,'')){return false}W=d.A-d._;U=true;d:while(U===true){U=false;d.C=d._;V=true;b:while(V===true){V=false;j=d.A-d._;q=true;c:while(q===true){q=false;if(!(b(d,a.a_15,4)===0?false:true)){break c}break b}d._=d.A-j;p=true;c:while(p===true){p=false;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){break c}break b}d._=d.A-j;D=true;c:while(D===true){D=false;if(!(!c(d)?false:b(d,a.a_12,4)===0?false:!h(d)?false:true)){break c}break b}d._=d.A-j;o=true;c:while(o===true){o=false;if(!(!c(d)?false:b(d,a.a_13,4)===0?false:true)){break c}break b}d._=d.A-j;r=true;c:while(r===true){r=false;if(!(!c(d)?false:b(d,a.a_14,4)===0?false:!h(d)?false:true)){break c}break b}d._=d.A-j}if(!(!c(d)?false:b(d,a.a_22,4)===0?false:!h(d)?false:true)){d._=d.A-W;break d}}}d.B=d._;return!e(d,'')?false:true};a.prototype.__=function(){var z;var N;var M;var L;var p;var K;var r;var J;var t;var u;var v;var w;var x;var y;var d;var A;var B;var C;var D;var E;var F;var G;var H;var I;var s;var q;var n;var m;var j;var h;this.C=this._;if(!(!g(this,2,'ki')?false:true)){return false}w=true;b:while(w===true){w=false;z=this.A-this._;x=true;c:while(x===true){x=false;if(!(!c(this)?false:b(this,a.a_6,4)===0?false:true)){break c}this.B=this._;if(!e(this,'')){return false}N=this.A-this._;y=true;f:while(y===true){y=false;this.C=this._;d=true;e:while(d===true){d=false;M=this.A-this._;A=true;d:while(A===true){A=false;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){break d}this.B=this._;if(!e(this,'')){return false}L=this.A-this._;B=true;a:while(B===true){B=false;if(!i(this)){this._=this.A-L;break a}}break e}this._=this.A-M;if(!(b(this,a.a_0,10)===0?false:!k(this)?false:true)){this._=this.A-N;break f}this.B=this._;if(!e(this,'')){return false}p=this.A-this._;C=true;a:while(C===true){C=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-p;break a}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-p;break a}}}}break b}this._=this.A-z;D=true;d:while(D===true){D=false;if(!(!c(this)?false:b(this,a.a_3,4)===0?false:!o(this)?false:true)){break d}this.B=this._;if(!e(this,'')){return false}K=this.A-this._;E=true;e:while(E===true){E=false;this.C=this._;F=true;a:while(F===true){F=false;r=this.A-this._;G=true;c:while(G===true){G=false;if(!(b(this,a.a_1,2)===0?false:true)){break c}this.B=this._;if(!e(this,'')){return false}break a}this._=this.A-r;H=true;f:while(H===true){H=false;this.C=this._;I=true;g:while(I===true){I=false;J=this.A-this._;s=true;c:while(s===true){s=false;if(!(b(this,a.a_0,10)===0?false:!k(this)?false:true)){break c}break g}this._=this.A-J;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true)){break f}}this.B=this._;if(!e(this,'')){return false}t=this.A-this._;q=true;c:while(q===true){q=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-t;break c}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-t;break c}}break a}this._=this.A-r;if(!i(this)){this._=this.A-K;break e}}}break b}this._=this.A-z;if(!(!c(this)?false:b(this,a.a_7,2)===0?false:true)){return false}n=true;a:while(n===true){n=false;u=this.A-this._;m=true;c:while(m===true){m=false;if(!(b(this,a.a_1,2)===0?false:true)){break c}this.B=this._;if(!e(this,'')){return false}break a}this._=this.A-u;j=true;d:while(j===true){j=false;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true)){break d}this.B=this._;if(!e(this,'')){return false}v=this.A-this._;h=true;c:while(h===true){h=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-v;break c}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-v;break c}}break a}this._=this.A-u;if(!i(this)){return false}}}return true};a.prototype.r_stem_suffix_chain_before_ki=a.prototype.__;function i(d){var j;var O;var N;var M;var q;var L;var s;var K;var u;var v;var w;var x;var y;var z;var h;var B;var C;var D;var E;var F;var G;var H;var I;var J;var t;var r;var p;var n;var m;var A;d.C=d._;if(!(!g(d,2,'ki')?false:true)){return false}x=true;b:while(x===true){x=false;j=d.A-d._;y=true;c:while(y===true){y=false;if(!(!c(d)?false:b(d,a.a_6,4)===0?false:true)){break c}d.B=d._;if(!e(d,'')){return false}O=d.A-d._;z=true;f:while(z===true){z=false;d.C=d._;h=true;e:while(h===true){h=false;N=d.A-d._;B=true;d:while(B===true){B=false;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){break d}d.B=d._;if(!e(d,'')){return false}M=d.A-d._;C=true;a:while(C===true){C=false;if(!i(d)){d._=d.A-M;break a}}break e}d._=d.A-N;if(!(b(d,a.a_0,10)===0?false:!k(d)?false:true)){d._=d.A-O;break f}d.B=d._;if(!e(d,'')){return false}q=d.A-d._;D=true;a:while(D===true){D=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-q;break a}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-q;break a}}}}break b}d._=d.A-j;E=true;d:while(E===true){E=false;if(!(!c(d)?false:b(d,a.a_3,4)===0?false:!o(d)?false:true)){break d}d.B=d._;if(!e(d,'')){return false}L=d.A-d._;F=true;e:while(F===true){F=false;d.C=d._;G=true;a:while(G===true){G=false;s=d.A-d._;H=true;c:while(H===true){H=false;if(!(b(d,a.a_1,2)===0?false:true)){break c}d.B=d._;if(!e(d,'')){return false}break a}d._=d.A-s;I=true;f:while(I===true){I=false;d.C=d._;J=true;g:while(J===true){J=false;K=d.A-d._;t=true;c:while(t===true){t=false;if(!(b(d,a.a_0,10)===0?false:!k(d)?false:true)){break c}break g}d._=d.A-K;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!l(d)?false:true)){break f}}d.B=d._;if(!e(d,'')){return false}u=d.A-d._;r=true;c:while(r===true){r=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-u;break c}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-u;break c}}break a}d._=d.A-s;if(!i(d)){d._=d.A-L;break e}}}break b}d._=d.A-j;if(!(!c(d)?false:b(d,a.a_7,2)===0?false:true)){return false}p=true;a:while(p===true){p=false;v=d.A-d._;n=true;c:while(n===true){n=false;if(!(b(d,a.a_1,2)===0?false:true)){break c}d.B=d._;if(!e(d,'')){return false}break a}d._=d.A-v;m=true;d:while(m===true){m=false;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!l(d)?false:true)){break d}d.B=d._;if(!e(d,'')){return false}w=d.A-d._;A=true;c:while(A===true){A=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-w;break c}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-w;break c}}break a}d._=d.A-v;if(!i(d)){return false}}}return true};a.prototype.z=function(){var d;var ar;var S;var j;var av;var m;var aq;var n;var p;var ax;var ay;var q;var ap;var r;var s;var as;var at;var au;var t;var aw;var u;var v;var w;var aA;var aB;var ao;var x;var y;var z;var A;var B;var C;var D;var E;var F;var G;var H;var I;var J;var K;var L;var M;var N;var O;var P;var Q;var R;var g;var T;var U;var V;var W;var X;var Y;var Z;var _;var $;var a0;var a1;var a2;var a3;var a4;var a5;var a6;var a7;var a8;var a9;var aa;var ab;var ac;var ad;var ae;var af;var ag;var ah;var ai;var aj;var ak;var al;var am;var an;var aC;var az;y=true;a:while(y===true){y=false;d=this.A-this._;z=true;b:while(z===true){z=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){break b}this.B=this._;if(!e(this,'')){return false}ar=this.A-this._;A=true;c:while(A===true){A=false;if(!i(this)){this._=this.A-ar;break c}}break a}this._=this.A-d;B=true;g:while(B===true){B=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_11,2)===0?false:!o(this)?false:true)){break g}this.B=this._;if(!e(this,'')){return false}S=this.A-this._;C=true;b:while(C===true){C=false;D=true;c:while(D===true){D=false;j=this.A-this._;E=true;d:while(E===true){E=false;this.C=this._;if(!(b(this,a.a_1,2)===0?false:true)){break d}this.B=this._;if(!e(this,'')){return false}break c}this._=this.A-j;F=true;f:while(F===true){F=false;this.C=this._;G=true;d:while(G===true){G=false;av=this.A-this._;H=true;e:while(H===true){H=false;if(!(b(this,a.a_0,10)===0?false:!k(this)?false:true)){break e}break d}this._=this.A-av;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true)){break f}}this.B=this._;if(!e(this,'')){return false}m=this.A-this._;I=true;d:while(I===true){I=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-m;break d}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-m;break d}}break c}aC=this._=this.A-j;this.C=aC;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-S;break b}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-S;break b}}}break a}this._=this.A-d;J=true;b:while(J===true){J=false;this.C=this._;K=true;d:while(K===true){K=false;aq=this.A-this._;L=true;c:while(L===true){L=false;if(!(!c(this)?false:b(this,a.a_7,2)===0?false:true)){break c}break d}this._=this.A-aq;if(!(!c(this)?false:b(this,a.a_5,2)===0?false:true)){break b}}M=true;c:while(M===true){M=false;n=this.A-this._;N=true;d:while(N===true){N=false;if(!(b(this,a.a_1,2)===0?false:true)){break d}this.B=this._;if(!e(this,'')){return false}break c}this._=this.A-n;O=true;e:while(O===true){O=false;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true)){break e}this.B=this._;if(!e(this,'')){return false}p=this.A-this._;P=true;d:while(P===true){P=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-p;break d}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-p;break d}}break c}this._=this.A-n;if(!i(this)){break b}}break a}this._=this.A-d;Q=true;c:while(Q===true){Q=false;this.C=this._;R=true;b:while(R===true){R=false;ax=this.A-this._;g=true;d:while(g===true){g=false;if(!(!c(this)?false:b(this,a.a_9,2)===0?false:true)){break d}break b}this._=this.A-ax;if(!(!c(this)?false:b(this,a.a_2,4)===0?false:true)){break c}}T=true;d:while(T===true){T=false;ay=this.A-this._;U=true;e:while(U===true){U=false;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true)){break e}this.B=this._;if(!e(this,'')){return false}q=this.A-this._;V=true;b:while(V===true){V=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-q;break b}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-q;break b}}break d}this._=this.A-ay;if(!(b(this,a.a_1,2)===0?false:true)){break c}}break a}this._=this.A-d;W=true;d:while(W===true){W=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_8,4)===0?false:true)){break d}this.B=this._;if(!e(this,'')){return false}ap=this.A-this._;X=true;e:while(X===true){X=false;this.C=this._;Y=true;c:while(Y===true){Y=false;r=this.A-this._;Z=true;f:while(Z===true){Z=false;if(!(b(this,a.a_0,10)===0?false:!k(this)?false:true)){break f}this.B=this._;if(!e(this,'')){return false}s=this.A-this._;_=true;b:while(_===true){_=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-s;break b}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-s;break b}}break c}this._=this.A-r;$=true;b:while($===true){$=false;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){break b}this.B=this._;if(!e(this,'')){return false}as=this.A-this._;a0=true;f:while(a0===true){a0=false;if(!i(this)){this._=this.A-as;break f}}break c}this._=this.A-r;if(!i(this)){this._=this.A-ap;break e}}}break a}this._=this.A-d;a1=true;d:while(a1===true){a1=false;this.C=this._;a2=true;b:while(a2===true){a2=false;at=this.A-this._;a3=true;c:while(a3===true){a3=false;if(!(!c(this)?false:b(this,a.a_3,4)===0?false:!o(this)?false:true)){break c}break b}this._=this.A-at;if(!(!c(this)?false:b(this,a.a_10,2)===0?false:!h(this)?false:true)){break d}}this.B=this._;if(!e(this,'')){return false}au=this.A-this._;a4=true;e:while(a4===true){a4=false;a5=true;c:while(a5===true){a5=false;t=this.A-this._;a6=true;b:while(a6===true){a6=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){break b}this.B=this._;if(!e(this,'')){return false}if(!i(this)){break b}break c}this._=this.A-t;a7=true;f:while(a7===true){a7=false;this.C=this._;a8=true;b:while(a8===true){a8=false;aw=this.A-this._;a9=true;g:while(a9===true){a9=false;if(!(b(this,a.a_0,10)===0?false:!k(this)?false:true)){break g}break b}this._=this.A-aw;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true)){break f}}this.B=this._;if(!e(this,'')){return false}u=this.A-this._;aa=true;b:while(aa===true){aa=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-u;break b}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-u;break b}}break c}this._=this.A-t;if(!i(this)){this._=this.A-au;break e}}}break a}this._=this.A-d;ab=true;b:while(ab===true){ab=false;this.C=this._;if(!(b(this,a.a_1,2)===0?false:true)){break b}this.B=this._;if(!e(this,'')){return false}break a}this._=this.A-d;ac=true;b:while(ac===true){ac=false;if(!i(this)){break b}break a}this._=this.A-d;ad=true;c:while(ad===true){ad=false;this.C=this._;ae=true;b:while(ae===true){ae=false;v=this.A-this._;af=true;d:while(af===true){af=false;if(!(!c(this)?false:b(this,a.a_6,4)===0?false:true)){break d}break b}this._=this.A-v;ag=true;d:while(ag===true){ag=false;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!h(this)?false:true)){break d}break b}this._=this.A-v;if(!(!c(this)?false:b(this,a.a_4,2)===0?false:!h(this)?false:true)){break c}}this.B=this._;if(!e(this,'')){return false}w=this.A-this._;ah=true;b:while(ah===true){ah=false;this.C=this._;ai=true;d:while(ai===true){ai=false;aA=this.A-this._;aj=true;e:while(aj===true){aj=false;if(!(b(this,a.a_0,10)===0?false:!k(this)?false:true)){break e}this.B=this._;if(!e(this,'')){return false}aB=this.A-this._;ak=true;f:while(ak===true){ak=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-aB;break f}}break d}this._=this.A-aA;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-w;break b}}this.B=this._;if(!e(this,'')){return false}this.C=this._;if(!i(this)){this._=this.A-w;break b}}break a}az=this._=this.A-d;this.C=az;al=true;b:while(al===true){al=false;ao=this.A-this._;am=true;c:while(am===true){am=false;if(!(b(this,a.a_0,10)===0?false:!k(this)?false:true)){break c}break b}this._=this.A-ao;if(!(!c(this)?false:!f(this,a.g_U,105,305)?false:!l(this)?false:true)){return false}}this.B=this._;if(!e(this,'')){return false}x=this.A-this._;an=true;b:while(an===true){an=false;this.C=this._;if(!(!c(this)?false:b(this,a.a_16,2)===0?false:true)){this._=this.A-x;break b}this.B=this._;if(!e(this,'')){return false}if(!i(this)){this._=this.A-x;break b}}}return true};a.prototype.r_stem_noun_suffixes=a.prototype.z;function L(d){var g;var as;var S;var m;var aw;var n;var ar;var p;var q;var ay;var az;var r;var aq;var s;var t;var at;var au;var av;var u;var ax;var v;var w;var x;var aB;var aC;var ap;var y;var z;var A;var B;var C;var D;var E;var F;var G;var H;var I;var J;var K;var L;var M;var N;var O;var P;var Q;var R;var j;var T;var U;var V;var W;var X;var Y;var Z;var _;var $;var a0;var a1;var a2;var a3;var a4;var a5;var a6;var a7;var a8;var a9;var aa;var ab;var ac;var ad;var ae;var af;var ag;var ah;var ai;var aj;var ak;var al;var am;var an;var ao;var aD;var aA;z=true;a:while(z===true){z=false;g=d.A-d._;A=true;b:while(A===true){A=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){break b}d.B=d._;if(!e(d,'')){return false}as=d.A-d._;B=true;c:while(B===true){B=false;if(!i(d)){d._=d.A-as;break c}}break a}d._=d.A-g;C=true;g:while(C===true){C=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_11,2)===0?false:!o(d)?false:true)){break g}d.B=d._;if(!e(d,'')){return false}S=d.A-d._;D=true;b:while(D===true){D=false;E=true;c:while(E===true){E=false;m=d.A-d._;F=true;d:while(F===true){F=false;d.C=d._;if(!(b(d,a.a_1,2)===0?false:true)){break d}d.B=d._;if(!e(d,'')){return false}break c}d._=d.A-m;G=true;f:while(G===true){G=false;d.C=d._;H=true;d:while(H===true){H=false;aw=d.A-d._;I=true;e:while(I===true){I=false;if(!(b(d,a.a_0,10)===0?false:!k(d)?false:true)){break e}break d}d._=d.A-aw;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!l(d)?false:true)){break f}}d.B=d._;if(!e(d,'')){return false}n=d.A-d._;J=true;d:while(J===true){J=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-n;break d}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-n;break d}}break c}aD=d._=d.A-m;d.C=aD;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-S;break b}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-S;break b}}}break a}d._=d.A-g;K=true;b:while(K===true){K=false;d.C=d._;L=true;d:while(L===true){L=false;ar=d.A-d._;M=true;c:while(M===true){M=false;if(!(!c(d)?false:b(d,a.a_7,2)===0?false:true)){break c}break d}d._=d.A-ar;if(!(!c(d)?false:b(d,a.a_5,2)===0?false:true)){break b}}N=true;c:while(N===true){N=false;p=d.A-d._;O=true;d:while(O===true){O=false;if(!(b(d,a.a_1,2)===0?false:true)){break d}d.B=d._;if(!e(d,'')){return false}break c}d._=d.A-p;P=true;e:while(P===true){P=false;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!l(d)?false:true)){break e}d.B=d._;if(!e(d,'')){return false}q=d.A-d._;Q=true;d:while(Q===true){Q=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-q;break d}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-q;break d}}break c}d._=d.A-p;if(!i(d)){break b}}break a}d._=d.A-g;R=true;c:while(R===true){R=false;d.C=d._;j=true;b:while(j===true){j=false;ay=d.A-d._;T=true;d:while(T===true){T=false;if(!(!c(d)?false:b(d,a.a_9,2)===0?false:true)){break d}break b}d._=d.A-ay;if(!(!c(d)?false:b(d,a.a_2,4)===0?false:true)){break c}}U=true;d:while(U===true){U=false;az=d.A-d._;V=true;e:while(V===true){V=false;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!l(d)?false:true)){break e}d.B=d._;if(!e(d,'')){return false}r=d.A-d._;W=true;b:while(W===true){W=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-r;break b}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-r;break b}}break d}d._=d.A-az;if(!(b(d,a.a_1,2)===0?false:true)){break c}}break a}d._=d.A-g;X=true;d:while(X===true){X=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_8,4)===0?false:true)){break d}d.B=d._;if(!e(d,'')){return false}aq=d.A-d._;Y=true;e:while(Y===true){Y=false;d.C=d._;Z=true;c:while(Z===true){Z=false;s=d.A-d._;_=true;f:while(_===true){_=false;if(!(b(d,a.a_0,10)===0?false:!k(d)?false:true)){break f}d.B=d._;if(!e(d,'')){return false}t=d.A-d._;$=true;b:while($===true){$=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-t;break b}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-t;break b}}break c}d._=d.A-s;a0=true;b:while(a0===true){a0=false;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){break b}d.B=d._;if(!e(d,'')){return false}at=d.A-d._;a1=true;f:while(a1===true){a1=false;if(!i(d)){d._=d.A-at;break f}}break c}d._=d.A-s;if(!i(d)){d._=d.A-aq;break e}}}break a}d._=d.A-g;a2=true;d:while(a2===true){a2=false;d.C=d._;a3=true;b:while(a3===true){a3=false;au=d.A-d._;a4=true;c:while(a4===true){a4=false;if(!(!c(d)?false:b(d,a.a_3,4)===0?false:!o(d)?false:true)){break c}break b}d._=d.A-au;if(!(!c(d)?false:b(d,a.a_10,2)===0?false:!h(d)?false:true)){break d}}d.B=d._;if(!e(d,'')){return false}av=d.A-d._;a5=true;e:while(a5===true){a5=false;a6=true;c:while(a6===true){a6=false;u=d.A-d._;a7=true;b:while(a7===true){a7=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){break b}d.B=d._;if(!e(d,'')){return false}if(!i(d)){break b}break c}d._=d.A-u;a8=true;f:while(a8===true){a8=false;d.C=d._;a9=true;b:while(a9===true){a9=false;ax=d.A-d._;aa=true;g:while(aa===true){aa=false;if(!(b(d,a.a_0,10)===0?false:!k(d)?false:true)){break g}break b}d._=d.A-ax;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!l(d)?false:true)){break f}}d.B=d._;if(!e(d,'')){return false}v=d.A-d._;ab=true;b:while(ab===true){ab=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-v;break b}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-v;break b}}break c}d._=d.A-u;if(!i(d)){d._=d.A-av;break e}}}break a}d._=d.A-g;ac=true;b:while(ac===true){ac=false;d.C=d._;if(!(b(d,a.a_1,2)===0?false:true)){break b}d.B=d._;if(!e(d,'')){return false}break a}d._=d.A-g;ad=true;b:while(ad===true){ad=false;if(!i(d)){break b}break a}d._=d.A-g;ae=true;c:while(ae===true){ae=false;d.C=d._;af=true;b:while(af===true){af=false;w=d.A-d._;ag=true;d:while(ag===true){ag=false;if(!(!c(d)?false:b(d,a.a_6,4)===0?false:true)){break d}break b}d._=d.A-w;ah=true;d:while(ah===true){ah=false;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!h(d)?false:true)){break d}break b}d._=d.A-w;if(!(!c(d)?false:b(d,a.a_4,2)===0?false:!h(d)?false:true)){break c}}d.B=d._;if(!e(d,'')){return false}x=d.A-d._;ai=true;b:while(ai===true){ai=false;d.C=d._;aj=true;d:while(aj===true){aj=false;aB=d.A-d._;ak=true;e:while(ak===true){ak=false;if(!(b(d,a.a_0,10)===0?false:!k(d)?false:true)){break e}d.B=d._;if(!e(d,'')){return false}aC=d.A-d._;al=true;f:while(al===true){al=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-aC;break f}}break d}d._=d.A-aB;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-x;break b}}d.B=d._;if(!e(d,'')){return false}d.C=d._;if(!i(d)){d._=d.A-x;break b}}break a}aA=d._=d.A-g;d.C=aA;am=true;b:while(am===true){am=false;ap=d.A-d._;an=true;c:while(an===true){an=false;if(!(b(d,a.a_0,10)===0?false:!k(d)?false:true)){break c}break b}d._=d.A-ap;if(!(!c(d)?false:!f(d,a.g_U,105,305)?false:!l(d)?false:true)){return false}}d.B=d._;if(!e(d,'')){return false}y=d.A-d._;ao=true;b:while(ao===true){ao=false;d.C=d._;if(!(!c(d)?false:b(d,a.a_16,2)===0?false:true)){d._=d.A-y;break b}d.B=d._;if(!e(d,'')){return false}if(!i(d)){d._=d.A-y;break b}}}return true};a.prototype.w=function(){var c;this.C=this._;c=b(this,a.a_23,4);if(c===0){return false}this.B=this._;switch(c){case 0:return false;case 1:if(!e(this,'p')){return false}break;case 2:if(!e(this,'ç')){return false}break;case 3:if(!e(this,'t')){return false}break;case 4:if(!e(this,'k')){return false}break}return true};a.prototype.r_post_process_last_consonants=a.prototype.w;function w(c){var d;c.C=c._;d=b(c,a.a_23,4);if(d===0){return false}c.B=c._;switch(d){case 0:return false;case 1:if(!e(c,'p')){return false}break;case 2:if(!e(c,'ç')){return false}break;case 3:if(!e(c,'t')){return false}break;case 4:if(!e(c,'k')){return false}break}return true};a.prototype.N=function(){var L;var _;var i;var Y;var B;var W;var K;var l;var S;var Q;var p;var O;var M;var s;var U;var u;var v;var w;var x;var y;var z;var A;var b;var C;var D;var j;var F;var G;var H;var I;var J;var E;var t;var r;var N;var q;var P;var o;var R;var m;var T;var k;var V;var h;var X;var e;var Z;var d;var $;var a0;var a1;var c;L=this.A-this._;u=true;a:while(u===true){u=false;_=this.A-this._;v=true;b:while(v===true){v=false;if(!g(this,1,'d')){break b}break a}this._=this.A-_;if(!g(this,1,'g')){return false}}this._=this.A-L;w=true;a:while(w===true){w=false;i=this.A-this._;x=true;b:while(x===true){x=false;Y=this.A-this._;d:while(true){B=this.A-this._;y=true;c:while(y===true){y=false;if(!f(this,a.g_vowel,97,305)){break c}this._=this.A-B;break d}V=this._=this.A-B;if(V<=this.D){break b}this._--}z=true;c:while(z===true){z=false;W=this.A-this._;A=true;d:while(A===true){A=false;if(!g(this,1,'a')){break d}break c}this._=this.A-W;if(!g(this,1,'ı')){break b}}h=this._=this.A-Y;b=h;N=h;q=n(this,h,h,'ı');if(h<=this.B){this.B+=q|0}if(N<=this.C){this.C+=q|0}this._=b;break a}this._=this.A-i;C=true;b:while(C===true){C=false;K=this.A-this._;c:while(true){l=this.A-this._;D=true;d:while(D===true){D=false;if(!f(this,a.g_vowel,97,305)){break d}this._=this.A-l;break c}X=this._=this.A-l;if(X<=this.D){break b}this._--}j=true;c:while(j===true){j=false;S=this.A-this._;F=true;d:while(F===true){F=false;if(!g(this,1,'e')){break d}break c}this._=this.A-S;if(!g(this,1,'i')){break b}}e=this._=this.A-K;b=e;P=e;o=n(this,e,e,'i');if(e<=this.B){this.B+=o|0}if(P<=this.C){this.C+=o|0}this._=b;break a}this._=this.A-i;G=true;b:while(G===true){G=false;Q=this.A-this._;c:while(true){p=this.A-this._;H=true;d:while(H===true){H=false;if(!f(this,a.g_vowel,97,305)){break d}this._=this.A-p;break c}Z=this._=this.A-p;if(Z<=this.D){break b}this._--}I=true;c:while(I===true){I=false;O=this.A-this._;J=true;d:while(J===true){J=false;if(!g(this,1,'o')){break d}break c}this._=this.A-O;if(!g(this,1,'u')){break b}}d=this._=this.A-Q;b=d;R=d;m=n(this,d,d,'u');if(d<=this.B){this.B+=m|0}if(R<=this.C){this.C+=m|0}this._=b;break a}a1=this._=(a0=this.A)-i;M=a0-a1;b:while(true){s=this.A-this._;E=true;c:while(E===true){E=false;if(!f(this,a.g_vowel,97,305)){break c}this._=this.A-s;break b}$=this._=this.A-s;if($<=this.D){return false}this._--}t=true;b:while(t===true){t=false;U=this.A-this._;r=true;c:while(r===true){r=false;if(!g(this,1,'ö')){break c}break b}this._=this.A-U;if(!g(this,1,'ü')){return false}}c=this._=this.A-M;b=c;T=c;k=n(this,c,c,'ü');if(c<=this.B){this.B+=k|0}if(T<=this.C){this.C+=k|0}this._=b}return true};a.prototype.r_append_U_to_stems_ending_with_d_or_g=a.prototype.N;function z(b){var $;var Z;var j;var X;var F;var L;var T;var m;var R;var P;var q;var N;var V;var t;var M;var v;var w;var x;var y;var z;var A;var B;var c;var D;var E;var C;var G;var H;var I;var J;var K;var u;var s;var r;var O;var p;var Q;var o;var S;var l;var U;var k;var W;var i;var Y;var h;var _;var e;var a0;var a1;var a2;var d;$=b.A-b._;v=true;a:while(v===true){v=false;Z=b.A-b._;w=true;b:while(w===true){w=false;if(!g(b,1,'d')){break b}break a}b._=b.A-Z;if(!g(b,1,'g')){return false}}b._=b.A-$;x=true;a:while(x===true){x=false;j=b.A-b._;y=true;b:while(y===true){y=false;X=b.A-b._;d:while(true){F=b.A-b._;z=true;c:while(z===true){z=false;if(!f(b,a.g_vowel,97,305)){break c}b._=b.A-F;break d}W=b._=b.A-F;if(W<=b.D){break b}b._--}A=true;c:while(A===true){A=false;L=b.A-b._;B=true;d:while(B===true){B=false;if(!g(b,1,'a')){break d}break c}b._=b.A-L;if(!g(b,1,'ı')){break b}}i=b._=b.A-X;c=i;O=i;p=n(b,i,i,'ı');if(i<=b.B){b.B+=p|0}if(O<=b.C){b.C+=p|0}b._=c;break a}b._=b.A-j;D=true;b:while(D===true){D=false;T=b.A-b._;c:while(true){m=b.A-b._;E=true;d:while(E===true){E=false;if(!f(b,a.g_vowel,97,305)){break d}b._=b.A-m;break c}Y=b._=b.A-m;if(Y<=b.D){break b}b._--}C=true;c:while(C===true){C=false;R=b.A-b._;G=true;d:while(G===true){G=false;if(!g(b,1,'e')){break d}break c}b._=b.A-R;if(!g(b,1,'i')){break b}}h=b._=b.A-T;c=h;Q=h;o=n(b,h,h,'i');if(h<=b.B){b.B+=o|0}if(Q<=b.C){b.C+=o|0}b._=c;break a}b._=b.A-j;H=true;b:while(H===true){H=false;P=b.A-b._;c:while(true){q=b.A-b._;I=true;d:while(I===true){I=false;if(!f(b,a.g_vowel,97,305)){break d}b._=b.A-q;break c}_=b._=b.A-q;if(_<=b.D){break b}b._--}J=true;c:while(J===true){J=false;N=b.A-b._;K=true;d:while(K===true){K=false;if(!g(b,1,'o')){break d}break c}b._=b.A-N;if(!g(b,1,'u')){break b}}e=b._=b.A-P;c=e;S=e;l=n(b,e,e,'u');if(e<=b.B){b.B+=l|0}if(S<=b.C){b.C+=l|0}b._=c;break a}a2=b._=(a1=b.A)-j;V=a1-a2;b:while(true){t=b.A-b._;u=true;c:while(u===true){u=false;if(!f(b,a.g_vowel,97,305)){break c}b._=b.A-t;break b}a0=b._=b.A-t;if(a0<=b.D){return false}b._--}s=true;b:while(s===true){s=false;M=b.A-b._;r=true;c:while(r===true){r=false;if(!g(b,1,'ö')){break c}break b}b._=b.A-M;if(!g(b,1,'ü')){return false}}d=b._=b.A-V;c=d;U=d;k=n(b,d,d,'ü');if(d<=b.B){b.B+=k|0}if(U<=b.C){b.C+=k|0}b._=c}return true};a.prototype.v=function(){var e;var f;var b;var c;var d;e=this._;b=2;a:while(true){f=this._;c=true;b:while(c===true){c=false;c:while(true){d=true;d:while(d===true){d=false;if(!v(this,a.g_vowel,97,305)){break d}break c}if(this._>=this.A){break b}this._++}b--;continue a}this._=f;break a}if(b>0){return false}this._=e;return true};a.prototype.r_more_than_one_syllable_word=a.prototype.v;function N(b){var f;var g;var c;var d;var e;f=b._;c=2;a:while(true){g=b._;d=true;b:while(d===true){d=false;c:while(true){e=true;d:while(e===true){e=false;if(!v(b,a.g_vowel,97,305)){break d}break c}if(b._>=b.A){break b}b._++}c--;continue a}b._=g;break a}if(c>0){return false}b._=f;return true};a.prototype.P=function(){var f;var g;var h;var b;var a;var c;var d;var i;var j;var e;b=true;b:while(b===true){b=false;f=this._;a=true;a:while(a===true){a=false;g=this._;c:while(true){c=true;d:while(c===true){c=false;if(!s(this,2,'ad')){break d}break c}if(this._>=this.A){break a}this._++}i=this.I_strlen=2;if(!(i===this.A)){break a}this._=g;break b}j=this._=f;h=j;a:while(true){d=true;c:while(d===true){d=false;if(!s(this,5,'soyad')){break c}break a}if(this._>=this.A){return false}this._++}e=this.I_strlen=5;if(!(e===this.A)){return false}this._=h}return true};a.prototype.r_is_reserved_word=a.prototype.P;function x(a){var g;var h;var i;var c;var b;var d;var e;var j;var k;var f;c=true;b:while(c===true){c=false;g=a._;b=true;a:while(b===true){b=false;h=a._;c:while(true){d=true;d:while(d===true){d=false;if(!s(a,2,'ad')){break d}break c}if(a._>=a.A){break a}a._++}j=a.I_strlen=2;if(!(j===a.A)){break a}a._=h;break b}k=a._=g;i=k;a:while(true){e=true;c:while(e===true){e=false;if(!s(a,5,'soyad')){break c}break a}if(a._>=a.A){return false}a._++}f=a.I_strlen=5;if(!(f===a.A)){return false}a._=i}return true};a.prototype.x=function(){var d;var e;var a;var b;var c;var f;var g;var h;d=this._;a=true;a:while(a===true){a=false;if(!x(this)){break a}return false}f=this._=d;this.D=f;h=this._=g=this.A;e=g-h;b=true;a:while(b===true){b=false;if(!z(this)){break a}}this._=this.A-e;c=true;a:while(c===true){c=false;if(!w(this)){break a}}this._=this.D;return true};a.prototype.r_postlude=a.prototype.x;function O(a){var e;var f;var b;var c;var d;var g;var h;var i;e=a._;b=true;a:while(b===true){b=false;if(!x(a)){break a}return false}g=a._=e;a.D=g;i=a._=h=a.A;f=h-i;c=true;a:while(c===true){c=false;if(!z(a)){break a}}a._=a.A-f;d=true;a:while(d===true){d=false;if(!w(a)){break a}}a._=a.D;return true};a.prototype.H=function(){var c;var a;var b;var d;var e;if(!N(this)){return false}this.D=this._;e=this._=d=this.A;c=d-e;a=true;a:while(a===true){a=false;if(!J(this)){break a}}this._=this.A-c;if(!this.B_continue_stemming_noun_suffixes){return false}b=true;a:while(b===true){b=false;if(!L(this)){break a}}this._=this.D;return!O(this)?false:true};a.prototype.stem=a.prototype.H;a.prototype.L=function(b){return b instanceof a};a.prototype.equals=a.prototype.L;a.prototype.M=function(){var c;var a;var b;var d;c='TurkishStemmer';a=0;for(b=0;b<c.length;b++){d=c.charCodeAt(b);a=(a<<5)-a+d;a=a&a}return a|0};a.prototype.hashCode=a.prototype.M;a.serialVersionUID=1;j(a,'methodObject',function(){return new a});j(a,'a_0',function(){return[new d('m',-1,-1),new d('n',-1,-1),new d('miz',-1,-1),new d('niz',-1,-1),new d('muz',-1,-1),new d('nuz',-1,-1),new d('müz',-1,-1),new d('nüz',-1,-1),new d('mız',-1,-1),new d('nız',-1,-1)]});j(a,'a_1',function(){return[new d('leri',-1,-1),new d('ları',-1,-1)]});j(a,'a_2',function(){return[new d('ni',-1,-1),new d('nu',-1,-1),new d('nü',-1,-1),new d('nı',-1,-1)]});j(a,'a_3',function(){return[new d('in',-1,-1),new d('un',-1,-1),new d('ün',-1,-1),new d('ın',-1,-1)]});j(a,'a_4',function(){return[new d('a',-1,-1),new d('e',-1,-1)]});j(a,'a_5',function(){return[new d('na',-1,-1),new d('ne',-1,-1)]});j(a,'a_6',function(){return[new d('da',-1,-1),new d('ta',-1,-1),new d('de',-1,-1),new d('te',-1,-1)]});j(a,'a_7',function(){return[new d('nda',-1,-1),new d('nde',-1,-1)]});j(a,'a_8',function(){return[new d('dan',-1,-1),new d('tan',-1,-1),new d('den',-1,-1),new d('ten',-1,-1)]});j(a,'a_9',function(){return[new d('ndan',-1,-1),new d('nden',-1,-1)]});j(a,'a_10',function(){return[new d('la',-1,-1),new d('le',-1,-1)]});j(a,'a_11',function(){return[new d('ca',-1,-1),new d('ce',-1,-1)]});j(a,'a_12',function(){return[new d('im',-1,-1),new d('um',-1,-1),new d('üm',-1,-1),new d('ım',-1,-1)]});j(a,'a_13',function(){return[new d('sin',-1,-1),new d('sun',-1,-1),new d('sün',-1,-1),new d('sın',-1,-1)]});j(a,'a_14',function(){return[new d('iz',-1,-1),new d('uz',-1,-1),new d('üz',-1,-1),new d('ız',-1,-1)]});j(a,'a_15',function(){return[new d('siniz',-1,-1),new d('sunuz',-1,-1),new d('sünüz',-1,-1),new d('sınız',-1,-1)]});j(a,'a_16',function(){return[new d('lar',-1,-1),new d('ler',-1,-1)]});j(a,'a_17',function(){return[new d('niz',-1,-1),new d('nuz',-1,-1),new d('nüz',-1,-1),new d('nız',-1,-1)]});j(a,'a_18',function(){return[new d('dir',-1,-1),new d('tir',-1,-1),new d('dur',-1,-1),new d('tur',-1,-1),new d('dür',-1,-1),new d('tür',-1,-1),new d('dır',-1,-1),new d('tır',-1,-1)]});j(a,'a_19',function(){return[new d('casına',-1,-1),new d('cesine',-1,-1)]});j(a,'a_20',function(){return[new d('di',-1,-1),new d('ti',-1,-1),new d('dik',-1,-1),new d('tik',-1,-1),new d('duk',-1,-1),new d('tuk',-1,-1),new d('dük',-1,-1),new d('tük',-1,-1),new d('dık',-1,-1),new d('tık',-1,-1),new d('dim',-1,-1),new d('tim',-1,-1),new d('dum',-1,-1),new d('tum',-1,-1),new d('düm',-1,-1),new d('tüm',-1,-1),new d('dım',-1,-1),new d('tım',-1,-1),new d('din',-1,-1),new d('tin',-1,-1),new d('dun',-1,-1),new d('tun',-1,-1),new d('dün',-1,-1),new d('tün',-1,-1),new d('dın',-1,-1),new d('tın',-1,-1),new d('du',-1,-1),new d('tu',-1,-1),new d('dü',-1,-1),new d('tü',-1,-1),new d('dı',-1,-1),new d('tı',-1,-1)]});j(a,'a_21',function(){return[new d('sa',-1,-1),new d('se',-1,-1),new d('sak',-1,-1),new d('sek',-1,-1),new d('sam',-1,-1),new d('sem',-1,-1),new d('san',-1,-1),new d('sen',-1,-1)]});j(a,'a_22',function(){return[new d('miş',-1,-1),new d('muş',-1,-1),new d('müş',-1,-1),new d('mış',-1,-1)]});j(a,'a_23',function(){return[new d('b',-1,1),new d('c',-1,2),new d('d',-1,3),new d('ğ',-1,4)]});j(a,'g_vowel',function(){return[17,65,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,32,8,0,0,0,0,0,0,1]});j(a,'g_U',function(){return[1,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,1]});j(a,'g_vowel1',function(){return[1,64,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]});j(a,'g_vowel2',function(){return[17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,130]});j(a,'g_vowel3',function(){return[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1]});j(a,'g_vowel4',function(){return[17]});j(a,'g_vowel5',function(){return[65]});j(a,'g_vowel6',function(){return[65]});var y={'src/stemmer.jsx':{Stemmer:u},'src/turkish-stemmer.jsx':{TurkishStemmer:a}}}(JSX)) var Stemmer = JSX.require("src/turkish-stemmer.jsx").TurkishStemmer; @@ -24,7 +28,7 @@ class SearchTurkish(SearchLanguage): language_name = 'Turkish' js_stemmer_rawcode = 'turkish-stemmer.js' js_stemmer_code = js_stemmer - stopwords = [] # type: List[unicode] + stopwords = set() # type: Set[unicode] def init(self, options): # type: (Dict) -> None diff --git a/sphinx/search/zh.py b/sphinx/search/zh.py index 520dd6493..4f17129b6 100644 --- a/sphinx/search/zh.py +++ b/sphinx/search/zh.py @@ -21,7 +21,11 @@ try: except ImportError: JIEBA = False -english_stopwords = set(""" +if False: + # For type annotation + from typing import Dict, List # NOQA + +english_stopwords = set(u""" a and are as at be but by for diff --git a/sphinx/setup_command.py b/sphinx/setup_command.py index 6d0aecb8f..4d3f56509 100644 --- a/sphinx/setup_command.py +++ b/sphinx/setup_command.py @@ -28,7 +28,7 @@ from sphinx.util.osutil import abspath if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, List, Tuple # NOQA class BuildDoc(Command): diff --git a/sphinx/theming.py b/sphinx/theming.py index ec7867b3b..1e1087620 100644 --- a/sphinx/theming.py +++ b/sphinx/theming.py @@ -16,8 +16,7 @@ import tempfile from os import path from six import string_types, iteritems -from six.moves import configparser # type: ignore -from typing import Any, Callable, Tuple # NOQA +from six.moves import configparser try: import pkg_resources @@ -32,7 +31,7 @@ logger = logging.getLogger(__name__) if False: # For type annotation - from typing import Any, Callable, Tuple # NOQA + from typing import Any, Callable, Dict, List, Tuple # NOQA NODEFAULT = object() THEMECONF = 'theme.conf' @@ -148,7 +147,7 @@ class Theme(object): fp.write(tinfo.read(name)) self.themeconf = configparser.RawConfigParser() - self.themeconf.read(path.join(self.themedir, THEMECONF)) + self.themeconf.read(path.join(self.themedir, THEMECONF)) # type: ignore try: inherit = self.themeconf.get('theme', 'inherit') @@ -172,7 +171,7 @@ class Theme(object): base theme chain. """ try: - return self.themeconf.get(section, name) + return self.themeconf.get(section, name) # type: ignore except (configparser.NoOptionError, configparser.NoSectionError): if self.base is not None: return self.base.get_confstr(section, name, default) @@ -245,7 +244,7 @@ def load_theme_plugins(): path = func_or_path if isinstance(path, string_types): - theme_paths.append(path) # type: ignore + theme_paths.append(path) else: raise ThemeError('Plugin %r does not response correctly.' % plugin.module_name) diff --git a/sphinx/transforms/i18n.py b/sphinx/transforms/i18n.py index bd49077d8..f398904d5 100644 --- a/sphinx/transforms/i18n.py +++ b/sphinx/transforms/i18n.py @@ -29,7 +29,7 @@ from sphinx.domains.std import make_glossary_term, split_term_classifiers if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.application import Sphinx # NOQA from sphinx.config import Config # NOQA diff --git a/sphinx/util/__init__.py b/sphinx/util/__init__.py index bfdecbaa0..1c284d2e0 100644 --- a/sphinx/util/__init__.py +++ b/sphinx/util/__init__.py @@ -45,7 +45,7 @@ from sphinx.util.matching import patfilter # noqa if False: # For type annotation - from typing import Any, Callable, IO, Iterable, Iterator, Pattern, Sequence, Tuple, Union # NOQA + from typing import Any, Callable, Dict, IO, Iterable, Iterator, List, Pattern, Sequence, Set, Tuple, Union # NOQA logger = logging.getLogger(__name__) @@ -109,7 +109,7 @@ def get_matching_docs(dirname, suffixes, exclude_matchers=()): suffixpatterns = ['*' + s for s in suffixes] for filename in get_matching_files(dirname, exclude_matchers): for suffixpattern in suffixpatterns: - if fnmatch.fnmatch(filename, suffixpattern): # type: ignore + if fnmatch.fnmatch(filename, suffixpattern): yield filename[:-len(suffixpattern) + 1] break diff --git a/sphinx/util/compat.py b/sphinx/util/compat.py index 42406afe7..e5ca6accb 100644 --- a/sphinx/util/compat.py +++ b/sphinx/util/compat.py @@ -22,7 +22,7 @@ docutils_version = tuple(int(x) for x in _du_version.split('.')[:2]) if False: # For type annotation - from typing import Any # NOQA + from typing import Any, Dict # NOQA class _DeprecationWrapper(object): diff --git a/sphinx/util/console.py b/sphinx/util/console.py index ac3d2282f..5e4a0d321 100644 --- a/sphinx/util/console.py +++ b/sphinx/util/console.py @@ -19,6 +19,11 @@ try: except ImportError: colorama = None +if False: + # For type annotation + from typing import Dict # NOQA + + _ansi_re = re.compile('\x1b\\[(\\d\\d;){0,2}\\d\\dm') codes = {} # type: Dict[str, str] diff --git a/sphinx/util/docfields.py b/sphinx/util/docfields.py index f0af0c59d..c7f5e01ee 100644 --- a/sphinx/util/docfields.py +++ b/sphinx/util/docfields.py @@ -17,7 +17,7 @@ from sphinx import addnodes if False: # For type annotation - from typing import Any, Tuple # NOQA + from typing import Any, Dict, List, Tuple # NOQA from sphinx.domains import Domain # NOQA diff --git a/sphinx/util/docstrings.py b/sphinx/util/docstrings.py index e79408da2..4a0a0df49 100644 --- a/sphinx/util/docstrings.py +++ b/sphinx/util/docstrings.py @@ -11,6 +11,10 @@ import sys +if False: + # For type annotation + from typing import List # NOQA + def prepare_docstring(s, ignore=1): # type: (unicode, int) -> List[unicode] diff --git a/sphinx/util/docutils.py b/sphinx/util/docutils.py index d9bc64bf3..165d5862a 100644 --- a/sphinx/util/docutils.py +++ b/sphinx/util/docutils.py @@ -24,10 +24,9 @@ logger = logging.getLogger(__name__) report_re = re.compile('^(.+?:\\d+): \\((DEBUG|INFO|WARNING|ERROR|SEVERE)/(\\d+)?\\) ' '(.+?)\n?$') - if False: # For type annotation - from typing import Any, Callable, Iterator, Tuple # NOQA + from typing import Any, Callable, Iterator, List, Tuple # NOQA from docutils import nodes # NOQA from sphinx.environment import BuildEnvironment # NOQA diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py index ddfb61e6b..58ed49068 100644 --- a/sphinx/util/fileutil.py +++ b/sphinx/util/fileutil.py @@ -18,7 +18,7 @@ from sphinx.util.osutil import copyfile, ensuredir, walk if False: # For type annotation - from typing import Callable, Union # NOQA + from typing import Callable, Dict, Union # NOQA from sphinx.util.matching import Matcher # NOQA from sphinx.util.template import BaseRenderer # NOQA diff --git a/sphinx/util/i18n.py b/sphinx/util/i18n.py index bb6896080..e338824d5 100644 --- a/sphinx/util/i18n.py +++ b/sphinx/util/i18n.py @@ -28,7 +28,7 @@ logger = logging.getLogger(__name__) if False: # For type annotation - from typing import Callable # NOQA + from typing import Callable, List, Set # NOQA from sphinx.environment import BuildEnvironment # NOQA LocaleFileInfoBase = namedtuple('CatalogInfo', 'base_dir,domain,charset') diff --git a/sphinx/util/images.py b/sphinx/util/images.py index 81dfaf681..653742c1a 100644 --- a/sphinx/util/images.py +++ b/sphinx/util/images.py @@ -23,7 +23,7 @@ except ImportError: if False: # For type annotation - from typing import Tuple # NOQA + from typing import Dict, List, Tuple # NOQA mime_suffixes = { '.pdf': 'application/pdf', diff --git a/sphinx/util/inspect.py b/sphinx/util/inspect.py index 58e750a53..4653197b3 100644 --- a/sphinx/util/inspect.py +++ b/sphinx/util/inspect.py @@ -12,13 +12,13 @@ import re from six import PY3, binary_type -from six.moves import builtins # type: ignore +from six.moves import builtins from sphinx.util import force_decode if False: # For type annotation - from typing import Any, Callable, Tuple, Type # NOQA + from typing import Any, Callable, List, Tuple, Type # NOQA # this imports the standard library inspect module without resorting to # relatively import this module diff --git a/sphinx/util/jsdump.py b/sphinx/util/jsdump.py index 592a4565f..9f3b83adf 100644 --- a/sphinx/util/jsdump.py +++ b/sphinx/util/jsdump.py @@ -18,7 +18,7 @@ from sphinx.util.pycompat import u if False: # For type annotation - from typing import Any, IO, Match, Union # NOQA + from typing import Any, Dict, IO, List, Match, Union # NOQA _str_re = re.compile(r'"(\\\\|\\"|[^"])*"') _int_re = re.compile(r'\d+') @@ -124,7 +124,7 @@ def loads(x): i = 0 n = len(x) stack = [] # type: List[Union[List, Dict]] - obj = nothing + obj = nothing # type: Any key = False keys = [] while i < n: diff --git a/sphinx/util/jsonimpl.py b/sphinx/util/jsonimpl.py index e5f6a0e72..08df7f570 100644 --- a/sphinx/util/jsonimpl.py +++ b/sphinx/util/jsonimpl.py @@ -29,7 +29,7 @@ class SphinxJSONEncoder(json.JSONEncoder): def dump(obj, fp, *args, **kwds): - # type: (Any, IO, Any, Any) -> unicode + # type: (Any, IO, Any, Any) -> None kwds['cls'] = SphinxJSONEncoder json.dump(obj, fp, *args, **kwds) diff --git a/sphinx/util/logging.py b/sphinx/util/logging.py index 8fd05dbb9..9aca592d7 100644 --- a/sphinx/util/logging.py +++ b/sphinx/util/logging.py @@ -24,7 +24,7 @@ from sphinx.util.console import colorize if False: # For type annotation - from typing import Any, Generator, IO, Tuple, Union # NOQA + from typing import Any, Dict, Generator, IO, List, Tuple, Union # NOQA from docutils import nodes # NOQA from sphinx.application import Sphinx # NOQA diff --git a/sphinx/util/matching.py b/sphinx/util/matching.py index be4bfee34..a643f4505 100644 --- a/sphinx/util/matching.py +++ b/sphinx/util/matching.py @@ -13,7 +13,7 @@ import re if False: # For type annotation - from typing import Callable, Match, Pattern # NOQA + from typing import Callable, Dict, List, Match, Pattern # NOQA def _translate_pattern(pat): diff --git a/sphinx/util/nodes.py b/sphinx/util/nodes.py index 6bf47da1f..99826f657 100644 --- a/sphinx/util/nodes.py +++ b/sphinx/util/nodes.py @@ -22,7 +22,7 @@ from sphinx.util import logging if False: # For type annotation - from typing import Any, Callable, Iterable, Tuple, Union # NOQA + from typing import Any, Callable, Iterable, List, Set, Tuple, Union # NOQA from sphinx.builders import Builder # NOQA from sphinx.utils.tags import Tags # NOQA @@ -182,6 +182,7 @@ def find_source_node(node): for pnode in traverse_parent(node): if pnode.source: return pnode.source + return None def traverse_parent(node, cls=None): diff --git a/sphinx/util/osutil.py b/sphinx/util/osutil.py index acf236027..299f2d272 100644 --- a/sphinx/util/osutil.py +++ b/sphinx/util/osutil.py @@ -25,7 +25,7 @@ from six import PY2, PY3, text_type if False: # For type annotation - from typing import Any, Iterator, Tuple, Union # NOQA + from typing import Any, Iterator, List, Tuple, Union # NOQA # Errnos that we need. EEXIST = getattr(errno, 'EEXIST', 0) diff --git a/sphinx/util/parallel.py b/sphinx/util/parallel.py index fc691bee1..c7bc1f367 100644 --- a/sphinx/util/parallel.py +++ b/sphinx/util/parallel.py @@ -25,7 +25,7 @@ from sphinx.util import logging if False: # For type annotation - from typing import Any, Callable, Sequence # NOQA + from typing import Any, Callable, Dict, List, Sequence # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/util/tags.py b/sphinx/util/tags.py index 18df4f9c3..fe6c9a769 100644 --- a/sphinx/util/tags.py +++ b/sphinx/util/tags.py @@ -16,7 +16,7 @@ env = Environment() if False: # For type annotation - from typing import Iterator # NOQA + from typing import Iterator, List # NOQA class BooleanParser(Parser): diff --git a/sphinx/util/template.py b/sphinx/util/template.py index 7dee0d71c..1099a2602 100644 --- a/sphinx/util/template.py +++ b/sphinx/util/template.py @@ -18,6 +18,7 @@ from sphinx.locale import get_translator if False: # For type annotation + from typing import Dict # NOQA from jinja2.loaders import BaseLoader # NOQA diff --git a/sphinx/util/typing.py b/sphinx/util/typing.py new file mode 100644 index 000000000..20c8883e4 --- /dev/null +++ b/sphinx/util/typing.py @@ -0,0 +1,24 @@ +# -*- coding: utf-8 -*- +""" + sphinx.util.typing + ~~~~~~~~~~~~~~~~~~ + + The composit types for Sphinx. + + :copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from six import PY3 +from typing import Callable, Dict, List, Tuple + +from docutils import nodes +from docutils.parsers.rst.states import Inliner + + +if PY3: + unicode = str + +# common role functions +RoleFunction = Callable[[unicode, unicode, unicode, int, Inliner, Dict, List[unicode]], + Tuple[List[nodes.Node], List[nodes.Node]]] diff --git a/sphinx/websupport/__init__.py b/sphinx/websupport/__init__.py index f7b215f83..294a44f4b 100644 --- a/sphinx/websupport/__init__.py +++ b/sphinx/websupport/__init__.py @@ -26,6 +26,10 @@ from sphinx.websupport import errors from sphinx.websupport.search import BaseSearch, SEARCH_ADAPTERS from sphinx.websupport.storage import StorageBackend +if False: + # For type annotation + from typing import Dict # NOQA + class WebSupport(object): """The main API class for the web support package. All interactions diff --git a/sphinx/websupport/storage/sqlalchemy_db.py b/sphinx/websupport/storage/sqlalchemy_db.py index 16418ec8f..4b28268b9 100644 --- a/sphinx/websupport/storage/sqlalchemy_db.py +++ b/sphinx/websupport/storage/sqlalchemy_db.py @@ -14,9 +14,13 @@ from datetime import datetime from sqlalchemy import Column, Integer, Text, String, Boolean, \ ForeignKey, DateTime -from sqlalchemy.orm import relation, sessionmaker, aliased # type: ignore +from sqlalchemy.orm import relation, sessionmaker, aliased from sqlalchemy.ext.declarative import declarative_base +if False: + # For type annotation + from typing import List # NOQA + Base = declarative_base() Session = sessionmaker() diff --git a/sphinx/websupport/storage/sqlalchemystorage.py b/sphinx/websupport/storage/sqlalchemystorage.py index 8b7d76714..7220fefd6 100644 --- a/sphinx/websupport/storage/sqlalchemystorage.py +++ b/sphinx/websupport/storage/sqlalchemystorage.py @@ -12,7 +12,7 @@ from datetime import datetime import sqlalchemy -from sqlalchemy.orm import aliased # type: ignore +from sqlalchemy.orm import aliased from sqlalchemy.sql import func from sphinx.websupport.errors import CommentNotAllowedError, \ diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py index 12f6934d6..7674f8d2f 100644 --- a/sphinx/writers/latex.py +++ b/sphinx/writers/latex.py @@ -34,7 +34,7 @@ from sphinx.util.smartypants import educate_quotes_latex if False: # For type annotation - from typing import Any, Callable, Iterator, Pattern, Tuple, Union # NOQA + from typing import Any, Callable, Dict, Iterator, List, Pattern, Tuple, Set, Union # NOQA from sphinx.builder import Builder # NOQA logger = logging.getLogger(__name__) @@ -823,7 +823,7 @@ class LaTeXTranslator(nodes.NodeVisitor): def generate_indices(self): # type: (Builder) -> unicode def generate(content, collapsed): - # type: (List[Tuple[unicode, List[Tuple[unicode, unicode, unicode, unicode, unicode]]]], bool) -> unicode # NOQA + # type: (List[Tuple[unicode, List[Tuple[unicode, unicode, unicode, unicode, unicode]]]], bool) -> None # NOQA ret.append('\\begin{sphinxtheindex}\n') ret.append('\\def\\bigletter#1{{\\Large\\sffamily#1}' '\\nopagebreak\\vspace{1mm}}\n') @@ -1666,6 +1666,7 @@ class LaTeXTranslator(nodes.NodeVisitor): return rstdim_to_latexdim(width_str) except ValueError: logger.warning('dimension unit %s is invalid. Ignored.', width_str) + return None def is_inline(self, node): # type: (nodes.Node) -> bool diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index c3cacd3e2..07559dd47 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -27,7 +27,7 @@ from sphinx.writers.latex import collected_footnote if False: # For type annotation - from typing import Any, Callable, Iterator, Pattern, Tuple, Union # NOQA + from typing import Any, Callable, Dict, Iterator, List, Pattern, Set, Tuple, Union # NOQA from sphinx.builders.texinfo import TexinfoBuilder # NOQA logger = logging.getLogger(__name__) diff --git a/sphinx/writers/text.py b/sphinx/writers/text.py index 8b4296057..97ca9e8de 100644 --- a/sphinx/writers/text.py +++ b/sphinx/writers/text.py @@ -24,7 +24,7 @@ from sphinx.util import logging if False: # For type annotation - from typing import Any, Callable, Tuple, Union # NOQA + from typing import Any, Callable, Dict, List, Tuple, Union # NOQA from sphinx.builders.text import TextBuilder # NOQA logger = logging.getLogger(__name__) |