示例#1
0
 def _assemble_roster(self):
     """Assemble a roster for this team."""
     # Prepare some variables that we'll need
     roster_order = ('P', 'C', '1B', '2B', '3B', 'SS', 'LF', 'CF', 'RF')
     lineup = []
     available_players = list(self.players)
     # Assemble starters
     for position_to_slot in roster_order:
         available_players_at_that_position = [
             p for p in available_players if p.position == position_to_slot
         ]
         best_available_at_that_position = max(
             available_players_at_that_position,
             key=lambda player: self.scout.grade(prospect=player,
                                                 position=position_to_slot))
         lineup.append(best_available_at_that_position)
         available_players.remove(best_available_at_that_position)
     # Assemble bullpen and bench
     bullpen = []
     bench = []
     for bench_player in available_players:
         if bench_player.position == 'P':
             bullpen.append(bench_player)
         else:
             bench.append(bench_player)
     # Instantiate and set a Roster object
     self.roster = Roster(lineup=tuple(lineup),
                          bullpen=tuple(bullpen),
                          bench=tuple(bench))
示例#2
0
def refresh():
    rost = Roster("password.json", "EAST")
    rost.setEmployees()
    rost.setOutOfQueue()
    s = SlackBot()
    s.refreshOOQ()
    print(f"Refresh Complete! Value of inTraining: {s.inTraining}")
示例#3
0
    def _build_roster(self):
        roster = Roster()

        for i, player in enumerate(self.player_pool):
            if self._player_is_included(i):
                roster.add_player(player)

        return roster
示例#4
0
    def test_write_roster(self):
        with Roster("Jones_2019.xlsx") as r:
            john = r.get_student("Johnny Carson")
            for assignment, grade in [(3, 90), (6, 94), (9, 92)]:
                john["grades"][assignment] = grade
            self.assertTrue(r.class_average() == 616.6 / 7)
            r.save("Jones_2019_Updated.xlsx")

        wb = load_workbook("Jones_2019_Updated.xlsx")
        self.assertTrue(wb.get_sheet_by_name("Student_1")["B12"].value == 94)
        wb.close()
示例#5
0
 def initialize_threads(self):
     """ Initializes io threads"""
     super().initialize_threads()
     self.dashboard_interval = int(self.ping_interval * 2)
     self.topic_fastclock_pub = self.publish_topics[Global.FASTCLOCK]
     self.topic_dashboard_pub = self.publish_topics[Global.DASHBOARD]
     self.topic_node_pub = self.publish_topics[Global.NODE]
     self.topic_ping_sub = self.subscribed_topics[Global.PING]
     # print("!!! ping sub: "+self.topic_ping_sub)
     self.topic_sensor_sub = self.subscribed_topics[Global.SENSOR]
     self.topic_backup_sub = self.subscribed_topics[Global.BACKUP]
     # print("!!! backup sub: "+self.topic_backup_sub)
     if Global.CONFIG in self.config:
         if Global.OPTIONS in self.config[Global.CONFIG]:
             if Global.TIME in self.config[Global.CONFIG][Global.OPTIONS]:
                 if Global.FAST in self.config[Global.CONFIG][
                         Global.OPTIONS][Global.TIME]:
                     if Global.RATIO in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_ratio = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.RATIO])
                     if Global.INTERVAL in self.config[Global.CONFIG][
                             Global.OPTIONS][Global.TIME][Global.FAST]:
                         self.fast_interval = int(
                             self.config[Global.CONFIG][Global.OPTIONS][
                                 Global.TIME][Global.FAST][Global.INTERVAL])
             if Global.PING in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.ping_interval = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.PING]
             if Global.BACKUP in self.config[Global.CONFIG][Global.OPTIONS]:
                 self.backup_path = self.config[Global.CONFIG][
                     Global.OPTIONS][Global.BACKUP]
     self.roster = Roster(self.log_queue,
                          file_path=Global.DATA + "/" + Global.ROSTER +
                          ".json")
     self.switches = Switches(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.SWITCHES + ".json")
     self.warrants = Warrants(self.log_queue,
                              file_path=Global.DATA + "/" +
                              Global.WARRANTS + ".json")
     self.signals = Signals(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SIGNALS +
                            ".json")
     self.layout = Layout(self.log_queue,
                          file_path=Global.DATA + "/" + Global.LAYOUT +
                          ".json")
     self.dashboard = Dashboard(self.log_queue,
                                file_path=Global.DATA + "/" +
                                Global.DASHBOARD + ".json")
     self.sensors = Sensors(self.log_queue,
                            file_path=Global.DATA + "/" + Global.SENSORS +
                            ".json")
