old_contents: import json
  
  import terminaltables
  from filehandler import load_schedules, load_teams_data
  from rankings import do_bubble
  from team import TeamEncoder
  
  if __name__ == '__main__':
      teams = load_teams_data('d1_2017.csv')
      schedule_items = load_schedules('GamesFiles/cbbga17.txt')
  
      for team in teams:
          team.load_schedule(schedule_items)
  
      # rpi_ranked = do_rpi(teams)
      # sos_ranked = do_sos(teams)
      bubble_ranked = do_bubble(teams)
  
      print(
          json.dumps(bubble_ranked, cls=TeamEncoder, indent=2)
      )
      # rpi_adjusted_ranked = do_rpi_adjusted(teams)
      #
      # data = [[
      #     'Bubble Rank',
      #     'Score',
      #     'Team',
      #     'RPI Rank',
      #     'Score',
      #     'Team',
      #     'RPI Adjusted',
      #     'Score',
      #     'Team'
      # ]]
  
      # for i in range(len(teams)):
      #     bubble_team = bubble_ranked[i]
      #     rpi_team = rpi_ranked[i]
      #     rpi_adjusted_team = rpi_adjusted_ranked[i]
      #     data.append([
      #         '{:>3}'.format(bubble_team.rank),
      #         '{:05.4f}'.format(round(bubble_team.score, 4)),
      #         '({}) {}'.format(bubble_team.record, bubble_team.name),
      #         '{:>3}'.format(rpi_team.rank),
      #         '{:05.4f}'.format(round(rpi_team.score, 4)),
      #         '({}) {}'.format(rpi_team.record, rpi_team.name),
      #         '{:>3}'.format(rpi_adjusted_team.rank),
      #         '{:05.4f}'.format(round(rpi_adjusted_team.score, 4)),
      #         '({}) {}'.format(rpi_adjusted_team.record, rpi_adjusted_team.name),
      #     ])
      #
      # table = terminaltables.AsciiTable(data)
      # print(table.table)
  
      # TODO: Make option to remove postseason games from output
  
new_contents: import argparse
  import json
  
  from filehandler import load_schedules, load_teams_data
  from rankings import do_bubble, do_rpi, do_rpi_adjusted, do_sos
  from team import TeamEncoder
  
  
  parser = argparse.ArgumentParser(prog='Robie')
  parser.add_argument(
      'uri',
      help='The file location to retrieve game data.'
  )
  parser.add_argument(
      '-s',
      '--store',
      action="store_true",
      default=False,
      help='Include this flag if you want to save the games file.'
  )
  parser.add_argument(
      '-m',
      '--method',
      default='bubble',
      choices=['bubble', 'rpi', 'rpiadj', 'sos'],
      help='The method to use.'
  )
  parser.add_argument(
      '-f',
      '--format',
      default='plain',
      choices=['plain', 'json'],
      help='The output format to print.'
  )
  parser.add_argument(
      '-p',
      '--postseason',
      action="store_true",
      default=False,
      help='Include this flag if you want to include postseason games.'
  )
  
  if __name__ == '__main__':
      args = parser.parse_args()
      teams = load_teams_data('d1_2017.csv')
      schedule_items = load_schedules(uri=args.uri)
  
      for team in teams:
          team.load_schedule(schedule_items, include_postseason=args.postseason)
  
      if args.method.lower() == 'bubble':
          ranked = do_bubble(teams)
      elif args.method.lower() == 'rpi':
          ranked = do_rpi(teams)
      elif args.method.lower() == 'rpiadj':
          ranked = do_rpi_adjusted(teams)
      elif args.method.lower() == 'sos':
          ranked = do_sos(teams)
      else:
          msg = 'Specified method not recognized: `{}`'
          raise RuntimeError(msg.format(args.method))
  
      if args.format.lower() == 'plain':
          output = '{:>3}\t{:05.4f}\t({})\t{}'
          for ranked_team in ranked:
              print(
                  output.format(
                      ranked_team.rank,
                      ranked_team.score,
                      ranked_team.record,
                      ranked_team.name
                  )
              )
      elif args.format.lower() == 'json':
          print(json.dumps(ranked, cls=TeamEncoder, indent=2))
      else:
          msg = 'Specified output format not recognized: `{}`'
          raise RuntimeError(msg.format(args.format))
  
subject: Implement command line arguments.