##// END OF EJS Templates
Merge pull request #12031 from Carreau/morer-cleanup...
Matthias Bussonnier -
r25350:8cb34665 merge
parent child Browse files
Show More
@@ -386,7 +386,7 b' class InputSplitter(object):'
386 finally:
386 finally:
387 self.reset()
387 self.reset()
388
388
389 def push(self, lines):
389 def push(self, lines:str) -> bool:
390 """Push one or more lines of input.
390 """Push one or more lines of input.
391
391
392 This stores the given lines and returns a status code indicating
392 This stores the given lines and returns a status code indicating
@@ -408,6 +408,7 b' class InputSplitter(object):'
408 this value is also stored as a private attribute (``_is_complete``), so it
408 this value is also stored as a private attribute (``_is_complete``), so it
409 can be queried at any time.
409 can be queried at any time.
410 """
410 """
411 assert isinstance(lines, str)
411 self._store(lines)
412 self._store(lines)
412 source = self.source
413 source = self.source
413
414
@@ -677,7 +678,7 b' class IPythonInputSplitter(InputSplitter):'
677 finally:
678 finally:
678 self.reset()
679 self.reset()
679
680
680 def push(self, lines):
681 def push(self, lines:str) -> bool:
681 """Push one or more lines of IPython input.
682 """Push one or more lines of IPython input.
682
683
683 This stores the given lines and returns a status code indicating
684 This stores the given lines and returns a status code indicating
@@ -700,9 +701,8 b' class IPythonInputSplitter(InputSplitter):'
700 this value is also stored as a private attribute (_is_complete), so it
701 this value is also stored as a private attribute (_is_complete), so it
701 can be queried at any time.
702 can be queried at any time.
702 """
703 """
703
704 assert isinstance(lines, str)
704 # We must ensure all input is pure unicode
705 # We must ensure all input is pure unicode
705 lines = cast_unicode(lines, self.encoding)
706 # ''.splitlines() --> [], but we need to push the empty line to transformers
706 # ''.splitlines() --> [], but we need to push the empty line to transformers
707 lines_list = lines.splitlines()
707 lines_list = lines.splitlines()
708 if not lines_list:
708 if not lines_list:
@@ -538,7 +538,7 b' class FullEvalFormatter(Formatter):'
538 """
538 """
539 # copied from Formatter._vformat with minor changes to allow eval
539 # copied from Formatter._vformat with minor changes to allow eval
540 # and replace the format_spec code with slicing
540 # and replace the format_spec code with slicing
541 def vformat(self, format_string, args, kwargs):
541 def vformat(self, format_string:str, args, kwargs)->str:
542 result = []
542 result = []
543 for literal_text, field_name, format_spec, conversion in \
543 for literal_text, field_name, format_spec, conversion in \
544 self.parse(format_string):
544 self.parse(format_string):
@@ -566,7 +566,7 b' class FullEvalFormatter(Formatter):'
566 # format the object and append to the result
566 # format the object and append to the result
567 result.append(self.format_field(obj, ''))
567 result.append(self.format_field(obj, ''))
568
568
569 return ''.join(py3compat.cast_unicode(s) for s in result)
569 return ''.join(result)
570
570
571
571
572 class DollarFormatter(FullEvalFormatter):
572 class DollarFormatter(FullEvalFormatter):
General Comments 0
You need to be logged in to leave comments. Login now