def update_availability():
    print(' ****************** Add available date **************** ')

    active_account = state.active_account

    if not active_account:
        error_msg(f'Please Login or create a new account : - ')
        return

    list_cages(supress_header=True)

    cagenumber = input('Book a Cage ?')
    if not cagenumber.strip():
        error_msg('Cancelled')
        print()

    cagenumber = int(cagenumber)
    account_cages = svc.find_cages_for_user(active_account)

    selectedcage = account_cages[cagenumber - 1]

    start_date = parser.parse(input('Enter available venom time slots?'))
    duration = int(input("How long can a stay be ? "))

    svc.add_available_date(selectedcage, start_date, duration)
    state.reload_account()

    success_msg(f'Date Added at {start_date} for {selectedcage.name}')
Exemplo n.º 2
0
def register_shelter():
    print(' ****************** REGISTER shelter **************** ')

    if not state.active_account:
        error_msg('You must login first to register a shelter.')
        return

    meters = input('How many square meters is the shelter? ')
    if not meters:
        error_msg('Cancelled')
        return

    meters = float(meters)
    carpeted = input("Is it carpeted [y, n]? ").lower().startswith('y')
    has_toys = input("Have pet toys [y, n]? ").lower().startswith('y')
    allow_dangerous = input("Can you host violent pets [y, n]? ").lower().startswith('y')
    name = input("Give your shelter a name: ")
    price = float(input("How much are you charging?  "))

    shelter = svc.register_shelter(
        state.active_account, name,
        allow_dangerous, has_toys, carpeted, meters, price
    )

    state.reload_account()
    success_msg(f'Register new shelter with id {shelter.id}.')
Exemplo n.º 3
0
def run():
    print(' ****************** Welcome Dancer **************** ')
    print()

    show_commands()

    while True:
        action = studios.get_action()

        with switch(action) as s:
            s.case('c', studios.create_account)
            s.case('l', studios.log_into_account)

            s.case('a', apply_to_teach)
            s.case('y', view_your_studios)
            s.case('b', book_a_class)
            s.case('v', view_bookings)
            s.case('m', lambda: 'change_mode')

            s.case('?', show_commands)
            s.case('', lambda: None)
            s.case(['x', 'bye', 'exit', 'exit()'], studios.exit_app)

            s.default(studios.unknown_command)

        state.reload_account()

        if action:
            print()

        if s.result == 'change_mode':
            return
Exemplo n.º 4
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg('You must login first to register a cage.')
        return

    meters = input('How many square meters is the cage? ')
    carpeted = input("Is it carpeted [y, n]? ").lower().startswith('y')
    has_toys = input("Have snake toys [y, n]? ").lower().startswith('y')
    allow_dangerous = input("Can you host venomous snakes [y, n]? ").lower().startswith('y')
    name = input("Give your cage a name: ")
    price = input("How much are you charging?  ")
    
    if ((not meters)or(not price)):
        error_msg('Dimension and price are mandatory')
        return
    try:
        meters = float(meters)
        price = float(price)
    except ValueError:    
        error_msg('Invalid dimension or price')
        return
        
    if name:
        name =str(name)
   
    cage = svc.register_cage( state.active_account, name, allow_dangerous, has_toys, carpeted, meters, price)

    state.reload_account()
    success_msg(f'Registered new cage with id {cage.id}.')
Exemplo n.º 5
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg("Voce precisa estar logado para continuar.")
        return

    meters = input("Quantos metros quadrados é a gaiola? ")
    if not meters:
        error_msg("Cancelado")
        return

    meters = float(meters)
    carpeted = input("Tem carpete [y, n]? ").lower().startswith('y')
    has_toys = input("Tem brinquedos [y, n]? ").lower().startswith('y')
    allow_dangerous = input("Pode receber cobras venenosas [y, n]? ").lower().startswith('y')
    name = input("Qual o nome? ")
    price = float(input("Qual o valor? "))

    cage = svc.register_cage(
        state.active_account, name,
        allow_dangerous, has_toys, carpeted, meters, price
    )

    state.reload_account()
    success_msg(f"Gaiola com o id {cage.id} registrada")
Exemplo n.º 6
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg("Must be logged in to register a cage")
        return

    metres = input('How many square metres is the cage? ')
    if not metres:
        error_msg('Cancelled - no input given')
        return

    metres = float(metres)
    carpeted = input('Is it carpeted (y/n)? ').lower().startswith('y')
    has_toys = input('Does it have toys (y/n)? ').lower().startswith('y')
    dangerous_snakes_allowed = input('Dangerous snakes allowed (y/n)? ').lower().startswith('y')
    name = input('Name of cage: ')
    price = float(input('Cage price: '))

    cage = svc.register_cage(
        state.active_account, name, price, metres, carpeted, has_toys, dangerous_snakes_allowed
    )

    state.reload_account()
    success_msg(f"New Cage {name} successfully registered with id '{cage.id}")
