Skip to content

Commit

Permalink
yaml.load argument Loader now required
Browse files Browse the repository at this point in the history
  • Loading branch information
toliwaga committed Apr 4, 2019
1 parent 7455624 commit 57e697d
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion activitysim/abm/test/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def close_handlers():
def inject_settings(configs_dir, **kwargs):

with open(os.path.join(configs_dir, 'settings.yaml')) as f:
settings = yaml.load(f)
settings = yaml.load(f, Loader=yaml.SafeLoader)

for k in kwargs:
settings[k] = kwargs[k]
Expand Down
4 changes: 1 addition & 3 deletions activitysim/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,11 +343,9 @@ def backfill_settings(settings, backfill):
logger.warn("read settings for %s from %s" % (file_name, file_path))

with open(file_path) as f:
s = yaml.load(f)
s = yaml.load(f, Loader=yaml.SafeLoader)
settings = backfill_settings(settings, s)

print("settings after %s\n%s\n\n" % (file_path, settings))

if s.get('inherit_settings', False):
logger.warn("inherit_settings flag set for %s in %s" % (file_name, file_path))
continue
Expand Down
2 changes: 1 addition & 1 deletion activitysim/core/mp_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1524,7 +1524,7 @@ def read_breadcrumbs():
if not os.path.exists(file_path):
raise IOError("Could not find saved breadcrumbs file '%s'" % file_path)
with open(file_path, 'r') as f:
breadcrumbs = yaml.load(f)
breadcrumbs = yaml.load(f, Loader=yaml.SafeLoader)
# convert array to ordered dict keyed by step name
breadcrumbs = OrderedDict([(step['name'], step) for step in breadcrumbs])
return breadcrumbs
Expand Down
3 changes: 2 additions & 1 deletion activitysim/core/tracing.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,8 @@ def config_logger(basic=False):

if log_config_file:
with open(log_config_file) as f:
config_dict = yaml.load(f)
# FIXME need alternative to yaml.UnsafeLoader?
config_dict = yaml.load(f, Loader=yaml.UnsafeLoader)
config_dict = config_dict['logging']
config_dict.setdefault('version', 1)
logging.config.dictConfig(config_dict)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
'numpy == 1.15.4', # https://github.com/PyTables/PyTables/issues/719
'openmatrix >= 0.3.4.1',
'pandas >= 0.20.3',
'pyyaml >= 3.0, <5.1',
'pyyaml >= 3.0',
'tables >= 3.3.0',
'toolz >= 0.8.1',
'zbox >= 1.2',
Expand Down

1 comment on commit 57e697d

@bstabler
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.