facebook/FAI-PEP

Checking if the key exists in dictionary instead of using dict.get(key, None)

mohitanand001 opened this issue · 1 comments

if "shared_libs" in info:
minfo["shared_libs"] = info["shared_libs"]

if "shared_libs" in info:
cinfo["shared_libs"] = info["shared_libs"]

Some places in this file FAI-PEP/benchmarking/driver/benchmark_driver.py has check if a key is in the dictionary and then tries to access it. It may be inefficient and less clean to go through
the dictionary twice. Can I raise a PR to change these to

minfo["shared_libs"] = info.get("shared_libs", "") 
cinfo["shared_libs"] = info.get("shared_libs", "")

Please do, thanks