Remove superfluous trailing white space from Python files
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
# PID : Protocol Identifier, 0 for MODBUS, (2 Bytes)
|
||||
# len : Number of bytes following the len field, (2 Bytes)
|
||||
# UID : Unit Identifier (1 Byte)
|
||||
#
|
||||
#
|
||||
# MODBUS TCP/IP ADU
|
||||
# ADU = [MBAP][PDU]
|
||||
# MBAP = [TID][PID][len][UID]
|
||||
@@ -28,7 +28,7 @@ sys.stdout = os.fdopen(sys.stdout.fileno(), 'w',0)
|
||||
|
||||
# Debug flags
|
||||
INFO = 1
|
||||
COMS = 2
|
||||
COMS = 2
|
||||
RREG = 4
|
||||
WREG = 8
|
||||
RCOIL = 16
|
||||
@@ -191,7 +191,7 @@ class Fermi_Prot(LineReceiver):
|
||||
self.RegVal[uid][a] = n
|
||||
i += 1
|
||||
return
|
||||
|
||||
|
||||
def rawDataReceived(self, ADU):
|
||||
self.debug(COMS, "Received ADU ", ADU.encode('hex'))
|
||||
self.ADU = ADU
|
||||
@@ -238,7 +238,7 @@ class Fermi_Prot(LineReceiver):
|
||||
self.debug(WCOIL, 'wcoil:OA=%d, OV=%X' % (OA,OV))
|
||||
# TODO This really just toggles IDLE speed so it's only correct for OA=2 (ie coil 3)
|
||||
self.FermiCoil[uid][OA] ^= OV
|
||||
if (OA == CSTART):
|
||||
if (OA == CSTART):
|
||||
self.debug(INFO, "START")
|
||||
self.RegVal[uid][10] |= (_RUN|_LEV)
|
||||
self.debug(INFO, 'RUNNING, LEVITATING')
|
||||
|
||||
@@ -24,7 +24,7 @@ class GalilController(object):
|
||||
def write(self, response):
|
||||
#print "Device Response: %s" % response
|
||||
self.response.append(response)
|
||||
|
||||
|
||||
def doIteration(self, now):
|
||||
#print "DoIteration"
|
||||
# pass to motors
|
||||
|
||||
@@ -25,7 +25,7 @@ class GalilProtocol(Protocol):
|
||||
print "connectionMade: connection number", self.factory.numProtocols
|
||||
if self.factory.numProtocols > 2:
|
||||
print "Too many connections - rejecting"
|
||||
self.transport.write("Too many connections, try later\r\n")
|
||||
self.transport.write("Too many connections, try later\r\n")
|
||||
self.transport.loseConnection()
|
||||
'''else:
|
||||
self.transport.write("Welcome connection %d\r\n" % self.factory.numProtocols)'''
|
||||
@@ -60,7 +60,7 @@ class GalilProtocol(Protocol):
|
||||
self.response = self.response[:-1]
|
||||
if len(self.response) > 0 and self.response[-1] != ":":
|
||||
self.response = self.response + ":"
|
||||
if len(self.response) == 0:
|
||||
if len(self.response) == 0:
|
||||
self.response = self.response + ":"
|
||||
if len(self.response) > 0:
|
||||
#print "Protocol Response: %s" % self.response
|
||||
@@ -68,7 +68,7 @@ class GalilProtocol(Protocol):
|
||||
self.response = ""
|
||||
else:
|
||||
self.pdu = self.pdu + c
|
||||
|
||||
|
||||
class GalilFactory(ServerFactory):
|
||||
"""Factory object used by the Twisted Infrastructure to create a Protocol
|
||||
object for incomming connections"""
|
||||
|
||||
@@ -29,7 +29,7 @@ class CubicPowderSample:
|
||||
self.wavelength = 0.0
|
||||
print "theta = %g, wl = %g, mEv = %g" % (angle, self.wavelength, self.mEv)
|
||||
|
||||
|
||||
|
||||
def atod(self, the_aspacing, h, k, l):
|
||||
result = math.sqrt(the_aspacing**2 /(h**2 + k**2 + l**2))
|
||||
return result
|
||||
|
||||
@@ -25,7 +25,7 @@ class HidenProtocol(Protocol):
|
||||
print "connectionMade:", self.factory.numProtocols
|
||||
if self.factory.numProtocols > 2:
|
||||
print "Too many connections - rejecting"
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.loseConnection()
|
||||
else:
|
||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||
@@ -58,7 +58,7 @@ class HidenProtocol(Protocol):
|
||||
self.response = ""
|
||||
else:
|
||||
self.pdu = self.pdu + c
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
class TestDevice:
|
||||
def __init__(self):
|
||||
|
||||
@@ -95,7 +95,7 @@ class HidenXCS(HidenDevice):
|
||||
if self.DigitalOut[2] and (self.AnalogIn[0] + self.AnalogIn[1] + self.AnalogIn[2]) > 0:
|
||||
self.humidity = 100.0
|
||||
self.humidity *= self.AnalogIn[1]
|
||||
self.humidity /= (self.AnalogIn[0] + self.AnalogIn[1] + self.AnalogIn[2])
|
||||
self.humidity /= (self.AnalogIn[0] + self.AnalogIn[1] + self.AnalogIn[2])
|
||||
|
||||
def doCommandAOUT(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
|
||||
@@ -25,7 +25,7 @@ class PfeifferProtocol(Protocol):
|
||||
print "connectionMade:", self.factory.numProtocols
|
||||
if self.factory.numProtocols > 2:
|
||||
print "Too many connections - rejecting"
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.loseConnection()
|
||||
else:
|
||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||
@@ -54,7 +54,7 @@ class PfeifferProtocol(Protocol):
|
||||
self.response = ""
|
||||
else:
|
||||
self.pdu = self.pdu + c
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
class TestDevice:
|
||||
def __init__(self):
|
||||
|
||||
@@ -185,14 +185,14 @@ class Lakeshore336(LakeshoreDevice):
|
||||
def doQueryALARM(self, cmd, args):
|
||||
if len(args) > 0:
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.ALARM:
|
||||
if idx in self.ALARM:
|
||||
self.write(self.ALARM[idx])
|
||||
else:
|
||||
self.write("0,1,500.0,0.0,0")
|
||||
def doQueryALARMST(self, cmd, args):
|
||||
if len(args) > 0:
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.ALARMST:
|
||||
if idx in self.ALARMST:
|
||||
self.write(self.ALARMST[idx])
|
||||
else:
|
||||
self.write("0,0")
|
||||
@@ -273,7 +273,7 @@ class Lakeshore336(LakeshoreDevice):
|
||||
self.write("%f" % self.COMM)
|
||||
def doQueryCRDG(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.KRDG:
|
||||
if idx in self.KRDG:
|
||||
if self.RANDOM > 0:
|
||||
self.write("%f" % (self.KRDG[idx] - 273.15 + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||
else:
|
||||
@@ -339,8 +339,8 @@ class Lakeshore336(LakeshoreDevice):
|
||||
for key in keys:
|
||||
self.FILTER[key] = params
|
||||
def doQueryFILTER(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
if idx in self.FILTER:
|
||||
idx = int(args[0])
|
||||
if idx in self.FILTER:
|
||||
self.write(self.FILTER[idx])
|
||||
else:
|
||||
raise IndexError
|
||||
@@ -358,7 +358,7 @@ class Lakeshore336(LakeshoreDevice):
|
||||
self.IEEE = args[0]
|
||||
def doQueryINCRV(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.INCRV:
|
||||
if idx in self.INCRV:
|
||||
self.write(self.INCRV[idx])
|
||||
else:
|
||||
self.write("0")
|
||||
@@ -370,7 +370,7 @@ class Lakeshore336(LakeshoreDevice):
|
||||
self.INCRV[key] = args[1]
|
||||
def doQueryINTYPE(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.INTYPE:
|
||||
if idx in self.INTYPE:
|
||||
self.write(self.INTYPE[idx])
|
||||
else:
|
||||
self.write("0")
|
||||
@@ -385,7 +385,7 @@ class Lakeshore336(LakeshoreDevice):
|
||||
self.KEYST = 0
|
||||
def doQueryKRDG(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.KRDG:
|
||||
if idx in self.KRDG:
|
||||
if self.RANDOM > 0:
|
||||
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||
else:
|
||||
@@ -504,7 +504,7 @@ class Lakeshore336(LakeshoreDevice):
|
||||
self.write("%f" % val)
|
||||
def doCommandSETP(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
val = float(args[1])
|
||||
val = float(args[1])
|
||||
if (val >= 0.0 and val <= 500.0):
|
||||
self.TARGET[idx] = val
|
||||
if self.RAMP_ON[idx] == 0:
|
||||
|
||||
@@ -185,14 +185,14 @@ class Lakeshore340(LakeshoreDevice):
|
||||
def doQueryALARM(self, cmd, args):
|
||||
if len(args) > 0:
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.ALARM:
|
||||
if idx in self.ALARM:
|
||||
self.write(self.ALARM[idx])
|
||||
else:
|
||||
self.write("0,1,500.0,0.0,0")
|
||||
def doQueryALARMST(self, cmd, args):
|
||||
if len(args) > 0:
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.ALARMST:
|
||||
if idx in self.ALARMST:
|
||||
self.write(self.ALARMST[idx])
|
||||
else:
|
||||
self.write("0,0")
|
||||
@@ -273,7 +273,7 @@ class Lakeshore340(LakeshoreDevice):
|
||||
self.write("%f" % self.COMM)
|
||||
def doQueryCRDG(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.KRDG:
|
||||
if idx in self.KRDG:
|
||||
if self.RANDOM > 0:
|
||||
self.write("%f" % (self.KRDG[idx] - 273.15 + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||
else:
|
||||
@@ -354,8 +354,8 @@ class Lakeshore340(LakeshoreDevice):
|
||||
for key in keys:
|
||||
self.FILTER[key] = params
|
||||
def doQueryFILTER(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
if idx in self.FILTER:
|
||||
idx = int(args[0])
|
||||
if idx in self.FILTER:
|
||||
self.write(self.FILTER[idx])
|
||||
else:
|
||||
raise IndexError
|
||||
@@ -373,7 +373,7 @@ class Lakeshore340(LakeshoreDevice):
|
||||
self.IEEE = args[0]
|
||||
def doQueryINCRV(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.INCRV:
|
||||
if idx in self.INCRV:
|
||||
self.write(self.INCRV[idx])
|
||||
else:
|
||||
self.write("0")
|
||||
@@ -385,19 +385,19 @@ class Lakeshore340(LakeshoreDevice):
|
||||
self.INCRV[key] = args[1]
|
||||
def doQueryINTYPE(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.INTYPE:
|
||||
if idx in self.INTYPE:
|
||||
self.write(self.INTYPE[idx])
|
||||
else:
|
||||
self.write("0")
|
||||
def doQueryINSET(self, cmd, args):
|
||||
idx = ord(args[0])
|
||||
if idx in self.INSET:
|
||||
idx = ord(args[0])
|
||||
if idx in self.INSET:
|
||||
self.write(self.INSET[idx])
|
||||
else:
|
||||
self.write("0,0")
|
||||
def doCommandINSET(self, cmd, args):
|
||||
if len(args) > 0:
|
||||
idx = ord(args[0])
|
||||
idx = ord(args[0])
|
||||
if idx in self.INSET:
|
||||
self.INSET[idx] = ",".join(args[1:])
|
||||
def doCommandINTYPE(self, cmd, args):
|
||||
@@ -411,7 +411,7 @@ class Lakeshore340(LakeshoreDevice):
|
||||
self.KEYST = 0
|
||||
def doQueryKRDG(self, cmd, args):
|
||||
idx = ord(args[0]) - 64
|
||||
if idx in self.KRDG:
|
||||
if idx in self.KRDG:
|
||||
if self.RANDOM > 0:
|
||||
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||
else:
|
||||
@@ -517,7 +517,7 @@ class Lakeshore340(LakeshoreDevice):
|
||||
self.write("%f" % val)
|
||||
def doCommandSETP(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
val = float(args[1])
|
||||
val = float(args[1])
|
||||
if (val >= 0.0 and val <= 500.0):
|
||||
self.TARGET[idx] = val
|
||||
if self.RAMP_ON[idx] == 0:
|
||||
|
||||
@@ -177,14 +177,14 @@ class Lakeshore370(LakeshoreDevice):
|
||||
for key in keys:
|
||||
self.ALARM[key] = params
|
||||
def doQueryALARM(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
if idx in self.ALARM:
|
||||
idx = int(args[0])
|
||||
if idx in self.ALARM:
|
||||
self.write(self.ALARM[idx])
|
||||
else:
|
||||
self.write("0,1,500.0,0.0,0")
|
||||
def doQueryALARMST(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
if idx in self.ALARMST:
|
||||
if idx in self.ALARMST:
|
||||
self.write(self.ALARMST[idx])
|
||||
else:
|
||||
self.write("0,0")
|
||||
@@ -309,8 +309,8 @@ class Lakeshore370(LakeshoreDevice):
|
||||
for key in keys:
|
||||
self.FILTER[key] = params
|
||||
def doQueryFILTER(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
if idx in self.FILTER:
|
||||
idx = int(args[0])
|
||||
if idx in self.FILTER:
|
||||
self.write(self.FILTER[idx])
|
||||
else:
|
||||
raise IndexError
|
||||
@@ -339,8 +339,8 @@ class Lakeshore370(LakeshoreDevice):
|
||||
def doCommandIEEE(self, cmd, args):
|
||||
self.IEEE = args[0]
|
||||
def doQueryINSET(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
if idx in self.INSET:
|
||||
idx = int(args[0])
|
||||
if idx in self.INSET:
|
||||
self.write(self.INSET[idx])
|
||||
else:
|
||||
self.write("0")
|
||||
@@ -414,8 +414,8 @@ class Lakeshore370(LakeshoreDevice):
|
||||
response = "%d" % self.RAMP_ST
|
||||
self.write(response)
|
||||
def doQueryRDGK(self, cmd, args):
|
||||
idx = int(args[0])
|
||||
if idx in self.KRDG:
|
||||
idx = int(args[0])
|
||||
if idx in self.KRDG:
|
||||
if self.RANDOM > 0:
|
||||
self.write("%f" % (self.KRDG[idx] + random.uniform(-self.RANDOM, self.RANDOM)))
|
||||
else:
|
||||
@@ -452,7 +452,7 @@ class Lakeshore370(LakeshoreDevice):
|
||||
self.write("%f" % val)
|
||||
def doCommandSETP(self, cmd, args):
|
||||
idx = 1
|
||||
val = float(args[0])
|
||||
val = float(args[0])
|
||||
if (val >= 0.0 and val <= 500.0):
|
||||
self.TARGET[idx] = val
|
||||
if self.RAMP_ON[idx] == 0:
|
||||
|
||||
@@ -21,7 +21,7 @@ class LakeshoreProtocol(Protocol):
|
||||
print "connectionMade:", self.factory.numProtocols
|
||||
if self.factory.numProtocols > 2:
|
||||
print "Too many connections - rejecting"
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.loseConnection()
|
||||
else:
|
||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||
@@ -55,7 +55,7 @@ class LakeshoreProtocol(Protocol):
|
||||
self.response = ""
|
||||
else:
|
||||
self.pdu = self.pdu + c
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
class TestDevice:
|
||||
def __init__(self):
|
||||
|
||||
@@ -25,7 +25,7 @@ class MercuryProtocol(Protocol):
|
||||
print "connectionMade:", self.factory.numProtocols
|
||||
if self.factory.numProtocols > 2:
|
||||
print "Too many connections - rejecting"
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.write("Too many connections, try later" + self.term)
|
||||
self.transport.loseConnection()
|
||||
else:
|
||||
self.transport.write(("Welcome connection %d" % self.factory.numProtocols) + self.term)
|
||||
@@ -59,7 +59,7 @@ class MercuryProtocol(Protocol):
|
||||
self.response = ""
|
||||
else:
|
||||
self.pdu = self.pdu + c
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
class TestDevice:
|
||||
def __init__(self):
|
||||
|
||||
@@ -319,7 +319,7 @@ class Baker(Able):
|
||||
def cb0(result, *args, **kw):
|
||||
if debug:
|
||||
print "\nMercury:", result.short_tree()
|
||||
self.deferred.callback(result)
|
||||
self.deferred.callback(result)
|
||||
if "mercury_scpi" in config.sections() and config.get("mercury_scpi", "enabled"):
|
||||
self.deferred = defer.Deferred()
|
||||
d = self.load_hipadaba("/sample/%s" % config.get("mercury_scpi", "name"))
|
||||
|
||||
Reference in New Issue
Block a user