Python colorama.Back.BLUE Examples

The following are 6 code examples of colorama.Back.BLUE(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module colorama.Back , or try the search function .
Example #1
Source File: errorAnalysis.py    From stanford-ctc with Apache License 2.0 5 votes vote down vote up
def disp_err_corr(hyp_corr, ref_corr):
    hyp_str = ''
    ref_str = ''
    assert len(hyp_corr) == len(ref_corr)
    for k in xrange(len(hyp_corr)):
        if hyp_corr[k] == '[space]':
            hc = ' '
        elif hyp_corr[k] == '<ins>':
            hc = Back.GREEN + ' ' + Back.RESET
        else:
            hc = hyp_corr[k]

        if ref_corr[k] == '[space]':
            rc = ' '
        elif ref_corr[k] == '<del>':
            rc = Back.RED + ' ' + Back.RESET
        else:
            rc = ref_corr[k]

        if hc != rc and len(hc) == 1 and len(rc) == 1:
            hc = Back.BLUE + Fore.BLACK + hc + Fore.RESET + Back.RESET
            rc = Back.BLUE + Fore.BLACK + rc + Fore.RESET + Back.RESET
        hyp_str += hc
        ref_str += rc
    print hyp_str
    print ref_str 
Example #2
Source File: helper.py    From PRET with GNU General Public License v2.0 5 votes vote down vote up
def info(self, msg, eol=None):
    if msg: print(Back.BLUE + msg + Style.RESET_ALL, end=eol)
    sys.stdout.flush()

  # show raw data 
Example #3
Source File: helper.py    From PRET with GNU General Public License v2.0 5 votes vote down vote up
def psdir(self, isdir, size, mtime, name, otime):
    otime = Style.DIM + "(created " + otime + ")" + Style.RESET_ALL 
    vol = Style.DIM + Fore.YELLOW + item(re.findall("^(%.*%)", name)) + Style.RESET_ALL
    name = re.sub("^(%.*%)", '', name) # remove volume information from filename
    name = Style.BRIGHT + Fore.BLUE + name + Style.RESET_ALL if isdir else name
    if isdir: print("d %8s   %s %s %s %s" % (size, mtime, otime, vol, name))
    else:     print("- %8s   %s %s %s %s" % (size, mtime, otime, vol, name))

  # show directory listing 
Example #4
Source File: helper.py    From PRET with GNU General Public License v2.0 5 votes vote down vote up
def pjldir(self, name, size):
    name = name if size else Style.BRIGHT + Fore.BLUE + name + Style.RESET_ALL
    if size: print("- %8s   %s" % (size, name))
    else:    print("d %8s   %s" % ("-", name))

  # show directory listing 
Example #5
Source File: helper.py    From PRET with GNU General Public License v2.0 5 votes vote down vote up
def fuzzed(self, path, cmd, opt):
      opt1, opt2, opt3 = opt
      if isinstance(opt1, bool): opt1 = (Back.GREEN + str(opt1) + Back.BLUE + "   ")\
                                 if opt1 else (Back.RED + str(opt1) + Back.BLUE + "  ")
      if isinstance(opt2, bool): opt2 = (Back.GREEN + str(opt2) + Back.BLUE + "   ")\
                                 if opt2 else (Back.RED + str(opt2) + Back.BLUE + "  ")
      if isinstance(opt3, bool): opt3 = (Back.GREEN + str(opt3) + Back.BLUE + "   ")\
                                 if opt3 else (Back.RED + str(opt3) + Back.BLUE + "  ")
      opt = opt1, opt2, opt3
      self.info("%-35s %-12s %-7s %-7s %-7s" % ((path, cmd) + opt))

  # show captured jobs 
Example #6
Source File: helper.py    From PRET with GNU General Public License v2.0 5 votes vote down vote up
def dump(self, data):
    # experimental regex to match sensitive strings like passwords
    data = re.sub(r"[\x00-\x06,\x1e]([!-~]{6,}?(?!\\0A))\x00{16}", "START" + r"\1" + "STOP", data)
    data = re.sub(r"\00+", "\x00", data) # ignore nullbyte streams
    data = re.sub(r"(\x00){10}", "\x00", data) # ignore nullbyte streams
    data = re.sub(r"([\x00-\x1f,\x7f-\xff])", ".", data)
    data = re.sub(r"START([!-~]{6,}?)STOP", Style.RESET_ALL + Back.BLUE + r"\1" + Style.RESET_ALL + Fore.YELLOW, data)
    self.raw(data, "")

  # dump ps dictionary