示例#6
0
def create_new_roster():
    clear_screen()
    name = input("Enter the name of your new program >> ")
    strengths = None
    while not strengths:
        strengths = input("""
Enter your string strengths. For example,
for 8 First Violins, 6 Seconds, 5 Violas, 4 Cellos and 3 Basses,
type "8 6 5 4 3" (max 30 players per section).
>> """)
        strengths = convert_input_to_int(strengths, 1, 30, 5)

    return Roster(strengths, name)
示例#7
0
    def test_read_roster(self):
        with Roster("Jones_2019.xlsx") as r:
            student_names = r.get_student_names()
            self.assertTrue(len(student_names) == 7)
            self.assertTrue("Robert Waters" in student_names)

            catherine = r.get_student("Catherine Hitchens")
            self.assertTrue(catherine["id"] == 3)
            self.assertTrue(isinstance(catherine["grades"], pandas.Series))
            self.assertTrue(len(catherine["grades"]) == 10)
            self.assertTrue(catherine["grades"][4] == 86)

            self.assertTrue(r.class_average() == 614.1 / 7)
示例#8
0
def main(): 
    f = Field('30x50 yards ', 'grass')
    all_players = Roster()
    r = all_players.roster
    tourney = Tournament()
    divided_teams = tourney.make_teams(r)
    # # print(test)
    winner = tourney.compute_winner()

    print("These are the teams:\n")
    for t in range(len(divided_teams)):
        print("{}\n".format(divided_teams[t]))

    print("The winner is: \033[1;32m{}\033[0m".format(winner))
示例#9
0
def class_average(ctx, filename="Jones_2019.xlsx"):
    """
        Runs Roster.class_average()

        Parameters
        ---------
        ctx
            The context parameter required by invoke tasks.

        filename
            Name of excel file to get class average from
    """
    with Roster(filename) as r:
        print(r.class_average())
示例#10
0
def get_student_names(ctx, filename="Jones_2019.xlsx"):
    """
        Runs Roster.get_student_names()

        Parameters
        ---------
        ctx
            The context parameter required by invoke tasks.

        filename
            Name of excel file to get student names from
    """
    with Roster(filename) as r:
        print(r.get_student_names())
示例#11
0
  def handle_media_ready(self, client, data):
    '''Announce self to the NDN network when the local user has media ready (i.e. get permission fo use microphone and/or camera)

    Args:
      client : local user
      data : media_ready message from local user
    '''
    if self.client is None:
      PeetsServerFactory.__logger.debug('register client %s', client.id)
      self.client = client
      # announce self in NDN
      self.roster = Roster('/ndn/broadcast/' + self.chatroom, self.peets_msg_callback, lambda: self.client.local_user)
      self.local_status_callback('Running')
    else:
      PeetsServerFactory.__logger.debug("Join message from: %s, but we already have a client: %s", client.id, self.client.id)
示例#12
0
def main():
    """Main function.

    Sets up some example students, then prints the intro email.
    """
    students = [
        Student('Alice', '*****@*****.**'),
        Student('Bob', '*****@*****.**'),
        Student('Mel', '*****@*****.**'),
    ]
    roster = Roster(students, 'David')

    intro_email = write_intro_email(roster)

    print(intro_email)
示例#13
0
def daily():
    rost = Roster("password.json", "EAST")
    rost.setEmployees()
    rost.setOutOfQueue()

    s = SlackBot()
    print("From cron.py")
    print(s.inTraining)

    if s.inTraining:
        for engineer in s.inTraining:
            s.setStatus(engineer)

    s.msgOutOfQueue()
    s.msgAllStaff()
示例#14
0
 def __init__(self, position, name, players, n_players, player_csv, load=None):
     self.roster = []
     self.mutex = threading.Lock()
     self.cond = threading.Condition(threading.Lock()) 
     self.players = players
     self.starred_players = []
     for player in self.players:
         if player.stared == 1:
             self.starred_players.append(player)
     self.allplayers = copy.copy(players)
     max_name = 10
     self.done = 0
     for player in players:
         if len(player.name) > max_name:
             max_name = len(player.name)
     self.maxnamelen = max_name
     self.user_pos = (position - 1)
     self.round = 0
     self.rd_pick = 0
     self.total_pick = 1
     self.n_rosters = n_players
     self.selections = []
     filname = 'logs/draft/Draft_' + time.strftime('%m_%d_%y') + '.log'
     self.logger = draftlogging.Logger(filname)
     filname = 'logs/picks/Draft_picks' + time.strftime('%m_%d_%y_%H_%M_%S') + '.log'
     self.picklogger = filname
     with open(self.picklogger, 'w+') as f:
         #ensure it is empty
         pass
     self.player_csv = player_csv
     self.user_name = name
     for i in range(1, (self.n_rosters+1)):
         if i == position:
             ros_str = name
         else:
             ros_str = "comp%d"%(i)
         roster = Roster(i, ros_str, self.player_csv, self.logger)
         if i == (self.user_pos+1):
             self.user_roster = roster
         self.roster.append(roster)
     if load != None:
         str =  "loading draft"
         self.logger.logg(str, 1)
     self.current_roster = self.roster[0]
     self.remaining_picks = (self.n_rosters * self.roster[0].max_players)
     self.turn_ts = time.time()
     self.started = 0
