def _package_chunk(self, raw_source_lines, raw_want_lines, lineno=<NUM_LIT:0>):
if DEBUG > <NUM_LIT:1>:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>match = INDENT_RE.search(raw_source_lines[<NUM_LIT:0>])<EOL>line_indent = <NUM_LIT:0> if match is None else (match.end() - match.start())<EOL>source_lines = [p[line_indent:] for p in raw_source_lines]<EOL>want_lines = [p[line_indent:] for p in raw_want_lines]<EOL>exec_source_lines = [p[<NUM_LIT:4>:] for p in source_lines]<EOL>if DEBUG > <NUM_LIT:1>:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>ps1_linenos, eval_final = self._locate_ps1_linenos(source_lines)<EOL>if DEBUG > <NUM_LIT:1>:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>break_linenos = []<EOL>ps1_to_directive = {}<EOL>for s1, s2 in zip(ps1_linenos, ps1_linenos[<NUM_LIT:1>:] + [None]):<EOL><INDENT>lines = exec_source_lines[s1:s2]<EOL>directives = list(directive.Directive.extract('<STR_LIT:\n>'.join(lines)))<EOL>if directives:<EOL><INDENT>ps1_to_directive[s1] = directives<EOL>break_linenos.append(s1)<EOL>if directives[<NUM_LIT:0>].inline:<EOL><INDENT>if s2 is not None:<EOL><INDENT>break_linenos.append(s2)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>def slice_example(s1, s2, want_lines=None):<EOL><INDENT>exec_lines = exec_source_lines[s1:s2]<EOL>orig_lines = source_lines[s1:s2]<EOL>directives = ps1_to_directive.get(s1, None)<EOL>example = doctest_part.DoctestPart(exec_lines,<EOL>want_lines=want_lines,<EOL>orig_lines=orig_lines,<EOL>line_offset=lineno + s1,<EOL>directives=directives)<EOL>return example<EOL><DEDENT>s1 = <NUM_LIT:0><EOL>s2 = <NUM_LIT:0><EOL>if self.simulate_repl:<EOL><INDENT>for s1, s2 in zip(ps1_linenos, ps1_linenos[<NUM_LIT:1>:]):<EOL><INDENT>example = slice_example(s1, s2)<EOL>yield example<EOL><DEDENT>s1 = s2<EOL><DEDENT>else:<EOL><INDENT>if break_linenos:<EOL><INDENT>break_linenos = sorted(set([<NUM_LIT:0>] + break_linenos))<EOL>for s1, s2 in zip(break_linenos, break_linenos[<NUM_LIT:1>:]):<EOL><INDENT>example = slice_example(s1, s2)<EOL>yield example<EOL><DEDENT>s1 = s2<EOL><DEDENT>if want_lines and eval_final:<EOL><INDENT>s2 = ps1_linenos[-<NUM_LIT:1>]<EOL>if s2 != s1:  <EOL><INDENT>example = slice_example(s1, s2)<EOL>yield example<EOL>s1 = s2<EOL><DEDENT><DEDENT><DEDENT>s2 = None<EOL>example = slice_example(s1, s2, want_lines)<EOL>example.use_eval = bool(want_lines) and eval_final<EOL>if DEBUG > <NUM_LIT:1>:<EOL><INDENT>print('<STR_LIT>')<EOL><DEDENT>yield example<EOL>
if `self.simulate_repl` is True, then each statement is broken into its
own part.  Otherwise, statements are grouped by the closest `want`
statement.

Example:
    >>> from xdoctest.parser import *
    >>> raw_source_lines = ['>>> "string"']
    >>> raw_want_lines = ['string']
    >>> self = DoctestParser()
    >>> part, = self._package_chunk(raw_source_lines, raw_want_lines)
    >>> part.source
    '"string"'
    >>> part.want
    'string'