Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style: add .style.yapf to control yapf styling of Python code #2709

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[style]
based_on_style = pep8
indent_width = 2
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Below are some tips that might be useful and improve the development experience.

```
pip install yapf
yapf log_parser.py -i --style='{based_on_style: pep8, indent_width: 2}'
yapf log_parser.py -i'
```

* Add a git hook to check for code style etc. prior to creating a pull request:
Expand Down
9 changes: 0 additions & 9 deletions tensorflow/lite/micro/tools/make/pigweed.patch
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@ diff --git a/pw_presubmit/py/pw_presubmit/format_code.py b/pw_presubmit/py/pw_pr
index 19d09546..c1ff6b5a 100755
--- a/pw_presubmit/py/pw_presubmit/format_code.py
+++ b/pw_presubmit/py/pw_presubmit/format_code.py
@@ -142,7 +142,7 @@ def fix_go_format(files: Iterable[Path]) -> None:


def _yapf(*args, **kwargs) -> subprocess.CompletedProcess:
- return log_run(['python', '-m', 'yapf', '--parallel', *args],
+ return log_run(['python', '-m', 'yapf', '--style', '{based_on_style:pep8,indent_width:2}', '--parallel', *args],
capture_output=True,
**kwargs)

@@ -229,11 +229,6 @@ def print_format_check(errors: Dict[Path, str],
except ValueError:
return Path(path).resolve()
Expand Down
Loading