Fix E127 errors in horizon/

E127 continuation line over-indented for visual indent

Partial-Bug: #1375931
Change-Id: Ib9ae85a767a85a360e5a720d8392a20069a8c873
This commit is contained in:
Akihiro Motoki 2014-09-30 21:15:10 +09:00
parent 4d688be57b
commit c228358258
14 changed files with 55 additions and 55 deletions

View File

@ -170,10 +170,10 @@ class Registry(object):
parent = self._registered_with._registerable_class.__name__
raise NotRegistered('%(type)s with slug "%(slug)s" is not '
'registered with %(parent)s "%(name)s".'
% {"type": class_name,
"slug": cls,
"parent": parent,
"name": self.slug})
% {"type": class_name,
"slug": cls,
"parent": parent,
"name": self.slug})
else:
slug = getattr(cls, "slug", cls)
raise NotRegistered('%(type)s with slug "%(slug)s" is not '

View File

@ -181,8 +181,8 @@ class SelectWidget(widgets.Select):
def render_option(self, selected_choices, option_value, option_label):
option_value = force_text(option_value)
other_html = (option_value in selected_choices) and \
u' selected="selected"' or ''
other_html = (u' selected="selected"'
if option_value in selected_choices else '')
if callable(self.transform_html_attrs):
html_attrs = self.transform_html_attrs(option_label)

View File

@ -492,8 +492,8 @@ class FilterAction(BaseAction):
# and actions won't allow it. Need to be fixed in the future.
cls_name = self.__class__.__name__
raise NotImplementedError("You must define a %s method "
"for %s data type in %s." %
(func_name, data_type, cls_name))
"for %s data type in %s." %
(func_name, data_type, cls_name))
_data = filter_func(table, data, filter_string)
self.assign_type_string(table, _data, data_type)
filtered_data.extend(_data)

View File

@ -768,7 +768,7 @@ class Cell(html.HTMLElement):
"""Returns a flattened string of the cell's CSS classes."""
if not self.url:
self.column.classes = [cls for cls in self.column.classes
if cls != "anchor"]
if cls != "anchor"]
column_class_string = self.column.get_final_attrs().get('class', "")
classes = set(column_class_string.split(" "))
if self.column.status:
@ -944,8 +944,8 @@ class DataTableOptions(object):
"""
def __init__(self, options):
self.name = getattr(options, 'name', self.__class__.__name__)
verbose_name = getattr(options, 'verbose_name', None) \
or self.name.title()
verbose_name = (getattr(options, 'verbose_name', None)
or self.name.title())
self.verbose_name = verbose_name
self.columns = getattr(options, 'columns', None)
self.status_columns = getattr(options, 'status_columns', [])
@ -983,9 +983,9 @@ class DataTableOptions(object):
'template',
'horizon/common/_data_table.html')
self.row_actions_template = \
'horizon/common/_data_table_row_actions.html'
'horizon/common/_data_table_row_actions.html'
self.table_actions_template = \
'horizon/common/_data_table_table_actions.html'
'horizon/common/_data_table_table_actions.html'
self.context_var_name = unicode(getattr(options,
'context_var_name',
'table'))
@ -1300,7 +1300,7 @@ class DataTable(object):
if not matches:
raise exceptions.Http302(self.get_absolute_url(),
_('No match returned for the id "%s".')
% lookup)
% lookup)
return matches[0]
@property

View File

@ -138,7 +138,7 @@ class FormsetDataTableMixin(object):
formset = self.get_formset()
formset.is_valid()
for datum, form in itertools.izip_longest(self.filtered_data,
formset):
formset):
row = self._meta.row_class(self, datum, form)
if self.get_object_id(datum) == self.current_item_id:
self.selected = True

View File

@ -41,7 +41,7 @@ def has_permissions(user, component):
@register.filter
def has_permissions_on_list(components, user):
return [component for component
in components if has_permissions(user, component)]
in components if has_permissions(user, component)]
@register.inclusion_tag('horizon/_accordion_nav.html', takes_context=True)
@ -57,19 +57,19 @@ def horizon_nav(context):
for group in panel_groups.values():
allowed_panels = []
for panel in group:
if callable(panel.nav) and panel.nav(context) and \
panel.can_access(context):
if (callable(panel.nav) and panel.nav(context) and
panel.can_access(context)):
allowed_panels.append(panel)
elif not callable(panel.nav) and panel.nav and \
panel.can_access(context):
elif (not callable(panel.nav) and panel.nav and
panel.can_access(context)):
allowed_panels.append(panel)
if allowed_panels:
non_empty_groups.append((group.name, allowed_panels))
if callable(dash.nav) and dash.nav(context) and \
dash.can_access(context):
if (callable(dash.nav) and dash.nav(context) and
dash.can_access(context)):
dashboards.append((dash, SortedDict(non_empty_groups)))
elif not callable(dash.nav) and dash.nav and \
dash.can_access(context):
elif (not callable(dash.nav) and dash.nav and
dash.can_access(context)):
dashboards.append((dash, SortedDict(non_empty_groups)))
return {'components': dashboards,
'user': context['request'].user,
@ -109,11 +109,11 @@ def horizon_dashboard_nav(context):
for group in panel_groups.values():
allowed_panels = []
for panel in group:
if callable(panel.nav) and panel.nav(context) and \
panel.can_access(context):
if (callable(panel.nav) and panel.nav(context) and
panel.can_access(context)):
allowed_panels.append(panel)
elif not callable(panel.nav) and panel.nav and \
panel.can_access(context):
elif (not callable(panel.nav) and panel.nav and
panel.can_access(context)):
allowed_panels.append(panel)
if allowed_panels:
non_empty_groups.append((group.name, allowed_panels))

View File

@ -66,7 +66,7 @@ def filesizeformat(bytes, filesize_number_format):
return _("%s TB") % \
filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024))
return _("%s PB") % \
filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024 * 1024))
filesize_number_format(bytes / (1024 * 1024 * 1024 * 1024 * 1024))
def float_cast_filesizeformat(value, multiplier=1, format=int_format):

View File

@ -107,7 +107,7 @@ class RequestFactoryWithMessages(RequestFactory):
@unittest.skipIf(os.environ.get('SKIP_UNITTESTS', False),
"The SKIP_UNITTESTS env variable is set.")
"The SKIP_UNITTESTS env variable is set.")
class TestCase(django_test.TestCase):
"""Specialized base test case class for Horizon which gives access to
numerous additional features:
@ -191,8 +191,8 @@ class TestCase(django_test.TestCase):
msgs = [force_text(m.message)
for m in messages if msg_type in m.tags]
assert len(msgs) == count, \
"%s messages not as expected: %s" % (msg_type.title(),
", ".join(msgs))
"%s messages not as expected: %s" % (msg_type.title(),
", ".join(msgs))
@unittest.skipUnless(os.environ.get('WITH_SELENIUM', False),

View File

@ -42,8 +42,8 @@ def parse_starttag_patched(self, i):
attrname, rest, attrvalue = m.group(1, 2, 3)
if not rest:
attrvalue = None
elif attrvalue[:1] == '\'' == attrvalue[-1:] or \
attrvalue[:1] == '"' == attrvalue[-1:]:
elif (attrvalue[:1] == '\'' == attrvalue[-1:] or
attrvalue[:1] == '"' == attrvalue[-1:]):
attrvalue = attrvalue[1:-1]
if attrvalue:
attrvalue = self.unescape(attrvalue)
@ -55,8 +55,8 @@ def parse_starttag_patched(self, i):
lineno, offset = self.getpos()
if "\n" in self.__starttag_text:
lineno = lineno + self.__starttag_text.count("\n")
offset = len(self.__starttag_text) \
- self.__starttag_text.rfind("\n")
offset = (len(self.__starttag_text)
- self.__starttag_text.rfind("\n"))
else:
offset = offset + len(self.__starttag_text)
self.error("junk characters in start tag: %r"

View File

@ -342,7 +342,7 @@ class GetUserHomeTests(BaseHorizonTests):
conf.HORIZON_CONFIG._setup()
self.assertEqual(self.test_user.username.upper(),
base.Horizon.get_user_home(self.test_user))
base.Horizon.get_user_home(self.test_user))
def test_using_module_function(self):
module_func = 'django.utils.encoding.force_text'
@ -351,7 +351,7 @@ class GetUserHomeTests(BaseHorizonTests):
self.test_user.username = 'testname'
self.assertEqual(self.original_username,
base.Horizon.get_user_home(self.test_user))
base.Horizon.get_user_home(self.test_user))
def test_using_url(self):
fixed_url = "/url"

View File

