Esempio n. 1
0
    def do_quit(self, arg):
        """Quits out of Interactive Mode."""

        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        print('Thank you for trying out the quizzes!\n')
        print("Try another quiz!\n")
        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        cprint(figlet_format("Visit Soon!"), 'yellow', attrs=['bold'])
        
        exit()
Esempio n. 2
0
class MyInteractive(cmd.Cmd):
    print (colored('='.center(170,"="), 'green', attrs=['bold']))
    print (colored('='.center(170,"="), 'green', attrs=['bold']))
    f = Figlet(font = 'slant')
    cprint(figlet_format('SMART', font='univers'),'red', 'on_grey', attrs=['bold'])
    print (colored('='.center(170,"="), 'green', attrs=['bold']))
    print (colored('='.center(170,"="), 'green', attrs=['bold']))
    cprint(figlet_format('READY?'), 'yellow', attrs=['bold'])
    intro = "Let's get started!\n" + "(type help for a command list.)"
    prompt = '(quiz_list) '
    file = None

#definition of docopt commands
    @docopt_cmd
    def do_list_quizzes(self, args):
        """Usage: list_quizzes"""
        quiz_list()

    @docopt_cmd
    def do_quiz_import(self, args):
        """Usage: quiz_import <quiz_path> """
        quiz_import(args["<quiz_path>"])

    @docopt_cmd
    def do_take_quiz(self, args):
        """Usage: take_quiz <quiz_name> """
        print(take_quiz(args["<quiz_name>"]))
        

    def do_quit(self, arg):
        """Quits out of Interactive Mode."""

        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        print('Thank you for trying out the quizzes!\n')
        print("Try another quiz!\n")
        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        print (colored('='.center(170,"="), 'green', attrs=['bold']))
        cprint(figlet_format("Visit Soon!"), 'yellow', attrs=['bold'])
        
        exit()
Esempio n. 3
0
def log(string, color='white', font="colossal", figlet=False):
    if colored:
        if not figlet:
            six.print_(colored(figlet_format(string, font=font), color))
        else:
            six.print_(string)
def yazdir(url):
    global exit
    global href
    say = 0
    link = []
    client = requests.session()
    soup = bs(client.get(url).text, 'html.parser')
    print(colored("Which one?", "red"))
    for a, b in zip(soup.findAll('td', {'class': 'n'}),
                    soup.findAll('td', {'class': 's'})):
        if b.text == '- \xa0':
            link.append([str(say), a.text, "DIRECTORY "])
        else:
            link.append([str(say), a.text, "FILE (" + b.text + ")"])
        say += 1

    for item in enumerate(link):
        print(
            colored(("[ " + str(int(item[1][0]) + 1) + " ]").ljust(6),
                    "green"),
            colored(" » ", "white") +
            colored("| " + (item[1][2]).ljust(14) + "|", "blue"),
            colored(item[1][1].rstrip('/'), "white"))
    print(colored("Press q to exit !", "red"))
    sor = input("Select one : ")
    os.system('cls' if os.name == 'nt' else 'clear')
    if sor == "q":
        print(
            colored(header, "blue") +
            colored("\n                            Come back when you need ..",
                    "green"))
        exit = True
    elif (int(sor) > len(link)) or (int(sor) == 0):
        print(colored("You have entered more than the list length.", "yellow"))
        return 0
    elif sor.isdigit():
        sor = int(sor) - 1
        git = link[sor][1]
        if "FILE" in link[sor][2]:
            indir = href + git
            with open(str(dizin) + "/" + git, 'wb') as f:
                cek = client.get(indir, stream=True)
                print(colored("Downloading : " + git, "yellow"))
                total_length = int(cek.headers.get('content-length'))
                for chunk in progress.bar(cek.iter_content(chunk_size=1024),
                                          expected_size=(total_length / 1024) +
                                          1):
                    if chunk:
                        f.write(chunk)
                        f.flush()
                print(colored("[\tCOMPLETED !\t]", "green"))

                return 0
        else:
            href = url_normalize(href + git)
  \/  \/  \___/ |_||_|   (_)  \___/ |_| |_||_|  \_/  \___||_|   |___/|_| \__| \__, |
          ______                        _                    _                 __/ |
          |  _  \                      | |                  | |               |___/
          | | | | ___ __      __ _ __  | |  ___    __ _   __| |  ___  _ __ 
          | | | |/ _ \\ \ /\ / /| '_ \ | | / _ \  / _` | / _` | / _ \| '__|
   __     | |/ /| (_) |\ V  V / | | | || || (_) || (_| || (_| ||  __/| |     __
   \ \    |___/  \___/  \_/\_/  |_| |_||_| \___/  \__,_| \__,_| \___||_|    / /
    \ \____________________________________________________________________/ /
     \______________________________________________________________________/
              D4rkbrain            __     __ https://github.com/burakunaltr
                                   \ \   / /
                                    \ \_/ /
                                     \   /
                                      \_/     
"""
print(colored(header, "green"))

href = "https://wolf.university/"
exit = False


def yazdir(url):
    global exit
    global href
    say = 0
    link = []
    client = requests.session()
    soup = bs(client.get(url).text, 'html.parser')
    print(colored("Which one?", "red"))
    for a, b in zip(soup.findAll('td', {'class': 'n'}),
                    soup.findAll('td', {'class': 's'})):