mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
fixed pylint warnings
This commit is contained in:
parent
c9f1dce6a2
commit
fbb73dd5da
@ -89,8 +89,8 @@ class UbusDeviceScanner(object):
|
|||||||
'call', 'uci', 'get',
|
'call', 'uci', 'get',
|
||||||
config="dhcp", type="dnsmasq")
|
config="dhcp", type="dnsmasq")
|
||||||
if result:
|
if result:
|
||||||
self.leasefile = next(iter(result["values"].
|
values = result["values"].values()
|
||||||
values()))["leasefile"]
|
self.leasefile = next(iter(values))["leasefile"]
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -101,8 +101,8 @@ class UbusDeviceScanner(object):
|
|||||||
if result:
|
if result:
|
||||||
self.mac2name = dict()
|
self.mac2name = dict()
|
||||||
for line in result["data"].splitlines():
|
for line in result["data"].splitlines():
|
||||||
[time, mac, ip, name, lid] = line.split(" ")
|
hosts = line.split(" ")
|
||||||
self.mac2name[mac.upper()] = name
|
self.mac2name[hosts[1].upper()] = hosts[3]
|
||||||
else:
|
else:
|
||||||
# Error, handled in the _req_json_rpc
|
# Error, handled in the _req_json_rpc
|
||||||
return
|
return
|
||||||
@ -138,6 +138,7 @@ class UbusDeviceScanner(object):
|
|||||||
|
|
||||||
return bool(results)
|
return bool(results)
|
||||||
|
|
||||||
|
|
||||||
def _req_json_rpc(url, session_id, rpcmethod, subsystem, method, **params):
|
def _req_json_rpc(url, session_id, rpcmethod, subsystem, method, **params):
|
||||||
""" Perform one JSON RPC operation. """
|
""" Perform one JSON RPC operation. """
|
||||||
|
|
||||||
@ -147,8 +148,7 @@ def _req_json_rpc(url, session_id, rpcmethod, subsystem, method, **params):
|
|||||||
"params": [session_id,
|
"params": [session_id,
|
||||||
subsystem,
|
subsystem,
|
||||||
method,
|
method,
|
||||||
params]
|
params]})
|
||||||
})
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
res = requests.post(url, data=data, timeout=5)
|
res = requests.post(url, data=data, timeout=5)
|
||||||
@ -159,7 +159,7 @@ def _req_json_rpc(url, session_id, rpcmethod, subsystem, method, **params):
|
|||||||
if res.status_code == 200:
|
if res.status_code == 200:
|
||||||
response = res.json()
|
response = res.json()
|
||||||
|
|
||||||
if (rpcmethod == "call"):
|
if rpcmethod == "call":
|
||||||
return response["result"][1]
|
return response["result"][1]
|
||||||
else:
|
else:
|
||||||
return response["result"]
|
return response["result"]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user