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