Show More
@@ -490,51 +490,6 class InputSplitter(object): | |||||
490 | # General fallback - accept more code |
|
490 | # General fallback - accept more code | |
491 | return True |
|
491 | return True | |
492 |
|
492 | |||
493 | #------------------------------------------------------------------------ |
|
|||
494 | # Private interface |
|
|||
495 | #------------------------------------------------------------------------ |
|
|||
496 |
|
||||
497 | def _find_indent(self, line): |
|
|||
498 | """Compute the new indentation level for a single line. |
|
|||
499 |
|
||||
500 | Parameters |
|
|||
501 | ---------- |
|
|||
502 | line : str |
|
|||
503 | A single new line of non-whitespace, non-comment Python input. |
|
|||
504 |
|
||||
505 | Returns |
|
|||
506 | ------- |
|
|||
507 | indent_spaces : int |
|
|||
508 | New value for the indent level (it may be equal to self.indent_spaces |
|
|||
509 | if indentation doesn't change. |
|
|||
510 |
|
||||
511 | full_dedent : boolean |
|
|||
512 | Whether the new line causes a full flush-left dedent. |
|
|||
513 | """ |
|
|||
514 | indent_spaces = self.indent_spaces |
|
|||
515 | full_dedent = self._full_dedent |
|
|||
516 |
|
||||
517 | inisp = num_ini_spaces(line) |
|
|||
518 | if inisp < indent_spaces: |
|
|||
519 | indent_spaces = inisp |
|
|||
520 | if indent_spaces <= 0: |
|
|||
521 | #print 'Full dedent in text',self.source # dbg |
|
|||
522 | full_dedent = True |
|
|||
523 |
|
||||
524 | if line.rstrip()[-1] == ':': |
|
|||
525 | indent_spaces += 4 |
|
|||
526 | elif dedent_re.match(line): |
|
|||
527 | indent_spaces -= 4 |
|
|||
528 | if indent_spaces <= 0: |
|
|||
529 | full_dedent = True |
|
|||
530 |
|
||||
531 | # Safety |
|
|||
532 | if indent_spaces < 0: |
|
|||
533 | indent_spaces = 0 |
|
|||
534 | #print 'safety' # dbg |
|
|||
535 |
|
||||
536 | return indent_spaces, full_dedent |
|
|||
537 |
|
||||
538 | def _update_indent(self): |
|
493 | def _update_indent(self): | |
539 | # self.source always has a trailing newline |
|
494 | # self.source always has a trailing newline | |
540 | self.indent_spaces = find_next_indent(self.source[:-1]) |
|
495 | self.indent_spaces = find_next_indent(self.source[:-1]) |
General Comments 0
You need to be logged in to leave comments.
Login now