diff options
author | Anton Leherbauer | 2012-01-26 08:59:52 +0000 |
---|---|---|
committer | Anton Leherbauer | 2012-01-26 08:59:52 +0000 |
commit | afd9a45d5af37286c9e6101cbb409d99e277bea3 (patch) | |
tree | 447f183ffce3761208ac61f8330a67cb584d2aff /python/src/tcf/channel | |
parent | 0c07df5f2a70a3af20dd8b1bd8f6a628b5085fbc (diff) | |
download | org.eclipse.tcf-afd9a45d5af37286c9e6101cbb409d99e277bea3.tar.gz org.eclipse.tcf-afd9a45d5af37286c9e6101cbb409d99e277bea3.tar.xz org.eclipse.tcf-afd9a45d5af37286c9e6101cbb409d99e277bea3.zip |
TCF Python: Fix dangerous assignments to reserved names
Diffstat (limited to 'python/src/tcf/channel')
-rw-r--r-- | python/src/tcf/channel/AbstractChannel.py | 7 | ||||
-rw-r--r-- | python/src/tcf/channel/__init__.py | 16 |
2 files changed, 11 insertions, 12 deletions
diff --git a/python/src/tcf/channel/AbstractChannel.py b/python/src/tcf/channel/AbstractChannel.py index b1d1d5427..f313cc252 100644 --- a/python/src/tcf/channel/AbstractChannel.py +++ b/python/src/tcf/channel/AbstractChannel.py @@ -60,8 +60,7 @@ class ReaderThread(threading.Thread): def readString(self): del self.buf[:] - bytes = self.readBytes(0, self.buf) - return bytes.decode("UTF8") + return self.readBytes(0, self.buf).decode("UTF8") def run(self): try: @@ -672,8 +671,8 @@ class AbstractChannel(object): l.event(msg.name, msg.data) self.__sendCongestionLevel() elif typeCode == 'F': - len = len(msg.data) - if len > 0 and msg.data[len - 1] == '\0': len -= 1 + length = len(msg.data) + if length > 0 and msg.data[length - 1] == '\0': length -= 1 self.remote_congestion_level = int(msg.data) else: assert False diff --git a/python/src/tcf/channel/__init__.py b/python/src/tcf/channel/__init__.py index 8fd0031d1..1e89c0bbe 100644 --- a/python/src/tcf/channel/__init__.py +++ b/python/src/tcf/channel/__init__.py @@ -26,7 +26,7 @@ class TraceListener(object): def onChannelClosed(self, error): pass -def Proxy(object): +class Proxy(object): def onCommand(self, token, service, name, data): pass @@ -151,11 +151,11 @@ def toJSONSequence(args): buf.write('\0') return buf.getvalue() -def fromJSONSequence(bytes): - if bytes[-1] == 0: - del bytes[-1] - str = bytes.decode("UTF-8") - parts = str.split('\0') +def fromJSONSequence(byteArray): + if byteArray[-1] == 0: + del byteArray[-1] + jsonStr = byteArray.decode("UTF-8") + parts = jsonStr.split('\0') objects = [] for part in parts: if part: @@ -164,8 +164,8 @@ def fromJSONSequence(bytes): objects.append(None) return objects -def dumpJSONObject(object, buf): - json.dump(object, buf, separators=(',', ':'), cls=TCFJSONEncoder) +def dumpJSONObject(obj, buf): + json.dump(obj, buf, separators=(',', ':'), cls=TCFJSONEncoder) def toByteArray(data): if data is None: return None |