Minor tweaks about code quality.
This commit is contained in:
@ -72,7 +72,7 @@ class ConfigurableMeta(type):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
import _functools
|
import _functools
|
||||||
except:
|
except ImportError:
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
PartiallyConfigured = functools.partial
|
PartiallyConfigured = functools.partial
|
||||||
|
|||||||
@ -1,5 +1,3 @@
|
|||||||
import inspect
|
|
||||||
import pprint
|
|
||||||
import re
|
import re
|
||||||
import threading
|
import threading
|
||||||
import types
|
import types
|
||||||
|
|||||||
@ -51,7 +51,7 @@ if __name__ == '__main__':
|
|||||||
s3.head_object(
|
s3.head_object(
|
||||||
Bucket='bonobo-examples', Key=s3_path
|
Bucket='bonobo-examples', Key=s3_path
|
||||||
)
|
)
|
||||||
except:
|
except Exception:
|
||||||
s3.upload_file(
|
s3.upload_file(
|
||||||
local_path,
|
local_path,
|
||||||
'bonobo-examples',
|
'bonobo-examples',
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
from contextlib import contextmanager
|
from contextlib import contextmanager
|
||||||
from logging import ERROR
|
|
||||||
|
|
||||||
from bonobo.util import deprecated
|
from bonobo.util import deprecated
|
||||||
from bonobo.util.objects import Wrapper, get_name
|
from bonobo.util.objects import Wrapper, get_name
|
||||||
@ -13,7 +12,7 @@ def recoverable(error_handler):
|
|||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
except Exception as exc: # pylint: disable=broad-except
|
except Exception as exc: # pylint: disable=broad-except
|
||||||
error_handler(*sys.exc_info(), level=ERROR)
|
error_handler(*sys.exc_info(), level=logging.ERROR)
|
||||||
|
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
@ -21,7 +20,7 @@ def unrecoverable(error_handler):
|
|||||||
try:
|
try:
|
||||||
yield
|
yield
|
||||||
except Exception as exc: # pylint: disable=broad-except
|
except Exception as exc: # pylint: disable=broad-except
|
||||||
error_handler(*sys.exc_info(), level=ERROR)
|
error_handler(*sys.exc_info(), level=logging.ERROR)
|
||||||
raise # raise unrecoverableerror from exc ?
|
raise # raise unrecoverableerror from exc ?
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class ExecutorStrategy(Strategy):
|
|||||||
with self.create_executor() as executor:
|
with self.create_executor() as executor:
|
||||||
try:
|
try:
|
||||||
context.start(self.get_starter(executor, futures))
|
context.start(self.get_starter(executor, futures))
|
||||||
except:
|
except Exception:
|
||||||
logger.critical('Exception caught while starting execution context.', exc_info=sys.exc_info())
|
logger.critical('Exception caught while starting execution context.', exc_info=sys.exc_info())
|
||||||
|
|
||||||
while context.alive:
|
while context.alive:
|
||||||
@ -53,14 +53,14 @@ class ExecutorStrategy(Strategy):
|
|||||||
try:
|
try:
|
||||||
with node:
|
with node:
|
||||||
node.loop()
|
node.loop()
|
||||||
except:
|
except Exception:
|
||||||
logging.getLogger(__name__).critical(
|
logging.getLogger(__name__).critical(
|
||||||
'Critical error in threadpool node starter.', exc_info=sys.exc_info()
|
'Critical error in threadpool node starter.', exc_info=sys.exc_info()
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
futures.append(executor.submit(_runner))
|
futures.append(executor.submit(_runner))
|
||||||
except:
|
except Exception:
|
||||||
logging.getLogger(__name__).critical('futures.append', exc_info=sys.exc_info())
|
logging.getLogger(__name__).critical('futures.append', exc_info=sys.exc_info())
|
||||||
|
|
||||||
return starter
|
return starter
|
||||||
|
|||||||
@ -1,12 +1,11 @@
|
|||||||
import csv
|
import csv
|
||||||
|
|
||||||
from bonobo.config import Option, use_raw_input, use_context
|
from bonobo.config import Option, use_context
|
||||||
from bonobo.config.options import Method, RenamedOption
|
from bonobo.config.options import Method, RenamedOption
|
||||||
from bonobo.constants import NOT_MODIFIED
|
from bonobo.constants import NOT_MODIFIED
|
||||||
from bonobo.nodes.io.base import FileHandler
|
from bonobo.nodes.io.base import FileHandler
|
||||||
from bonobo.nodes.io.file import FileReader, FileWriter
|
from bonobo.nodes.io.file import FileReader, FileWriter
|
||||||
from bonobo.util import ensure_tuple
|
from bonobo.util import ensure_tuple
|
||||||
from bonobo.util.bags import BagType
|
|
||||||
|
|
||||||
|
|
||||||
class CsvHandler(FileHandler):
|
class CsvHandler(FileHandler):
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
from bonobo.plugins import Plugin
|
from bonobo.plugins import Plugin
|
||||||
from raven import Client
|
|
||||||
|
|
||||||
|
|
||||||
class SentryPlugin(Plugin):
|
class SentryPlugin(Plugin):
|
||||||
|
|||||||
@ -52,7 +52,7 @@ class Setting:
|
|||||||
def set(self, value):
|
def set(self, value):
|
||||||
value = self.formatter(value) if self.formatter else value
|
value = self.formatter(value) if self.formatter else value
|
||||||
if self.validator and not self.validator(value):
|
if self.validator and not self.validator(value):
|
||||||
raise ValidationError('Invalid value {!r} for setting {}.'.format(value, self.name))
|
raise ValidationError(self, 'Invalid value {!r} for setting {!r}.'.format(value, self.name))
|
||||||
self.value = value
|
self.value = value
|
||||||
|
|
||||||
def set_if_true(self, value):
|
def set_if_true(self, value):
|
||||||
|
|||||||
@ -57,7 +57,6 @@ def get_argument_parser(parser=None):
|
|||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
if parser is None:
|
if parser is None:
|
||||||
import argparse
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
|
|
||||||
# Store globally to be able to warn the user about the fact he's probably wrong not to pass a parser to
|
# Store globally to be able to warn the user about the fact he's probably wrong not to pass a parser to
|
||||||
|
|||||||
Reference in New Issue
Block a user