Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def load():
for config_path in BaseDirectory.load_config_paths('buildhck', 'config.yaml'):
with open(config_path) as f:
obj = yaml.load(f)
if obj:
config.update(obj)
if not path.isdir(build_directory()):
makedirs(build_directory())
def get_config_files(filename):
"""
Iterator to @filename in all
config paths, with most important (takes precendence)
files first
"""
return base.load_config_paths(PACKAGE_NAME, filename) or ()
def load_config_paths(*resource):
import xdg.BaseDirectory
return xdg.BaseDirectory.load_config_paths(*resource)
def get_config_paths(appname, filename):
paths = reversed(list(xdg.BaseDirectory.load_config_paths(appname)))
config_paths = []
for path in paths:
config_paths.append(os.path.join(path, filename))
return config_paths
def load_config_paths(*resource):
import xdg.BaseDirectory
return xdg.BaseDirectory.load_config_paths(*resource)
def lookup_menu_files(filename):
return [f for f in xdg.BaseDirectory.load_config_paths('menus/' + filename)]
def load():
dct = {}
for filepath in BaseDirectory.load_config_paths("mup/mup.yaml"):
with open(filepath) as f:
try:
dct.update(yaml.load(f))
except Exception as exc:
logging.exception("Failed to load {}, skipping it.".format(filepath))
return dct
def load_config(app, filename):
config.clear()
for filename in BaseDirectory.load_config_paths('pb', filename):
with open(filename) as f:
obj = yaml.load(f)
config.update(obj)
if app:
app.config.from_mapping(config)
return config
def _read(self):
self._save = self._save_xdg
for d in BaseDirectory.load_config_paths(CONFIG):
path = os.path.join(d, DOMAINS)
if os.path.exists(path):
return self._read_file(path)
else:
return {}