Exemplo n.º 1
0
def b_call(event):
    """
    Button functionality stuff
    """
    a = Choice('investing', slope_input.value, int_input.value)
    b = Choice('not investing', var_input.value)

    ALL = slice(len(df.data['x']))

    df.patch({
        'y': [(ALL, df.data['x'] * a.slope + a.inter)],
        'y2': [(ALL, df.data['x'] * b.slope)]
    })

    try:
        diff = Choice.when_equal(a, b)
        BUF = 10
        SOL = diff['sol']['x']
        eq_solve.location = SOL
        answer.text = diff['descr']

        p.x_range.start = SOL - BUF
        p.x_range.end = SOL + BUF

        p.y_range.start = diff['sol']['y'] - BUF
        p.y_range.end = diff['sol']['y'] + BUF

    except ValueError:
        eq_solve.location = 0
        answer.text = 'There isnt a solution'
Exemplo n.º 2
0
 def __init__(self):
     # 初始化程序
     self.download = Downloader()
     self.parser = HtmlParser()
     self.save = SaveData()
     self.workbook = Workbook()
     self.ch = Choice()
     print('初始化完成...')
 def __init__(self):
     """
     Initialize a new UI with a background image and
     """
     self.root = None
     self.init_window()
     self.new_choice = Choice()
     self.set_background()      # To set the background image in place
     self.count = 0
Exemplo n.º 4
0
 def _purchase_or_play_treasure_choice(self, player):
     return Choice(
         player.get_name(),
         list({(ChoiceType.play, card.name)
               for card in player.get_hand()
               if card.type == CardType.treasure}) +
         [(ChoiceType.buy, card.name)
          for card in self._cards_available_at(player.get_available_spend())
          ] + [(ChoiceType.end_turn, )])
Exemplo n.º 5
0
from choice import Choice
from schoolFileReader import SchoolFileReader

while True:
    print("이용하고 싶은 서비스를 입력해주세요 : ")
    print("1. 관심있는 분야의 고등학교 알아보기\n2. 마이페이지")

    write = input()

    if write == "1":
        c = Choice()
        c.choice()

        while True:
            print("다시 시작하시겠습니까 ?(y / n) ")
            answer = input()

            if answer == "y":
                print(
                    "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n다시 시작합니다 ! "
                )
                break
            elif answer == "n":
                print("종료합니다 ! ")
                break
            else:
                print("다시 입력 해주세요")

    elif write == "2":
        fr = SchoolFileReader()
        fr.schoolFileReader()
Exemplo n.º 6
0
    conf = Configuration(storage, config)
    questions = load_database(config.get("db", "questions"))
    msgdb = MessageDatabase(questions)
    pingpong = PingPong()
    alphabet = Alphabet(storage, conf)
    count = Count(storage, conf)
    greet = Greet(
        [x.strip() for x in config.get("modules", "greetings").split(",")],
        nick)
    flooding = Flooding(conf)

    search_engines = load_database(config.get("db", "searchengines"))
    search = Search(search_engines)
    #expression = Expression()
    actions = Actions(storage)
    choice = Choice(conf)
    scripting = Scripting(storage, search_engines=search_engines)
    fatfox = FatFox()
    burgi = Burgi()
    cookies = Cookies()
    #urltitle = Urltitle()
    #finder = Finder()
    hands = Hands(storage, conf, config.get("modules", "hands"))
    weather = Weather(storage, conf, config.get("modules", "hands"))
    mute = Mute(storage)

    conf.add_handler('mute', mute.config_handler)
    conf.add_handler(['show', 'mute'], mute.show_handler)
    conf.add_handler(['show', 'participants'], status.show_participants)
    conf.add_handler(['show', 'online', 'users'], status.show_online_users)
Exemplo n.º 7
0
 def add_choice(self, description, res_moment):
     self.choices_.append(Choice(description, res_moment))
Exemplo n.º 8
0
    "MenuFrauenhoferParser": MenuFrauenhoferParser,
    "MenuSolarParser": MenuSolarParser,
    "FoodTruckParser": FoodTruckParser,
    "NullParser": NullParser
}

choices = []
for ident, args in config.items("restaurants"):
    logging.info("Loading parser: %s (%s)" % (ident, args))
    argList = [item.strip() for item in args.split(",")]
    parserClass = PARSER[argList[1]]
    if parserClass is None:
        logging.error("No parser class found: %s" % argList[1])
        continue
    parser = parserClass(argList[2])
    choice = Choice(ident, argList[0], parser)
    choices.append(choice)

GuessingGabin.databasePath = os.path.join(BASE_DIR,
                                          config.get("misc", "dbpath"))

log = logging.getLogger('werkzeug')
log.setLevel(logging.WARNING)

voteFormGenerator = VoteFormGenerator(VERSION, choices)


@app.route('/', methods=['GET', 'POST'])
def showVoteForm():
    return voteFormGenerator.getVoteForm()
Exemplo n.º 9
0
 def __init__(self, name, names, maxPlayers):
     self._name = name
     self._choices = list(map(lambda n: Choice(n), names))
     self._maxPlayers = maxPlayers
Exemplo n.º 10
0
 def addChoice(self, name):
     if not self.hasChoice(name):
         self._choices.append(Choice(name))
Exemplo n.º 11
0
def comment(text):
    return "\n".join(["# %s" % line for line in text.splitlines()])


#=============================================================================
# Create the Plan object: we need to add all the possible choices a user may
# want to make and the code to use for each choice.
plan = ChoiceList("I'm now going to ask a few questions in order to build a "
                  "plan for making the distribution (a plan is just a shell "
                  "script that you can run to re-create the distribution so "
                  "that you don't need to answer the same questions again "
                  "and again).")

use_def_un = plan.add_choice(
    Choice("Which username should I use to access "
           "the repositories?"))
use_def_un.add_alternative(Alternative("Use '%s'." % username))
use_def_un.add_alternative(Alternative("Use a different username."))

what_un = plan.add_choice(OpenQuestion("What username shoud I use?"))
what_un.when_should_ask(lambda: use_def_un.chosen == 1)

want_ctr = plan.add_choice(
    Choice("Which repositories do you want to use as "
           "source for building the tarball?"))
want_ctr.add_alternative(Alternative("Use the central repositories."))
want_ctr.add_alternative(
    Alternative("Use the current repository for src and "
                "central repositories for doc and test."))

want_old = plan.add_choice(
Exemplo n.º 12
0
 def add_choice(self, description, res_node):
     self.choices_ = [Choice(description, res_node)] + self.choices_
     print("INFO: New choice added: links node " + self.name_ + " with node " + res_node.name_ + ".")
Exemplo n.º 13
0
question_list = []

for line in questions_and_answers:
    question_data = line.strip().split(';')

    question = question_data[0]

    a = question_data[1]
    b = question_data[2]
    c = question_data[3]
    d = question_data[4]

    answer = question_data[5]

    question_list.append(Question(question, Choice(a, b, c, d), answer))

questions_and_answers.close()
print_ascii('welcome.txt')

number_of_correct = 0

for question in question_list:
    print(question.question + '\n')
    choices = question.choices
    print("(A) " + choices.a)
    print("(B) " + choices.b)
    print("(C) " + choices.c)
    print("(D) " + choices.d + "\n")

    answer = input("Your Answer: ")
Exemplo n.º 14
0
 def add_choice(self, description, res_moment):
     self.choices_ = [Choice(description, res_moment)] + self.choices_