Work in progress on documentation for 0.6

This commit is contained in:
Romain Dorgueil
2017-12-04 08:31:24 +01:00
parent a1f883e3c6
commit 99c4745b4e
6 changed files with 63 additions and 37 deletions

View File

@ -3,7 +3,6 @@ from bonobo.util import isoption, iscontextprocessor, sortedlist
__all__ = [
'Configurable',
'Option',
]
get_creation_counter = lambda v: v._creation_counter
@ -192,11 +191,7 @@ class Configurable(metaclass=ConfigurableMeta):
position += 1
def __call__(self, *args, **kwargs):
raise AbstractError(
'You must implement the __call__ method in your configurable class {} to actually use it.'.format(
type(self).__name__
)
)
raise AbstractError(self.__call__)
@property
def __options__(self):

View File

@ -1,31 +1,4 @@
# -*- coding: utf-8 -*-
#
# Copyright 2012-2014 Romain Dorgueil
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
class AbstractError(NotImplementedError):
"""Abstract error is a convenient error to declare a method as "being left as an exercise for the reader"."""
def __init__(self, method):
super().__init__(
'Call to abstract method {class_name}.{method_name}(...): missing implementation.'.format(
class_name=method.__self__.__name__,
method_name=method.__name__,
)
)
from bonobo.util import get_name
class InactiveIOError(IOError):
@ -63,6 +36,18 @@ class UnrecoverableError(Exception):
because you know that your transformation has no point continuing runnning after a bad event."""
class AbstractError(UnrecoverableError, NotImplementedError):
"""Abstract error is a convenient error to declare a method as "being left as an exercise for the reader"."""
def __init__(self, method):
super().__init__(
'Call to abstract method {class_name}.{method_name}(...): missing implementation.'.format(
class_name=get_name(method.__self__),
method_name=get_name(method),
)
)
class UnrecoverableTypeError(UnrecoverableError, TypeError):
pass