removed redundant returns

This commit is contained in:
tomaae 2019-12-12 23:14:14 +01:00
parent 0f2cb6d455
commit 9be5a15c54
6 changed files with 0 additions and 56 deletions

View file

@ -49,9 +49,7 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
mikrotik_controller.listeners.append(
async_dispatcher_connect(hass, mikrotik_controller.signal_update, update_controller)
)
update_controller()
return
# ---------------------------
@ -75,8 +73,6 @@ def update_items(inst, mikrotik_controller, async_add_entities, sensors):
if new_sensors:
async_add_entities(new_sensors, True)
return
class MikrotikControllerBinarySensor(BinarySensorDevice):
"""Define an Mikrotik Controller Binary Sensor."""
@ -129,12 +125,10 @@ class MikrotikControllerBinarySensor(BinarySensorDevice):
async def async_update(self):
"""Synchronize state with controller."""
return
async def async_added_to_hass(self):
"""Port entity created."""
_LOGGER.debug("New sensor %s (%s)", self._inst, self._sensor)
return
@property
def is_on(self):

View file

@ -51,7 +51,6 @@ class MikrotikControllerConfigFlow(ConfigFlow, domain=DOMAIN):
def __init__(self):
"""Initialize MikrotikControllerConfigFlow."""
return
@staticmethod
@callback

View file

@ -66,7 +66,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
)
update_controller()
return
# ---------------------------
@ -91,8 +90,6 @@ def update_items(inst, mikrotik_controller, async_add_entities, tracked):
if new_tracked:
async_add_entities(new_tracked)
return
# ---------------------------
# MikrotikControllerPortDeviceTracker
@ -118,11 +115,9 @@ class MikrotikControllerPortDeviceTracker(ScannerEntity):
async def async_added_to_hass(self):
"""Port entity created."""
_LOGGER.debug("New port tracker %s (%s %s)", self._inst, self._data['default-name'], self._data['port-mac-address'])
return
async def async_update(self):
"""Synchronize state with controller."""
return
@property
def is_connected(self):

View file

@ -49,15 +49,12 @@ class MikrotikControllerData():
async_track_time_interval(self.hass, self.force_update, self.option_scan_interval)
async_track_time_interval(self.hass, self.force_fwupdate_check, timedelta(hours=1))
return
# ---------------------------
# force_update
# ---------------------------
async def force_update(self, _now=None):
"""Trigger update by timer"""
await self.async_update()
return
# ---------------------------
# force_fwupdate_check
@ -65,7 +62,6 @@ class MikrotikControllerData():
async def force_fwupdate_check(self, _now=None):
"""Trigger hourly update by timer"""
await self.async_fwupdate_check()
return
# ---------------------------
# option_track_arp
@ -112,7 +108,6 @@ class MikrotikControllerData():
await self.hass.async_add_executor_job(self.get_system_routerboard)
await self.hass.async_add_executor_job(self.get_system_resource)
self.lock.release()
return
# ---------------------------
# async_fwupdate_check
@ -120,9 +115,7 @@ class MikrotikControllerData():
async def async_fwupdate_check(self):
"""Update Mikrotik data"""
await self.hass.async_add_executor_job(self.get_firmware_update)
async_dispatcher_send(self.hass, self.signal_update)
return
# ---------------------------
# async_update
@ -146,7 +139,6 @@ class MikrotikControllerData():
async_dispatcher_send(self.hass, self.signal_update)
self.lock.release()
return
# ---------------------------
# async_reset
@ -176,8 +168,6 @@ class MikrotikControllerData():
except ApiEntryNotFound as error:
_LOGGER.error("Failed to run script: %s", error)
return
# ---------------------------
# get_interface
# ---------------------------
@ -209,8 +199,6 @@ class MikrotikControllerData():
]
)
return
# ---------------------------
# get_interface_traffic
# ---------------------------
@ -231,7 +219,6 @@ class MikrotikControllerData():
{'name': 'tx-bits-per-second', 'default': 0},
]
)
return
# ---------------------------
# get_interface_client
@ -262,8 +249,6 @@ class MikrotikControllerData():
self.data['interface'][uid]['client-ip-address'] = from_entry(self.data['arp'][uid], 'address')
self.data['interface'][uid]['client-mac-address'] = from_entry(self.data['arp'][uid], 'mac-address')
return
# ---------------------------
# update_arp
# ---------------------------
@ -337,8 +322,6 @@ class MikrotikControllerData():
self.data['arp'][uid]['mac-address'] = from_entry(entry, 'mac-address')
self.data['arp'][uid]['address'] = mac2ip[self.data['arp'][uid]['mac-address']] if self.data['arp'][uid]['mac-address'] in mac2ip else ""
return
# ---------------------------
# get_iface_from_entry
# ---------------------------
@ -384,7 +367,6 @@ class MikrotikControllerData():
{'key': 'action', 'value': 'dst-nat'}
]
)
return
# ---------------------------
# get_system_routerboard
@ -401,7 +383,6 @@ class MikrotikControllerData():
{'name': 'firmware', 'default': 'unknown'}
]
)
return
# ---------------------------
# get_system_resource
@ -434,8 +415,6 @@ class MikrotikControllerData():
else:
self.data['resource']['hdd-usage'] = "unknown"
return
# ---------------------------
# get_system_routerboard
# ---------------------------
@ -457,8 +436,6 @@ class MikrotikControllerData():
else:
self.data['fw-update']['available'] = False
return
# ---------------------------
# get_script
# ---------------------------
@ -474,4 +451,3 @@ class MikrotikControllerData():
{'name': 'run-count', 'default': 'unknown'}
]
)
return

