Fix pep H101(TODO) and H231(py3 exceptions)

Change-Id: I6797c4df1595466a12f84721a383eb541e6401f7
This commit is contained in:
Angus Salkeld
2014-08-20 17:20:26 +10:00
parent b7e42316fa
commit b909d29058
10 changed files with 13 additions and 15 deletions

View File

@@ -37,7 +37,7 @@ PKG_PARAMS_MAP = {'display_name': 'name',
def get_draft(environment_id=None, session_id=None):
unit = db_session.get_session()
#TODO: When session is deployed should be returned env.description
# TODO(all): When session is deployed should be returned env.description
if session_id:
session = unit.query(models.Session).get(session_id)
return session.description

View File

@@ -32,7 +32,7 @@ class Controller(object):
target = {"environment_id": environment_id}
policy.check("get_aggregated_statistics", request.context, target)
# TODO (stanlagun): Check that caller is authorized to access
# TODO(stanlagun): Check that caller is authorized to access
# tenant's statistics
return instances.InstanceStatsServices.get_aggregated_stats(
@@ -44,7 +44,7 @@ class Controller(object):
target = {"environment_id": environment_id, "instance_id": instance_id}
policy.check("get_instance_statistics", request.context, target)
# TODO (stanlagun): Check that caller is authorized to access
# TODO(stanlagun): Check that caller is authorized to access
# tenant's statistics
return instances.InstanceStatsServices.get_raw_environment_stats(
@@ -56,7 +56,7 @@ class Controller(object):
target = {"environment_id": environment_id}
policy.check("get_statistics", request.context, target)
# TODO (stanlagun): Check that caller is authorized to access
# TODO(stanlagun): Check that caller is authorized to access
# tenant's statistics
return instances.InstanceStatsServices.get_raw_environment_stats(

View File

@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
#TODO:write detailed schema
# TODO(all): write detailed schema.
ENV_SCHEMA = {
"$schema": "http://json-schema.org/draft-04/schema#",

View File

@@ -61,7 +61,7 @@ def main():
launcher.launch_service(stats.StatsCollectingService())
launcher.wait()
except RuntimeError, e:
except RuntimeError as e:
sys.stderr.write("ERROR: %s\n" % e)
sys.exit(1)

View File

@@ -48,7 +48,7 @@ def main():
launcher.launch_service(engine.get_rpc_service())
launcher.wait()
except RuntimeError, e:
except RuntimeError as e:
sys.stderr.write("ERROR: %s\n" % e)
sys.exit(1)

View File

@@ -336,7 +336,7 @@ def load_paste_app(app_name=None):
CONF.log_opt_values(logger, logging.DEBUG)
return app
except (LookupError, ImportError), e:
except (LookupError, ImportError) as e:
msg = _("Unable to load %(app_name)s from "
"configuration file %(conf_file)s."
"\nGot: %(e)r") % locals()

View File

@@ -35,14 +35,14 @@ LOG = logging.getLogger(__name__)
def _package_get(package_id_or_name, session):
# TODO (sjmc7): update openstack/common and pull in
# TODO(sjmc7): update openstack/common and pull in
# uuidutils, check that package_id_or_name resembles a
# UUID before trying to treat it as one
package = session.query(models.Package).get(package_id_or_name)
if not package:
# Try using the FQN name instead. Since FQNs right now are unique,
# don't need to do any logic to figure out if we have the right one.
# # TODO (sjmc7): Revisit for precedence rules.
# # TODO(sjmc7): Revisit for precedence rules.
# Heat does this in nicer way, giving each stack an unambiguous ID of
# stack_name/id and redirecting to it in the API. We need to do some
# reworking for precedence rules later, so maybe take a look at this

View File

@@ -37,7 +37,7 @@ class CoreServices(object):
:return: Service status
"""
# Now we assume that service has same status as environment.
# TODO: implement as designed and described above
# TODO(ruhe): implement as designed and described above
return envs.EnvironmentServices.get_status(environment_id)

View File

@@ -83,7 +83,7 @@ class MuranoDslExecutor(object):
if external_call and not is_special_method and \
method.usage != murano_method.MethodUsages.Action:
raise Exception('{0} is not an action'.format(method.name))
# TODO (slagun): check method accessibility from murano_class
# TODO(slagun): check method accessibility from murano_class
if not external_call and is_special_method:
LOG.deprecated('initialize/destroy methods are called '

View File

@@ -36,15 +36,13 @@ deps = flake8
commands = flake8
[flake8]
# H101 Use TODO(NAME)
# H202 assertRaises Exception too broad
# H231 Python 3.x incompatible 'except x,y:' construct
# H402 one line docstring needs punctuation
# H404 multi line docstring should start without a leading new line
# H501 Do not use locals() for string formatting
# H702 Argument to _ must be just a string
# H902 Use the 'not in' operator for collection membership evaluation
ignore = H101,H202,H231,H402,H404,H501,H702,H902
ignore = H202,H402,H404,H501,H702,H902
show-source = true
builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,tools