Skip to content

Commit 187d6e0

Browse files
author
Arkadiusz Adamski
committed
fixed W503
In new version of pep8 (1.6.2) raise W503 as error. See PyCQA/pycodestyle#197
1 parent f4e300e commit 187d6e0

File tree

5 files changed

+15
-15
lines changed

5 files changed

+15
-15
lines changed

src/ralph_assets/forms_transitions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def __init__(self, *args, **kwargs):
6161

6262
def clean(self):
6363
if (
64-
not self.transition.odt_templates
65-
and self.transition.required_report
64+
not self.transition.odt_templates and
65+
self.transition.required_report
6666
):
6767
raise forms.ValidationError(_('Odt template does not exist!'))
6868
return super(TransitionForm, self).clean()

src/ralph_assets/models.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ def get_query(self, text, request):
113113
'id', flat=True
114114
).filter(name__icontains=text)
115115
query = Q(
116-
Q(barcode__icontains=text)
117-
| Q(sn__icontains=text)
118-
| Q(device_info__ralph_device_id__in=matched_devices_ids)
116+
Q(barcode__icontains=text) |
117+
Q(sn__icontains=text) |
118+
Q(device_info__ralph_device_id__in=matched_devices_ids)
119119
)
120120
return self.get_base_objects().filter(query).order_by()[:10]
121121

src/ralph_assets/tests/functional/tests_view.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,8 +1714,8 @@ def get_cols_by_mode(self, bob_cols, mode):
17141714
if not col.bob_tag:
17151715
continue
17161716
if (col.show_conditions is True) or (
1717-
isinstance(col.show_conditions, tuple)
1718-
and col.show_conditions[1] == mode
1717+
isinstance(col.show_conditions, tuple) and
1718+
col.show_conditions[1] == mode
17191719
):
17201720
mode_cols.add(col.header_name)
17211721
return mode_cols

src/ralph_assets/views/data_import.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,8 +221,8 @@ def _get_field_value(self, field_name, value):
221221
elif issubclass(field.rel.to, Sluggy):
222222
value = field.rel.to.objects.get(slug=value)
223223
elif (
224-
issubclass(field.rel.to, ServiceCatalog)
225-
or issubclass(field.rel.to, DeviceEnvironment)
224+
issubclass(field.rel.to, ServiceCatalog) or
225+
issubclass(field.rel.to, DeviceEnvironment)
226226
):
227227
try:
228228
value = field.rel.to.objects.get(name__iexact=value)

src/ralph_assets/views/transition.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,19 +337,19 @@ def base_error_handler(self, *args, **kwargs):
337337
)
338338

339339
if (
340-
self.assets.filter(model__category__code='').count() > 0
341-
and self.change_hostname
340+
self.assets.filter(model__category__code='').count() > 0 and
341+
self.change_hostname
342342
):
343343
messages.error(
344344
self.request, _("Asset has no assigned category with code"),
345345
)
346346
error = True
347347
# check assets has assigned user
348348
if (
349-
self.transition_type in required_user_transitions
350-
or (
351-
not self.assign_user
352-
and self.transition_type not in not_required_user_transitions
349+
self.transition_type in required_user_transitions or
350+
(
351+
not self.assign_user and
352+
self.transition_type not in not_required_user_transitions
353353
)
354354
):
355355
assets = self.assets.values('user__username').distinct()

0 commit comments

Comments
 (0)