View file

@ -92,7 +92,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
)
update_controller()
return
# ---------------------------
@ -129,8 +128,6 @@ def update_items(inst, mikrotik_controller, async_add_entities, sensors):
if new_sensors:
async_add_entities(new_sensors, True)
return
# ---------------------------
# MikrotikControllerSensor
@ -211,12 +208,10 @@ class MikrotikControllerSensor(Entity):
async def async_update(self):
"""Synchronize state with controller."""
return
async def async_added_to_hass(self):
"""Port entity created."""
_LOGGER.debug("New sensor %s (%s)", self._inst, self._sensor)
return
# ---------------------------
@ -255,4 +250,3 @@ class MikrotikControllerTrafficSensor(MikrotikControllerSensor):
async def async_added_to_hass(self):
"""Port entity created."""
_LOGGER.debug("New sensor %s (%s %s)", self._inst, self._data['default-name'], self._sensor)
return

View file

@ -81,7 +81,6 @@ async def async_setup_entry(hass, config_entry, async_add_entities):
)
update_controller()
return
# ---------------------------
@ -110,8 +109,6 @@ def update_items(inst, mikrotik_controller, async_add_entities, switches):
if new_switches:
async_add_entities(new_switches)
return
# ---------------------------
# MikrotikControllerSwitch
@ -128,11 +125,9 @@ class MikrotikControllerSwitch(SwitchDevice, RestoreEntity):
async def async_added_to_hass(self):
"""Switch entity created."""
_LOGGER.debug("New switch %s (%s)", self._inst, self._uid)
return
async def async_update(self):
"""Synchronize state with controller."""
return
@property
def available(self) -> bool:
@ -158,7 +153,6 @@ class MikrotikControllerPortSwitch(MikrotikControllerSwitch):
async def async_added_to_hass(self):
"""Port entity created."""
_LOGGER.debug("New port switch %s (%s %s)", self._inst, self._data['default-name'], self._data['port-mac-address'])
return
@property
def name(self) -> str:
@ -214,7 +208,6 @@ class MikrotikControllerPortSwitch(MikrotikControllerSwitch):
mod_value = False
self._ctrl.set_value(path, param, value, mod_param, mod_value)
await self._ctrl.force_update()
return
async def async_turn_off(self):
"""Turn on the switch."""
@ -225,7 +218,6 @@ class MikrotikControllerPortSwitch(MikrotikControllerSwitch):
mod_value = True
self._ctrl.set_value(path, param, value, mod_param, mod_value)
await self._ctrl.async_update()
return
@property
def is_on(self):
@ -251,7 +243,6 @@ class MikrotikControllerNATSwitch(MikrotikControllerSwitch):
async def async_added_to_hass(self):
"""NAT switch entity created."""
_LOGGER.debug("New port switch %s (%s)", self._inst, self._data['name'])
return
@property
def name(self) -> str:
@ -308,7 +299,6 @@ class MikrotikControllerNATSwitch(MikrotikControllerSwitch):
mod_value = False
self._ctrl.set_value(path, param, value, mod_param, mod_value)
await self._ctrl.force_update()
return
async def async_turn_off(self):
"""Turn on the switch."""
@ -323,7 +313,6 @@ class MikrotikControllerNATSwitch(MikrotikControllerSwitch):
mod_value = True
self._ctrl.set_value(path, param, value, mod_param, mod_value)
await self._ctrl.async_update()
return
@property
def is_on(self):
@ -349,7 +338,6 @@ class MikrotikControllerScriptSwitch(MikrotikControllerSwitch):
async def async_added_to_hass(self):
"""Script switch entity created."""
_LOGGER.debug("New script switch %s (%s)", self._inst, self._data['name'])
return
@property
def name(self) -> str:
@ -392,11 +380,9 @@ class MikrotikControllerScriptSwitch(MikrotikControllerSwitch):
"""Turn on the switch."""
self._ctrl.run_script(self._data['name'])
await self._ctrl.force_update()
return
async def async_turn_off(self):
"""Turn off the switch."""
return
@property
def is_on(self):