Formatting.

This commit is contained in:
Romain Dorgueil
2018-07-22 07:54:22 +02:00
parent 66451d03bb
commit 4e2cb29fc2
3 changed files with 14 additions and 3 deletions

View File

@ -77,6 +77,7 @@ except ImportError:
PartiallyConfigured = functools.partial PartiallyConfigured = functools.partial
else: else:
class PartiallyConfigured(_functools.partial): class PartiallyConfigured(_functools.partial):
@property # TODO XXX cache this @property # TODO XXX cache this
def _options_values(self): def _options_values(self):

View File

@ -30,6 +30,7 @@ class NodeExecutionContext(BaseContext, WithStatistics):
a service implementation, or a value holder). a service implementation, or a value holder).
""" """
def __init__(self, wrapped, *, parent=None, services=None, _input=None, _outputs=None): def __init__(self, wrapped, *, parent=None, services=None, _input=None, _outputs=None):
""" """
Node execution context has the responsibility fo storing the state of a transformation during its execution. Node execution context has the responsibility fo storing the state of a transformation during its execution.
@ -92,11 +93,15 @@ class NodeExecutionContext(BaseContext, WithStatistics):
# Not normal to have a partially configured object here, so let's warn the user instead of having get into # Not normal to have a partially configured object here, so let's warn the user instead of having get into
# the hard trouble of understanding that by himself. # the hard trouble of understanding that by himself.
raise TypeError( raise TypeError(
'Configurables should be instanciated before execution starts.\nGot {!r}.\n'.format(self.wrapped) 'Configurables should be instanciated before execution starts.\nGot {!r}.\n'.format(
self.wrapped
)
) from exc ) from exc
else: else:
raise TypeError( raise TypeError(
'Configurables should be instanciated before execution starts.\nGot {!r}.\n'.format(self.wrapped) 'Configurables should be instanciated before execution starts.\nGot {!r}.\n'.format(
self.wrapped
)
) )
self._stack.setup(self) self._stack.setup(self)
except Exception: except Exception:
@ -128,7 +133,10 @@ class NodeExecutionContext(BaseContext, WithStatistics):
self._step() self._step()
except InactiveReadableError: except InactiveReadableError:
raise raise
except (NotImplementedError, UnrecoverableError, ): except (
NotImplementedError,
UnrecoverableError,
):
self.fatal(sys.exc_info()) # exit loop self.fatal(sys.exc_info()) # exit loop
except Exception: # pylint: disable=broad-except except Exception: # pylint: disable=broad-except
self.error(sys.exc_info()) # does not exit loop self.error(sys.exc_info()) # does not exit loop

View File

@ -89,6 +89,7 @@ class Registry:
default_registry = Registry() default_registry = Registry()
def create_reader(name, *args, format=None, registry=default_registry, **kwargs): def create_reader(name, *args, format=None, registry=default_registry, **kwargs):
""" """
Create a reader instance, guessing its factory using filename (and eventually format). Create a reader instance, guessing its factory using filename (and eventually format).
@ -103,6 +104,7 @@ def create_reader(name, *args, format=None, registry=default_registry, **kwargs)
""" """
return registry.get_reader_factory_for(name, format=format)(name, *args, **kwargs) return registry.get_reader_factory_for(name, format=format)(name, *args, **kwargs)
def create_writer(name, *args, format=None, registry=default_registry, **kwargs): def create_writer(name, *args, format=None, registry=default_registry, **kwargs):
""" """
Create a writer instance, guessing its factory using filename (and eventually format). Create a writer instance, guessing its factory using filename (and eventually format).