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


Python Fore.YELLOW属性代码示例

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


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

示例1: list_submissions

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def list_submissions(reddit, post_list, parser):
        print("\nChecking if post(s) exist...")
        posts, not_posts = Validation.Validation.existence(s_t[2], post_list, parser, reddit, s_t)
        
        if not_posts:
            print(Fore.YELLOW + Style.BRIGHT + 
                "\nThe following posts were not found and will be skipped:")
            print(Fore.YELLOW + Style.BRIGHT + "-" * 55)
            print(*not_posts, sep = "\n")

        if not posts:
            print(Fore.RED + Style.BRIGHT + "\nNo submissions to scrape!")
            print(Fore.RED + Style.BRIGHT + "\nExiting.\n")
            quit()

        return posts 
开发者ID:JosephLai241,项目名称:URS,代码行数:18,代码来源:Comments.py

示例2: list_redditors

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def list_redditors(parser, reddit, user_list):
        print("\nChecking if Redditor(s) exist...")
        users, not_users = Validation.Validation.existence(s_t[1], user_list, parser, reddit, s_t)
        
        if not_users:
            print(Fore.YELLOW + Style.BRIGHT + 
                "\nThe following Redditors were not found and will be skipped:")
            print(Fore.YELLOW + Style.BRIGHT + "-" * 59)
            print(*not_users, sep = "\n")

        if not users:
            print(Fore.RED + Style.BRIGHT + "\nNo Redditors to scrape!")
            print(Fore.RED + Style.BRIGHT + "\nExiting.\n")
            quit()

        return users 
开发者ID:JosephLai241,项目名称:URS,代码行数:18,代码来源:Redditor.py

示例3: list_subreddits

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def list_subreddits(parser, reddit, s_t, sub_list):
        print("\nChecking if Subreddit(s) exist...")
        subs, not_subs = Validation.Validation().existence(s_t[0], sub_list, parser, reddit, s_t)
        
        if not_subs:
            print(Fore.YELLOW + Style.BRIGHT + 
                "\nThe following Subreddits were not found and will be skipped:")
            print(Fore.YELLOW + Style.BRIGHT + "-" * 60)
            print(*not_subs, sep = "\n")

        if not subs:
            print(Fore.RED + Style.BRIGHT + "\nNo Subreddits to scrape!")
            print(Fore.RED + Style.BRIGHT + "\nExiting.\n")
            quit()

        return subs 
开发者ID:JosephLai241,项目名称:URS,代码行数:18,代码来源:Subreddit.py

示例4: GetCredentials

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def GetCredentials():
    global repoName
    global private
    global username
    global password

    if repoName == "":
        repoName = input("Enter a name for the GitHub repository: ")
    if private == "":
        private = input("Private GitHub repository (y/n): ")
    while private != False and private != True:
        if private == "y":
            private = True
        elif private == "n":
            private = False
        else:
            print("{}Invalid value.{}".format(Fore.YELLOW, Fore.WHITE))
            private = input("Private GitHub repository (y/n): ")
    if username == "":
        username = input("Enter your GitHub username: ")
    if username == "" or password == "":
        password = getpass.getpass("Enter your GitHub password: ")


# creates GitHub repo if credentials are valid 
开发者ID:jarodburchill,项目名称:project-automation,代码行数:27,代码来源:automate_project.py

示例5: handle_one_request

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def handle_one_request(self):
        """Catch more exceptions than default

        Intend to catch exceptions on local side
        Exceptions on remote side should be handled in do_*()
        """
        try:
            BaseHTTPRequestHandler.handle_one_request(self)
            return
        except (ConnectionError, FileNotFoundError) as e:
            logger.warning("%03d " % self.reqNum + Fore.RED + "%s %s", self.server_version, e)
        except (ssl.SSLEOFError, ssl.SSLError) as e:
            if hasattr(self, 'url'):
                # Happens after the tunnel is established
                logger.warning("%03d " % self.reqNum + Fore.YELLOW + '"%s" while operating on established local SSL tunnel for [%s]' % (e, self.url))
            else:
                logger.warning("%03d " % self.reqNum + Fore.YELLOW + '"%s" while trying to establish local SSL tunnel for [%s]' % (e, self.path))
        self.close_connection = 1 
