style(pep8): remove identation ignores

This patch set removes few pep8/flake8 ignored rules and implemented
the fix in the code to address those rules.

Change-Id: I2e613acd760818a6e18288d284f6224c38c4353a
Signed-off-by: Tin Lam <tin@irrational.io>
This commit is contained in:
Tin Lam 2018-05-18 15:40:16 -05:00
parent a552bf2a0f
commit 33e2203f5e
15 changed files with 53 additions and 43 deletions

View File

@ -58,8 +58,7 @@ def list_opts():
barbican_group: barbican_opts + barbican_group: barbican_opts +
ks_loading.get_session_conf_options() + ks_loading.get_session_conf_options() +
ks_loading.get_auth_common_conf_options() + ks_loading.get_auth_common_conf_options() +
ks_loading.get_auth_plugin_conf_options( ks_loading.get_auth_plugin_conf_options('v3password')}
'v3password')}
return opts return opts

View File

@ -155,7 +155,8 @@ def __build_tables(blob_type_obj, blob_type_list):
ondelete='CASCADE'), ondelete='CASCADE'),
nullable=False) nullable=False)
revision_id = Column( revision_id = Column(
Integer, ForeignKey('revisions.id', ondelete='CASCADE'), Integer,
ForeignKey('revisions.id', ondelete='CASCADE'),
nullable=False) nullable=False)
# Used for documents that haven't changed across revisions but still # Used for documents that haven't changed across revisions but still
# have been carried over into newer revisions. This is necessary in # have been carried over into newer revisions. This is necessary in
@ -167,7 +168,8 @@ def __build_tables(blob_type_obj, blob_type_list):
# still being able to roll back to all the documents that exist in a # still being able to roll back to all the documents that exist in a
# specific revision or generate an accurate revision diff report. # specific revision or generate an accurate revision diff report.
orig_revision_id = Column( orig_revision_id = Column(
Integer, ForeignKey('revisions.id', ondelete='CASCADE'), Integer,
ForeignKey('revisions.id', ondelete='CASCADE'),
nullable=True) nullable=True)
@hybrid_property @hybrid_property
@ -201,7 +203,8 @@ def __build_tables(blob_type_obj, blob_type_list):
validator = Column(blob_type_obj, nullable=False) validator = Column(blob_type_obj, nullable=False)
errors = Column(blob_type_list, nullable=False, default=[]) errors = Column(blob_type_list, nullable=False, default=[])
revision_id = Column( revision_id = Column(
Integer, ForeignKey('revisions.id', ondelete='CASCADE'), Integer,
ForeignKey('revisions.id', ondelete='CASCADE'),
nullable=False) nullable=False)
this_module = sys.modules[__name__] this_module = sys.modules[__name__]

View File

@ -186,8 +186,8 @@ class DataSchemaValidator(GenericValidator):
continue continue
if 'data' not in data_schema: if 'data' not in data_schema:
continue continue
schema_prefix, schema_version = _get_schema_parts(data_schema, schema_prefix, schema_version = _get_schema_parts(
'metadata.name') data_schema, 'metadata.name')
schema_map[schema_version].setdefault(schema_prefix, schema_map[schema_version].setdefault(schema_prefix,
data_schema.data) data_schema.data)

View File

@ -916,8 +916,8 @@ class TestDocumentLayering3LayersAbstractConcrete(TestDocumentLayering):
"actions": [{"method": "replace", "path": ".b"}]} "actions": [{"method": "replace", "path": ".b"}]}
} }
doc_factory = factories.DocumentFactory(3, [1, 1, 1]) doc_factory = factories.DocumentFactory(3, [1, 1, 1])
documents = doc_factory.gen_test(mapping, site_abstract=False, documents = doc_factory.gen_test(
region_abstract=False) mapping, site_abstract=False, region_abstract=False)
site_expected = {"a": {"x": 1, "y": 2, "z": 3}, "b": 4} site_expected = {"a": {"x": 1, "y": 2, "z": 3}, "b": 4}
region_expected = {"a": {"x": 1, "y": 2, "z": 3}, "b": 5} region_expected = {"a": {"x": 1, "y": 2, "z": 3}, "b": 5}

View File

@ -114,7 +114,8 @@ class TestDocumentLayeringNegative(
'parentSelector'] = parent_selector 'parentSelector'] = parent_selector
layering.DocumentLayering(documents, validate=False) layering.DocumentLayering(documents, validate=False)
self.assertTrue(any('Could not find parent for document' in self.assertTrue(
any('Could not find parent for document' in
mock_log.debug.mock_calls[x][1][0]) mock_log.debug.mock_calls[x][1][0])
for x in range(len(mock_log.debug.mock_calls))) for x in range(len(mock_log.debug.mock_calls)))
mock_log.debug.reset_mock() mock_log.debug.reset_mock()
@ -129,7 +130,8 @@ class TestDocumentLayeringNegative(
documents[1]['metadata']['labels'] = parent_label documents[1]['metadata']['labels'] = parent_label
layering.DocumentLayering(documents, validate=False) layering.DocumentLayering(documents, validate=False)
self.assertTrue(any('Could not find parent for document' in self.assertTrue(
any('Could not find parent for document' in
mock_log.debug.mock_calls[x][1][0]) mock_log.debug.mock_calls[x][1][0])
for x in range(len(mock_log.debug.mock_calls))) for x in range(len(mock_log.debug.mock_calls)))
mock_log.debug.reset_mock() mock_log.debug.reset_mock()
@ -168,7 +170,8 @@ class TestDocumentLayeringNegative(
'parentSelector'] = self_ref 'parentSelector'] = self_ref
layering.DocumentLayering(documents, validate=False) layering.DocumentLayering(documents, validate=False)
self.assertTrue(any('Could not find parent for document' in self.assertTrue(
any('Could not find parent for document' in
mock_log.debug.mock_calls[x][1][0]) mock_log.debug.mock_calls[x][1][0])
for x in range(len(mock_log.debug.mock_calls))) for x in range(len(mock_log.debug.mock_calls)))

View File

@ -108,7 +108,8 @@ class RealPolicyFixture(fixtures.Fixture):
""" """
if not (set(self.expected_policy_actions) == if not (set(self.expected_policy_actions) ==
set(self.actual_policy_actions)): set(self.actual_policy_actions)):
error_msg = ('The expected policy actions passed to ' error_msg = (
'The expected policy actions passed to '
'`self.policy.set_rules` do not match the policy actions ' '`self.policy.set_rules` do not match the policy actions '
'that were actually enforced by Deckhand. Set of expected ' 'that were actually enforced by Deckhand. Set of expected '
'policies %s should be equal to set of actual policies: %s. ' 'policies %s should be equal to set of actual policies: %s. '

View File

@ -0,0 +1,4 @@
---
fixes:
- |
Removed indentation rules E127, E128, E129 and E131 from pep8 exclusion.

View File

@ -96,7 +96,7 @@ commands = flake8 {posargs}
# [H210] Require autospec, spec, or spec_set in mock.patch/mock.patch.object calls # [H210] Require autospec, spec, or spec_set in mock.patch/mock.patch.object calls
# [H904] Delay string interpolations at logging calls. # [H904] Delay string interpolations at logging calls.
enable-extensions = H106,H203,H204,H205,H210,H904 enable-extensions = H106,H203,H204,H205,H210,H904
ignore = E127,E128,E129,E131,H405 ignore = H405
exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes,docs,alembic/versions exclude = .venv,.git,.tox,dist,*lib/python*,*egg,build,releasenotes,docs,alembic/versions
[testenv:docs] [testenv:docs]