当前位置: 首页>>代码示例>>Python>>正文


Python Fore.MAGENTA属性代码示例

本文整理汇总了Python中colorama.Fore.MAGENTA属性的典型用法代码示例。如果您正苦于以下问题:Python Fore.MAGENTA属性的具体用法?Python Fore.MAGENTA怎么用?Python Fore.MAGENTA使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在colorama.Fore的用法示例。


在下文中一共展示了Fore.MAGENTA属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: format

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def format(self, record):
        # add color
        if self.colors and record.levelname in COLORS:
            start = COLORS[record.levelname]
            record.levelname = start + record.levelname + Fore.RESET
            record.msg = Fore.WHITE + record.msg + Fore.RESET

        # add extras
        if self.extras:
            extras = merge_record_extra(record=record, target=dict(), reserved=RESERVED_ATTRS)
            record.extras = ', '.join('{}={}'.format(k, v) for k, v in extras.items())
            if record.extras:
                record.extras = Fore.MAGENTA + '({})'.format(record.extras) + Fore.RESET

        # hide traceback
        if not self.traceback:
            record.exc_text = None
            record.exc_info = None
            record.stack_info = None

        return super().format(record) 
开发者ID:dephell,项目名称:dephell,代码行数:23,代码来源:logging_helpers.py

示例2: first_time_init

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def first_time_init(self, jarvis):
        remind_still_active = []
        for item in self.get_data(jarvis):
            timestamp = item['timestamp']
            if timestamp < time.time():
                time_format = self.timestamp_to_string(timestamp)
                jarvis.say(
                    "Reminder: {} missed ({})".format(
                        item['message'], time_format), Fore.MAGENTA)
                continue

            schedule_id = jarvis.schedule(timestamp, self.reminder_exec,
                                          item['message'])
            item['schedule_id'] = schedule_id
            remind_still_active += [item]
        self.save_data(jarvis, remind_still_active) 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:18,代码来源:reminder.py

示例3: magenta

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def magenta(s: str) -> str:  # pragma: no cover
    """Magenta color string if tty
    
    Args:
        s (str): String to color
    
    Returns:
        str: Colored string

    Examples:
        >>> from chepy.modules.internal.colors import magenta
        >>> print(MAGENTA("some string"))
    """
    if sys.stdout.isatty():
        return Fore.MAGENTA + s + Fore.RESET
    else:
        return s 
开发者ID:securisec,项目名称:chepy,代码行数:19,代码来源:colors.py

示例4: preprocess

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def preprocess(self):
        response = namedtuple('response', 'color label intl title')
        self.responses = {
            'pass': response(color=Fore.GREEN, label="PASS", intl='P', title="Passed      : "),
            'rule': response(color=Fore.RED, label="FAIL", intl='F', title="Failed      : "),
            'info': response(color=Fore.WHITE, label="INFO", intl='I', title="Info        : "),
            'skip': response(color=Fore.BLUE, label="SKIP", intl='S', title="Missing Deps: "),
            'fingerprint': response(color=Fore.YELLOW, label="FINGERPRINT", intl='P',
                                  title="Fingerprint : "),
            'metadata': response(color=Fore.YELLOW, label="META", intl='M', title="Metadata    : "),
            'metadata_key': response(color=Fore.MAGENTA, label="META", intl='K', title="Metadata Key: "),
            'exception': response(color=Fore.RED, label="EXCEPT", intl='E', title="Exceptions  : ")
        }

        self.counts = {}
        for key in self.responses:
            self.counts[key] = 0

        self.print_header("Progress:", Fore.CYAN)
        self.broker.add_observer(self.progress_bar, rule)
        self.broker.add_observer(self.progress_bar, condition)
        self.broker.add_observer(self.progress_bar, incident)
        self.broker.add_observer(self.progress_bar, parser) 
开发者ID:RedHatInsights,项目名称:insights-core,代码行数:25,代码来源:text.py

示例5: banner

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def banner():
    print(
        Style.BRIGHT
        + Color.MAGENTA
        + """


          _/_/_/                                          _/        _/  _/
       _/          _/_/      _/_/_/  _/  _/_/    _/_/_/  _/_/_/    _/  _/
        _/_/    _/_/_/_/  _/    _/  _/_/      _/        _/    _/  _/_/_/_/
           _/  _/        _/    _/  _/        _/        _/    _/      _/
    _/_/_/      _/_/_/    _/_/_/  _/          _/_/_/  _/    _/      _/


        > version 1.0
        > Script to find user account on various platforms.
        """
        + Style.RESET_ALL
    ) 
