Commit 3436df071ef4e529b86748da840ec4ae339ff97f

Authored by Christian Herdtweck
1 parent ef36a777

msodde: no else after return

making pylint happier, part 4
Showing 1 changed file with 11 additions and 13 deletions
oletools/msodde.py
... ... @@ -353,10 +353,9 @@ def process_doc_field(data):
353 353  
354 354 if data.lstrip().lower().startswith(u'dde'):
355 355 return data
356   - elif data.lstrip().lower().startswith(u'\x00d\x00d\x00e\x00'):
  356 + if data.lstrip().lower().startswith(u'\x00d\x00d\x00e\x00'):
357 357 return data
358   - else:
359   - return u''
  358 + return u''
360 359  
361 360  
362 361 OLE_FIELD_START = 0x13
... ... @@ -621,7 +620,7 @@ def field_is_blacklisted(contents):
621 620 logger.debug('too few args: found {0}, but need at least {1} in "{2}"'
622 621 .format(nargs, nargs_required, contents))
623 622 return False
624   - elif nargs > nargs_required + nargs_optional:
  623 + if nargs > nargs_required + nargs_optional:
625 624 logger.debug('too many args: found {0}, but need at most {1}+{2} in '
626 625 '"{3}"'
627 626 .format(nargs, nargs_required, nargs_optional, contents))
... ... @@ -899,9 +898,8 @@ def process_file(filepath, field_filter_mode=None):
899 898 if is_ppt(ole):
900 899 logger.debug('is ppt - cannot have DDE')
901 900 return u''
902   - else:
903   - logger.debug('Process file as word 2003 (doc)')
904   - return process_doc(ole)
  901 + logger.debug('Process file as word 2003 (doc)')
  902 + return process_doc(ole)
905 903  
906 904 with open(filepath, 'rb') as file_handle:
907 905 if file_handle.read(4) == RTF_START:
... ... @@ -918,18 +916,18 @@ def process_file(filepath, field_filter_mode=None):
918 916 if doctype == ooxml.DOCTYPE_EXCEL:
919 917 logger.debug('Process file as excel 2007+ (xlsx)')
920 918 return process_xlsx(filepath)
921   - elif doctype in (ooxml.DOCTYPE_EXCEL_XML, ooxml.DOCTYPE_EXCEL_XML2003):
  919 + if doctype in (ooxml.DOCTYPE_EXCEL_XML, ooxml.DOCTYPE_EXCEL_XML2003):
922 920 logger.debug('Process file as xml from excel 2003/2007+')
923 921 return process_excel_xml(filepath)
924   - elif doctype in (ooxml.DOCTYPE_WORD_XML, ooxml.DOCTYPE_WORD_XML2003):
  922 + if doctype in (ooxml.DOCTYPE_WORD_XML, ooxml.DOCTYPE_WORD_XML2003):
925 923 logger.debug('Process file as xml from word 2003/2007+')
926 924 return process_docx(filepath)
927   - elif doctype is None:
  925 + if doctype is None:
928 926 logger.debug('Process file as csv')
929 927 return process_csv(filepath)
930   - else: # could be docx; if not: this is the old default code path
931   - logger.debug('Process file as word 2007+ (docx)')
932   - return process_docx(filepath, field_filter_mode)
  928 + # could be docx; if not: this is the old default code path
  929 + logger.debug('Process file as word 2007+ (docx)')
  930 + return process_docx(filepath, field_filter_mode)
933 931  
934 932  
935 933 # === MAIN =================================================================
... ...