File tree Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Expand file tree Collapse file tree 2 files changed +5
-16
lines changed Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python2.7
1
+ #!/usr/bin/env python3
2
2
import gyb
3
3
gyb .main ()
Original file line number Diff line number Diff line change 1
- #!/usr/bin/env python
1
+ #!/usr/bin/env python3
2
2
# GYB: Generate Your Boilerplate (improved names welcome; at least
3
3
# this one's short). See -h output for instructions
4
4
11
11
import textwrap
12
12
import tokenize
13
13
from bisect import bisect
14
-
15
-
16
- try :
17
- from StringIO import StringIO
18
- except ImportError :
19
- from io import StringIO
20
-
21
-
22
- try :
23
- basestring
24
- except NameError :
25
- basestring = str
14
+ from io import StringIO
26
15
27
16
28
17
def get_line_starts (s ):
@@ -732,15 +721,15 @@ def execute(self, context):
732
721
# If we got a result, the code was an expression, so append
733
722
# its value
734
723
if result is not None \
735
- or (isinstance (result , basestring ) and result != '' ):
724
+ or (isinstance (result , str ) and result != '' ):
736
725
from numbers import Number , Integral
737
726
result_string = None
738
727
if isinstance (result , Number ) and not isinstance (result , Integral ):
739
728
result_string = repr (result )
740
729
elif isinstance (result , Integral ) or isinstance (result , list ):
741
730
result_string = str (result )
742
731
else :
743
- result_string = StringIO ( result ). read ()
732
+ result_string = result
744
733
context .append_text (
745
734
result_string , self .filename , self .start_line_number )
746
735
You can’t perform that action at this time.
0 commit comments