Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2019-12-24 19:28:23 +0300
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2019-12-24 20:02:06 +0300
commit0a1d9e2b491623a198068b3983b1cb37dd88ec41 (patch)
treeeb85ca0c3db7113841e653ae32026c845f3f7f9e /sphinx/errors.py
parent4b8937ab29e6750974e34cb0ec0265d62c5894e2 (diff)
Migrate to py3 style type annotation: sphinx.errors
Diffstat (limited to 'sphinx/errors.py')
-rw-r--r--sphinx/errors.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/sphinx/errors.py b/sphinx/errors.py
index 64036721f..d67d6d1f7 100644
--- a/sphinx/errors.py
+++ b/sphinx/errors.py
@@ -9,9 +9,7 @@
:license: BSD, see LICENSE for details.
"""
-if False:
- # For type annotation
- from typing import Any # NOQA
+from typing import Any
class SphinxError(Exception):
@@ -51,21 +49,18 @@ class ExtensionError(SphinxError):
"""Extension error."""
category = 'Extension error'
- def __init__(self, message, orig_exc=None):
- # type: (str, Exception) -> None
+ def __init__(self, message: str, orig_exc: Exception = None) -> None:
super().__init__(message)
self.message = message
self.orig_exc = orig_exc
- def __repr__(self):
- # type: () -> str
+ def __repr__(self) -> str:
if self.orig_exc:
return '%s(%r, %r)' % (self.__class__.__name__,
self.message, self.orig_exc)
return '%s(%r)' % (self.__class__.__name__, self.message)
- def __str__(self):
- # type: () -> str
+ def __str__(self) -> str:
parent_str = super().__str__()
if self.orig_exc:
return '%s (exception: %s)' % (parent_str, self.orig_exc)
@@ -102,21 +97,18 @@ class SphinxParallelError(SphinxError):
category = 'Sphinx parallel build error'
- def __init__(self, message, traceback):
- # type: (str, Any) -> None
+ def __init__(self, message: str, traceback: Any) -> None:
self.message = message
self.traceback = traceback
- def __str__(self):
- # type: () -> str
+ def __str__(self) -> str:
return self.message
class PycodeError(Exception):
"""Pycode Python source code analyser error."""
- def __str__(self):
- # type: () -> str
+ def __str__(self) -> str:
res = self.args[0]
if len(self.args) > 1:
res += ' (exception was: %r)' % self.args[1]