示例#15
0
def daily():
    rost = Roster("password.json", "EAST")
    rost.setEmployees()
    rost.setOutOfQueue()

    s = SlackBot()
    print("From cron.py")  #debugging
    print(s.inTraining)

    #iterate through list of CEs that are out of queue
    if s.inTraining:
        for engineer in s.inTraining:
            s.setStatus(engineer)

    #send message to staff channels with current out of queue people
    s.msgOutOfQueue()
    s.msgAllStaff()
示例#16
0
def post_install():
    # Retrieve the auth code from the request params
    auth_code = request.args['code']
    name = request.args['state'].split(' ')

    first_name = name[0]

    if len(name) == 3:
        last_name = name[2]
        first_name += ' ' + name[1]
    else:
        last_name = name[1]

    client = slack.WebClient(token="")

    # Request the auth tokens from Slack
    response = client.oauth_access(client_id=client_id,
                                   client_secret=client_secret,
                                   code=auth_code)

    # Save the token to an to data store for later use
    person = {
        'access_token': response['access_token'],
        'user_id': response['user_id'],
    }

    employees.update({
        'first_name': first_name,
        'last_name': last_name
    }, {'$set': person},
                     upsert=False)

    r = Roster("password.json", "EAST")
    r.setOutOfQueue()

    #set the user to Out of Queue if it is their OOQ day
    completed = employees.find_one({
        'first_name': first_name,
        'last_name': last_name
    })
    choose_command.apply_async(args=("run", response['user_id']),
                               queue="commands")

    return "Auth complete! You will receive a notification on your Out of Queue day, and your status will be updated! \n\n Please check out #sup-ooq for discussion"
示例#17
0
    def test_delete_roster_student(self):
        student_count = 0
        with Roster("Jones_2019.xlsx") as r:
            student_count = len(r.get_student_names())
            self.assertTrue(student_count == 7)
            self.assertTrue(r.get_student("William Thomas")["id"] == 5)
            r.delete_student("Allen Dalton")
            student_count = len(r.get_student_names())
            self.assertTrue(student_count == 6)
            self.assertTrue(r.get_student("William Thomas")["id"] == 4)
            r.save("Jones_2019_Reduced.xlsx")

        wb = load_workbook("Jones_2019_Reduced.xlsx")
        sheet_names = wb.get_sheet_names()
        self.assertTrue(len(sheet_names) == 7)
        self.assertTrue(sheet_names[0] == "Roster")
        self.assertTrue(sheet_names[-1] == "Student_6")
        self.assertTrue(wb.get_sheet_by_name("Student_3")["B7"].value == 92)
        wb.close()
示例#18
0
 def test_init(self):
     nshiftsperday = 3
     qualified = ["Q1", "Q2", "Q3"]
     regular = ["R1", "R2", "R3", "R4", "R5"]
     monthno = 5
     year = 2019
     roster = Roster(nshiftsperday, qualified, regular, monthno, year)
     self.assertEqual(roster.nshiftsperday, nshiftsperday)
     self.assertEqual(roster.qualified, qualified)
     self.assertEqual(roster.regular, regular)
     self.assertEqual(roster.monthno, monthno)
     self.assertEqual(roster.year, year)
     self.assertEqual(roster.ndays, ndays(monthno, year))
     self.assertEqual(len(roster.arr), ndays(monthno, year))
     self.assertEqual(len(roster.arr[0]), nshiftsperday)
     for iday in range(0, roster.ndays):
         for ishift in range(0, roster.nshiftsperday):
             self.assertEqual(roster.arr[iday][ishift], "")
     return roster
示例#19
0
def get_student(ctx, student_identifier, filename="Jones_2019.xlsx"):
    """
        Runs Roster.get_student_()

        Parameters
        ---------
        ctx
            The context parameter required by invoke tasks.

        student_identifier
            Either a full name as a string, or a student ID as an int

        filename
            Name of excel file to get the student
    """
    with Roster(filename) as r:
        if _is_intstring(student_identifier):
            print(r.get_student(int(student_identifier)))
        else:
            print(r.get_student(student_identifier))
示例#20
0
def delete_student(ctx, student_identifier, filename="Jones_2019.xlsx"):
    """
        Runs Roster.delete_student_()

        Parameters
        ---------
        ctx
            The context parameter required by invoke tasks.

        student_identifier
            Either a full name as a string, or a student ID as an int

        filename
            Name of excel file to delete the student from
    """
    with Roster(filename) as r:
        if _is_intstring(student_identifier):
            r.delete_student(int(student_identifier))
        else:
            r.delete_student(student_identifier)

        updated_file = filename.split(".xlsx")[0] + "_Updated.xlsx"
        print("Student deleted. See " + updated_file + " to review sheets.")
