Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build_from(actions, ints):
ints_index = 0
g = Goals('Root')
for name in actions:
int_val = 0
if name == 'select':
int_val = ints[ints_index]
ints_index += 1
USER_ACTIONS[name](g, int_val)
return g
def setUp(self):
self.goals = Goals('Root')
def read_disk_config():
"""
Volumes - this is tricky to bend .ini files to handle lists of tuples
The encoded json approach was just too fragile.
So a new section is being added
"""
try:
confd = config.read_ini(CONFIGLOCATION)
if confd["devstation_config_root"].startswith("~/"):
confd["devstation_config_root"] = confd["devstation_config_root"].replace(
"~", os.path.expanduser("~")
)
volumesd = config.read_ini(CONFIGLOCATION)["volumes"]
#: we want to convert an ini section to a dict.
confd["volumes"] = {}
for k, i in volumesd.items():
if "~/" in k:
# convert ~/data to /home/user/data
newkey = os.path.join(os.path.expanduser("~"), k.replace("~/", ""))
# we should have volumes = {'/home/user/data': '/var/data'}
confd["volumes"][newkey] = i
hasconfigdir = True
except Exception as e:
log.error("Failed to read config - error is %s", e)
def read_disk_config():
"""
Volumes - this is tricky to bend .ini files to handle lists of tuples
The encoded json approach was just too fragile.
So a new section is being added
"""
try:
confd = config.read_ini(CONFIGLOCATION)
if confd["devstation_config_root"].startswith("~/"):
confd["devstation_config_root"] = confd["devstation_config_root"].replace(
"~", os.path.expanduser("~")
)
volumesd = config.read_ini(CONFIGLOCATION)["volumes"]
#: we want to convert an ini section to a dict.
confd["volumes"] = {}
for k, i in volumesd.items():
if "~/" in k:
# convert ~/data to /home/user/data
newkey = os.path.join(os.path.expanduser("~"), k.replace("~/", ""))
# we should have volumes = {'/home/user/data': '/var/data'}
confd["volumes"][newkey] = i
hasconfigdir = True
except Exception as e:
log.error("Failed to read config - error is %s", e)
if PDB:
import pdb
pdb.set_trace()
confd = {}
def write_disk_config(confd):
""" """
config.write_ini(confd, CONFIGLOCATION)