Fix the current flake8 errors

The test pip ordering was resulting in the pep8 rules not really
running so this fixes that up and the resulting errors so we can
get a clean run.

Change-Id: Icc27be05cd513c4f04135c7e768007dbf9d07b10
This commit is contained in:
Angus Salkeld
2013-06-26 11:03:23 +10:00
parent 9bb29b224a
commit 339e43d03b
12 changed files with 32 additions and 22 deletions

View File

@@ -19,7 +19,8 @@
import logging import logging
import traceback as tb import traceback as tb
from celery.signals import task_failure, task_success from celery.signals import task_failure
from celery.signals import task_success
LOG = logging.getLogger(__name__) LOG = logging.getLogger(__name__)
@@ -35,7 +36,7 @@ def task_error_handler(signal=None, sender=None, task_id=None,
LOG.error('Trackeback: %s' % (tb.print_tb(traceback), )) LOG.error('Trackeback: %s' % (tb.print_tb(traceback), ))
wf = sender.name.split('.')[0] wf = sender.name.split('.')[0]
task = ('.').join(n for n in (sender.name.split('.')[1:]) if n) task = ('.').join(n for n in (sender.name.split('.')[1:]) if n)
# TODO: Auto-initiate rollback from failed task # TODO(jlucci): Auto-initiate rollback from failed task
@task_success.connect @task_success.connect

View File

@@ -23,7 +23,7 @@ import logging
import threading import threading
import weakref import weakref
import taskflow import taskflow.job
from taskflow import catalog from taskflow import catalog
from taskflow import exceptions as exc from taskflow import exceptions as exc

View File

@@ -22,6 +22,7 @@
import logging import logging
from taskflow import states from taskflow import states
from taskflow.db.sqlalchemy import models from taskflow.db.sqlalchemy import models
from taskflow.db.sqlalchemy.session import get_session from taskflow.db.sqlalchemy.session import get_session

View File

@@ -19,7 +19,7 @@
""" """
SQLAlchemy models for taskflow data. SQLAlchemy models for taskflow data.
""" """
import json
from oslo.config import cfg from oslo.config import cfg
from sqlalchemy import Column, Integer, String, Table, MetaData from sqlalchemy import Column, Integer, String, Table, MetaData
@@ -29,10 +29,11 @@ from sqlalchemy.orm import object_mapper, relationship, backref
from sqlalchemy import DateTime, ForeignKey from sqlalchemy import DateTime, ForeignKey
from sqlalchemy import types as types from sqlalchemy import types as types
from json import dumps, loads from taskflow.db.sqlalchemy.session import get_engine
from taskflow.db.sqlalchemy.session import get_session
from taskflow.db.sqlalchemy.session import get_session, get_engine from taskflow.openstack.common import exception
from taskflow.openstack.common import timeutils, uuidutils, exception from taskflow.openstack.common import timeutils
from taskflow.openstack.common import uuidutils
CONF = cfg.CONF CONF = cfg.CONF
BASE = declarative_base() BASE = declarative_base()
@@ -42,10 +43,10 @@ class Json(types.TypeDecorator, types.MutableType):
impl = types.Text impl = types.Text
def process_bind_param(self, value, dialect): def process_bind_param(self, value, dialect):
return dumps(value) return json.dumps(value)
def process_result_value(self, value, dialect): def process_result_value(self, value, dialect):
return loads(value) return json.loads(value)
class TaskFlowBase(object): class TaskFlowBase(object):

View File

@@ -21,10 +21,10 @@
import logging import logging
import sqlalchemy.orm import sqlalchemy
import sqlalchemy.engine import sqlalchemy.engine
import sqlalchemy.interfaces import sqlalchemy.interfaces
import sqlalchemy import sqlalchemy.orm
from sqlalchemy.pool import NullPool from sqlalchemy.pool import NullPool
from sqlalchemy import exc from sqlalchemy import exc
@@ -92,7 +92,7 @@ def get_engine():
sqlalchemy.event.listen(_ENGINE, 'connect', sqlalchemy.event.listen(_ENGINE, 'connect',
synchronous_switch_listener) synchronous_switch_listener)
#TODO: Check to make sure engine connected # TODO(jharlow): Check to make sure engine connected
return _ENGINE return _ENGINE

View File

@@ -77,7 +77,8 @@ class Flow(object):
callback_task.name = '%s.%s' % (self.name, callback_task.name) callback_task.name = '%s.%s' % (self.name, callback_task.name)
self._tasks.append(callback_task) self._tasks.append(callback_task)
#TODO: Need to set up chord so that it's not executed immediately # TODO(jlucci): Need to set up chord so that it's not executed
# immediately.
c = chord(header, body=callback_task) c = chord(header, body=callback_task)
def run(self, context, *args, **kwargs): def run(self, context, *args, **kwargs):

View File

@@ -19,9 +19,9 @@
import collections import collections
import logging import logging
from networkx import exception as g_exc
from networkx.algorithms import dag from networkx.algorithms import dag
from networkx.classes import digraph from networkx.classes import digraph
from networkx import exception as g_exc
from taskflow import exceptions as exc from taskflow import exceptions as exc
from taskflow.patterns import ordered_flow from taskflow.patterns import ordered_flow

View File

@@ -24,6 +24,7 @@ import logging
import sys import sys
from taskflow.openstack.common import excutils from taskflow.openstack.common import excutils
from taskflow import exceptions as exc from taskflow import exceptions as exc
from taskflow import states from taskflow import states
from taskflow import utils from taskflow import utils

View File

@@ -22,11 +22,13 @@ import unittest2
from os import path from os import path
from oslo.config import cfg from oslo.config import cfg
from taskflow import states
from taskflow.openstack.common import exception
from taskflow.db import api as db_api from taskflow.db import api as db_api
from taskflow.db.sqlalchemy import models from taskflow.db.sqlalchemy import models
from taskflow.db.sqlalchemy.session import get_session from taskflow.db.sqlalchemy.session import get_session
from taskflow.openstack.common import exception from taskflow import states
db_api.configure() db_api.configure()
db_api.SQL_CONNECTION = 'sqlite:///test.db' db_api.SQL_CONNECTION = 'sqlite:///test.db'

View File

@@ -45,7 +45,7 @@ class ProvidesRequiresTask(task.Task):
KWARGS_KEY: dict(kwargs), KWARGS_KEY: dict(kwargs),
ARGS_KEY: list(args), ARGS_KEY: list(args),
} }
if not ORDER_KEY in context: if ORDER_KEY not in context:
context[ORDER_KEY] = [] context[ORDER_KEY] = []
context[ORDER_KEY].append(self.name) context[ORDER_KEY].append(self.name)
for v in self.provides: for v in self.provides:

View File

@@ -1,12 +1,15 @@
# Packages needed for developer testing this library. # Install bounded pep8/pyflakes first, then let flake8 install
pep8==1.4.5
pyflakes==0.7.2
flake8==2.0
hacking>=0.5.3,<0.6
coverage coverage
distribute>=0.6.24 distribute>=0.6.24
flake8==2.0
mox mox
nose nose
nose-exclude nose-exclude
openstack.nose_plugin>=0.7 openstack.nose_plugin>=0.7
pep8==1.4.5
pylint==0.25.2 pylint==0.25.2
# Needed for features in 2.7 not in 2.6 # Needed for features in 2.7 not in 2.6
unittest2 unittest2

View File

@@ -41,4 +41,4 @@ commands = {posargs}
[flake8] [flake8]
ignore = E711,E712,F401,F403,F811,F841,H302,H303,H304,H401,H402,H403,H404 ignore = E711,E712,F401,F403,F811,F841,H302,H303,H304,H401,H402,H403,H404
builtins = _ builtins = _
exclude = .venv,.tox,dist,doc,*openstack/common*,*egg,.git exclude = .venv,.tox,dist,doc,*openstack/common*,*egg,.git,build,tools