1.1 --- a/lib/__builtins__/__init__.py Thu Jan 12 23:29:39 2017 +0100
1.2 +++ b/lib/__builtins__/__init__.py Thu Jan 12 23:50:26 2017 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Simple built-in classes and functions.
1.6
1.7 -Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -19,22 +19,19 @@
1.13 this program. If not, see <http://www.gnu.org/licenses/>.
1.14 """
1.15
1.16 -from __builtins__.core import function, get_using, module, object, type, \
1.17 - BaseException, Exception, MemoryError, \
1.18 - OverflowError, TypeError, ZeroDivisionError, \
1.19 - UnboundMethodInvocation, Warning
1.20 +from __builtins__.core import (
1.21 + function, get_using, module, object, type,
1.22 + ArithmeticError, Exception, FloatingPointError, MemoryError, OverflowError,
1.23 + TypeError, UnboundMethodInvocation, ZeroDivisionError
1.24 + )
1.25
1.26 # Exceptions.
1.27
1.28 from __builtins__.exception import (
1.29 - ArithmeticError,
1.30 AssertionError,
1.31 AttributeError,
1.32 - DeprecationWarning,
1.33 EOFError,
1.34 EnvironmentError,
1.35 - FloatingPointError,
1.36 - FutureWarning,
1.37 IndentationError,
1.38 IndexError,
1.39 IOError,
1.40 @@ -42,12 +39,9 @@
1.41 KeyboardInterrupt,
1.42 NotImplementedError,
1.43 OSError,
1.44 - PendingDeprecationWarning,
1.45 RuntimeError,
1.46 - RuntimeWarning,
1.47 StopIteration,
1.48 SyntaxError,
1.49 - SyntaxWarning,
1.50 SystemError,
1.51 SystemExit,
1.52 TabError,
1.53 @@ -55,8 +49,6 @@
1.54 UnicodeEncodeError,
1.55 UnicodeError,
1.56 UnicodeTranslateError,
1.57 - UnicodeWarning,
1.58 - UserWarning,
1.59 ValueError
1.60 )
1.61
2.1 --- a/lib/__builtins__/core.py Thu Jan 12 23:29:39 2017 +0100
2.2 +++ b/lib/__builtins__/core.py Thu Jan 12 23:50:26 2017 +0100
2.3 @@ -3,7 +3,7 @@
2.4 """
2.5 Core objects.
2.6
2.7 -Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
2.8 +Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
2.9
2.10 This program is free software; you can redistribute it and/or modify it under
2.11 the terms of the GNU General Public License as published by the Free Software
2.12 @@ -113,18 +113,57 @@
2.13
2.14 __repr__ = __str__
2.15
2.16 -class BaseException:
2.17 +class Exception:
2.18
2.19 "The root of all exception types."
2.20
2.21 pass
2.22
2.23 -class Exception(BaseException): pass
2.24 -class MemoryError(Exception): pass
2.25 -class OverflowError(Exception): pass
2.26 -class TypeError(Exception): pass
2.27 -class UnboundMethodInvocation(Exception): pass
2.28 -class Warning: pass
2.29 -class ZeroDivisionError(Exception): pass
2.30 +# Fundamental exceptions
2.31 +
2.32 +class MemoryError(Exception):
2.33 +
2.34 + "An error indicating failure to allocate or manage memory."
2.35 +
2.36 + pass
2.37 +
2.38 +class TypeError(Exception):
2.39 +
2.40 + "An error indicating unsuitable type usage."
2.41 +
2.42 + pass
2.43 +
2.44 +class UnboundMethodInvocation(Exception):
2.45 +
2.46 + "An error indicating an attempt to call an unbound method."
2.47 +
2.48 + pass
2.49 +
2.50 +class ArithmeticError(Exception):
2.51 +
2.52 + "A general arithmetic operation error."
2.53 +
2.54 + pass
2.55 +
2.56 +class FloatingPointError(Exception):
2.57 +
2.58 + "A floating point operation error."
2.59 +
2.60 + pass
2.61 +
2.62 +class OverflowError(ArithmeticError):
2.63 +
2.64 + """
2.65 + Indicates that an arithmetic operation produced a result that could not be
2.66 + represented.
2.67 + """
2.68 +
2.69 + pass
2.70 +
2.71 +class ZeroDivisionError(ArithmeticError):
2.72 +
2.73 + "An error occurring when an attempt was made to divide an operand by zero."
2.74 +
2.75 + pass
2.76
2.77 # vim: tabstop=4 expandtab shiftwidth=4
3.1 --- a/lib/__builtins__/exception/__init__.py Thu Jan 12 23:29:39 2017 +0100
3.2 +++ b/lib/__builtins__/exception/__init__.py Thu Jan 12 23:50:26 2017 +0100
3.3 @@ -3,7 +3,7 @@
3.4 """
3.5 Exception objects.
3.6
3.7 -Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
3.8 +Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
3.9
3.10 This program is free software; you can redistribute it and/or modify it under
3.11 the terms of the GNU General Public License as published by the Free Software
3.12 @@ -27,6 +27,7 @@
3.13 IndexError,
3.14 KeyError,
3.15 NotImplementedError,
3.16 + RuntimeError,
3.17 StopIteration,
3.18 ValueError
3.19 )
3.20 @@ -41,27 +42,15 @@
3.21 AttributeError
3.22 )
3.23
3.24 -from __builtins__.exception.numeric import (
3.25 - ArithmeticError,
3.26 - FloatingPointError
3.27 - )
3.28 -
3.29 from __builtins__.exception.program import (
3.30 - DeprecationWarning,
3.31 - FutureWarning,
3.32 IndentationError,
3.33 - PendingDeprecationWarning,
3.34 SyntaxError,
3.35 - SyntaxWarning,
3.36 - TabError,
3.37 - UserWarning
3.38 + TabError
3.39 )
3.40
3.41 from __builtins__.exception.system import (
3.42 EnvironmentError,
3.43 OSError,
3.44 - RuntimeError,
3.45 - RuntimeWarning,
3.46 SystemError,
3.47 SystemExit
3.48 )
3.49 @@ -70,8 +59,7 @@
3.50 UnicodeDecodeError,
3.51 UnicodeEncodeError,
3.52 UnicodeError,
3.53 - UnicodeTranslateError,
3.54 - UnicodeWarning
3.55 + UnicodeTranslateError
3.56 )
3.57
3.58 # vim: tabstop=4 expandtab shiftwidth=4
4.1 --- a/lib/__builtins__/exception/base.py Thu Jan 12 23:29:39 2017 +0100
4.2 +++ b/lib/__builtins__/exception/base.py Thu Jan 12 23:50:26 2017 +0100
4.3 @@ -1,7 +1,7 @@
4.4 #!/usr/bin/env python
4.5
4.6 """
4.7 -Base exception objects.
4.8 +Base exception objects. See __builtins__.core for the core exceptions.
4.9
4.10 Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
4.11
4.12 @@ -19,21 +19,33 @@
4.13 this program. If not, see <http://www.gnu.org/licenses/>.
4.14 """
4.15
4.16 -class IndexError(Exception):
4.17 +class LookupError(Exception):
4.18 +
4.19 + "A general lookup error."
4.20 +
4.21 + pass
4.22 +
4.23 +class IndexError(LookupError):
4.24
4.25 "An error condition involving an index."
4.26
4.27 def __init__(self, index):
4.28 self.index = index
4.29
4.30 -class KeyError(Exception):
4.31 +class KeyError(LookupError):
4.32
4.33 "An error concerned with a dictionary key."
4.34
4.35 def __init__(self, key):
4.36 self.key = key
4.37
4.38 -class NotImplementedError(Exception):
4.39 +class RuntimeError(Exception):
4.40 +
4.41 + "A general runtime error."
4.42 +
4.43 + pass
4.44 +
4.45 +class NotImplementedError(RuntimeError):
4.46
4.47 "An error indicating an unimplemented function or method."
4.48
5.1 --- a/lib/__builtins__/exception/io.py Thu Jan 12 23:29:39 2017 +0100
5.2 +++ b/lib/__builtins__/exception/io.py Thu Jan 12 23:50:26 2017 +0100
5.3 @@ -3,7 +3,7 @@
5.4 """
5.5 Input/output exception objects.
5.6
5.7 -Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
5.8 +Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
5.9
5.10 This program is free software; you can redistribute it and/or modify it under
5.11 the terms of the GNU General Public License as published by the Free Software
5.12 @@ -35,6 +35,10 @@
5.13
5.14 self.value = value
5.15
5.16 -class KeyboardInterrupt(Exception): pass
5.17 +class KeyboardInterrupt(Exception):
5.18 +
5.19 + "An interruption condition initiated by keyboard or console input."
5.20 +
5.21 + pass
5.22
5.23 # vim: tabstop=4 expandtab shiftwidth=4
6.1 --- a/lib/__builtins__/exception/numeric.py Thu Jan 12 23:29:39 2017 +0100
6.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
6.3 @@ -1,25 +0,0 @@
6.4 -#!/usr/bin/env python
6.5 -
6.6 -"""
6.7 -Numeric exception objects.
6.8 -
6.9 -Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
6.10 -
6.11 -This program is free software; you can redistribute it and/or modify it under
6.12 -the terms of the GNU General Public License as published by the Free Software
6.13 -Foundation; either version 3 of the License, or (at your option) any later
6.14 -version.
6.15 -
6.16 -This program is distributed in the hope that it will be useful, but WITHOUT
6.17 -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
6.18 -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
6.19 -details.
6.20 -
6.21 -You should have received a copy of the GNU General Public License along with
6.22 -this program. If not, see <http://www.gnu.org/licenses/>.
6.23 -"""
6.24 -
6.25 -class ArithmeticError(Exception): pass
6.26 -class FloatingPointError(Exception): pass
6.27 -
6.28 -# vim: tabstop=4 expandtab shiftwidth=4
7.1 --- a/lib/__builtins__/exception/program.py Thu Jan 12 23:29:39 2017 +0100
7.2 +++ b/lib/__builtins__/exception/program.py Thu Jan 12 23:50:26 2017 +0100
7.3 @@ -3,7 +3,7 @@
7.4 """
7.5 Program exception objects.
7.6
7.7 -Copyright (C) 2015 Paul Boddie <paul@boddie.org.uk>
7.8 +Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
7.9
7.10 This program is free software; you can redistribute it and/or modify it under
7.11 the terms of the GNU General Public License as published by the Free Software
7.12 @@ -19,13 +19,13 @@
7.13 this program. If not, see <http://www.gnu.org/licenses/>.
7.14 """
7.15
7.16 -class DeprecationWarning(Exception): pass
7.17 -class FutureWarning(Warning): pass
7.18 -class IndentationError(Exception): pass
7.19 -class PendingDeprecationWarning(Warning): pass
7.20 -class SyntaxError(Exception): pass
7.21 -class SyntaxWarning(Warning): pass
7.22 -class TabError(Exception): pass
7.23 -class UserWarning(Warning): pass
7.24 +class SyntaxError(Exception):
7.25 +
7.26 + "A general syntax error."
7.27 +
7.28 + pass
7.29 +
7.30 +class IndentationError(SyntaxError): pass
7.31 +class TabError(SyntaxError): pass
7.32
7.33 # vim: tabstop=4 expandtab shiftwidth=4
8.1 --- a/lib/__builtins__/exception/system.py Thu Jan 12 23:29:39 2017 +0100
8.2 +++ b/lib/__builtins__/exception/system.py Thu Jan 12 23:50:26 2017 +0100
8.3 @@ -3,7 +3,7 @@
8.4 """
8.5 System exception objects.
8.6
8.7 -Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
8.8 +Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
8.9
8.10 This program is free software; you can redistribute it and/or modify it under
8.11 the terms of the GNU General Public License as published by the Free Software
8.12 @@ -19,7 +19,11 @@
8.13 this program. If not, see <http://www.gnu.org/licenses/>.
8.14 """
8.15
8.16 -class EnvironmentError(Exception): pass
8.17 +class EnvironmentError(Exception):
8.18 +
8.19 + "The base class for external errors."
8.20 +
8.21 + pass
8.22
8.23 class OSError(Exception):
8.24
8.25 @@ -37,9 +41,11 @@
8.26
8.27 __repr__ = __str__
8.28
8.29 -class RuntimeError(Exception): pass
8.30 -class RuntimeWarning(Warning): pass
8.31 -class SystemError(Exception): pass
8.32 +class SystemError(Exception):
8.33 +
8.34 + "A non-serious error occurring within the runtime system."
8.35 +
8.36 + pass
8.37
8.38 class SystemExit(Exception):
8.39
9.1 --- a/lib/__builtins__/exception/unicode.py Thu Jan 12 23:29:39 2017 +0100
9.2 +++ b/lib/__builtins__/exception/unicode.py Thu Jan 12 23:50:26 2017 +0100
9.3 @@ -3,7 +3,7 @@
9.4 """
9.5 Unicode exception objects.
9.6
9.7 -Copyright (C) 2015, 2016 Paul Boddie <paul@boddie.org.uk>
9.8 +Copyright (C) 2015, 2016, 2017 Paul Boddie <paul@boddie.org.uk>
9.9
9.10 This program is free software; you can redistribute it and/or modify it under
9.11 the terms of the GNU General Public License as published by the Free Software
9.12 @@ -19,7 +19,13 @@
9.13 this program. If not, see <http://www.gnu.org/licenses/>.
9.14 """
9.15
9.16 -class UnicodeDecodeError(Exception):
9.17 +class UnicodeError(ValueError):
9.18 +
9.19 + "A general Unicode error."
9.20 +
9.21 + pass
9.22 +
9.23 +class UnicodeDecodeError(UnicodeError):
9.24
9.25 """
9.26 An exception indicating a failure to interpret a byte sequence according to
9.27 @@ -35,9 +41,7 @@
9.28
9.29 self.value = value
9.30
9.31 -class UnicodeEncodeError(Exception): pass
9.32 -class UnicodeError(Exception): pass
9.33 -class UnicodeTranslateError(Exception): pass
9.34 -class UnicodeWarning(Warning): pass
9.35 +class UnicodeEncodeError(UnicodeError): pass
9.36 +class UnicodeTranslateError(UnicodeError): pass
9.37
9.38 # vim: tabstop=4 expandtab shiftwidth=4