33import inspect
44import linecache
55import os
6- import six
76import sys
87import tokenize
98import vmprof
1312from vmprof .stats import EmptyProfileFile
1413
1514
16- class color (six . text_type ):
15+ class color (str ):
1716 RED = '\033 [31m'
1817 WHITE = '\033 [37m'
1918 BLUE = '\033 [94m'
2019 BOLD = '\033 [1m'
2120 END = '\033 [0m'
2221
2322 def __new__ (cls , content , color , bold = False ):
24- return six . text_type .__new__ (
23+ return str .__new__ (
2524 cls , "%s%s%s%s" % (color , cls .BOLD if bold else "" , content , cls .END ))
2625
2726class AbstractPrinter (object ):
@@ -81,7 +80,7 @@ def _walk_tree(self, parent, node, level, callback):
8180 level += 1
8281 if level > self ._prune_level :
8382 return
84- for c in six . itervalues ( node .children ):
83+ for c in node .children . values ( ):
8584 self ._walk_tree (node , c , level , callback )
8685
8786 color = color
@@ -140,7 +139,7 @@ def _print_tree(self, tree):
140139 partial (self ._print_node , total = float (tree .count )))
141140
142141
143- class html_color (six . text_type ):
142+ class html_color (str ):
144143 RED = 'red'
145144 WHITE = 'black'
146145 BLUE = 'blue'
@@ -172,7 +171,7 @@ def _walk_tree(self, parent, node, level, callback):
172171 level += 1
173172 if level > self ._prune_level :
174173 return
175- for c in six . itervalues ( node .children ):
174+ for c in node .children . values ( ):
176175 self ._walk_tree (node , c , level , callback )
177176 print ("</details>" )
178177
@@ -218,7 +217,7 @@ def _show(self, tree):
218217
219218 def _walk_tree (self , parent , node , callback ):
220219 callback (parent , node )
221- for c in six . itervalues ( node .children ):
220+ for c in node .children . values ( ):
222221 self ._walk_tree (node , c , callback )
223222
224223 def _print_tree (self , tree ):
@@ -235,7 +234,7 @@ def collect_node(parent, node):
235234 0 if parse_block_name (ch .name )[0 ] == 'n' and self .no_native
236235 else ch .count
237236
238- for ch in six . itervalues ( node .children ))
237+ for ch in node .children . values ( ))
239238
240239 func_id_to_count [ndescr ] = func_id_to_count .get (ndescr , 0 ) + mycount
241240
@@ -284,15 +283,15 @@ def walk(node, d):
284283 # only python supported for line profiling
285284 if block_type == 'py' :
286285 lines = d .setdefault ((filename , int (funline ), funname ), {})
287- for l , cnt in six . iteritems ( node .lines ):
286+ for l , cnt in node .lines . items ( ):
288287 lines [l ] = lines .get (l , 0 ) + cnt
289288
290- for c in six . itervalues ( node .children ):
289+ for c in node .children . values ( ):
291290 walk (c , d )
292291
293292 walk (tree , funcs )
294293
295- return six . iteritems ( funcs )
294+ return funcs . items ( )
296295
297296 def show_func (self , filename , start_lineno , func_name , timings , stream = None , stripzeros = False ):
298297 """ Show results for a single function.
@@ -305,7 +304,7 @@ def show_func(self, filename, start_lineno, func_name, timings, stream=None, str
305304 total_hits = 0.0
306305
307306 linenos = []
308- for lineno , nhits in six . iteritems ( timings ):
307+ for lineno , nhits in timings . items ( ):
309308 total_hits += nhits
310309 linenos .append (lineno )
311310
@@ -338,7 +337,7 @@ def show_func(self, filename, start_lineno, func_name, timings, stream=None, str
338337 # Fake empty lines so we can see the timings, if not the code.
339338 nlines = max (linenos ) - min (min (linenos ), start_lineno ) + 1
340339 sublines = ['' ] * nlines
341- for lineno , nhits in six . iteritems ( timings ):
340+ for lineno , nhits in timings . items ( ):
342341 d [lineno ] = (nhits , '%5.1f' % (100 * nhits / total_hits ))
343342 linenos = range (start_lineno , start_lineno + len (sublines ))
344343 empty = ('' , '' )
0 commit comments