예제 #1
0
def login_prompt():
    print("======================")
    print("Logue-se")
    print("======================\n")

    user = UserForm()
    params = user.render()


    response = sign_in(params)

    # import code;
    # code.interact(local=dict(globals(), **locals()))

    if response["status"] == 200:
        print(response["message"]) # "alert"
    else:
        clear()

        print("Ocorreu um Erro! \n")
        print(response["body"])

        user_register_input = input("Deseja se cadastrar? (Sim/Não): ")
        user_sign_up = "s" in user_register_input

        if user_sign_up:
            clear()
            redirect_to_sign_up()
예제 #2
0
def replhelp():
	"""Return help text for the REPL."""
	utils.clear()
	utils.printf.logPrint("Most of the time the 'user' arg can be omitted", LogType.INFO)
	utils.printf.logPrint("Functions: ", LogType.BOLD)
	for name, function in functions.items():
		params = list(function.__code__.co_varnames[: function.__code__.co_argcount])
		utils.printf.logPrint(f"- {name} : {params}")
예제 #3
0
def showrepo(repo: str, user: str | None = None):
	"""Print user repo data for a given repo."""
	utils.clear()
	user = username if user is None else user
	rawMarkdown = github_rest.getReadme(user + "/" + repo)
	repoText = github_rest.getRepo(user + "/" + repo)
	github_rest.printRepo(repoText)
	utils.printf.logPrint("README", LogType.BOLD)
	printMarkdown(rawMarkdown, 1)
예제 #4
0
def profile(user: str | None = None):
	"""Print user profile info."""
	user = username if user is None else user
	utils.clear()
	userData = github_rest.getUser(user)
	utils.printf.logPrint(f"{userData['name']}", LogType.BOLD)
	utils.printf.logPrint(
		f"""{userData['login']}
Avatar: {userData['avatar_url']}
Company: {userData['company']}
Location: {userData['location']}
Email: {userData['email']}
Followers: {userData['followers']} Following: {userData['following']}"""
	)
예제 #5
0
def render_index():
    users = get_index()
    clear()
    print("""
        ======================================
            LISTA DE USUARIOS CADASTRADOS
        ======================================
    \n\n
    """)
    for user in users:
        print(
            f"Usuario: { user.username }  | Cadastrado em: { user.created_at }"
        )

    input("\n ..Aperte enter para voltar ao menu")
예제 #6
0
def render_index():
    clear()
    vehicles = index()
    print("""
    ==============================
        VEICULOS CADASTRADOS
    ==============================
    \n\n
    """)
    if len(vehicles) > 0:
        for vehicle in vehicles:
            print(vehicle_card(vehicle))

    else:
        print("Nao existem veiculos cadastrados")

    input("\n ..Aperte enter para voltar ao menu")
예제 #7
0
import json
from lib.game import Game
from lib.utils import clear
from lib.constants import colors, color_names
from termcolor import colored


game = Game(4, 6)

tries = []
tests = []


while True:
    clear()

    for i, l in enumerate(tries):
        ok, near = tests[i]
        res = ["\u25cf"] * ok + ["\u25d0"] * near + ["\u25cb"] * (len(game.target) - ok - near)
        line = "  ".join(res) + "    -    " + "  ".join([colored("\u25cf", color_names[it]) for it in l])
        print(line)
        print("")

    print("")
    print("")
    print("")

    print("                                      Available colors: " + "  ".join(colors))

    if game.success:
        print(f"Game won in {game.try_count} moves")
예제 #8
0
def showreadme(repo: str, user: str | None = None):
	"""Print the readme for a given repo."""
	utils.clear()
	user = username if user is None else user
	printMarkdown(github_rest.getReadme(user + "/" + repo))
예제 #9
0
def clear(self, *args, **kwargs):
    utils.clear(self, *args, **kwargs)