Exemplo n.º 7
0
def update_availability():
    print(' ****************** Add available date **************** ')

    if not state.active_account:
        error_msg("Must be logged in to update availability")
        return

    list_cages(suppress_header=True)

    cage_number = input("Enter cage number: ")
    if not cage_number:
        error_msg("Cancelled")
        return

    cage_number = int(cage_number)
    cages = svc.find_cages_for_user(state.active_account)
    selected_cage = cages[cage_number - 1]

    success_msg(f"Selected cage {selected_cage.name}")

    start_date = parser.parse(
        input("Enter date cage will be available from [yyyy-mm-dd]: ")
    )
    days = int(input('How many days will the cage be available for? '))

    svc.add_available_date(
        selected_cage,
        start_date,
        days
    )
    state.reload_account()

    success_msg(f'Date added to cage {selected_cage.name}')
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    active_account = state.active_account
    if not active_account:
        error_msg(f'Please Login or create a new account : - ')
        return

    meters = input("How many square meters is the Cage ?")
    if not meters:
        error_msg(f'Enter the Cage Size in sq.mts ')
        return

    meters = float(meters)
    carpeted = input("Is it carpeted [y, n]? ").lower().startswith('y')
    has_toys = input("Have snake toys [y, n]? ").lower().startswith('y')
    allow_dangerous = input(
        "Can you host venomous snakes [y, n]? ").lower().startswith('y')
    name = input("Give your cage a name: ")
    price = float(input("How much is a noit ?"))

    cage = svc.register_cage(state.active_account, name, allow_dangerous,
                             has_toys, carpeted, meters, price)

    state.reload_account()
    success_msg(f'Cage registered with ID {cage.id}')
Exemplo n.º 9
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg('You must login first to register for a cage.')
        return

    meters = input('How many square meters is the cage? ')
    price = input('How much are you charging? ')

    if not meters:
        error_msg('Cancelled')
        return

    meters = float(meters)
    carpeted = input('Is it carpeted [y, n]? ').lower().startswith('y')
    has_toys = input('Have snake toys [y, n]? ').lower().startswith('y')
    allow_dangerous = input(
        'Can you host a venomous snake [y, n]? ').lower().startswith('y')
    name = input('Give your cage a name: ')
    price = float(price)

    cage = svc.register_cage(state.active_account, name, allow_dangerous,
                             has_toys, carpeted, meters, price)

    state.reload_account()
    success_msg(f'Register new cage with id {cage.id}.')
def run():
    print(" ****************** Welcome guest **************** ")
    print()

    show_commands()

    while True:
        action = hosts.get_action()

        with switch(action) as s:
            s.case("c", hosts.create_account)
            s.case("l", hosts.log_into_account)

            s.case("a", add_a_snake)
            s.case("y", view_your_snakes)
            s.case("b", book_a_cage)
            s.case("v", view_bookings)
            s.case("m", lambda: "change_mode")

            s.case("?", show_commands)
            s.case("", lambda: None)
            s.case(["x", "bye", "exit", "exit()"], hosts.exit_app)

            s.default(hosts.unknown_command)

        state.reload_account()

        if action:
            print()

        if s.result == "change_mode":
            return
Exemplo n.º 11
0
def run():
    print(' ****************** Welcome guest **************** ')
    print()

    show_commands()

    while True:
        action = hosts.get_action()

        with switch(action) as s:
            s.case('c', hosts.create_account)
            s.case('l', hosts.log_into_account)

            s.case('a', add_a_snake)
            s.case('y', view_your_snakes)
            s.case('b', book_a_cage)
            s.case('v', view_bookings)
            s.case('m', lambda: 'change_mode')

            s.case('?', show_commands)
            s.case('', lambda: None)
            s.case(['x', 'bye', 'exit', 'exit()'], hosts.exit_app)

            s.default(hosts.unknown_command)

        state.reload_account()

        if action:
            print()

        if s.result == 'change_mode':
            return
