Skip to content

Commit 1485926

Browse files
committed
Apply ruff rules
1 parent ed33585 commit 1485926

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

netbox/dcim/forms/bulk_import.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1440,7 +1440,7 @@ class CableImportForm(NetBoxModelImportForm):
14401440
queryset=Site.objects.all(),
14411441
required=False,
14421442
to_field_name='name',
1443-
help_text=_('Site of parent A (if any)'),
1443+
help_text=_('Site of parent A (if any)')
14441444
)
14451445
side_a_parent = forms.CharField(
14461446
label=_('Side A parent'),
@@ -1463,7 +1463,7 @@ class CableImportForm(NetBoxModelImportForm):
14631463
queryset=Site.objects.all(),
14641464
required=False,
14651465
to_field_name='name',
1466-
help_text=_('Site of parent B (if any)'),
1466+
help_text=_('Site of parent B (if any)')
14671467
)
14681468
side_b_parent = forms.CharField(
14691469
label=_('Side B parent'),
@@ -1543,7 +1543,10 @@ def _clean_side(self, side):
15431543
# Get the parent model mapping from the submitted content_type
15441544
parent_map = self.CABLE_PARENT_MAPPING.get(f'{content_type.app_label}.{content_type.model}')
15451545
# This should never happen
1546-
assert parent_map, f'Unknown cable termination content type parent mapping: {content_type.app_label}.{content_type.model}'
1546+
assert parent_map, (
1547+
'Unknown cable termination content type parent mapping: '
1548+
f'{content_type.app_label}.{content_type.model}'
1549+
)
15471550

15481551
parent_content_type, parent_accessor = parent_map
15491552
parent_app_label, parent_model_name = parent_content_type.split('.')
@@ -1602,7 +1605,10 @@ def _clean_side(self, side):
16021605
# Look up the termination object
16031606
try:
16041607
# Handle virtual chassis for device-based terminations
1605-
if parent_field == 'device' and parent_object.virtual_chassis and parent_object.virtual_chassis.master == parent_object and termination_model.objects.filter(**query).count() == 0:
1608+
if (parent_field == 'device' and
1609+
parent_object.virtual_chassis and
1610+
parent_object.virtual_chassis.master == parent_object and
1611+
termination_model.objects.filter(**query).count() == 0):
16061612
query[f'{parent_field}__in'] = parent_object.virtual_chassis.members.all()
16071613
query.pop(parent_field, None)
16081614
termination_object = termination_model.objects.get(**query)
@@ -1618,7 +1624,9 @@ def _clean_side(self, side):
16181624
)
16191625

16201626
# Circuit terminations can also be connected to provider networks
1621-
if name_field == 'term_side' and hasattr(termination_object, '_provider_network') and termination_object._provider_network is not None:
1627+
if (name_field == 'term_side' and
1628+
hasattr(termination_object, '_provider_network') and
1629+
termination_object._provider_network is not None):
16221630
raise forms.ValidationError(
16231631
_('Side {side_upper}: {parent} {termination} is already connected to a provider network').format(
16241632
side_upper=side.upper(), parent=parent_object, termination=termination_object
@@ -1627,8 +1635,10 @@ def _clean_side(self, side):
16271635
except termination_model.DoesNotExist:
16281636
raise forms.ValidationError(
16291637
_('Side {side_upper}: {model_name} not found: {parent} {name}').format(
1630-
side_upper=side.upper(), model_name=termination_model.__name__, parent=parent_object, name=name or ''
1631-
)
1638+
side_upper=side.upper(),
1639+
model_name=termination_model.__name__,
1640+
parent=parent_object, name=name or '',
1641+
),
16321642
)
16331643
except termination_model.MultipleObjectsReturned: # pragma: no cover
16341644
# This should never happen

0 commit comments

Comments
 (0)