Ejemplo n.º 1
0
def run():

    parser = argparse.ArgumentParser(
        description="data collection tool for PathFinder class")
    parser.add_argument(
        "--league",
        default=league_names[0],
        choices=league_names,
        help=
        "League specifier, ie. 'Synthesis', 'Hardcore Synthesis' or 'Flashback Event (BRE001)'",
    )
    parser.add_argument(
        "--path",
        default="data_analysis/raw",
        help="Location where to save collected data",
    )
    parser.add_argument(
        "--fullbulk",
        default=False,
        action="store_true",
        help="Whether to use all supported bulk items",
    )
    parser.add_argument(
        "--nofilter",
        default=False,
        action="store_true",
        help="Whether to disable item pair filters")

    arguments = parser.parse_args()
    league = arguments.league
    path = arguments.path
    use_filter = False if arguments.nofilter else True
    config = {"fullbulk": arguments.fullbulk}
    backend = poetrade
    chosen_currencies = build_item_list("poetrade", config)

    # Load excluded trader list
    with open("excluded_traders.txt", "r") as f:
        excluded_traders = [x.strip() for x in f.readlines()]

    p = PathFinder(league, chosen_currencies, backend, excluded_traders,
                   use_filter)
    p.run(3)

    filename = "{}/{}".format(path, gen_filename())
    with open(filename, "wb") as f:
        data = p.prepickle()
        pickle.dump(data, f)
Ejemplo n.º 2
0
    def run(self):
        item_list = ItemList.load_from_file()
        user_config = UserConfig.from_file()
        # By default,
        default_backend = PoeTrade(item_list)

        params = parse_args()
        item_pairs = user_config.get_item_pairs(
        ) if params.use_filter else item_list.get_item_list_for_backend(
            default_backend, {"fullbulk": params.fullbulk})

        p = PathFinder(params.league, item_pairs, user_config)
        p.run(2)

        filename = "{}/{}".format(params.path, gen_filename())
        with open(filename, "w") as f:
            data = p.prepickle()
            f.write(data)
def execute_pathfinding(currency: str, league: str, limit: int, item_pairs,
                        user_config, excluded_traders):
    p = PathFinder(league, item_pairs, user_config, excluded_traders)
    p.run(2)

    try:
        logging.info("\n")
        if currency == "all":
            for c in p.graph.keys():
                conversions = unique_conversions_by_trader_name(p.results[c])
                log_conversions(conversions, limit)
        else:
            conversions = unique_conversions_by_trader_name(
                p.results[currency])
            log_conversions(conversions, limit)

    except KeyError:
        logging.warning(
            "Could not find any profitable conversions for {} in {}".format(
                currency, league))
Ejemplo n.º 4
0
def run():

    parser = argparse.ArgumentParser(
        description="data collection tool for PathFinder class")
    parser.add_argument(
        "--league",
        default="Flashback Event (BRE001)",
        help=
        "League specifier, ie. 'Bestiary', 'Hardcore Bestiary' or 'Flashback Event (BRE001)'"
    )
    parser.add_argument("--path",
                        default="data_analysis/raw",
                        help="Location where to save collected data")
    arguments = parser.parse_args()

    p = PathFinder(arguments.league, currencies)
    p.run(3)

    filename = "{}/{}".format(arguments.path, gen_filename())
    with open(filename, "wb") as f:
        pickle.dump(p, f)
def test_find_exec_mac(mock_walk, s1_dir_exe_mac):

    def define_execs(execs):
        def mock_access(path, _):
            return path in execs
        return mock_access

    expected = ['StarCraft/Starcraft', 'StarCraft/editor/editor']
    with mock.patch('os.access', define_execs(expected)):
        mock_walk.return_value = s1_dir_exe_mac
        execs = PathFinder(Platform.MACOS).find_executables('some_mock_path')
        assert execs == expected
Ejemplo n.º 6
0
limit = arguments.limit
fullbulk = arguments.fullbulk
no_filter = arguments.nofilter
config = {"fullbulk": fullbulk}

# Load excluded trader list
excluded_traders = load_excluded_traders()

# Load user config
user_config = UserConfig.from_file()

# Load item pairs
item_pairs = item_list.get_item_list_for_backend(
    backend, config) if no_filter else user_config.get_item_pairs()

p = PathFinder(league, item_pairs, user_config, excluded_traders)
p.run(2)

try:
    logging.info("\n")
    if currency == "all":
        for c in p.graph.keys():
            log_conversions(p.results, c, limit)
    else:
        log_conversions(p.results, currency, limit)

except KeyError:
    logging.warning(
        "Could not find any profitable conversions for {} in {}".format(
            currency, league))
Ejemplo n.º 7
0
    help="Use poe.trade instead of pathofexile.com/trade")

arguments = parser.parse_args()
league = arguments.league
currency = arguments.currency
limit = arguments.limit
fullbulk = arguments.fullbulk
use_filter = False if arguments.nofilter else True
backend = poetrade if arguments.poetrade else poeofficial
config = {"fullbulk": fullbulk}
chosen_currencies = item_list.get_item_list_for_backend(backend, config)

# Load excluded trader list
with open("excluded_traders.txt", "r") as f:
    excluded_traders = [x.strip() for x in f.readlines()]

p = PathFinder(league, chosen_currencies, backend, excluded_traders,
               use_filter)
p.run(3, True)

try:
    if currency == "all":
        for c in p.graph.keys():
            log_conversions(p.results, league, c, limit)
    else:
        log_conversions(p.results, league, currency, limit)

except KeyError:
    print("Could not find any profitable conversions for {} in {}".format(
        currency, league))
def test_find_exec_win_empty(mock_walk, s1_dir_no_exe):
    mock_walk.return_value = s1_dir_no_exe
    execs = PathFinder(Platform.WINDOWS).find_executables('some_mock_path')
    assert execs == []