Exemplo n.º 12
0
def add_a_cat():
    print(' ****************** Add a cat **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a cat")
        return

    name = str(input("What is your cat's name? "))
    if not (name.strip(' ')):
        error_msg('name cannot be empty')
        return

    height = input('Height your cat (in meters)? ')
    if not height:
        error_msg('Height is mandatory')
        return
    try:
        height = float(height)
    except ValueError:
        error_msg('Invalid height')
        return

    species = input("Species? ")
    if not (name.strip(' ')):
        error_msg('species cannot be empty')
        return

    not_angry = input(
        "Is your cat angry by nature [y]es, [n]o? ").lower().startswith('n')
    is_angry = not not_angry

    cat = svc.add_cat(state.active_account, name, height, species, is_angry)
    state.reload_account()
    success_msg('Created {} with id {}'.format(cat.name, cat.id))
Exemplo n.º 13
0
def register_event():
    print(' ****************** REGISTER EVENT **************** ')

    if not state.active_account:
        error_msg('You must login first to register a cage.')
        return

    minutes = input('How long is the duration for the event? ')
    if not minutes:
        error_msg('Cancelled')
        return

    minutes = float(minutes)
    in_public_place = input("Is it in a public space [y, n]? ").lower().startswith('y')
    in_outdoors = input("Is it outdoors [y, n]? ").lower().startswith('y')
    allow_non_friends = input("Do you allow strangers (non-friends) to join your event [y, n]? ").lower().startswith('y')
    name = input("Give your sportevent a name: ")
    location = input("Where are you looking play ? (Just city name for now)")
    rating_price = float(input("How much rating are you expecting for the players to have?  "))

    cage = svc.register_event(
        state.active_account, name,
        allow_non_friends, in_outdoors, in_public_place, minutes, rating_price, location
    )

    state.reload_account()
    success_msg(f'Register new sportevent with id {cage.id}.')
Exemplo n.º 14
0
def run():
    print(' ****************** Welcome team member **************** ')
    print()

    show_commands()

    while True:
        action = tmaker.get_action()

        with switch(action) as s:
            s.case('c', tmaker.create_account)
            s.case('l', tmaker.log_into_account)

            s.case('a', add_a_sportevent)
            s.case('y', view_your_sportevents)
            s.case('j', join_a_sport_event)
            s.case('v', view_your_joinings)
            s.case('m', lambda: 'change_mode')

            s.case('?', show_commands)  #help
            s.case('', lambda: None)
            s.case(['x', 'bye', 'exit', 'exit()'], tmaker.exit_app)

            s.default(tmaker.unknown_command)

        state.reload_account()

        if action:
            print()

        if s.result == 'change_mode':
            return
Exemplo n.º 15
0
def add_a_snake():
    print(' ****************** Add a snake **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a snake")
        return

    name = str(input("What is your snake's name? "))
    if not (name.strip(' ')):
        error_msg('name cannot be empty')
        return

    length = input('How long is your snake (in meters)? ')
    if not length:
        error_msg('Length is mandatory')
        return
    try:
        length = float(length)
    except ValueError:
        error_msg('Invalid length')
        return

    species = input("Species? ")
    if not (name.strip(' ')):
        error_msg('species cannot be empty')
        return

    not_venomous = input(
        "Is your snake venomous [y]es, [n]o? ").lower().startswith('n')
    is_venomous = not not_venomous

    snake = svc.add_snake(state.active_account, name, length, species,
                          is_venomous)
    state.reload_account()
    success_msg('Created {} with id {}'.format(snake.name, snake.id))
Exemplo n.º 16
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    # Require an account
    if not state.active_account:
        error_msg("You must login first to register a cage")
        return
    meters = input("How many square meters?")
    if not meters:
        error_msg("Cancled")
        return

    # get info about the cage
    meters = float(meters)
    carpated = input("Is is carpated? [y, n] ?").lower().startswith("y")
    has_toys = input("Have snake toys? [y, n] ?").lower().startswith("y")
    allow_dangerous = input(
        "Can you host venomous snake? [y, n]").lower().startswith("y")
    name = input("Give the name of your cage: ")
    price = float(input("Charge for the cage?"))

    # register the cage
    cage = svc.register_cage(state.active_account, price, name,
                             allow_dangerous, has_toys, carpated, meters)

    state.reload_account()
    success_msg(f"Cage registered successfully with id {cage.id}!")
Exemplo n.º 17
0
def update_availability():
    print(' ****************** Add available date **************** ')

    if not state.active_account:
        print("You need to login")
        return

    list_cages(supress_header=True)

    cage_num = input("Enter Cage num ")
    if not cage_num:
        print("Didnt enter cage num")
        return

    cage_num = int(cage_num)

    cages = svc.find_cage_for_user(state.active_account)
    selected_cage = cages[cage_num - 1]
    print(f"Selected cage {selected_cage}")
    # parser comes from dateutils in datetime module
    start_date = parser.parse(input("Enter start date[yyyy-mm-dd]: "))
    days = int(input("Hpw many days do you wish you rent: "))

    svc.add_date(selected_cage, start_date, days)
    state.reload_account()
def update_availability():
    print(" ****************** Add available date **************** ")
    if not state.active_account:
        error_msg("You must login first to register a cage.")
        return

    list_cages(suppress_header=True)
    cage_number = input("Enter cage number: ")
    if not cage_number.strip():
        error_msg("Cancelled")
        print()
        return

    cage_number = int(cage_number)

    cages = svc.find_cages_for_user(state.active_account)
    selected_cage = cages[cage_number - 1]

    success_msg("Selected cage {}".format(selected_cage.name))

    start_date = parser.parse(input("Enter available date [YYYY-mm-dd]: "))
    days = int(input("How many days is this block of time? "))

    svc.add_available_date(selected_cage, start_date, days)
    state.reload_account()

    success_msg(f"Date added to cage {selected_cage.name}.")
Exemplo n.º 19
0
def register_cage():
  if not state.active_account:
    error_msg('Please Log In To Register')
    return
  print('       ********** Register Cage **********')
  name = input('Enter your cage name.... ')
  area = (float(input('Enter area for your cage.... [numbers only]')))
  assert type(area) == float, 'Should be Num'
  is_carpeted = (input('Is your cage carpeted [y/n] ?').strip().lower().startswith('y'))
  has_toys = (input('Does it has toys ? [y/n] ?').strip().lower().startswith('y'))
  
  cage = services.register_cage(state.active_account, name, area, is_carpeted, has_toys)

  state.reload_account()
  success_msg(f'Registered Cage Successfully With ID > {cage.id}')
Exemplo n.º 20
0
def add_a_snake():
    print(' ****************** Add a snake **************** ')

    account = state.active_account
    if not account:
        error_msg(f'Please Login or create an account')
        return

    name = input('What is your snake\'s name ? ')
    length = float(input('How long is your snake ?'))
    is_venomous = input('Is it venomous ?').lower().startswith("y")
    species = input('What species ?')

    snake = svc.add_snake(account, name, length, is_venomous, species)
    state.reload_account()
    success_msg(f'{snake.name} ({snake.id}) added to our snake directory')
Exemplo n.º 21
0
def add_a_snake():
    print(' ****************** Add a snake **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a snake")
        return

    name = input("What is your snake's name? ")
    if not name:
        error_msg('cancelled')
        return

    length = float(input('How long is your snake (in meters)? '))
    species = input("Species? ")
    is_venomous = input("Is your snake venomous [y]es, [n]o? ").lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, length, species, is_venomous)
    state.reload_account()
    success_msg('Created {} with id {}'.format(snake.name, snake.id))
Exemplo n.º 22
0
def add_a_snake():
    print(' ****************** Add a snake **************** ')
    # TODO: Require an account
    if not state.active_account:
        print(f"You have to be logged in")
        return

    # TODO: Get snake info from user
    name = input('Enter name of snake')

    species = input('Enter Species of snake')
    length = int(input('Enter length of snake'))
    is_venomous = input('Is the snake venomous [y/n]').lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, species, length,
                          is_venomous)
    state.reload_account()
    print(f"successfully created snake {snake.name} with id {snake.id}")
Exemplo n.º 23
0
def add_a_bitch():
    print(' ****************** Add a bitch **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a bitch")
        return

    name = input("What is your bitch's name? ")
    if not name:
        error_msg('cancelled')
        return

    functions = input("Functions? ")
    is_cruel = input(
        "Is your bitch want cruel sex [y]es, [n]o? ").lower().startswith('y')

    bitch = svc.add_bitch(state.active_account, name, functions, is_cruel)
    state.reload_account()
    success_msg('Created {} with id {}'.format(bitch.name, bitch.id))
def add_a_snake():
    print(' ****************** Add a snake **************** ')
    if not state.active_account:
        error_msg("You must log in first to add a snake")
        return

    name = input("What is your snake's name? ")
    if not name:
        error_msg('cancelled')
        return

    length = float(input('How long is your snake (in meters)? '))
    species = input("Species? ")
    is_venomous = input("Is your snake venomous [y]es, [n]o? ").lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, length, species, is_venomous)
    state.reload_account()
    success_msg('Created {} with id {}'.format(snake.name, snake.id))
Exemplo n.º 25
0
def add_a_snake():
    print(' ****************** Add a snake **************** ')

    if not state.active_account:
        hosts.error_msg("Must be logged in to register a cage")
        return

    species = input('Species: ')
    length = float(input('Length (m): '))
    venomous = input('Venomous snake (y/n)? ').startswith('y')

    name = input('Snake name: ')

    snake = svc.add_snake(state.active_account, name, species, length,
                          venomous)

    state.reload_account()
    hosts.success_msg(
        f'Snake {snake.name} created successfully with id {snake.id}')
Exemplo n.º 26
0
def for_guest():
    print('       ********** Welcome Guest **********')

    while 1:
        show_options()
        action = host.get_option()

        with switchlang.switch(action) as s:
            s.case('C', host.create_account)
            s.case('L', host.login)
            s.case('B', book_cage)
            s.case('A', add_bird)
            s.case('Y', list_birds)
            # s.case('L', my_bookings)
            s.case('M', lambda: 'mode_change')
            s.case(['X', 'exit', 'quit', 'exit()', 'quit()', 'bye'], exit)
        state.reload_account()

        if s.result == 'mode_change':
            return
Exemplo n.º 27
0
def apply_to_teach():
    print(' ****************** Apply to Teach **************** ')
    if not state.active_account:
        error_msg("You must log in first to become a teacher")
        return

    while True:
        try:
            age = int(input("How many years have you been training? "))
            break
        except ValueError:
            error_msg("Please use a proper number.")
            continue

    dance_style = input("Which dance style is your specialty? ")
    is_friend = input("Are you a Friends Who Dance member? [y]es, [n]o? ").lower().startswith('y')

    teacher = svc.add_teacher(state.active_account, age, is_friend, dance_style)
    state.reload_account()
    success_msg('Welcome {}! Your Teacher ID is: {}'.format(state.active_account.name, teacher.id))
def register_room():
    print(' ****************** REGISTER ROOM **************** ')

    if not state.active_account:
        error_msg('You must login first to register a room.')
        return

    milf = input("Is it milf [y, n]? ").lower().startswith('y')
    has_instruments = input(
        "Have bitch instruments [y, n]? ").lower().startswith('y')
    allow_deepthroat = input(
        "Can you host cruel bitches [y, n]? ").lower().startswith('y')
    name = input("Give your room a name: ")
    price = float(input("How much are you charging?  "))

    room = svc.register_room(state.active_account, name, allow_deepthroat,
                             has_instruments, milf, price)

    state.reload_account()
    success_msg(f'Register new room with id {room.id}.')
def add_a_snake():
    print(' ****************** Add a snake **************** ')

    if not state.active_account:
        error_msg('You must login first to register a cage.')
        return

    name = input('What is the name of your snake? ')
    if not name:
        error_msg('Cancelled')
        return

    length = float(input('How long is your snake (in meters)? '))
    species = input('Species? ')
    venomous = input('Is your snake venomous [y, n]? ').lower().startswith('y')

    snake = svc.add_snake(state.active_account, name, species, length,
                          venomous)
    state.reload_account()
    success_msg(f'Registered {snake.name} with id {snake.id}.')
Exemplo n.º 30
0
def for_host():
  print('       ********** Welcome Host **********')

  while 1:
    show_options()
    action = get_option()

    with switchlang.switch(action) as s:
      s.case('C', create_account)
      s.case('L', login)
      s.case('R', register_cage)
      s.case('Y', list_cages)
      s.case('U', update_availability)
      s.case('S', lambda: 'mode_change')
      s.case(['X', 'exit', 'quit', 'exit()', 'quit()', 'bye'], exit)
      # s.case('L', log_into_account)
    state.reload_account()

    if s.result == 'mode_change':
      return
Exemplo n.º 31
0
def register_cage():
    print(' ****************** REGISTER CAGE **************** ')

    if not state.active_account:
        error_msg('You must login first in order to register a cage')
        return
    meters = input('Area(Sq. Metres)? :')
    if not meters:
        error_msg('Cancelled')
        return
    meters = float(meters)
    carpeted = input('Is it carpeted [y,n]? :').lower().startswith('y')
    has_toys = input('Have snake toys [y,n]? :').lower().startswith('y')
    allow_dangerous=input('Can you host a venomous snake [y,n]? :').lower().startswith('y')
    name = input('Name for the Cage? :')
    price = float(input('Price for cage? :'))

    cage = svc.register_cage(state.active_account, name, allow_dangerous, has_toys, carpeted, meters, price)
    state.reload_account()
    success_msg(f'Registered a new cage with new cage-id: {cage.id}')