# Path: starterpyth/log.py
# RED = '31'
# 
# GREEN = '32'
# 
# Path: starterpyth/log.py
# def display(text, color=None, bold=False, newline=True):
#     if not isinstance(text, text_type):
#         text = text.decode('utf-8')
#     if bold and color:
#         text = u("\033[1;{0}m{1}\033[0m").format(color, text)
#     text = u("\033[{0}m{1}\033[0m").format(color, text)
#     if newline:
#         text += u('\n')
#     end = u('')
#     if __encode_stdout:
#         text = text.encode('utf-8')
#         end = b('')
#     print_(text, end=end)


from six import u, BytesIO
from starterpyth.log import RED, GREEN
from starterpyth.log import display
from distutils.core import Command
import os.path
import pdb
import token
import tokenize
    import cProfile as profile
    import profile
                import pstats
                display(u('File %s not found' % self.input), color=RED)
                return
            stats = pstats.Stats(self.input)
            stats.print_stats()
        elif not self.call:
            display('Please provide a function to profile with --call \'module.function\'', color=RED)
            return
        else:
            if '(' not in self.call:
                self.call += '()'
            tokens = tokenize.generate_tokens(BytesIO(self.call).readline)
            index = 0
            simple_function_call = True
            for toknum, tokval, tokstart, tokend, tokline in tokens:
                if toknum == token.ENDMARKER:
                    break
                elif index == 0 and toknum != token.NAME:
                    simple_function_call = False
                    break
                elif index == 1 and toknum == token.OP and tokval == '(':
                    break
                elif index == 1 and (toknum != token.OP or tokval != '.'):
                    simple_function_call = False
                    break
                index = 1 - index
            if simple_function_call:
                module_name = self.call.partition('(')[0].rpartition('.')[0]
                if module_name:
                    display('Load module %s' % module_name, color=GREEN)
                    self.call = 'import %s ; %s' % (module_name, self.call)

# Path: starterpyth/log.py
# RED = '31'
# 
# GREEN = '32'
# 
# Path: starterpyth/log.py
# def display(text, color=None, bold=False, newline=True):
#     if not isinstance(text, text_type):
#         text = text.decode('utf-8')
#     if bold and color:
#         text = u("\033[1;{0}m{1}\033[0m").format(color, text)
#     text = u("\033[{0}m{1}\033[0m").format(color, text)
#     if newline:
#         text += u('\n')
#     end = u('')
#     if __encode_stdout:
#         text = text.encode('utf-8')
#         end = b('')
#     print_(text, end=end)


# Path: starterpyth/commands/profiling.py
from six import u, BytesIO
from starterpyth.log import RED, GREEN
from starterpyth.log import display
from distutils.core import Command
import os.path
import pdb
import token
import tokenize
    import cProfile as profile
    import profile
                import pstats

                display(u('File %s not found' % self.input), color=RED)
                return
            stats = pstats.Stats(self.input)
            stats.print_stats()
        elif not self.call:
            display('Please provide a function to profile with --call \'module.function\'', color=RED)
            return
        else:
            if '(' not in self.call:
                self.call += '()'
            tokens = tokenize.generate_tokens(BytesIO(self.call).readline)
            index = 0
            simple_function_call = True
            for toknum, tokval, tokstart, tokend, tokline in tokens:
                if toknum == token.ENDMARKER:
                    break
                elif index == 0 and toknum != token.NAME:
                    simple_function_call = False
                    break
                elif index == 1 and toknum == token.OP and tokval == '(':
                    break
                elif index == 1 and (toknum != token.OP or tokval != '.'):
                    simple_function_call = False
                    break
                index = 1 - index
            if simple_function_call:
                module_name = self.call.partition('(')[0].rpartition('.')[0]
                if module_name:
                    display('Load module %s' % module_name, color=GREEN)
                    self.call = 'import %s ; %s' % (module_name, self.call)

            display("running profiling on %(call)s" % {'call': self.call}, color=GREEN)