diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 15:05:36 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-14 10:33:47 +0000 |
commit | e684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch) | |
tree | d55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/styleguide/python/python.md | |
parent | 2b94bfe47ccb6c08047959d1c26e392919550e86 (diff) | |
download | qtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz |
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/styleguide/python/python.md')
-rw-r--r-- | chromium/styleguide/python/python.md | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/chromium/styleguide/python/python.md b/chromium/styleguide/python/python.md new file mode 100644 index 00000000000..0f30b544ad3 --- /dev/null +++ b/chromium/styleguide/python/python.md @@ -0,0 +1,56 @@ +# Chromium Python style guide + +_For other languages, please see the [Chromium style +guides](https://chromium.googlesource.com/chromium/src/+/master/styleguide/styleguide.md)._ + +Chromium follows [PEP-8](https://www.python.org/dev/peps/pep-0008/) unless an +exception is listed below. + +See also the [Chromium OS Python Style +Guidelines](https://sites.google.com/a/chromium.org/dev/chromium-os/python-style-guidelines). + +You can propose changes to this style guide by sending an email to +`python@chromium.org`. Ideally, the list will arrive at some consensus and you +can request review for a change to this file. If there's no consensus, +[`//styleguide/python/OWNERS`](https://chromium.googlesource.com/chromium/src/+/master/styleguide/python/OWNERS) +get to decide. + +[TOC] + +## Differences from PEP-8 + +* Use two-space indentation instead of four-space indentation. +* Use `CamelCase()` method and function names instead of `unix_hacker_style()` + names. + +(The rationale for these is mostly legacy: the code was originally written +following Google's internal style guideline, the cost of updating all of the +code to PEP-8 compliance was not small, and consistency was seen to be a +greater virtue than compliance.) + +## Tools + +### pylint +[Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools.html) +contains a local copy of pylint, appropriately configured. + * Directories need to opt into pylint presumbit checks via: + `input_api.canned_checks.RunPylint()`. + +### YAPF +[YAPF](https://github.com/google/yapf) is a Python formatter that can be used via: + +```sh +git cl format --python +``` + +Directories can opt into enforcing YAPF styling by adding `.style.yapf` file +with the following contents: +``` +[style] +based_on_style = chromium +``` + +Entire files can be formatted (rather than just touched lines) via: +```sh +git cl format --python --full +```
\ No newline at end of file |