开发者ID:0xknown,项目名称:Search4,代码行数:21,代码来源:utils.py

示例6: color

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def color(s, c, style="bright"):
    color_map = {
        "black": Fore.BLACK,
        "red": Fore.RED,
        "green": Fore.GREEN,
        "yellow": Fore.YELLOW,
        "blue": Fore.BLUE,
        "magenta": Fore.MAGENTA,
        "cyan": Fore.CYAN,
        "white": Fore.WHITE,
    }
    style_map = {
        "dim": Style.DIM,
        "normal": Style.NORMAL,
        "bright": Style.BRIGHT,
    }

    return color_map[c] + style_map[style] + s + Style.RESET_ALL 
开发者ID:vinayak-mehta,项目名称:nbcommands,代码行数:20,代码来源:_grep.py

示例7: main

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def main(SONG_NAME=''):
    """Run on program call."""
    cache = Cache()
    match = cache.search(SONG_NAME)
    if match:
        PREPEND(1)
        print(Fore.MAGENTA, end='')
        print('{} '.format(SONG_NAME), end='')
        print(Style.RESET_ALL, end='')
        print('found.')
        while True:
            choice = input('Do you still want to continue[y/n]')
            choice = choice.lower()
            if choice == 'y' or choice == 'Y':
                return True
            elif choice == 'n' or choice == 'N':
                return False
    else:
        return True 
开发者ID:deepjyoti30,项目名称:ytmdl,代码行数:21,代码来源:cache.py

示例8: main

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def main(self, s):
    # Trims input s to be just the city/region name
    s = s.replace('time ', '').replace('in ', '')

    exists = os.path.isfile(module_path + 'key_timein.json')
    if not exists:
        shutil.copy2(
            module_path
            + 'samplekey_timein.json',
            module_path
            + 'key_timein.json')
        print(
            Fore.RED
            + "Generate api key here: https://developers.google.com/maps/documentation/geocoding/start?hl=en_US")
        print(
            Fore.RED
            + "and add it to jarviscli/data/key_timein.json"
            + Fore.RESET)
        return

    # Transforms a city name into coordinates using Google Maps API
    loc = getLocation(s)
    if loc is None:
        return
    # Gets current date and time using TimeZoneDB API
    send_url = (
        "http://api.timezonedb.com/v2/get-time-zone?"
        "key=BFA6XBCZ8AL5&format=json"
        "&by=position&lat={:.6f}&lng={:.6f}".format(*loc)
    )
    r = requests.get(send_url)
    j = json.loads(r.text)
    time = j['formatted']
    self.dst = j['dst']
    # Prints current date and time as YYYY-MM-DD HH:MM:SS
    print("{COLOR}The current date and time in {LOC} is: {TIME}{COLOR_RESET}"
          .format(COLOR=Fore.MAGENTA, COLOR_RESET=Fore.RESET,
                  LOC=str(s).title(), TIME=str(time))) 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:40,代码来源:timeIn.py

示例9: remind_add

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def remind_add(self, jarvis, s, time_in_parser, example):
        s = s.split(" to ")
        if len(s) != 2:
            jarvis.say("Sorry, please say something like:", Fore.MAGENTA)
            jarvis.say(" > {}".format(example), Fore.MAGENTA)
            return

        time_in = time_in_parser(s[0])
        while time_in is None:
            jarvis.say("Sorry, when should I remind you?", Fore.MAGENTA)
            time_in = time_in_parser(jarvis.input("Time: "))
        timestamp = time.time() + time_in

        message = s[1]
        notification_message = message

        todo_refere_id = None
        if message == 'todo':
            message = ''
            todo_refere_entry = self.interact().select_one_remind(jarvis)
            if todo_refere_entry is None:
                jarvis.say("Nothing selected", Fore.MAGENTA)
                return
            notification_message = todo_refere_entry['message']
            notification_message = "TODO: {}".format(notification_message)
            todo_refere_id = todo_refere_entry['id']

        # schedule
        schedule_id = jarvis.schedule(time_in, self.reminder_exec,
                                      notification_message)
        self.add(jarvis, message, timestamp=timestamp, schedule_id=schedule_id,
                 todo_refere_id=todo_refere_id) 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:34,代码来源:reminder.py

