MCPcopy Index your code
hub / github.com/clips/pattern / execute

Method execute

pattern/web/pdf/pdfinterp.py:773–805  ·  view source on GitHub ↗
(self, streams)

Source from the content-addressed store, hash-verified

771 return
772
773 def execute(self, streams):
774 try:
775 parser = PDFContentParser(streams)
776 except PSEOF:
777 # empty page
778 return
779 while 1:
780 try:
781 (_,obj) = parser.nextobject()
782 except PSEOF:
783 break
784 if isinstance(obj, PSKeyword):
785 name = keyword_name(obj)
786 method = 'do_%s' % name.replace('*','_a').replace('"','_w').replace("'",'_q')
787 if hasattr(self, method):
788 func = getattr(self, method)
789 nargs = func.func_code.co_argcount-1
790 if nargs:
791 args = self.pop(nargs)
792 if 2 <= self.debug:
793 print >>sys.stderr, 'exec: %s %r' % (name, args)
794 if len(args) == nargs:
795 func(*args)
796 else:
797 if 2 <= self.debug:
798 print >>sys.stderr, 'exec: %s' % (name)
799 func()
800 else:
801 if STRICT:
802 raise PDFInterpreterError('Unknown operator: %r' % name)
803 else:
804 self.push(obj)
805 return
806
807
808## process_pdf

Callers 1

render_contentsMethod · 0.95

Calls 7

popMethod · 0.95
pushMethod · 0.95
keyword_nameFunction · 0.90
PDFContentParserClass · 0.85
lenFunction · 0.85
PDFInterpreterErrorClass · 0.85
nextobjectMethod · 0.80

Tested by

no test coverage detected