示例#21
0
def add_grades(ctx, student_dict, filename="Jones_2019.xlsx"):
    """
        Runs Roster.class_average()

        Parameters
        ---------
        ctx
            The context parameter required by invoke tasks.

        student_dict
            dictionary containing student ID and a list of assignments/grades.
                CLI Input example: invoke add_grades '{"id": 1, "grades": [(3, 90), (12, 100), (1, 10)]}'

        filename
            Name of excel file to get class average from
    """
    with Roster(filename) as r:
        data = ast.literal_eval(student_dict)
        print(data)
        r.add_grades(data)
        updated_file = filename.split(".xlsx")[0] + "_Updated.xlsx"
        print("Grades added. See " + updated_file +
              " or run invoke get_student(<student>) to review changes.")
示例#22
0
 def __init__(self,
              position,
              name,
              players,
              n_players,
              player_csv,
              load=None):
     self.roster = []
     self.players = players
     self.allplayers = copy.copy(players)
     max_name = 10
     for player in players:
         if len(player.name) > max_name:
             max_name = len(player.name)
     self.maxnamelen = max_name
     self.user_pos = position
     self.round = 0
     self.rd_pick = 0
     self.total_pick = 1
     self.n_rosters = n_players
     filname = 'logs/draft/Draft_' + time.strftime('%m_%d_%y') + '.log'
     self.logger = draftlogging.Logger(filname)
     filname = 'logs/picks/Draft_picks' + time.strftime(
         '%m_%d_%y_%H') + '.log'
     self.picklogger = filname
     self.player_csv = player_csv
     for i in range(1, (self.n_rosters + 1)):
         if i == self.user_pos:
             ros_str = name
         else:
             ros_str = "comp%d" % (i)
         roster = Roster(i, ros_str, self.player_csv, self.logger)
         self.roster.append(roster)
     if load != None:
         str = "loading draft"
         self.logger.logg(str, 1)
示例#23
0
roster = Roster(
    id='brit',
    numeric_id=1,
    # keep dates for power and speeds matched
    truck_speeds={
        0: 25,
        1905: 40,
        1935: 55,
        1965: 70,
        1985: 80
    },
    tram_speeds={
        0: 25,
        1900: 35,
        1930: 45,
        1960: 55,
        1990: 65
    },
    truck_power_bands={
        0: 100,
        1905: 150,
        1935: 250,
        1965: 450,
        1985: 700
    },
    tram_power_bands={
        0: 100,
        1900: 200,
        1930: 350,
        1960: 550,
        1990: 800
    },
    vehicles=[catchcan])
示例#24
0
from roster import Roster

Roster.getCategories()

