Merged DR v1.0.1.2

This commit is contained in:
codemann8
2022-08-29 19:38:06 -05:00
6 changed files with 29 additions and 24 deletions

View File

@@ -1,11 +1,11 @@
import argparse
import logging
from pathlib import Path
import os
import RaceRandom as random
import urllib.request
import urllib.parse
import yaml
import os
from pathlib import Path
from DungeonRandomizer import parse_cli
from Main import main as DRMain
@@ -108,14 +108,11 @@ def main():
DRMain(erargs, seed, BabelFish())
def get_weights(path):
try:
if os.path.exists(Path(path)):
with open(path, "r", encoding="utf-8") as f:
return yaml.load(f, Loader=yaml.SafeLoader)
elif urllib.parse.urlparse(path).scheme in ['http', 'https']:
return yaml.load(urllib.request.urlopen(path), Loader=yaml.FullLoader)
except Exception as e:
raise Exception(f'Failed to read weights file: {e}')
if os.path.exists(Path(path)):
with open(path, "r", encoding="utf-8") as f:
return yaml.load(f, Loader=yaml.SafeLoader)
elif urllib.parse.urlparse(path).scheme in ['http', 'https']:
return yaml.load(urllib.request.urlopen(path), Loader=yaml.FullLoader)
def roll_settings(weights):
def get_choice(option, root=None):