Bump hacking to 1.1.0
Fix the following new errors: * E305 expected 2 blank lines after class or function definition, found 1 * E126 continuation line over-indented for hanging indent max_line_length is set to 80 as the default value in pycodestyle is 79 but horizon uses 80 as max_line_length. Ignore W504 and F405 by configurations. Reasons of disabling them are explained as comments in tox.ini. Change-Id: Iee8bcd60c30883fc8c74f08cf20af853cbb5e271
This commit is contained in:
parent
a3a4b93d32
commit
cebe212d00
@ -22,7 +22,7 @@ register = template.Library()
|
||||
def shellfilter(value):
|
||||
"""Replace HTML chars for shell usage."""
|
||||
replacements = {'\\': '\\\\',
|
||||
'`': '\`',
|
||||
'`': '\\`',
|
||||
"'": "\\'",
|
||||
'"': '\\"'}
|
||||
for search, repl in replacements.items():
|
||||
|
@ -30,6 +30,7 @@ def _lazy_join(separator, strings):
|
||||
return separator.join([force_text(s)
|
||||
for s in strings])
|
||||
|
||||
|
||||
lazy_join = lazy(_lazy_join, six.text_type)
|
||||
|
||||
|
||||
|
@ -131,6 +131,7 @@ def memoized(func=None, max_size=None):
|
||||
return decorate(func)
|
||||
return decorate
|
||||
|
||||
|
||||
# We can use @memoized for methods now too, because it uses weakref and so
|
||||
# it doesn't keep the instances in memory forever. We might want to separate
|
||||
# them in the future, however.
|
||||
|
@ -76,6 +76,7 @@ def validate_metadata(value):
|
||||
if not len(keyval) == 2 or not keyval[0]:
|
||||
raise ValidationError(error_msg)
|
||||
|
||||
|
||||
# Same as POSIX [:print:]. Accordingly, diacritics are disallowed.
|
||||
PRINT_REGEX = re.compile(r'^[\x20-\x7E]*$')
|
||||
|
||||
|
@ -1286,4 +1286,5 @@ class OpenStackAuthTestsWebSSO(OpenStackAuthTestsMixin,
|
||||
self.assertRedirects(response, settings.WEBSSO_DEFAULT_REDIRECT_LOGOUT,
|
||||
status_code=302, target_status_code=301)
|
||||
|
||||
|
||||
load_tests = load_tests_apply_scenarios
|
||||
|
@ -1841,6 +1841,7 @@ def is_router_enabled(request):
|
||||
return (is_enabled_by_config('enable_router') and
|
||||
is_extension_supported(request, 'router'))
|
||||
|
||||
|
||||
# FEATURE_MAP is used to define:
|
||||
# - related neutron extension name (key: "extension")
|
||||
# - corresponding dashboard config (key: "config")
|
||||
|
@ -31,6 +31,7 @@ class AjaxError(Exception):
|
||||
self.http_status = http_status
|
||||
super(AjaxError, self).__init__(msg)
|
||||
|
||||
|
||||
http_errors = exceptions.UNAUTHORIZED + exceptions.NOT_FOUND + \
|
||||
exceptions.RECOVERABLE + (AjaxError, )
|
||||
|
||||
@ -147,6 +148,7 @@ def ajax(authenticated=True, data_required=False,
|
||||
return _wrapped
|
||||
return decorator
|
||||
|
||||
|
||||
PARAM_MAPPING = {
|
||||
'None': None,
|
||||
'True': True,
|
||||
|
@ -32,4 +32,5 @@ class Admin(horizon.Dashboard):
|
||||
else:
|
||||
permissions = (tuple(utils.get_admin_permissions()),)
|
||||
|
||||
|
||||
horizon.register(Admin)
|
||||
|
@ -36,11 +36,11 @@ urlpatterns = [
|
||||
url(r'^create/$', views.CreateView.as_view(), name='create'),
|
||||
url(NETWORKS % 'update', views.UpdateView.as_view(), name='update'),
|
||||
url(NETWORKS % 'detail', views.DetailView.as_view(), name='detail'),
|
||||
url(NETWORKS % 'detail\?tab=network_tabs__ports_tab$',
|
||||
url(NETWORKS % r'detail\?tab=network_tabs__ports_tab$',
|
||||
views.DetailView.as_view(), name='ports_tab'),
|
||||
url(NETWORKS % 'detail\?tab=network_tabs__agents_tab$',
|
||||
url(NETWORKS % r'detail\?tab=network_tabs__agents_tab$',
|
||||
views.DetailView.as_view(), name='agents_tab'),
|
||||
url(NETWORKS % 'detail\?tab=network_tabs__subnets_tab$',
|
||||
url(NETWORKS % r'detail\?tab=network_tabs__subnets_tab$',
|
||||
views.DetailView.as_view(), name='subnets_tab'),
|
||||
url(NETWORKS % 'agents/add',
|
||||
agent_views.AddView.as_view(), name='adddhcpagent'),
|
||||
|
@ -25,7 +25,7 @@ urlpatterns = [
|
||||
url(r'^(?P<identity_provider_id>[^/]+)/detail/$',
|
||||
views.DetailView.as_view(), name='detail'),
|
||||
url(r'^(?P<identity_provider_id>[^/]+)/detail/'
|
||||
'\?tab=idp_details__protocols$',
|
||||
r'\?tab=idp_details__protocols$',
|
||||
views.DetailView.as_view(),
|
||||
name='protocols_tab'),
|
||||
url(r'^(?P<identity_provider_id>[^/]+)/update/$',
|
||||
|
@ -26,4 +26,5 @@ class Project(horizon.Dashboard):
|
||||
has_project = request.user.token.project.get('id') is not None
|
||||
return super(Project, self).can_access(context) and has_project
|
||||
|
||||
|
||||
horizon.register(Project)
|
||||
|
@ -43,6 +43,7 @@ IMAGE_FORMAT_CHOICES = IMAGE_BACKEND_SETTINGS.get('image_formats', [])
|
||||
class ImageURLField(forms.URLField):
|
||||
default_validators = [validators.URLValidator(schemes=["http", "https"])]
|
||||
|
||||
|
||||
if api.glance.get_image_upload_mode() == 'direct':
|
||||
FileField = forms.ExternalFileField
|
||||
CreateParent = six.with_metaclass(forms.ExternalUploadMeta,
|
||||
|
@ -32,12 +32,12 @@ NETWORKS = r'^(?P<network_id>[^/]+)/%s$'
|
||||
urlpatterns = [
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'^create$', views.CreateView.as_view(), name='create'),
|
||||
url(NETWORKS % 'detail(\?tab=network_tabs__overview)?$',
|
||||
url(NETWORKS % r'detail(\?tab=network_tabs__overview)?$',
|
||||
views.DetailView.as_view(),
|
||||
name='detail'),
|
||||
url(NETWORKS % 'detail\?tab=network_tabs__ports_tab$',
|
||||
url(NETWORKS % r'detail\?tab=network_tabs__ports_tab$',
|
||||
views.DetailView.as_view(), name='ports_tab'),
|
||||
url(NETWORKS % 'detail\?tab=network_tabs__subnets_tab$',
|
||||
url(NETWORKS % r'detail\?tab=network_tabs__subnets_tab$',
|
||||
views.DetailView.as_view(), name='subnets_tab'),
|
||||
url(NETWORKS % 'update', views.UpdateView.as_view(), name='update'),
|
||||
url(NETWORKS % 'subnets/create', subnet_views.CreateView.as_view(),
|
||||
|
@ -139,6 +139,8 @@ def find_apache_log_dir():
|
||||
if os.path.exists(log_dir) and os.path.isdir(log_dir):
|
||||
return log_dir
|
||||
return DEFAULT_LOG_DIR
|
||||
|
||||
|
||||
context['LOGDIR'] = find_apache_log_dir()
|
||||
|
||||
|
||||
|
@ -72,9 +72,9 @@ class FloatingipsPage(basepage.BaseNavigationPage):
|
||||
def allocate_floatingip(self):
|
||||
floatingip_form = self.floatingips_table.allocate_ip()
|
||||
floatingip_form.submit()
|
||||
ip = re.compile('(([2][5][0-5]\.)|([2][0-4][0-9]\.)'
|
||||
'|([0-1]?[0-9]?[0-9]\.)){3}(([2][5][0-5])|'
|
||||
'([2][0-4][0-9])|([0-1]?[0-9]?[0-9]))')
|
||||
ip = re.compile(r'(([2][5][0-5]\.)|([2][0-4][0-9]\.)'
|
||||
r'|([0-1]?[0-9]?[0-9]\.)){3}(([2][5][0-5])|'
|
||||
r'([2][0-4][0-9])|([0-1]?[0-9]?[0-9]))')
|
||||
match = ip.search((self._get_element(
|
||||
*self._floatingips_fadein_popup_locator)).text)
|
||||
floatingip = str(match.group())
|
||||
|
@ -33,11 +33,11 @@ class GlanceApiTests(test.APIMockTestCase):
|
||||
@override_settings(API_RESULT_PAGE_SIZE=2)
|
||||
@mock.patch.object(api.glance, 'glanceclient')
|
||||
def test_long_url(self, mock_glanceclient):
|
||||
servers = self.servers.list()*100
|
||||
api_images = self.images_api.list()*100
|
||||
servers = self.servers.list() * 100
|
||||
api_images = self.images_api.list() * 100
|
||||
instances_img_ids = [instance.image.get('id') for instance in
|
||||
servers if hasattr(instance, 'image')]
|
||||
expected_images = self.images.list()*100
|
||||
expected_images = self.images.list() * 100
|
||||
glanceclient = mock_glanceclient.return_value
|
||||
mock_images_list = glanceclient.images.list
|
||||
mock_images_list.return_value = iter(api_images)
|
||||
|
@ -7,7 +7,7 @@
|
||||
# be installed in a specific order.
|
||||
#
|
||||
# Hacking should appear first in case something else depends on pep8
|
||||
hacking!=0.13.0,<0.14,>=0.12.0 # Apache-2.0
|
||||
hacking>=1.1.0 # Apache-2.0
|
||||
#
|
||||
bandit>=1.4.0 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
|
8
tox.ini
8
tox.ini
@ -173,7 +173,12 @@ basepython = python3
|
||||
[flake8]
|
||||
filename = *.py,django.wsgi
|
||||
exclude = .git,.tox,dist,*lib/python*,*egg,build,panel_template,dash_template,local_settings.py,*/local/*,*/test/test_plugins/*,.ropeproject,node_modules,openstack_dashboard/enabled/*
|
||||
ignore =
|
||||
# W504 line break after binary operator
|
||||
# (W503 and W504 are incompatible and we need to choose one of them.
|
||||
# Existing codes follows W503, so we disable W504.)
|
||||
# F405 TEMPLATES may be undefined, or defined from star imports
|
||||
# (because it is not easy to avoid this in openstack_dashboard.test.settings)
|
||||
ignore = W504,F405
|
||||
# Enable the following hacking rules which are disabled by default
|
||||
# H106 Do not put vim configuration in source files.
|
||||
# H203 Use assertIs(Not)None to check for None.
|
||||
@ -182,6 +187,7 @@ ignore =
|
||||
# H904 Delay string interpolations at logging calls.
|
||||
enable-extensions=H106,H203,H204,H205,H904
|
||||
max-complexity = 20
|
||||
max_line_length = 80
|
||||
|
||||
# flake8-import-order configurations
|
||||
import-order-style = pep8
|
||||
|
Loading…
Reference in New Issue
Block a user