rost = Roster("password.json", "EAST")
q = Roster.getOutOfQueue()
print(q)
'''rost.setEmployees()
rost.getCategories()
rost.setOutOfQueue()'''
'''def printQ():
    for t in q:
        print(t)
        print("\n")

def testTrainingIds():
    
    idset = set()
    
    
    if not q:
        return idset

    for t in q:
        print(t)
        if 'user_id' in t and t['user_id']:
            idset.add(t['user_id'])
            print(idset)

    #print(f"idset: {idset}")
示例#25
0
def main(disabled=False):
    # migration note; see also render_docs as it may already have methods for getting the tech tree in generation order
    print(
        'roster engines list should be refactored to use order from role_group_mapping combined with engine generation'
    )
    roster = Roster(
        id='pony',
        numeric_id=1,
        # ELRL, ELNG is mapped to RAIL, NG etc
        # default intro dates per generation, can be over-ridden if needed by setting intro_date kw on consist
        intro_dates={
            'RAIL': [1860, 1900, 1930, 1960, 1990, 2020],
            'METRO': [1900, 1950, 2000],
            'NG': [1860, 1905, 1950, 2000]
        },
        # default speeds per generation, can be over-ridden if needed by setting speed kw arg on consist
        # speeds roughly same as RH trucks of same era + 5mph or so, and a bit higher at the top end (back and forth on this many times eh?),
        # NG is Corsican-style 1000mm, native brit NG is not a thing for gameplay
        speeds={
            'RAIL': {
                'standard': [
                    45, 45, 60, 75, 87, 96
                ],  # gen 5 and 6 forced down by design, really fast freight is imbalanced
                'express': [
                    60, 75,
                    90, 105, 115, 125
                ],  # smaller steps in gen 5 and 6, balances against faster HSTs
                'hst': [0, 0, 0, 0, 125, 140],  # only gen 5 and 6 HST provided
                'very_high_speed': [0, 0, 0, 0, 140, 186]
            },
            'METRO': {
                'standard': [45, 55, 65]
            },  # no express for metro in Pony
            'NG': {
                'standard': [
                    45, 45, 55, 65
                ],  # NG standard/express all same in Pony, balanced against trams, RVs
                'express': [45, 45, 55, 65]
            }
        },

        # capacity factor per generation, will be multiplied by vehicle length
        freight_car_capacity_per_unit_length={
            'RAIL': [4, 4, 5, 5.5, 6, 6],
            'NG': [3, 3, 4, 4]
        },
        pax_car_capacity_per_unit_length={
            'RAIL': [3, 4, 5, 5, 6, 6],
            'NG': [3, 4, 5, 6]
        },
        # freight car weight factor varies slightly by gen, reflecting modern cars with lighter weight
        train_car_weight_factors=[0.5, 0.5, 0.5, 0.48, 0.44, 0.44],
        engines=[  # branch express
            lark,
            merrylegs,
            proper_job,
            stoat,
            pinhorse,
            shoebox,
            super_shoebox,
            ultra_shoebox,
            # express
            spinner,
            carrack,
            tencendur,
            kelpie,
            griffon,
            shredder,
            wyvern,
            thunderbird,
            revolution,
            upcountry,
            pegasus,
            dragon,
            hurly_burly,
            moor_gallop,
            roarer,
            fury,
            screamer,
            sizzler,
            # driving cab cars
            driving_cab_pony_gen_5,
            driving_cab_pony_gen_6,
            # branch freight
            saxon,
            little_bear,
            hercules,
            goliath,
            # freight
            gwynt,
            braf,
            haar,
            growler,
            slug,
            phoenix,
            girt_licker,
            lemon,
            chinook,
            grid,
            blackthorn,
            cheddar_valley,
            chimera,
            flindermouse,
            peasweep,
            flanders_storm,
            gosling_blast,
            # joker engines / snowploughs
            grub,
            gronk,
            snowplough_pony_gen_2,
            # diesel railcars
            deasil,
            slammer,
            tin_rocket,
            happy_train,
            gowsty,
            scooby,
            plastic_postbox,
            mail_rail,
            # electric railcars
            athena,
            geronimo,
            breeze,
            zeus,
            ares,
            dover,
            jupiter,
            pylon,
            # brit high speed pax
            blaze,
            scorcher,
            helm_wind_cab,
            helm_wind_middle,
            brenner_cab,
            brenner_middle,
            # metro
            serpentine,
            westbourne,
            fleet,
            longwater,
            tyburn,
            tideway,
            # ng engines
            cheese_bug,
            bean_feast,
            pikel,
            boar_cat,
            # ng railcars
            mumble,
            snapper,
            workish,
            zorro
        ])
    roster.register(disabled=disabled)
示例#26
0
roster = Roster(
    id='brit',
    numeric_id=1,
    # keep dates for power and speeds matched
    truck_speeds={
        0: 25,
        1905: 40,
        1935: 55,
        1965: 70,
        1985: 80
    },
    tram_speeds={
        0: 25,
        1900: 35,
        1930: 45,
        1960: 55,
        1990: 60
    },  # last generation only increase by 5mph by design
    truck_power_bands={
        0: 100,
        1905: 150,
        1935: 250,
        1965: 450,
        1985: 700
    },
    # tram power is excessive compare to RL, otherwise the OpenTTD physics model spanks the trams
    tram_power_bands={
        0: 240,
        1900: 480,
        1930: 720,
        1960: 960,
        1990: 1200
    },
    vehicles=[
        leyburn_pax,
        thunder_pax,
        highgate_pax,
        topley_pax,
        glenmore_pax_express,
        oxleas_pax_express,
        acton_pax_express,
        # big_sky, deprecated
        tallyho_mail,
        brass_monkey_mail,
        goldmire_mail,
        littleduke_mail,
        jinglepot_open,
        rattlebrook_open,
        yeoman_open,
        capo_open,
        runwell_box,
        easywheal_box,
        quickset_box,
        speedwell_box,
        chainburn_flat,
        windergill_flat,
        towerhouse_flat,
        big_rigg_flat,
        coleman_dump,
        honister_dump,
        wookey_dump,
        powerstock_dump,
        boilingwell_tanker,
        greenscoe_tanker,
        meriden_tanker,
        cloud_hill_tanker,
        limebreach_covered_hopper,
        ribble_covered_hopper,
        mcdowell_covered_hopper,
        cowsleigh_livestock,
        pigstick_livestock,
        swineshead_livestock,
        stungun_livestock,
        flow_edge_edibles_tanker,
        beerwoods_edibles_tanker,
        waterperry_edibles_tanker,
        silvertop_edibles_tanker,
        merrivale_refrigerated,
        fortiscue_refrigerated,
        coldfall_refrigerated,
        #foreshore, # deprecated, pending decision on container trucks being in or out
        reaver_supplies,
        crime_rigg_supplies,
        brigand_supplies,
        road_thief_supplies,
        # trams
        ladycross_pax,
        fairlop_pax,
        newbold_pax,
        northbeach_pax,
        twinhills_pax,
        tin_hatch_mail,
        foxley_mail,
        stagrun_mail,
        strongbox_mail,
        singing_river_mail,
        buildwas_open,
        portland_open,
        brightling_open,
        amblecote_box,
        rakeway_box,
        colbiggan_box,
        stakebeck_flat,
        rackwood_flat,
        stancliffe_flat,
        scrooby_top_dump,
        hawkmoor_dump,
        nettlebridge_dump,
        drumbreck_tanker,
        catchcan_tanker,
        oylbarral_tanker,
        polangrain_covered_hopper,
        thurlbear_covered_hopper,
        scrag_end_livestock,
        trotalong_livestock,
        shotover_livestock,
        poptop_edibles_tanker,
        bottlebrook_edibles_tanker,
        winterfold_refrigerated,
        sparkford_refrigerated,
        plumley_fruit_veg,
        applethwaite_fruit_veg,
        nutbrook_fruit_veg,
        # off-highway
        griff_log,
        trefell_log,
        knockdown_log,
        buff_log,
        broadrock_dump,
        witch_hill_dump,
        steeraway_metal
    ])
示例#27
0
def main(disabled=False):
    roster = Roster(
        id="pony",
        numeric_id=1,
        # ELRL, ELNG is mapped to RAIL, NG etc
        # default intro dates per generation, can be over-ridden if needed by setting intro_date kw on consist
        intro_dates={
            "RAIL": [1860, 1900, 1930, 1960, 1990, 2020],
            "METRO": [1900, 1950, 2000],
            "NG": [1860, 1905, 1950, 2000],
        },
        # default speeds per generation, can be over-ridden if needed by setting speed kw arg on consist
        # speeds roughly same as RH trucks of same era + 5mph or so, and a bit higher at the top end (back and forth on this many times eh?),
        # NG is Corsican-style 1000mm, native brit NG is not a thing for gameplay
        speeds={
            "RAIL": {
                "standard": [
                    45,
                    45,
                    60,
                    75,
                    87,
                    87,
                ],  # gen 5 and 6 held down by design, really fast freight is imbalanced
                "railcar": [45, 45, 60, 75, 87, 99],  # match standard, except gen 6
                "express": [
                    60,
                    75,
                    90,
                    105,
                    115,
                    125,
                ],  # smaller steps in gen 5 and 6, balances against faster HSTs
                "hst": [0, 0, 0, 112, 125, 140],  # only gen 4, 5 and 6 HST provided
                "very_high_speed": [0, 0, 0, 0, 140, 186],
            },
            "METRO": {
                "standard": [45, 55, 65]
                # no express for metro in Pony
            },
            "NG": {
                "standard": [
                    45,
                    45,
                    55,
                    65,
                ],  # NG standard/railcar/express all same in Pony, balanced against trams, RVs
                "railcar": [45, 45, 55, 65],
                "express": [45, 45, 55, 65],
            },
        },
        # capacity factor per generation, will be multiplied by vehicle length
        freight_car_capacity_per_unit_length={
            "RAIL": [4, 4, 5, 5.5, 6, 6.5],
            "NG": [3, 3, 4, 4],
        },
        pax_car_capacity_per_unit_length={
            "RAIL": [4, 5, 6, 7, 8, 8],
            "NG": [3, 4, 5, 6],
        },
        # freight car weight factor varies slightly by gen, reflecting modern cars with lighter weight
        train_car_weight_factors=[0.5, 0.5, 0.5, 0.48, 0.44, 0.40],
        # specify lists of cc1 and not_cc2 colours, and an option to remap all the cc1 to a specific other cc (allowing multiple input colours to map to one result)
        livery_presets={
            "EWS": {
                "cc1": ["COLOUR_PINK"],
                "not_cc2": [],
                "remap_to_cc": None,
                "docs_image_input_cc": [("COLOUR_PINK", "COLOUR_YELLOW")],
            },
            "FREIGHTLINER_GBRF": {
                "cc1": [
                    "COLOUR_PALE_GREEN",
                    "COLOUR_GREEN",
                    "COLOUR_DARK_GREEN",
                    "COLOUR_MAUVE",
                ],  # includes GBRF
                "not_cc2": [],
                "remap_to_cc": None,
                "docs_image_input_cc": [
                    ("COLOUR_PALE_GREEN", "COLOUR_YELLOW"),
                    ("COLOUR_DARK_GREEN", "COLOUR_ORANGE"),
                    ("COLOUR_GREEN", "COLOUR_ORANGE"),
                    ("COLOUR_MAUVE", "COLOUR_CREAM"),
                ],
            },
            # stupid hax to get a 47 with default intercity that can also be plain solid colour
            "PLAIN_NOT_INTERCITY": {
                "cc1": [
                    "COLOUR_DARK_BLUE",
                    "COLOUR_PALE_GREEN",
                    "COLOUR_PINK",
                    "COLOUR_YELLOW",
                    "COLOUR_RED",
                    "COLOUR_LIGHT_BLUE",
                    "COLOUR_GREEN",
                    "COLOUR_DARK_GREEN",
                    "COLOUR_BLUE",
                    "COLOUR_CREAM",
                    "COLOUR_MAUVE",
                    "COLOUR_PURPLE",
                    "COLOUR_ORANGE",
                    "COLOUR_BROWN",
                    "COLOUR_GREY",
                    "COLOUR_WHITE",
                ],
                "not_cc2": ["COLOUR_WHITE"],
                "remap_to_cc": None,
                "docs_image_input_cc": [
                    ("COLOUR_GREY", "COLOUR_GREY"),
                    ("COLOUR_RED", "COLOUR_RED"),
                    ("COLOUR_DARK_BLUE", "COLOUR_DARK_BLUE"),
                ],
            },
            # red stripe cc1 chosen to give nice wagon colour options
            "RAILFREIGHT_RED_STRIPE": {
                "cc1": [
                    "COLOUR_GREY",
                    "COLOUR_BROWN",
                    "COLOUR_YELLOW",
                    "COLOUR_ORANGE",
                ],  # not white, too limiting for other liveries
                "not_cc2": [
                    "COLOUR_GREY",
                    "COLOUR_BROWN",
                    "COLOUR_YELLOW",
                    "COLOUR_ORANGE",
                    "COLOUR_WHITE",
                ],  # do ban white though, looks bad as lower stripe
                "remap_to_cc": "COLOUR_GREY",
                "docs_image_input_cc": [
                    ("COLOUR_GREY", "COLOUR_RED"),
                    ("COLOUR_BROWN", "COLOUR_PINK"),
                ],
            },
            # triple grey cc1 chosen to give nice wagon colour options
            # notcc2 chosen for (a) ensuring contrast of sector symbol (b) also happens to enable dutch yellow/grey livery
            # note the remap to white, to provide lightest of the triple greys as cc1
            "RAILFREIGHT_TRIPLE_GREY": {
                "cc1": [
                    "COLOUR_GREY",
                    "COLOUR_BROWN",
                    "COLOUR_YELLOW",
                    "COLOUR_ORANGE",
                ],  # not white, too limiting for other liveries
                "not_cc2": [
                    "COLOUR_GREY",
                    "COLOUR_BROWN",
                    "COLOUR_YELLOW",
                    "COLOUR_ORANGE",
                    "COLOUR_WHITE",
                ],  # do ban white though, looks bad with sector logo
                "remap_to_cc": "COLOUR_WHITE",
                "docs_image_input_cc": [
                    ("COLOUR_GREY", "COLOUR_RED"),
                    ("COLOUR_YELLOW", "COLOUR_BLUE"),
                    ("COLOUR_BROWN", "COLOUR_DARK_BLUE"),
                ],
            },
            "YEOMAN": {
                "cc1": ["COLOUR_GREY", "COLOUR_WHITE"],
                "not_cc2": [],
                "remap_to_cc": None,
                "docs_image_input_cc": [
                    ("COLOUR_GREY", "COLOUR_BLUE"),
                    ("COLOUR_WHITE", "COLOUR_DARK_BLUE"),
                ],
            },
        },
        # this list is manually maintained deliberately, even though it could be mostly automated using tech tree
        engines=[
            # challenger, # for NA roster
            # branch express
            lark,
            merrylegs,
            proper_job,
            kelpie,
            griffon,
            pinhorse,
            argus,
            booster,
            tornado,
            # express (electro-diesels with non-standard position in power/length tree)
            shoebox,
            super_shoebox,
            ultra_shoebox,
            # express
            reliance,
            spinner,
            carrack,
            tencendur,
            merlion,
            shredder,
            thunderer,
            swift,
            strongbow,
            streamer,
            wyvern,
            intrepid,
            vanguard,
            resilient,
            evolution,  # out of normal order so that the names read 'Evolution', 'Revolution' (usually jokers come after the tech tree version not before)
            revolution,
            pegasus,
            dragon,
            vulcan,
            onslaught,
            relentless,
            hurly_burly,
            moor_gallop,
            roarer,
            fury,
            hector,
            zebedee,
            screamer,
            nimbus,
            avenger,
            sizzler,
            # driving cab cars
            driving_cab_passenger_pony_gen_4,
            driving_cab_passenger_pony_gen_5,
            driving_cab_passenger_pony_gen_6,
            driving_cab_mail_pony_gen_5,
            driving_cab_mail_pony_gen_6,
            # branch freight
            buffalo,
            saxon,
            little_bear,
            captain_steel,
            goliath,
            stoat,
            zest,
            # freight
            hercules,
            braf,
            diablo,
            haar,
            viking,
            growler,
            slug,
            phoenix,
            vigilant,
            blind_smuir,
            girt_licker,
            lemon,
            esk,
            chinook,
            grid,
            bone,
            blackthorn,
            defiant,
            quietus,
            cheddar_valley,
            stentor,
            highlander,
            toaster,
            flindermouse,
            peasweep,
            flanders_storm,
            triton,
            # joker engines / snowploughs
            grub,
            lamia,
            gronk,
            chuggypig,
            magnum_70,
            snowplough_pony_gen_2,
            # cargo sprinter
            cargo_sprinter,
            # auto-coach (only one as autoreplace can't handle mixed cargo articulated consists)
            auto_coach_pony_gen_2,
            # diesel railcars
            deasil,
            slammer,
            tin_rocket,
            happy_train,
            gowsty,
            scooby,
            plastic_postbox,
            # electric railcars
            athena,
            geronimo,
            breeze,
            zeus,
            ares,
            dover,
            jupiter,
            pylon,
            # express electric railcars
            high_flyer,
            sunshine_coast,
            olympic,
            bright_country,
            # brit high speed pax
            firebird,
            blaze,
            scorcher,
            # iep_thing,
            helm_wind_cab,
            helm_wind_middle,
            brenner_cab,
            brenner_middle,
            # metro
            serpentine,
            westbourne,
            fleet,
            longwater,
            tyburn,
            tideway,
            # ng engines
            cheese_bug,
            bean_feast,
            pikel,
            boar_cat,
            # ng railcars
            mumble,
            snapper,
            workish,
            zorro,
        ],
    )
    roster.register(disabled=disabled)
示例#28
0
文件: brit.py 项目: andythenorth/fish
from ships import harbour_point_utility_vessel
from ships import hopetown_tanker
from ships import little_cumbrae_freighter
from ships import marstein_freighter
from ships import meteor_freighter
from ships import maspalomas_freighter
from ships import nanaimo_70_hovercraft
from ships import nieuwpoort_container_feeder
from ships import pegwell_super_4_hovercraft
from ships import provence_edibles_tanker
from ships import santorini_freighter
from ships import shark_island_livestock_ship
from ships import sunk_rock_ferry
from ships import whitgift_freight_barge
from ships import yokohama_tanker

roster = Roster(
    id='brit',
    numeric_id=1,
    ships=[
        harbour_point_utility_vessel, sunk_rock_ferry, barletta_paddle_steamer,
        fastnet_paddle_steamer, castle_point_steamer, nanaimo_70_hovercraft,
        pegwell_super_4_hovercraft, fish_island_trawler, cape_spear_trawler,
        whitgift_freight_barge, meteor_freighter, little_cumbrae_freighter,
        marstein_freighter, altamira_freighter, cadiz_freighter,
        frisco_bay_freighter, santorini_freighter, maspalomas_freighter,
        eddystone_tanker, hopetown_tanker, yokohama_tanker,
        shark_island_livestock_ship, provence_edibles_tanker, grindavik_reefer,
        nieuwpoort_container_feeder
    ])
示例#29
0
                help="Slack URL to upload")
argparser.add_argument('-t', '--token', required=True,
                help="Slack User Token")
argparser.add_argument('-c', '--channel', required=True,
                help="Main garbage channel name")
argparser.add_argument('-i', '--important-channel', required=True,
                help="Notification and important messages channel")
argparser.add_argument('--spreadsheet', required=True, help="Roster spreadsheet ID")
argparser.add_argument('--gcreds', required=True, help="Google credentials.json file")
args = argparser.parse_args()
slack_url = args.url
slack_token = args.token
slack_channel = args.channel
slack_important_channel = args.important_channel

roster = Roster(args.spreadsheet, args.gcreds)

def send_to_slack(msg):
    try:
        requests.post(slack_url, json={'text': msg})
    except Exception:
        traceback.print_exc()

def send_to_slack_important(text):
    try:
        s = Slacker(slack_token)
        channel_id = s.channels.get_channel_id(slack_important_channel)
        print text
        s.chat.command(channel=channel_id, command='/meme', text='tried ' + text)
    except Exception:
        traceback.print_exc()
示例#30
0
from roster import Roster

from vehicles import wastelander

roster = Roster(
    id='wasteland',
    numeric_id=2,  # this is likely to change, wasteland looks non-viable
    truck_speeds={
        0: 20,
        1900: 25,
        1920: 40,
        1940: 55,
        1960: 70,
        1980: 80
    },
    tram_speeds={
        0: 20,
        1895: 35,
        1940: 50,
        1980: 65
    },
    vehicles=[wastelander])