Skip to content

Commit a5f8aec

Browse files
Applying ruff rule ERA001
1 parent 268d38f commit a5f8aec

File tree

6 files changed

+2
-77
lines changed

6 files changed

+2
-77
lines changed

mxcubecore/Command/Mockup.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,6 @@
1818
# You should have received a copy of the GNU Lesser General Public License
1919
# along with MXCuBE. If not, see <http://www.gnu.org/licenses/>.
2020

21-
# import time
22-
# import logging
23-
# import weakref
24-
25-
# try:
26-
# import Queue as queue
27-
# except ImportError:
28-
# import queue
29-
3021

3122
from mxcubecore.CommandContainer import (
3223
ChannelObject,

mxcubecore/Command/Pool.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ def state_polling(self):
251251
s = self.device.State()
252252
except Exception:
253253
pass
254-
# logging.getLogger("HWR").exception("Could not read State attribute")
255254
else:
256255
if s == PyTango.DevState.OFF:
257256
return
@@ -278,9 +277,6 @@ def get_value(self):
278277
return self.value
279278

280279
def set_value(self, new_value):
281-
# newval = PyTango.AttributeValue()
282-
# newval.value = newValue
283-
# self.device.write_attribute(self.attribute_name, newval)
284280
attr = PyTango.AttributeProxy(self.device_name + "/" + self.attribute_name)
285281
a = attr.read()
286282
a.value = new_value

mxcubecore/Command/Sardana.py

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@
2929
import gevent
3030
from gevent.event import Event
3131

32-
# import time
33-
# import types
3432
from mxcubecore.dispatcher import saferef
3533

3634
try:
@@ -156,17 +154,6 @@ def init_device(self):
156154
self.door.set_timeout_millis(10000)
157155
self.doorstate = self.door.state.name.upper()
158156

159-
#
160-
# DIRTY FIX to make compatible taurus listeners and existence of Tango channels/commands
161-
# as defined in Command/Tango.py
162-
#
163-
# if self.door.__class__ == taurus.core.tango.tangodevice.TangoDevice:
164-
# dp = self.door.getHWObj()
165-
# try:
166-
# dp.subscribe_event = dp._subscribe_event
167-
# except AttributeError:
168-
# pass
169-
170157
if self.macroStatusAttr is None:
171158
self.macroStatusAttr = self.door.getAttribute("State")
172159
self.macroStatusAttr.addListener(self.object_listener)
@@ -261,9 +248,8 @@ def update(self, event):
261248

262249
try:
263250
if not isinstance(data, PyTango.DeviceAttribute):
264-
# Events different than a value changed on attribute. Taurus sends an event with attribute info
265-
# logging.getLogger('HWR').debug("==========. Got an event, but it is not an attribute . it is %s" % type(data))
266-
# logging.getLogger('HWR').debug("doorstate event. type is %s" % str(type(data)))
251+
# Events different than a value changed on attribute.
252+
# Taurus sends an event with attribute info.
267253
return
268254

269255
# Handling macro state changed event
@@ -275,18 +261,14 @@ def update(self, event):
275261
if doorstate != self.doorstate:
276262
self.doorstate = doorstate
277263

278-
# logging.getLogger('HWR').debug("self.doorstate is %s" % self.canExecute())
279264
self.emit("commandCanExecute", (self.can_execute(),))
280265

281266
if doorstate in ["ON", "ALARM"]:
282-
# logging.getLogger('HWR').debug("Macroserver ready for commands")
283267
self.emit("commandReady", ())
284268
else:
285-
# logging.getLogger('HWR').debug("Macroserver busy ")
286269
self.emit("commandNotReady", ())
287270

288271
if self.macrostate == SardanaMacro.STARTED and doorstate == "RUNNING":
289-
# logging.getLogger('HWR').debug("Macro server is running")
290272
self.macrostate = SardanaMacro.RUNNING
291273
elif self.macrostate == SardanaMacro.RUNNING and (
292274
doorstate in ["ON", "ALARM"]
@@ -323,7 +305,6 @@ def abort(self):
323305
if self.door is not None:
324306
logging.getLogger("HWR").debug("SardanaMacro / aborting macro")
325307
self.door.abortMacro()
326-
# self.emit('commandReady', ())
327308

328309
def is_connected(self):
329310
return self.door is not None
@@ -417,18 +398,6 @@ def __init__(self):
417398
def init_device(self):
418399
try:
419400
self.attribute = Attribute(self.model)
420-
#
421-
# DIRTY FIX to make compatible taurus listeners and existence of Tango channels/commands
422-
# as defined in Command/Tango.py
423-
#
424-
# if self.attribute.__class__ == taurus.core.tango.tangoattribute.TangoAttribute:
425-
# dev = self.attribute.getParentObj()
426-
# dp = dev.getHWObj()
427-
# try:
428-
# dp.subscribe_event = dp._subscribe_event
429-
# except AttributeError:
430-
# pass
431-
# logging.getLogger("HWR").debug("initialized")
432401
except DevFailed as traceback:
433402
self.imported = False
434403
return

mxcubecore/Command/Tine.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,9 @@ def __call__(self, *args, **kwargs):
6262
else:
6363
commandArgument = args[0]
6464
try:
65-
# logging.getLogger("HWR").info("Tine command %s sent" % self.commandName)
6665
ret = tine.set(
6766
self.tineName, self.commandName, commandArgument, self.timeout
6867
)
69-
# logging.getLogger("HWR").info("Tine command %s reply arrived" % self.commandName)
7068
self.emit("commandReplyArrived", (ret, str(self.name())))
7169
except IOError as strerror:
7270
logging.getLogger("user_level_log").exception("TINE: %s" % strerror)
@@ -122,9 +120,6 @@ class TineChannel(ChannelObject):
122120
attach = {"timer": tine.attach, "event": tine.notify, "datachange": tine.update}
123121

124122
updates = queue.Queue()
125-
# updates_emitter = QtCore.QTimer()
126-
# QtCore.QObject.connect(updates_emitter, QtCore.SIGNAL('timeout()'), emitTineChannelUpdates)
127-
# updates_emitter.start(20)
128123
updates_emitter = gevent.spawn(do_tine_channel_update, 0.1)
129124

130125
def __init__(
@@ -167,10 +162,6 @@ def __init__(
167162
self.linkid = TineChannel.attach[kwargs.get("attach", "timer")](
168163
self.tineName, self.attributeName, self.tineEventCallback, self.timeout
169164
)
170-
# except IOError as strerror:
171-
# logging.getLogger("HWR").error("%s" %strerror)
172-
# except ValueError:
173-
# logging.getLogger("HWR").error("TINE attach object is not callable")
174165

175166
if self.linkid > 0 and kwargs.get("attach", "timer") == "datachange":
176167
tolerance = kwargs.get("tolerance", 0.0)
@@ -180,9 +171,6 @@ def __init__(
180171
if tolerance != 0.0:
181172
tine.tolerance(self.linkid, float(tolerance), 0.0)
182173

183-
# TODO Remove this sleep. Tine lib bug when after attach directly get is called
184-
# time.sleep(0.025)
185-
186174
atexit.register(self.__del__)
187175

188176
def __del__(self):
@@ -232,9 +220,6 @@ def tineEventCallback(self, id, cc, data_list):
232220
"""
233221

234222
def update(self, value=None):
235-
# if self.tineName.split("/")[2] == 'ics':
236-
# print '>>>>>>>>>>>>>>>>>>', self.attributeName, value, self.value, self.oldvalue
237-
238223
if value is None:
239224
logging.getLogger("HWR").warning(
240225
"Update with value None on: %s %s" % (self.tineName, self.attributeName)
@@ -245,14 +230,8 @@ def update(self, value=None):
245230
if value != self.oldvalue:
246231
TineChannel.updates.put((weakref.ref(self), value))
247232
self.oldvalue = value
248-
# if self.tineName == "/P14/BCUIntensity/Device0":
249-
# logging.getLogger("HWR").debug('----------------- %s %s' %(self.attributeName,self.value))
250233

251234
def get_value(self, force=False):
252-
# logging.getLogger("HWR").debug('TINE channel %s, %s get at val=%s'%(self.tineName,self.attributeName,self.value))
253-
# if self.tineName == "/P14/BCUIntensity/Device0":
254-
# print self.attributeName, self.value
255-
256235
# GB: if forced while having a value already, i.e. well after connecting a channel, do a real synchronous get and return
257236
if force:
258237
if self.value is not None:
@@ -279,7 +258,6 @@ def get_value(self, force=False):
279258
# but now tine lib should be standing the get, so we try....
280259

281260
self.value = self._synchronous_get()
282-
# time.sleep(0.02)
283261
_counter += 1
284262
if self.value is None:
285263
logging.getLogger("HWR").warning(

mxcubecore/CommandContainer.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,7 +329,6 @@ def get_channel_object(
329329
if channel is None and not optional:
330330
msg = "%s: Unable to get channel %s" % (self.id, channel_name)
331331
logging.getLogger("user_level_log").error(msg)
332-
# raise Exception(msg)
333332
return channel
334333

335334
def get_channel_names_list(self) -> List[str]:

ruff.toml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ convention = "google"
101101
]
102102
"mxcubecore/Command/Mockup.py" = [
103103
"ARG002",
104-
"ERA001",
105104
"EXE002",
106105
"FBT002",
107106
"FIX001",
@@ -116,7 +115,6 @@ convention = "google"
116115
"ARG002",
117116
"B904",
118117
"BLE001",
119-
"ERA001",
120118
"EXE002",
121119
"F821",
122120
"N813",
@@ -142,7 +140,6 @@ convention = "google"
142140
"C901",
143141
"E402",
144142
"E501",
145-
"ERA001",
146143
"F401",
147144
"F841",
148145
"G002",
@@ -162,7 +159,6 @@ convention = "google"
162159
"TRY400",
163160
]
164161
"mxcubecore/Command/Spec.py" = [
165-
"ERA001",
166162
"I001",
167163
"N802",
168164
"N803",
@@ -172,7 +168,6 @@ convention = "google"
172168
"ARG002",
173169
"BLE001",
174170
"E501",
175-
"ERA001",
176171
"FBT002",
177172
"FBT003",
178173
"N802",
@@ -194,7 +189,6 @@ convention = "google"
194189
"B904",
195190
"E501",
196191
"E713",
197-
"ERA001",
198192
"FBT003",
199193
"FIX002",
200194
"ICN001",
@@ -219,7 +213,6 @@ convention = "google"
219213
"ARG002",
220214
"BLE001",
221215
"E501",
222-
"ERA001",
223216
"EXE002",
224217
"F841",
225218
"FBT002",
@@ -308,7 +301,6 @@ convention = "google"
308301
"BLE001",
309302
"C901",
310303
"E501",
311-
"ERA001",
312304
"F841",
313305
"FBT001",
314306
"FBT002",

0 commit comments

Comments
 (0)