diff options
author | Robey Pointer <robey@lag.net> | 2005-07-10 09:56:00 +0000 |
---|---|---|
committer | Robey Pointer <robey@lag.net> | 2005-07-10 09:56:00 +0000 |
commit | 0ac7b0dcbd43b5077b74bb5072d5f5e2423371d7 (patch) | |
tree | 09651c42bfa91989506104915b0d6d100e40c604 /paramiko/ber.py | |
parent | 5ba8b47a458560e6170b5635daf9db1211eadf61 (diff) | |
download | paramiko-0ac7b0dcbd43b5077b74bb5072d5f5e2423371d7.tar.gz |
[project @ Arch-1:robey@lag.net--2005-master-shake%paramiko--dev--1--patch-29]
a bunch of silly changes where i was trying to fix pychecker warnings before i decided it wasnt worth the effort
Diffstat (limited to 'paramiko/ber.py')
-rw-r--r-- | paramiko/ber.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/paramiko/ber.py b/paramiko/ber.py index d479233b..a28b4a73 100644 --- a/paramiko/ber.py +++ b/paramiko/ber.py @@ -45,15 +45,15 @@ class BER(object): def decode_next(self): if self.idx >= len(self.content): return None - id = ord(self.content[self.idx]) + ident = ord(self.content[self.idx]) self.idx += 1 - if (id & 31) == 31: + if (ident & 31) == 31: # identifier > 30 - id = 0 + ident = 0 while self.idx < len(self.content): t = ord(self.content[self.idx]) self.idx += 1 - id = (id << 7) | (t & 0x7f) + ident = (ident << 7) | (t & 0x7f) if not (t & 0x80): break if self.idx >= len(self.content): @@ -75,29 +75,29 @@ class BER(object): data = self.content[self.idx : self.idx + size] self.idx += size # now switch on id - if id == 0x30: + if ident == 0x30: # sequence return self.decode_sequence(data) - elif id == 2: + elif ident == 2: # int return util.inflate_long(data) else: # 1: boolean (00 false, otherwise true) - raise BERException('Unknown ber encoding type %d (robey is lazy)' % id) + raise BERException('Unknown ber encoding type %d (robey is lazy)' % ident) def decode_sequence(data): out = [] b = BER(data) - while 1: + while True: x = b.decode_next() - if x == None: + if x is None: return out out.append(x) decode_sequence = staticmethod(decode_sequence) - def encode_tlv(self, id, val): - # FIXME: support id > 31 someday - self.content += chr(id) + def encode_tlv(self, ident, val): + # no need to support ident > 31 here + self.content += chr(ident) if len(val) > 0x7f: lenstr = util.deflate_long(len(val)) self.content += chr(0x80 + len(lenstr)) + lenstr |