Home | History | Annotate | Download | only in email

Lines Matching full:line

8 message, line by line.  This has advantages for certain applications, such as
47 You can also push and pop line-matching predicates onto a stack. When the
48 current predicate matches the current line, a false EOF response
53 # The last partial line pushed into this object.
69 # Don't forget any trailing partial line.
79 # Pop the line off the stack and see if it matches the current
81 line = self._lines.pop()
86 if ateof(line):
87 # We're at the false EOF. But push the last line back first.
88 self._lines.append(line)
90 return line
92 def unreadline(self, line):
93 # Let the consumer push a line back into the buffer.
94 assert line is not NeedMoreData
95 self._lines.append(line)
112 # parts is a list of strings, alternating between the line contents
131 line = self.readline()
132 if line == '':
134 return line
201 # Collect the headers, searching for a line that doesn't match the RFC
202 # 2822 header or continuation pattern (including an empty line).
203 for line in self._input:
204 if line is NeedMoreData:
207 if not headerRE.match(line):
209 # (i.e. newline), just throw it away. Otherwise the line is
211 if not NLCRE.match(line):
212 self._input.unreadline(line)
214 headers.append(line)
224 line = self._input.readline()
225 if line is NeedMoreData:
228 if line == '':
230 lines.append(line)
235 # a blank line. We'll represent each header block as a separate
238 # nested messages. A blank line separates the subparts.
253 # first consume the blank line, then test the next line to see
256 line = self._input.readline()
257 if line is NeedMoreData:
262 line = self._input.readline()
263 if line is NeedMoreData:
267 if line == '':
269 # Not at EOF so this is a line we're going to need.
270 self._input.unreadline(line)
291 for line in self._input:
292 if line is NeedMoreData:
295 lines.append(line)
298 # Create a line match predicate which matches the inter-part
310 line = self._input.readline()
311 if line is NeedMoreData:
314 if line == '':
316 mo = boundaryre.match(line)
336 self._input.unreadline(line)
343 line = self._input.readline()
344 if line is NeedMoreData:
347 mo = boundaryre.match(line)
349 self._input.unreadline(line)
352 # at the subpart's first line.
387 preamble.append(line)
396 for line in self._input:
397 if line is NeedMoreData:
408 for line in self._input:
409 if line is NeedMoreData:
412 epilogue.append(line)
426 for line in self._input:
427 if line is NeedMoreData:
430 lines.append(line)
437 for lineno, line in enumerate(lines):
439 if line[0] in ' \t':
441 # The first line of the headers was a continuation. This
443 # line, and ignore it for purposes of headers.
444 defect = errors.FirstHeaderLineIsContinuationDefect(line)
447 lastvalue.append(line)
455 if line.startswith('From '):
458 mo = NLCRE_eol.search(line)
460 line = line[:-len(mo.group(0))]
461 self._cur.set_unixfrom(line)
465 # probably the first line of the body, so push back the
466 # line and stop.
467 self._input.unreadline(line)
470 # Weirdly placed unix-from line. Note this as a defect
472 defect = errors.MisplacedEnvelopeHeaderDefect(line)
475 # Split the line on the colon separating field name from value.
476 i = line.find(':')
478 defect = errors.MalformedHeaderDefect(line)
481 lastheader = line[:i]
482 lastvalue = [line[i+1:].lstrip()]