refix yaml laoding
This commit is contained in:
parent
95d51d48bf
commit
1c855fea9a
3
Fill.py
3
Fill.py
|
@ -191,14 +191,13 @@ def fill_restrictive(world, base_state, locations, itempool, single_player_place
|
||||||
if world.accessibility[item_to_place.player] == 'none':
|
if world.accessibility[item_to_place.player] == 'none':
|
||||||
perform_access_check = not world.has_beaten_game(maximum_exploration_state, item_to_place.player) if single_player_placement else not has_beaten_game
|
perform_access_check = not world.has_beaten_game(maximum_exploration_state, item_to_place.player) if single_player_placement else not has_beaten_game
|
||||||
|
|
||||||
spot_to_fill = None
|
|
||||||
for location in locations:
|
for location in locations:
|
||||||
if (not single_player_placement or location.player == item_to_place.player)\
|
if (not single_player_placement or location.player == item_to_place.player)\
|
||||||
and location.can_fill(maximum_exploration_state, item_to_place, perform_access_check):
|
and location.can_fill(maximum_exploration_state, item_to_place, perform_access_check):
|
||||||
spot_to_fill = location
|
spot_to_fill = location
|
||||||
break
|
break
|
||||||
|
|
||||||
if spot_to_fill is None:
|
else:
|
||||||
# we filled all reachable spots. Maybe the game can be beaten anyway?
|
# we filled all reachable spots. Maybe the game can be beaten anyway?
|
||||||
unplaced_items.insert(0, item_to_place)
|
unplaced_items.insert(0, item_to_place)
|
||||||
if world.can_beat_game():
|
if world.can_beat_game():
|
||||||
|
|
|
@ -140,8 +140,9 @@ def main():
|
||||||
|
|
||||||
def get_weights(path):
|
def get_weights(path):
|
||||||
try:
|
try:
|
||||||
parsed_url = urllib.parse.urlparse(path)
|
if urllib.parse.urlparse(path).scheme:
|
||||||
if all(parsed_url.scheme, parsed_url.netloc, parsed_url.path):
|
yaml = str(urllib.request.urlopen(path).read(), "utf-8")
|
||||||
|
else:
|
||||||
with open(path, 'rb') as f:
|
with open(path, 'rb') as f:
|
||||||
yaml = str(f.read(), "utf-8")
|
yaml = str(f.read(), "utf-8")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Reference in New Issue