Commit e837ab8cd2e6ba2da499ea2cd79dcae3e1aabf60

Authored by Philippe Lagadec
1 parent 2d2d5c2c

Added comments for pylint

oletools/ezhexviewer.py
... ... @@ -132,6 +132,7 @@ def hexdump3(src, length=8, startindex=0):
132 132 startindex: index of 1st byte.
133 133 """
134 134 result=[]
  135 + # pylint: disable-next=possibly-used-before-assignment
135 136 for i in xrange(0, len(src), length):
136 137 s = src[i:i+length]
137 138 hexa = ' '.join(["%02X" % xord(x) for x in s])
... ...
oletools/msodde.py
... ... @@ -388,6 +388,7 @@ def process_doc_stream(stream):
388 388 # appending a raw byte to a unicode string here. Not clean but
389 389 # all we do later is check for the ascii-sequence 'DDE' later...
390 390 elif char == 0: # may be a high-byte of a 2-byte codec
  391 + # pylint: disable-next=possibly-used-before-assignment
391 392 field_contents += unichr(char)
392 393 elif char in (10, 13):
393 394 field_contents += u'\n'
... ...
oletools/oleobj.py
... ... @@ -332,6 +332,7 @@ def read_zero_terminated_string(data, index):
332 332 """
333 333 if index is None:
334 334 result = bytearray()
  335 + # pylint: disable-next=possibly-used-before-assignment
335 336 for _ in xrange(STR_MAX_LEN):
336 337 char = ord(data.read(1)) # need ord() for py3
337 338 if char == 0:
... ...
oletools/olevba.py
... ... @@ -1050,6 +1050,7 @@ def vba_chr_tostr(t):
1050 1050 else:
1051 1051 # unicode character
1052 1052 # Note: this distinction is only needed for Python 2
  1053 + # pylint: disable-next=possibly-used-before-assignment
1053 1054 return VbaExpressionString(unichr(i).encode('utf-8', 'backslashreplace'))
1054 1055 except ValueError:
1055 1056 log.exception('ERROR: incorrect parameter value for chr(): %r' % i)
... ... @@ -1165,6 +1166,7 @@ def subtract_ints_list(tokens):
1165 1166 # extract argument from the tokens:
1166 1167 # expected to be a tuple containing a list of integers such as [a,'&',b,'&',c,...]
1167 1168 integers = tokens[0][::2]
  1169 + # pylint: disable-next=possibly-used-before-assignment
1168 1170 return reduce(lambda x,y:x-y, integers)
1169 1171  
1170 1172  
... ... @@ -1407,6 +1409,7 @@ def decompress_stream(compressed_container):
1407 1409 # copy tokens (reference to a previous literal token)
1408 1410 flag_byte = compressed_container[compressed_current]
1409 1411 compressed_current += 1
  1412 + # pylint: disable-next=possibly-used-before-assignment
1410 1413 for bit_index in xrange(0, 8):
1411 1414 # log.debug('bit_index=%d / compressed_current=%d / compressed_end=%d' % (bit_index, compressed_current, compressed_end))
1412 1415 if compressed_current >= compressed_end:
... ... @@ -2434,6 +2437,7 @@ def json2ascii(json_obj, encoding='utf8', errors='replace'):
2434 2437 else:
2435 2438 # on Python 3, just keep Unicode strings as-is:
2436 2439 return json_obj
  2440 + # pylint: disable-next=possibly-used-before-assignment
2437 2441 elif isinstance(json_obj, unicode) and PYTHON2:
2438 2442 # On Python 2, encode unicode to bytes:
2439 2443 json_obj_bytes = json_obj.encode(encoding, errors)
... ...