Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 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
2 changes: 1 addition & 1 deletion .github/workflows/ci-file-checks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ jobs:
- name: Run Yapf on the Python changed files
run: |
set +e
yapf --parallel --diff --style=google \
yapf --parallel --diff \
${{needs.Changes.outputs.python_files}} > diff.out 2>&1
exit_code=$?
if [[ -s ./diff.out ]]; then
Expand Down
2 changes: 2 additions & 0 deletions .style.yapf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[style]
based_on_style = google
Comment thread
mhucka marked this conversation as resolved.
2 changes: 0 additions & 2 deletions scripts/build_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@
FLAGS = flags.FLAGS




def main(unused_argv):

Check warning on line 46 in scripts/build_docs.py

View workflow job for this annotation

GitHub Actions / Check Python lint

C0116: Missing function or method docstring (missing-function-docstring)

doc_generator = generate_lib.DocGenerator(
root_title="TensorFlow Quantum",
Expand Down
3 changes: 1 addition & 2 deletions scripts/format_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
# limitations under the License.
# ==============================================================================
echo "Doing python language formatting..."
python3 -m yapf --style=google --in-place --recursive ./benchmarks
python3 -m yapf --style=google --in-place --recursive ./tensorflow_quantum
python3 -m yapf --in-place --recursive ./benchmarks ./tensorflow_quantum ./scripts
echo -e "Done! \nDoing notebook formatting..."
python3 ./scripts/format_ipynb.py
echo -e "Done! \nDoing C++ formatting..."
Expand Down
8 changes: 4 additions & 4 deletions scripts/format_check.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
# Copyright 2020 The TensorFlow Quantum Authors. All Rights Reserved.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -72,7 +72,7 @@ for changed_file in ${changed_files}; do
)
if [[ "${changed_line_ranges}" != "--lines=0-0 " ]]; then
# Do the formatting.
results=$(yapf --style=google --diff "${changed_file}" ${changed_line_ranges})
results=$(python3 -m yapf --diff "${changed_file}" ${changed_line_ranges})

# Print colorized error messages.
if [ ! -z "${results}" ]; then
Expand Down
2 changes: 1 addition & 1 deletion scripts/format_ipynb.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
lines = cell.get('source')
# This will safely skip over cells containing !% magic
try:
fmt_lines = yapf.yapf_api.FormatCode(''.join(lines),

Check warning on line 31 in scripts/format_ipynb.py

View workflow job for this annotation

GitHub Actions / Check Python lint

C0103: Constant name "fmt_lines" doesn't conform to '(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern ('(([A-Z_][A-Z0-9_]*)|(__.*__))$' pattern) (invalid-name)
style_config="google")[0]
filename=fname)[0]
except (SyntaxError, yapf.yapflib.errors.YapfError):
continue
# google style always adds an EOF newline; undo this.
Expand Down
Loading