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"))
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
# The compare_deploy.py uses FILEMAP.TXT from the staging tree produced by the "./deploySICS.sh -n"
|
||||
# The compare_deploy.py path is to what *is* deployed on echidna
|
||||
# The untracked files may be manually deployed and missing from MANIFEST.TXT
|
||||
# The untracked files may be new, modified, test or junk
|
||||
# The untracked files may be new, modified, test or junk
|
||||
# You can then "gvim -d " then cut/paste lines emitted under "Changed Files:" (or diff)
|
||||
#
|
||||
import os
|
||||
|
||||
@@ -26,7 +26,7 @@ inst_test_sockoffset = {
|
||||
'echidna' : 0,
|
||||
'wombat' : 100,
|
||||
'kowari' : 200,
|
||||
'dingo' : 300,
|
||||
'dingo' : 300,
|
||||
'quokka' : 400,
|
||||
'platypus' : 500,
|
||||
'pelican' : 600,
|
||||
@@ -37,7 +37,7 @@ inst_test_sockoffset = {
|
||||
'emu' : 1100
|
||||
}
|
||||
|
||||
deflt_dir = '/usr/local/sics/server'
|
||||
deflt_dir = '/usr/local/sics/server'
|
||||
deflt_sockoffset = 'none'
|
||||
deflt_user = inst_user
|
||||
sics_killer = inst_user
|
||||
@@ -66,7 +66,7 @@ def start_cmd(server, args):
|
||||
'fakedev': 'SICS_SIMULATION=fakedev%s' % soffset,
|
||||
'scriptval': 'SICS_SIMULATION=script_validator%s' % soffset
|
||||
}
|
||||
# Set SICS_SIMULATION environment variable
|
||||
# Set SICS_SIMULATION environment variable
|
||||
if (server == 'scriptval'):
|
||||
SIMENV = sicsenv['scriptval']
|
||||
else:
|
||||
@@ -111,7 +111,7 @@ def stop_cmd(server, args):
|
||||
return
|
||||
if status_fn(server, args) != (0,0):
|
||||
print 'Failed to stop %s' % server
|
||||
print "Fragging PID %d with default KILL" % (pid)
|
||||
print "Fragging PID %d with default KILL" % (pid)
|
||||
subprocess.call(shlex.split('sudo -u %s /bin/kill %d' %
|
||||
(sics_killer, pid)))
|
||||
else:
|
||||
@@ -215,7 +215,7 @@ def main(**kwargs):
|
||||
help= args_dir_help % (server_port['sics']['server'] +
|
||||
inst_test_sockoffset[inst_name]),
|
||||
action='store_true')
|
||||
args = parser.parse_args()
|
||||
args = parser.parse_args()
|
||||
# By default don't launch script validator in development environments.
|
||||
if args.dev:
|
||||
if args.scriptval:
|
||||
|
||||
@@ -52,7 +52,7 @@ class Screen(CursesStdIO):
|
||||
self.redisplayLines()
|
||||
|
||||
def redisplayLines(self):
|
||||
""" method for redisplaying lines
|
||||
""" method for redisplaying lines
|
||||
based on internal list of lines """
|
||||
|
||||
self.stdscr.clear()
|
||||
@@ -60,7 +60,7 @@ class Screen(CursesStdIO):
|
||||
i = 0
|
||||
index = len(self.lines) - 1
|
||||
while i < (self.rows - 3) and index >= 0:
|
||||
self.stdscr.addstr(self.rows - 3 - i, 0, self.lines[index],
|
||||
self.stdscr.addstr(self.rows - 3 - i, 0, self.lines[index],
|
||||
curses.color_pair(2))
|
||||
i = i + 1
|
||||
index = index - 1
|
||||
@@ -68,7 +68,7 @@ class Screen(CursesStdIO):
|
||||
|
||||
def paintStatus(self, text):
|
||||
if len(text) > self.cols: raise TextTooLongError
|
||||
self.stdscr.addstr(self.rows-2,0,text + ' ' * (self.cols-len(text)),
|
||||
self.stdscr.addstr(self.rows-2,0,text + ' ' * (self.cols-len(text)),
|
||||
curses.color_pair(1))
|
||||
# move cursor to input line
|
||||
self.stdscr.move(self.rows-1, self.cols-1)
|
||||
@@ -106,7 +106,7 @@ class Screen(CursesStdIO):
|
||||
return
|
||||
self.searchText = self.searchText + chr(c)
|
||||
|
||||
self.stdscr.addstr(self.rows-1, 0,
|
||||
self.stdscr.addstr(self.rows-1, 0,
|
||||
self.searchText + (' ' * (
|
||||
self.cols-len(self.searchText)-2)))
|
||||
self.stdscr.move(self.rows-1, len(self.searchText))
|
||||
|
||||
Reference in New Issue
Block a user