Skip to content

Commit bc76201

Browse files
committed
util/agent: disable pylint warnings
The pylint code warns because of a possibly-used-before-assignment, which is only valid in case python gobject introspectiuon is not used. The reason the variable is hidden behind a type check is a hang related to sphinx, which when trying to import the module for autodoc hangs forever. The normal case is that the `nm` variable is always assigned before use, so disable the related warnings. Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
1 parent 49aa0eb commit bc76201

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

labgrid/util/agents/network_interface.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def connection_from_dict(data):
9595
class NMDev:
9696
def __init__(self, interface):
9797
self._interface = interface
98-
self._nm_dev = nm.get_device_by_iface(interface)
98+
self._nm_dev = nm.get_device_by_iface(interface) # pylint: disable=possibly-used-before-assignment
9999

100100
def _delete_connection(self, con):
101101
future = Future()
@@ -114,7 +114,7 @@ def cb(con, res, error):
114114
)
115115

116116
def get_settings(self):
117-
lg_con = nm.get_connection_by_id(f"labgrid-{self._interface}")
117+
lg_con = nm.get_connection_by_id(f"labgrid-{self._interface}") # pylint: disable=possibly-used-before-assignment
118118
if lg_con:
119119
return dict(lg_con.to_dbus(NM.ConnectionSerializationFlags.ALL))
120120

@@ -125,7 +125,7 @@ def get_active_settings(self):
125125
return dict(con.to_dbus(NM.ConnectionSerializationFlags.ALL))
126126

127127
def configure(self, data):
128-
lg_con = nm.get_connection_by_id(f"labgrid-{self._interface}")
128+
lg_con = nm.get_connection_by_id(f"labgrid-{self._interface}") # pylint: disable=possibly-used-before-assignment
129129
if lg_con:
130130
self._delete_connection(lg_con)
131131
data['connection'].update({
@@ -139,12 +139,12 @@ def configure(self, data):
139139
def cb(dev, res, error):
140140
assert error is None
141141
try:
142-
res = nm.add_and_activate_connection_finish(res)
142+
res = nm.add_and_activate_connection_finish(res) # pylint: disable=possibly-used-before-assignment
143143
future.set(res)
144144
except Exception as e:
145145
future.set(e)
146146

147-
nm.add_and_activate_connection_async(
147+
nm.add_and_activate_connection_async( # pylint: disable=possibly-used-before-assignment
148148
con,
149149
self._nm_dev,
150150
None, # specific_object
@@ -172,7 +172,7 @@ def wait_state(self, expected, timeout):
172172
)
173173

174174
def disable(self):
175-
lg_con = nm.get_connection_by_id(f"labgrid-{self._interface}")
175+
lg_con = nm.get_connection_by_id(f"labgrid-{self._interface}") # pylint: disable=possibly-used-before-assignment
176176
if lg_con:
177177
self._delete_connection(lg_con)
178178

0 commit comments

Comments
 (0)