remove f-strings for python 3.5 compatibility (#854)
This commit is contained in:
@@ -123,7 +123,7 @@ def mpi_weighted_mean(comm, local_name2valcount):
|
||||
val = float(val)
|
||||
except ValueError:
|
||||
if comm.rank == 0:
|
||||
warnings.warn(f'WARNING: tried to compute mean on non-float {name}={val}')
|
||||
warnings.warn('WARNING: tried to compute mean on non-float {}={}'.format(name, val))
|
||||
else:
|
||||
name2sum[name] += val * count
|
||||
name2count[name] += count
|
||||
|
@@ -177,7 +177,7 @@ def profile_tf_runningmeanstd():
|
||||
outfile = '/tmp/timeline.json'
|
||||
with open(outfile, 'wt') as f:
|
||||
f.write(chrome_trace)
|
||||
print(f'Successfully saved profile to {outfile}. Exiting.')
|
||||
print('Successfully saved profile to {}. Exiting.'.format(outfile))
|
||||
exit(0)
|
||||
'''
|
||||
|
||||
|
@@ -17,7 +17,7 @@ def test_mpi_weighted_mean():
|
||||
d = mpi_util.mpi_weighted_mean(comm, name2valcount)
|
||||
correctval = {'a' : (10 * 2 + 19) / 3.0, 'b' : 20, 'c' : 42}
|
||||
if comm.rank == 0:
|
||||
assert d == correctval, f'{d} != {correctval}'
|
||||
assert d == correctval, '{} != {}'.format(d, correctval)
|
||||
|
||||
for name, (val, count) in name2valcount.items():
|
||||
for _ in range(count):
|
||||
|
@@ -232,7 +232,7 @@ def main(args):
|
||||
env.render()
|
||||
done = done.any() if isinstance(done, np.ndarray) else done
|
||||
if done:
|
||||
print(f'episode_rew={episode_rew}')
|
||||
print('episode_rew={}'.format(episode_rew))
|
||||
episode_rew = 0
|
||||
obs = env.reset()
|
||||
|
||||
|
Reference in New Issue
Block a user