开发者ID:wheever,项目名称:ProxHTTPSProxyMII,代码行数:20,代码来源:ProxyTool.py

示例6: tunnel_traffic

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def tunnel_traffic(self):
        "Tunnel traffic to remote host:port"
        logger.info("%03d " % self.reqNum + Fore.CYAN + '[D] SSL Pass-Thru: https://%s/' % self.path)
        server_conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        try:
            server_conn.connect((self.host, int(self.port)))
            self.wfile.write(("HTTP/1.1 200 Connection established\r\n" +
                              "Proxy-agent: %s\r\n" % self.version_string() +
                              "\r\n").encode('ascii'))
            read_write(self.connection, server_conn)
        except TimeoutError:
            self.wfile.write(b"HTTP/1.1 504 Gateway Timeout\r\n\r\n")
            logger.warning("%03d " % self.reqNum + Fore.YELLOW + 'Timed Out: https://%s:%s/' % (self.host, self.port))
        except socket.gaierror as e:
            self.wfile.write(b"HTTP/1.1 503 Service Unavailable\r\n\r\n")
            logger.warning("%03d " % self.reqNum + Fore.YELLOW + '%s: https://%s:%s/' % (e, self.host, self.port))
        finally:
            # We don't maintain a connection reuse pool, so close the connection anyway
            server_conn.close() 
开发者ID:wheever,项目名称:ProxHTTPSProxyMII,代码行数:21,代码来源:ProxyTool.py

示例7: view_logs

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def view_logs(server: str, token: str) -> None:
    async with ClientSession() as session:
        async with session.ws_connect(f"{server}/_matrix/maubot/v1/logs") as ws:
            await ws.send_str(token)
            try:
                msg: WSMessage
                async for msg in ws:
                    if msg.type == WSMsgType.TEXT:
                        if not handle_msg(msg.json()):
                            break
                    elif msg.type == WSMsgType.ERROR:
                        print(Fore.YELLOW + "Connection error: " + msg.data + Fore.RESET)
                    elif msg.type == WSMsgType.CLOSE:
                        print(Fore.YELLOW + "Server closed connection" + Fore.RESET)
            except asyncio.CancelledError:
                pass 
开发者ID:maubot,项目名称:maubot,代码行数:18,代码来源:logs.py

示例8: write_plugin

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def write_plugin(meta: PluginMeta, output: Union[str, IO]) -> None:
    with zipfile.ZipFile(output, "w") as zip:
        meta_dump = BytesIO()
        yaml.dump(meta.serialize(), meta_dump)
        zip.writestr("maubot.yaml", meta_dump.getvalue())

        for module in meta.modules:
            if os.path.isfile(f"{module}.py"):
                zip.write(f"{module}.py")
            elif module is not None and os.path.isdir(module):
                zipdir(zip, module)
            else:
                print(Fore.YELLOW + f"Module {module} not found, skipping" + Fore.RESET)

        for file in meta.extra_files:
            zip.write(file) 
开发者ID:maubot,项目名称:maubot,代码行数:18,代码来源:build.py

示例9: perform

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def perform(self, requests=None):
        for stage_info, code, request in self.api.dispatch_open_requests(requests):
            action = request.find('action')
            target_package = action.find('target').get('package')
            if code == 'unstage':
                # Technically, the new request has not been staged, but superseded the old one.
                code = None
            verbage = self.CODE_MAP[code]
            if code is not None:
                verbage += ' in favor of'
            print('request {} for {} {} {} in {}'.format(
                request.get('id'),
                Fore.CYAN + target_package + Fore.RESET,
                verbage,
                stage_info['rq_id'],
                Fore.YELLOW + stage_info['prj'] + Fore.RESET)) 
开发者ID:openSUSE,项目名称:openSUSE-release-tools,代码行数:18,代码来源:supersede_command.py

示例10: create_json_feed

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def create_json_feed(meta, json_path):
        #Creating JSON feed using scripts in cbfeeds/
        data = generate_feed.create_feed(meta)
        #print data

        #Saving the data to file in json_feeds/
        try:
            print((Fore.YELLOW + '[*]' + Fore.RESET), end=' ')
            print('Saving report to: %s' % json_path)
            dump_data = open(json_path, 'w+').write(data)
        except:
            print((Fore.RED + '[-]' + Fore.RESET), end=' ')
            print('Could not dump report to %s' % json_path)
            exit(0)

        return 
