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

Method search

pattern/web/pdf/pdfparser.py:496–515  ·  view source on GitHub ↗
(obj, parent)

Source from the content-addressed store, hash-verified

494 if not self.xrefs:
495 raise PDFException('PDFDocument is not initialized')
496 def search(obj, parent):
497 if isinstance(obj, int):
498 objid = obj
499 tree = dict_value(self.getobj(objid)).copy()
500 else:
501 objid = obj.objid
502 tree = dict_value(obj).copy()
503 for (k,v) in parent.iteritems():
504 if k in self.INHERITABLE_ATTRS and k not in tree:
505 tree[k] = v
506 if tree.get('Type') is LITERAL_PAGES and 'Kids' in tree:
507 if 1 <= self.debug:
508 print >>sys.stderr, 'Pages: Kids=%r' % tree['Kids']
509 for c in list_value(tree['Kids']):
510 for x in search(c, tree):
511 yield x
512 elif tree.get('Type') is LITERAL_PAGE:
513 if 1 <= self.debug:
514 print >>sys.stderr, 'Page: %r' % tree
515 yield (objid, tree)
516 if 'Pages' not in self.catalog: return
517 for (pageid,tree) in search(self.catalog['Pages'], self.catalog):
518 yield PDFPage(self, pageid, tree)

Callers 11

name2unicodeFunction · 0.45
asciihexdecodeFunction · 0.45
nextlineMethod · 0.45
_parse_mainMethod · 0.45
_parse_commentMethod · 0.45
_parse_literalMethod · 0.45
_parse_numberMethod · 0.45
_parse_floatMethod · 0.45
_parse_keywordMethod · 0.45
_parse_stringMethod · 0.45
_parse_hexstringMethod · 0.45

Calls 9

getobjMethod · 0.95
dict_valueFunction · 0.90
list_valueFunction · 0.90
decode_textFunction · 0.90
str_valueFunction · 0.90
searchFunction · 0.85
iteritemsMethod · 0.80
copyMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected