--- a/targets/typemapping.py Tue Aug 15 12:17:51 2017 +0300
+++ b/targets/typemapping.py Tue Aug 15 15:50:30 2017 +0300
@@ -47,15 +47,15 @@
("ns", c_long)] # tv_nsec
-def _t(t, u=lambda x:x.value, p=lambda t,x:t(x)): return (t, u, p)
+def _t(t, u=lambda x: x.value, p=lambda t, x: t(x)): return (t, u, p)
def _ttime(): return (IEC_TIME,
- lambda x:td(0, x.s, x.ns/1000),
- lambda t,x:t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))
+ lambda x: td(0, x.s, x.ns/1000),
+ lambda t, x: t(x.days * 24 * 3600 + x.seconds, x.microseconds*1000))
SameEndianessTypeTranslator = {
- "BOOL": _t(c_uint8, lambda x:x.value!=0),
+ "BOOL": _t(c_uint8, lambda x: x.value!=0),
"STEP": _t(c_uint8),
"TRANSITION": _t(c_uint8),
"ACTION": _t(c_uint8),
@@ -63,8 +63,8 @@
"USINT": _t(c_uint8),
"BYTE": _t(c_uint8),
"STRING": (IEC_STRING,
- lambda x:x.body[:x.len],
- lambda t,x:t(len(x),x)),
+ lambda x: x.body[:x.len],
+ lambda t, x: t(len(x), x)),
"INT": _t(c_int16),
"UINT": _t(c_uint16),
"WORD": _t(c_uint16),
@@ -89,18 +89,18 @@
TypeTranslator=SameEndianessTypeTranslator
# Construct debugger natively supported types
-DebugTypesSize = dict([(key,sizeof(t)) for key,(t,p,u) in SameEndianessTypeTranslator.iteritems() if t is not None])
+DebugTypesSize = dict([(key, sizeof(t)) for key, (t, p, u) in SameEndianessTypeTranslator.iteritems() if t is not None])
def UnpackDebugBuffer(buff, indexes):
res = []
buffoffset = 0
buffsize = len(buff)
- buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)),c_void_p).value
+ buffptr = cast(ctypes.pythonapi.PyString_AsString(id(buff)), c_void_p).value
for iectype in indexes:
- c_type,unpack_func, pack_func = \
+ c_type, unpack_func, pack_func = \
TypeTranslator.get(iectype,
- (None,None,None))
+ (None, None, None))
if c_type is not None and buffoffset < buffsize:
cursor = c_void_p( buffptr + buffoffset)
value = unpack_func( cast(cursor,
@@ -115,8 +115,8 @@
-LogLevels = ["CRITICAL","WARNING","INFO","DEBUG"]
+LogLevels = ["CRITICAL", "WARNING", "INFO", "DEBUG"]
LogLevelsCount = len(LogLevels)
-LogLevelsDict = dict(zip(LogLevels,range(LogLevelsCount)))
+LogLevelsDict = dict(zip(LogLevels, range(LogLevelsCount)))
LogLevelsDefault = LogLevelsDict["DEBUG"]