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

Method get_inline_data

pattern/web/pdf/pdfinterp.py:239–267  ·  view source on GitHub ↗
(self, pos, target='EI')

Source from the content-addressed store, hash-verified

237 return
238
239 def get_inline_data(self, pos, target='EI'):
240 self.seek(pos)
241 i = 0
242 data = ''
243 while i <= len(target):
244 self.fillbuf()
245 if i:
246 c = self.buf[self.charpos]
247 data += c
248 self.charpos += 1
249 if len(target) <= i and c.isspace():
250 i += 1
251 elif i < len(target) and c == target[i]:
252 i += 1
253 else:
254 i = 0
255 else:
256 try:
257 j = self.buf.index(target[0], self.charpos)
258 #print 'found', (0, self.buf[j:j+10])
259 data += self.buf[self.charpos:j+1]
260 self.charpos = j+1
261 i = 1
262 except ValueError:
263 data += self.buf[self.charpos:]
264 self.charpos = len(self.buf)
265 data = data[:-(len(target)+1)] # strip the last part
266 data = re.sub(r'(\x0d\x0a|[\x0d\x0a])$', '', data)
267 return (pos, data)
268
269 def flush(self):
270 self.add_results(*self.popall())

Callers 1

do_keywordMethod · 0.95

Calls 4

seekMethod · 0.95
fillbufMethod · 0.95
lenFunction · 0.85
indexMethod · 0.45

Tested by

no test coverage detected