Update hacking version

Use latest release 1.1.0 and compatible changes w.r.t pep8

Change-Id: If1860c3fe287852e87704b511567c65d8d4d0c1c
This commit is contained in:
zhulingjie 2019-01-04 23:59:26 +08:00
parent 7dbd8ab34b
commit a4d31eac42
10 changed files with 31 additions and 31 deletions

View File

@ -5,7 +5,7 @@
coverage>=4.5.1 # Apache-2.0
doc8>=0.8.0 # Apache-2.0
freezegun>=0.3.10 # Apache-2.0
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
hacking>=1.1.0,<1.2.0 # Apache-2.0
mock>=2.0.0 # BSD
oslotest>=3.3.0 # Apache-2.0
os-testr>=1.0.0 # Apache-2.0

View File

@ -72,7 +72,7 @@ commands =
[flake8]
filename = *.py,app.wsgi
show-source=True
ignore= H105,E123,E226,N320,H202
ignore= H105,E123,E226,E731,N320,H202
builtins= _
enable-extensions = H106,H203,H904
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,*sqlalchemy/alembic/versions/*,demo/,releasenotes

View File

@ -123,8 +123,8 @@ class AuditPostType(wtypes.Base):
'or goal should be provided.')
if (self.audit_type == objects.audit.AuditType.ONESHOT.value and
(self.start_time not in (wtypes.Unset, None)
or self.end_time not in (wtypes.Unset, None))):
(self.start_time not in (wtypes.Unset, None) or
self.end_time not in (wtypes.Unset, None))):
raise exception.AuditStartEndTimeNotAllowed(
audit_type=self.audit_type)

View File

@ -69,8 +69,8 @@ class Service(base.APIBase):
def _set_status(self, id):
service = objects.Service.get(pecan.request.context, id)
last_heartbeat = (service.last_seen_up or service.updated_at
or service.created_at)
last_heartbeat = (service.last_seen_up or service.updated_at or
service.created_at)
if isinstance(last_heartbeat, six.string_types):
# NOTE(russellb) If this service came in over rpc via
# conductor, then the timestamp will be a string and needs to be

View File

@ -82,8 +82,8 @@ class APISchedulingService(scheduling.BackgroundSchedulerService):
def get_service_status(self, context, service_id):
service = objects.Service.get(context, service_id)
last_heartbeat = (service.last_seen_up or service.updated_at
or service.created_at)
last_heartbeat = (service.last_seen_up or service.updated_at or
service.created_at)
if isinstance(last_heartbeat, six.string_types):
# NOTE(russellb) If this service came in over rpc via
# conductor, then the timestamp will be a string and needs to be

View File

@ -100,9 +100,9 @@ class HardwareMaintenance(base.EfficacySpecification):
if (indicators_map and
indicators_map.planned_live_migrate_instance_count > 0):
li_value = (
float(indicators_map.planned_live_migrate_instance_count)
/ float(indicators_map.live_migrate_instance_count)
* 100
float(indicators_map.planned_live_migrate_instance_count) /
float(indicators_map.live_migrate_instance_count) *
100
)
li_indicator = efficacy.Indicator(
@ -116,9 +116,9 @@ class HardwareMaintenance(base.EfficacySpecification):
if (indicators_map and
indicators_map.planned_cold_migrate_instance_count > 0):
ci_value = (
float(indicators_map.planned_cold_migrate_instance_count)
/ float(indicators_map.cold_migrate_instance_count)
* 100
float(indicators_map.planned_cold_migrate_instance_count) /
float(indicators_map.cold_migrate_instance_count) *
100
)
ci_indicator = efficacy.Indicator(
@ -133,8 +133,8 @@ class HardwareMaintenance(base.EfficacySpecification):
indicators_map.planned_volume_migrate_count > 0):
dv_value = (float(indicators_map.planned_volume_migrate_count) /
float(indicators_map.
volume_migrate_count)
* 100)
volume_migrate_count) *
100)
dv_indicator = efficacy.Indicator(
name="volume_migrate_ratio",
@ -148,8 +148,8 @@ class HardwareMaintenance(base.EfficacySpecification):
indicators_map.planned_volume_update_count > 0):
av_value = (float(indicators_map.planned_volume_update_count) /
float(indicators_map.
volume_update_count)
* 100)
volume_update_count) *
100)
av_indicator = efficacy.Indicator(
name="volume_update_ratio",

View File

@ -535,8 +535,8 @@ class ZoneMigration(base.ZoneMigrationBaseStrategy):
return None
return [i for i in self.nova.get_instance_list()
if getattr(i, 'OS-EXT-SRV-ATTR:host') in src_node_list
and self.compute_model.get_instance_by_uuid(i.id)]
if getattr(i, 'OS-EXT-SRV-ATTR:host') in src_node_list and
self.compute_model.get_instance_by_uuid(i.id)]
def get_volumes(self):
"""Get migrate target volumes
@ -547,8 +547,8 @@ class ZoneMigration(base.ZoneMigrationBaseStrategy):
src_pool_list = self.get_src_pool_list()
return [i for i in self.cinder.get_volume_list()
if getattr(i, 'os-vol-host-attr:host') in src_pool_list
and self.storage_model.get_volume_by_uuid(i.id)]
if getattr(i, 'os-vol-host-attr:host') in src_pool_list and
self.storage_model.get_volume_by_uuid(i.id)]
def filtered_targets(self):
"""Filter targets

View File

@ -144,8 +144,8 @@ class TestNoExceptionTracebackHook(base.FunctionalTest):
# rare thing (happens due to wrong deserialization settings etc.)
# we don't care about this garbage.
expected_msg = ("Remote error: %s %s"
% (test_exc_type, self.MSG_WITHOUT_TRACE)
+ ("\n[u'" if six.PY2 else "\n['"))
% (test_exc_type, self.MSG_WITHOUT_TRACE) +
("\n[u'" if six.PY2 else "\n['"))
actual_msg = jsonutils.loads(
response.json['error_message'])['faultstring']
self.assertEqual(expected_msg, actual_msg)

View File

@ -550,10 +550,10 @@ class TestPatchStateTransitionDenied(api_base.FunctionalTest):
# because we cannot retrieve them with a GET (soft_deleted state).
# This is the reason why they are not listed here but they have a
# special test to cover it
if original_state != objects.action_plan.State.DELETED
and original_state != new_state
and {"original_state": original_state,
"new_state": new_state} not in ALLOWED_TRANSITIONS
if original_state != objects.action_plan.State.DELETED and
original_state != new_state and
{"original_state": original_state,
"new_state": new_state} not in ALLOWED_TRANSITIONS
]
def setUp(self):

View File

@ -384,9 +384,9 @@ class TestPatchStateTransitionDenied(api_base.FunctionalTest):
)
for original_state, new_state
in list(itertools.product(STATES, STATES))
if original_state != new_state
and {"original_state": original_state,
"new_state": new_state} not in ALLOWED_TRANSITIONS
if original_state != new_state and
{"original_state": original_state,
"new_state": new_state} not in ALLOWED_TRANSITIONS
]
def setUp(self):