def _get_emacs_vars(self, text):
emacs_vars = {}<EOL>SIZE = pow(<NUM_LIT:2>, <NUM_LIT>) <EOL>head = text[:SIZE]<EOL>if "<STR_LIT>" in head:<EOL><INDENT>match = self._emacs_oneliner_vars_pat.search(head)<EOL>if match:<EOL><INDENT>emacs_vars_str = match.group(<NUM_LIT:1>)<EOL>assert '<STR_LIT:\n>' not in emacs_vars_str<EOL>emacs_var_strs = [s.strip() for s in emacs_vars_str.split('<STR_LIT:;>')<EOL>if s.strip()]<EOL>if len(emacs_var_strs) == <NUM_LIT:1> and '<STR_LIT::>' not in emacs_var_strs[<NUM_LIT:0>]:<EOL><INDENT>emacs_vars["<STR_LIT>"] = emacs_var_strs[<NUM_LIT:0>].strip()<EOL><DEDENT>else:<EOL><INDENT>for emacs_var_str in emacs_var_strs:<EOL><INDENT>try:<EOL><INDENT>variable, value = emacs_var_str.strip().split('<STR_LIT::>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>log.debug("<STR_LIT>"<EOL>"<STR_LIT>", emacs_var_str)<EOL>continue<EOL><DEDENT>emacs_vars[variable.lower()] = value.strip()<EOL><DEDENT><DEDENT><DEDENT><DEDENT>tail = text[-SIZE:]<EOL>if "<STR_LIT>" in tail:<EOL><INDENT>match = self._emacs_local_vars_pat.search(tail)<EOL>if match:<EOL><INDENT>prefix = match.group("<STR_LIT>")<EOL>suffix = match.group("<STR_LIT>")<EOL>lines = match.group("<STR_LIT:content>").splitlines(<NUM_LIT:0>)<EOL>for i, line in enumerate(lines):<EOL><INDENT>if not line.startswith(prefix):<EOL><INDENT>log.debug("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (line, prefix))<EOL>return {}<EOL><DEDENT>if i != len(lines)-<NUM_LIT:1> and not line.endswith(suffix):<EOL><INDENT>log.debug("<STR_LIT>"<EOL>"<STR_LIT>"<EOL>% (line, suffix))<EOL>return {}<EOL><DEDENT><DEDENT>continued_for = None<EOL>for line in lines[:-<NUM_LIT:1>]: <EOL><INDENT>if prefix: line = line[len(prefix):] <EOL>if suffix: line = line[:-len(suffix)] <EOL>line = line.strip()<EOL>if continued_for:<EOL><INDENT>variable = continued_for<EOL>if line.endswith('<STR_LIT:\\>'):<EOL><INDENT>line = line[:-<NUM_LIT:1>].rstrip()<EOL><DEDENT>else:<EOL><INDENT>continued_for = None<EOL><DEDENT>emacs_vars[variable] += '<STR_LIT:U+0020>' + line<EOL><DEDENT>else:<EOL><INDENT>try:<EOL><INDENT>variable, value = line.split('<STR_LIT::>', <NUM_LIT:1>)<EOL><DEDENT>except ValueError:<EOL><INDENT>log.debug("<STR_LIT>"<EOL>"<STR_LIT>" % line)<EOL>continue<EOL><DEDENT>value = value.strip()<EOL>if value.endswith('<STR_LIT:\\>'):<EOL><INDENT>value = value[:-<NUM_LIT:1>].rstrip()<EOL>continued_for = variable<EOL><DEDENT>else:<EOL><INDENT>continued_for = None<EOL><DEDENT>emacs_vars[variable] = value<EOL><DEDENT><DEDENT><DEDENT><DEDENT>for var, val in list(emacs_vars.items()):<EOL><INDENT>if len(val) > <NUM_LIT:1> and (val.startswith('<STR_LIT:">') and val.endswith('<STR_LIT:">')<EOL>or val.startswith('<STR_LIT:">') and val.endswith('<STR_LIT:">')):<EOL><INDENT>emacs_vars[var] = val[<NUM_LIT:1>:-<NUM_LIT:1>]<EOL><DEDENT><DEDENT>return emacs_vars<EOL>
Return a dictionary of emacs-style local variables.

        Parsing is done loosely according to this spec (and according to
        some in-practice deviations from this):
        http://www.gnu.org/software/emacs/manual/html_node/emacs/Specifying-File-Variables.html#Specifying-File-Variables