开发者ID:opensourcesec,项目名称:Forager,代码行数:18,代码来源:cb_tools.py

示例11: print_line

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def print_line(message, level=1, category = None, title = None, status=False):
    sts = get_status(category, status)

    if sts == 'applied':
        color = Fore.GREEN
        pre = '[+] '
    elif sts == 'touse':
        color = Fore.YELLOW
        pre = '[+] '
    elif sts == 'toremove':
        color = Fore.RED
        pre = '[-] '
    else:
        color = ''
        pre = ''

    if title:
        print(' '*4*level + Style.BRIGHT + title + ': ' + Style.RESET_ALL + message)
    else:
        print(' '*4*level + color + Style.BRIGHT + pre + Fore.RESET + message) 
开发者ID:gildasio,项目名称:h2t,代码行数:22,代码来源:output.py

示例12: todays_games

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def todays_games(self, jarvis):
        jarvis.spinner_start('Fetching...')
        date = datetime.datetime.now().strftime('%Y-%m-%d')
        response = self.fetch_data("games?date={}".format(date))
        if response is None:
            jarvis.spinner_stop("Error While Loading Matches - Try Again Later.", Fore.YELLOW)
            return
        total_count = response["results"]
        matches = response["response"]
        if total_count == 0:
            jarvis.spinner_stop("There is No Matches Today", Fore.YELLOW)
            return
        jarvis.spinner_stop("Found {} Matches".format(total_count))
        for i in range(total_count):
            match = matches[i]
            time = match["time"]
            country = match["country"]["name"]
            league = match["league"]["name"]
            teams = "{} VS {}".format(match["teams"]["home"]["name"], match["teams"]["away"]["name"])
            print(" {}. {} {} {} {}".format(i + 1, country, league, time, teams)) 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:22,代码来源:basketball.py

示例13: binary

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def binary(jarvis, s):
    """
    Converts an integer into a binary number
    """

    if s == "":
        s = jarvis.input("What's your number? ")

    try:
        n = int(s)
    except ValueError:
        jarvis.say("This is no number, right?", Fore.RED)
        return
    else:
        if n < 0:
            jarvis.say("-" + bin(n)[3:], Fore.YELLOW)
        else:
            jarvis.say(bin(n)[2:], Fore.YELLOW) 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:20,代码来源:binary.py

示例14: matches

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def matches(self, jarvis, compId):
        """
        Fetches today's matches in given competition
        and prints the match info
        """
        print()
        jarvis.spinner_start('Fetching ')
        r = fetch("/matches?competitions={}".format(compId))
        if r is None:
            jarvis.spinner_stop("Error in fetching data - try again later.", Fore.YELLOW)
            return

        jarvis.spinner_stop('')
        if r["count"] == 0:
            jarvis.say("No matches found for today.", Fore.BLUE)
            return
        else:
            # Print each match info
            for match in r["matches"]:
                matchInfo = self.formatMatchInfo(match)
                length = len(matchInfo)
                jarvis.say(matchInfo[0], Fore.BLUE)
                for i in range(1, length):
                    print(matchInfo[i])
                print() 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:27,代码来源:football.py

示例15: check_ram__WINDOWS

# 需要导入模块: from colorama import Fore [as 别名]
# 或者: from colorama.Fore import YELLOW [as 别名]
def check_ram__WINDOWS(jarvis, s):
    """
    checks your system's RAM stats.
    -- Examples:
        check ram
    """
    import psutil
    mem = psutil.virtual_memory()

    def format(size):
        mb, _ = divmod(size, 1024 * 1024)
        gb, mb = divmod(mb, 1024)
        return "%s GB %s MB" % (gb, mb)
    jarvis.say("Total RAM: %s" % (format(mem.total)), Fore.BLUE)
    if mem.percent > 80:
        color = Fore.RED
    elif mem.percent > 60:
        color = Fore.YELLOW
    else:
        color = Fore.GREEN
    jarvis.say("Available RAM: %s" % (format(mem.available)), color)
    jarvis.say("RAM used: %s%%" % (mem.percent), color) 
开发者ID:sukeesh,项目名称:Jarvis,代码行数:24,代码来源:systemOptions.py


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