示例10: bright_foreground

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def bright_foreground(self):
        color = {
            'red'       : '{0}{1}'.format(Fore.RED, Style.BRIGHT),
            'cyan'      : '{0}{1}'.format(Fore.CYAN, Style.BRIGHT),
            'green'     : '{0}{1}'.format(Fore.GREEN, Style.BRIGHT),
            'yellow'    : '{0}{1}'.format(Fore.YELLOW, Style.BRIGHT),
            'blue'      : '{0}{1}'.format(Fore.BLUE, Style.BRIGHT),
            'magenta'   : '{0}{1}'.format(Fore.MAGENTA, Style.BRIGHT),
            'white'     : '{0}{1}'.format(Fore.WHITE, Style.BRIGHT),
            'grey'      : '{0}{1}'.format(Fore.WHITE, Style.RESET_ALL)
        }
        return color 
开发者ID:dfirence,项目名称:drone,代码行数:14,代码来源:colors.py

示例11: print_purpul

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def print_purpul(*args):
    """"""
    raw = str(args)
    init(autoreset=True)
    print((Fore.MAGENTA + raw))

#---------------------------------------------------------------------- 
开发者ID:VillanCh,项目名称:g3ar,代码行数:9,代码来源:print_utils.py

示例12: do_banner

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def do_banner(self, args):
        """Print WebPocket banner"""
        ascii_text = text2art("WebPocket", "rand")
        self.poutput("\n\n")
        self.poutput(ascii_text, '\n\n', color=Fore.LIGHTCYAN_EX)
        self.poutput("{art} WebPocket has {count} modules".format(art=art("inlove"), count=self.get_module_count()), "\n\n", color=Fore.MAGENTA) 
开发者ID:TuuuNya,项目名称:WebPocket,代码行数:8,代码来源:Pocket.py

示例13: banner

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def banner(self):        
        self.clear() 

        banner = choice(banners)
        color = choice([Fore.GREEN, Fore.YELLOW, Fore.RED, Fore.MAGENTA, Fore.BLUE, Fore.CYAN])

        print(color)
        print(banner.format('{0}V.{1}{2}'.format(Fore.WHITE, version, Fore.RESET))) 
开发者ID:Pure-L0G1C,项目名称:SQL-scanner,代码行数:10,代码来源:display.py

示例14: magenta

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def magenta(text, readline=False):
    return Fore.MAGENTA + str(text) + Fore.RESET 
开发者ID:opensourcesec,项目名称:CIRTKit,代码行数:4,代码来源:colors.py

示例15: result_collector

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import MAGENTA [as 别名]
def result_collector(result_queue):
  """Collect and display results."""

  def notename(n, space):
    if space:
      return [' ', '  ', ' ', ' ', '  ', ' ', '  ', ' ', ' ', '  ', ' ',
              '  '][n % 12]
    return [
        Fore.BLUE + 'A' + Style.RESET_ALL,
        Fore.LIGHTBLUE_EX + 'A#' + Style.RESET_ALL,
        Fore.GREEN + 'B' + Style.RESET_ALL,
        Fore.CYAN + 'C' + Style.RESET_ALL,
        Fore.LIGHTCYAN_EX + 'C#' + Style.RESET_ALL,
        Fore.RED + 'D' + Style.RESET_ALL,
        Fore.LIGHTRED_EX + 'D#' + Style.RESET_ALL,
        Fore.YELLOW + 'E' + Style.RESET_ALL,
        Fore.WHITE + 'F' + Style.RESET_ALL,
        Fore.LIGHTBLACK_EX + 'F#' + Style.RESET_ALL,
        Fore.MAGENTA + 'G' + Style.RESET_ALL,
        Fore.LIGHTMAGENTA_EX + 'G#' + Style.RESET_ALL,
    ][n % 12]  #+ str(n//12)

  print('Listening to results..')
  # TODO(mtyka) Ensure serial stitching of results (no guarantee that
  # the blocks come in in order but they are all timestamped)
  while True:
    result = result_queue.get()
    serial = result.audio_chunk.serial
    result_roll = result.result
    if serial > 0:
      result_roll = result_roll[4:]
    for notes in result_roll:
      for i in range(6, len(notes) - 6):
        note = notes[i]
        is_frame = note[0] > 0.0
        notestr = notename(i, not is_frame)
        print(notestr, end='')
      print('|') 
开发者ID:magenta,项目名称:magenta,代码行数:40,代码来源:onsets_frames_transcription_realtime.py


注:本文中的colorama.Fore.MAGENTA属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。