Skip to content

Commit f52ab25

Browse files
committedFeb 17, 2025
dhcp: T7052: Clean up unnecessary params in formatter methods
The formatter methods are mostly `family` agnostic now.
1 parent 6b0a09d commit f52ab25

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed
 

‎src/op_mode/dhcp.py

+8-10
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def _get_raw_server_pool_statistics(config, family='inet', pool=None):
205205
return stats
206206

207207

208-
def _get_formatted_server_pool_statistics(pool_data, family='inet'):
208+
def _get_formatted_server_pool_statistics(pool_data):
209209
data_entries = []
210210
for entry in pool_data:
211211
pool = entry.get('pool')
@@ -235,7 +235,7 @@ def _get_raw_server_static_mappings(config, family='inet', pool=None, sorted=Non
235235
return mappings
236236

237237

238-
def _get_formatted_server_static_mappings(raw_data, family='inet'):
238+
def _get_formatted_server_static_mappings(raw_data):
239239
data_entries = []
240240

241241
for entry in raw_data:
@@ -245,10 +245,8 @@ def _get_formatted_server_static_mappings(raw_data, family='inet'):
245245
ip_addr = entry.get('ip', 'N/A')
246246
mac_addr = entry.get('mac', 'N/A')
247247
duid = entry.get('duid', 'N/A')
248-
description = entry.get('description', 'N/A')
249-
data_entries.append(
250-
[pool, subnet, hostname, ip_addr, mac_addr, duid, description]
251-
)
248+
desc = entry.get('description', 'N/A')
249+
data_entries.append([pool, subnet, hostname, ip_addr, mac_addr, duid, desc])
252250

253251
headers = [
254252
'Pool',
@@ -327,7 +325,7 @@ def show_server_pool_statistics(
327325
if raw:
328326
return pool_data
329327
else:
330-
return _get_formatted_server_pool_statistics(pool_data, family=family)
328+
return _get_formatted_server_pool_statistics(pool_data)
331329

332330

333331
@_verify_server
@@ -408,7 +406,7 @@ def show_server_static_mappings(
408406
if raw:
409407
return static_mappings
410408
else:
411-
return _get_formatted_server_static_mappings(static_mappings, family=family)
409+
return _get_formatted_server_static_mappings(static_mappings)
412410

413411

414412
def _lease_valid(inet, address):
@@ -482,7 +480,7 @@ def _get_raw_client_leases(family='inet', interface=None):
482480
return lease_data
483481

484482

485-
def _get_formatted_client_leases(lease_data, family):
483+
def _get_formatted_client_leases(lease_data):
486484
from time import localtime
487485
from time import strftime
488486

@@ -534,7 +532,7 @@ def show_client_leases(raw: bool, family: ArgFamily, interface: typing.Optional[
534532
if raw:
535533
return lease_data
536534
else:
537-
return _get_formatted_client_leases(lease_data, family=family)
535+
return _get_formatted_client_leases(lease_data)
538536

539537

540538
@_verify_client

0 commit comments

Comments
 (0)