Skip to content

Commit 259ecc3

Browse files
committed
create_station.py: Readability
Signed-off-by: Alex Gavin <alex.gavin@candelatech.com>
1 parent ef6b55b commit 259ecc3

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

py-scripts/create_station.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -342,9 +342,9 @@ def cleanup(self):
342342

343343
def build(self):
344344
# Build stations
345-
self.station_profile.use_security(self.security,
346-
self.ssid,
347-
self.password)
345+
self.station_profile.use_security(security_type=self.security,
346+
ssid=self.ssid,
347+
passwd=self.password)
348348
self.station_profile.set_number_template(self.number_template)
349349

350350
print("Creating stations")
@@ -403,18 +403,18 @@ def build(self):
403403
sgi=self.set_txo_data["sgi"],
404404
)
405405

406-
if self.station_profile.create(
407-
radio=self.radio,
408-
sta_names_=self.sta_list,
409-
debug=self.debug,
410-
up_=self.up):
406+
if self.station_profile.create(radio=self.radio,
407+
sta_names_=self.sta_list,
408+
debug=self.debug,
409+
up_=self.up):
411410
self._pass("Stations created.")
412411
else:
413412
self._fail("Stations not properly created.")
414413
# Custom Wifi setting
415414
if self.custom_wifi_cmd:
416415
for sta in self.sta_list:
417-
self.set_custom_wifi(resource=int(sta.split('.')[1]), station=str(sta.split('.')[2]),
416+
self.set_custom_wifi(resource=int(sta.split('.')[1]),
417+
station=str(sta.split('.')[2]),
418418
cmd=self.custom_wifi_cmd)
419419

420420
if self.up:
@@ -438,8 +438,13 @@ def modify_radio(self, mgr, radio, antenna, channel, tx_power, country_code):
438438
shelf, resource, radio, *nil = LFUtils.name_to_eid(radio)
439439

440440
modify_radio = lf_modify_radio.lf_modify_radio(lf_mgr=mgr)
441-
modify_radio.set_wifi_radio(_resource=resource, _radio=radio, _shelf=shelf, _antenna=antenna, _channel=channel,
442-
_txpower=tx_power,_country_code=country_code)
441+
modify_radio.set_wifi_radio(_resource=resource,
442+
_radio=radio,
443+
_shelf=shelf,
444+
_antenna=antenna,
445+
_channel=channel,
446+
_txpower=tx_power,
447+
_country_code=country_code)
443448

444449
def get_station_list(self):
445450
response = super().json_get("/port/list?fields=_links,alias,device,port+type")
@@ -903,15 +908,15 @@ def main():
903908
_custom_wifi_cmd=args.custom_wifi_cmd,
904909
_debug_on=args.debug)
905910

906-
if(not args.no_pre_cleanup):
911+
if not args.no_pre_cleanup:
907912
create_station.cleanup()
908913

909914
else:
910915
already_available_stations = create_station.get_station_list()
911-
if(len(already_available_stations) > 0):
916+
if len(already_available_stations) > 0:
912917
used_indices = [int(station_id.split('sta')[1]) for station_id in already_available_stations]
913918
for new_station in station_list:
914-
if(new_station in already_available_stations):
919+
if new_station in already_available_stations:
915920
print('Some stations are already existing in the LANforge from the given start id.')
916921
print('You can create stations from the start id {}'.format(max(used_indices) + 1))
917922
exit(1)
@@ -925,7 +930,7 @@ def main():
925930
country_code=args.country_code)
926931
create_station.build()
927932

928-
if(args.cleanup):
933+
if args.cleanup:
929934
create_station.cleanup()
930935

931936
if create_station.passes():

0 commit comments

Comments
 (0)