class_docstr: OLE container object
  
  This class encapsulates the interface to an OLE 2 structured
  storage file.  Use the listdir and openstream methods to
  access the contents of this file.
  
  Object names are given as a list of strings, one for each subentry
  level.  The root entry should be omitted.  For example, the following
  code extracts all image streams from a Microsoft Image Composer file::
  
      ole = OleFileIO("fan.mic")
  
      for entry in ole.listdir():
          if entry[1:2] == "Image":
              fin = ole.openstream(entry)
              fout = open(entry[0:1], "wb")
              while True:
                  s = fin.read(8192)
                  if not s:
                      break
                  fout.write(s)
  
  You can use the viewer application provided with the Python Imaging
  Library to view the resulting files (which happens to be standard
  TIFF files).
class_docstr_tok: ["OLE","container","object","This","class","encapsulates","the","interface","to","an","OLE","2","structured","storage","file",".","Use","the","listdir","and","openstream","methods","to","access","the","contents","of","this","file",".","Object","names","are","given","as","a","list","of","strings",",","one","for","each","subentry","level",".","The","root","entry","should","be","omitted",".","For","example",",","the","following","code","extracts","all","image","streams","from","a","Microsoft","Image","Composer","file",":",":","ole","=","OleFileIO","(","``","fan.mic","''",")","for","entry","in","ole.listdir","(",")",":","if","entry","[","1:2","]","==","``","Image","''",":","fin","=","ole.openstream","(","entry",")","fout","=","open","(","entry","[","0:1","]",",","``","wb","''",")","while","True",":","s","=","fin.read","(","8192",")","if","not","s",":","break","fout.write","(","s",")","You","can","use","the","viewer","application","provided","with","the","Python","Imaging","Library","to","view","the","resulting","files","(","which","happens","to","be","standard","TIFF","files",")","."]
docstr: This method should be called for any defect found during file parsing.
  It may raise an IOError exception according to the minimal level chosen
  for the OleFileIO object.
  
  :param defect_level: defect level, possible values are:
  
      - DEFECT_UNSURE    : a case which looks weird, but not sure it's a defect
      - DEFECT_POTENTIAL : a potential defect
      - DEFECT_INCORRECT : an error according to specifications, but parsing can go on
      - DEFECT_FATAL     : an error which cannot be ignored, parsing is impossible
  
  :param message: string describing the defect, used with raised exception.
  :param exception_type: exception class to be raised, IOError by default
docstr_tok: ["This","method","should","be","called","for","any","defect","found","during","file","parsing",".","It","may","raise","an","IOError","exception","according","to","the","minimal","level","chosen","for","the","OleFileIO","object",".",":","param","defect_level",":","defect","level",",","possible","values","are",":","-","DEFECT_UNSURE",":","a","case","which","looks","weird",",","but","not","sure","it","'s","a","defect","-","DEFECT_POTENTIAL",":","a","potential","defect","-","DEFECT_INCORRECT",":","an","error","according","to","specifications",",","but","parsing","can","go","on","-","DEFECT_FATAL",":","an","error","which","can","not","be","ignored",",","parsing","is","impossible",":","param","message",":","string","describing","the","defect",",","used","with","raised","exception",".",":","param","exception_type",":","exception","class","to","be","raised",",","IOError","by","default"]
code: def _raise_defect(
      self, defect_level, message, exception_type=IOError
  ):
      """
      This method should be called for any defect found during file parsing.
      It may raise an IOError exception according to the minimal level chosen
      for the OleFileIO object.
  
      :param defect_level: defect level, possible values are:
  
          - DEFECT_UNSURE    : a case which looks weird, but not sure it's a defect
          - DEFECT_POTENTIAL : a potential defect
          - DEFECT_INCORRECT : an error according to specifications, but parsing can go on
          - DEFECT_FATAL     : an error which cannot be ignored, parsing is impossible
  
      :param message: string describing the defect, used with raised exception.
      :param exception_type: exception class to be raised, IOError by default
      """
      # added by [PL]
      if defect_level >= self._raise_defects_level:
          log.error(message)
          raise exception_type(message)
      else:
          # just record the issue, no exception raised:
          self.parsing_issues.append((exception_type, message))
          log.warning(message)
  
imports: from __future__ import print_function
  import io
  import sys
  import struct, array, os.path, datetime, logging
label_desc: Use image node_id 4 for calling the OleFileIO obj's underlying member method code with example usage: obj._raise_defect(defect_level, message, exception_type) without return types