@ -56,7 +56,7 @@ class MiddlewareTests(test.TestCase):
HTTP_X_REQUESTED_WITH='XMLHttpRequest')
request.META['HTTP_X_REQUESTED_WITH'] = 'XMLHttpRequest'
request.horizon = {'async_messages':
[('error', 'error_msg', 'extra_tag')]}
[('error', 'error_msg', 'extra_tag')]}
response = HttpResponseRedirect(url)
response.client = self.client

View File

@ -227,7 +227,7 @@ class MyTable(tables.DataTable):
link_attrs={'data-type': 'modal dialog',
'data-tip': 'click for dialog'})
status = tables.Column('status', link=get_link,
cell_attributes_getter=tooltip_dict.get)
cell_attributes_getter=tooltip_dict.get)
optional = tables.Column('optional', empty_value='N/A')
excluded = tables.Column('excluded')
@ -1219,12 +1219,12 @@ class DataTableTests(test.TestCase):
self.assertEqual(row.cells['status'].data, 'down')
self.assertEqual(row.cells['status'].attrs,
{'title': 'service is not available',
{'title': 'service is not available',
'style': 'color:red;cursor:pointer'})
self.assertEqual(row1.cells['status'].data, 'up')
self.assertEqual(row1.cells['status'].attrs,
{'title': 'service is up and running',
'style': 'color:green;cursor:pointer'})
{'title': 'service is up and running',
'style': 'color:green;cursor:pointer'})
self.assertEqual(row2.cells['status'].data, 'standby')
self.assertEqual(row2.cells['status'].attrs, {})

View File

@ -79,9 +79,9 @@ class ValidatorsTests(test.TestCase):
"1.2.3.4:1111:2222::5555//22",
"fe80::204:61ff:254.157.241.86/200",
# some valid IPv4 addresses
"10.144.11.107/4",
"255.255.255.255/0",
"0.1.2.3/16")
"10.144.11.107/4",
"255.255.255.255/0",
"0.1.2.3/16")
ip = forms.IPField(mask=True, version=forms.IPv6)
for cidr in GOOD_CIDRS:
self.assertIsNone(ip.validate(cidr))
@ -149,7 +149,7 @@ class ValidatorsTests(test.TestCase):
ipv4 = forms.IPField(required=True, version=forms.IPv4)
ipv6 = forms.IPField(required=False, version=forms.IPv6)
ipmixed = forms.IPField(required=False,
version=forms.IPv4 | forms.IPv6)
version=forms.IPv4 | forms.IPv6)
for ip_addr in GOOD_IPS_V4:
self.assertIsNone(ipv4.validate(ip_addr))
@ -170,9 +170,9 @@ class ValidatorsTests(test.TestCase):
self.assertRaises(ValidationError, ipv4.validate, "") # required=True
iprange = forms.IPField(required=False,
mask=True,
mask_range_from=10,
version=forms.IPv4 | forms.IPv6)
mask=True,
mask_range_from=10,
version=forms.IPv4 | forms.IPv6)
self.assertRaises(ValidationError, iprange.validate,
"fe80::204:61ff:254.157.241.86/6")
self.assertRaises(ValidationError, iprange.validate,

View File

@ -67,8 +67,8 @@ class ActionMetaclass(forms.forms.DeclarativeFieldsMetaclass):
cls.slug = getattr(opts, "slug", slugify(name))
cls.permissions = getattr(opts, "permissions", ())
cls.progress_message = getattr(opts,
"progress_message",
_("Processing..."))
"progress_message",
_("Processing..."))
cls.help_text = getattr(opts, "help_text", "")
cls.help_text_template = getattr(opts, "help_text_template", None)
return cls
@ -347,8 +347,8 @@ class Step(object):
except ImportError:
raise ImportError("Could not import %s from the "
"module %s as a connection "
"handler on %s."
% (bits[-1], module_name, cls))
"handler on %s."
% (bits[-1], module_name, cls))
except AttributeError:
raise AttributeError("Could not import %s from the "
"module %s as a connection "
@ -723,7 +723,7 @@ class Workflow(html.HTMLElement):
def _trigger_handlers(self, key):
responses = []
handlers = [(step.slug, f) for step in self.steps
for f in step._handlers.get(key, [])]
for f in step._handlers.get(key, [])]
for slug, handler in handlers:
responses.append((slug, handler(self.request, self.context)))
return responses