Convert None to the default for attribs.

This simplifies code that initializes attrs-based objects from
dictionaries that may or may not have the corresponding keys. Instead
of having to check if attribute 'x' is  present in the dict to determine
whether or not to pass an argument for the attribute, you can simply
pass x=d.get('x').

Bug: 1128746
Change-Id: I17a6147fdb9599ba7d1d8b5a3a8e10b045105a62
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/build/+/2513752
Commit-Queue: Garrett Beaty <gbeaty@chromium.org>
Reviewed-by: Stephen Martinis <martiniss@chromium.org>
2 files changed
tree: f12a882b07a7b92acaae567ea4a805e748af8a92
  1. infra/
  2. recipes/
  3. scripts/
  4. site_config/
  5. third_party/
  6. .gitattributes
  7. .gitignore
  8. .style.yapf
  9. .vpython
  10. .yapfignore
  11. codereview.settings
  12. CROS_OWNERS
  13. DEPS
  14. environment.cfg.py
  15. LICENSE
  16. OWNERS
  17. PRESUBMIT.py
  18. README.md
  19. WATCHLISTS
README.md

Recipes

If you're here to make a change to ‘recipes’ (the code located in scripts/slave/recipes*), please take a look at the README for more information pertaining to recipes.

Style

The preferred style is PEP8 with two-space indent; that is, the Chromium Python style. Functions use lowercase_with_underscores, with the exception of the special functions RunSteps and RunTests in recipes. Use yapf (git cl format --no-clang-format) to autoformat new code.