You've already forked comprehensive-rust
mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-06-16 22:27:34 +02:00
Format Python files with YAPF (#1360)
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@ -16,9 +16,9 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Install Gettext
|
- name: Install formatting dependencies
|
||||||
run: |
|
run: |
|
||||||
sudo apt install gettext
|
sudo apt install gettext yapf3
|
||||||
|
|
||||||
- name: Install nightly rustfmt
|
- name: Install nightly rustfmt
|
||||||
run: |
|
run: |
|
||||||
|
10
.github/workflows/prevent-msgid.py
vendored
10
.github/workflows/prevent-msgid.py
vendored
@ -4,13 +4,17 @@ for filename in os.popen("git diff --name-only").read().split():
|
|||||||
if not filename.endswith(".po"):
|
if not filename.endswith(".po"):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if "POT-Creation-Date" in os.popen(f"git diff --unified=0 {filename}").read():
|
if "POT-Creation-Date" in os.popen(
|
||||||
print(f"Assuming {filename} was changed automatically, skipping msgid check")
|
f"git diff --unified=0 {filename}").read():
|
||||||
|
print(
|
||||||
|
f"Assuming {filename} was changed automatically, skipping msgid check"
|
||||||
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
changed_lines = {
|
changed_lines = {
|
||||||
i + 1
|
i + 1
|
||||||
for i, line in enumerate(os.popen(f"git blame {filename}").readlines())
|
for i, line in enumerate(
|
||||||
|
os.popen(f"git blame {filename}").readlines())
|
||||||
if line.startswith("00000000")
|
if line.startswith("00000000")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@
|
|||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
"""mdbook preprocessor which will help show the presentation aspect ratio.
|
"""mdbook preprocessor which will help show the presentation aspect ratio.
|
||||||
|
|
||||||
The preprocessor adds a large red rectangle on every page. The
|
The preprocessor adds a large red rectangle on every page. The
|
||||||
@ -31,6 +30,7 @@ import json
|
|||||||
import sys
|
import sys
|
||||||
import textwrap
|
import textwrap
|
||||||
|
|
||||||
|
|
||||||
def update_book_items(items):
|
def update_book_items(items):
|
||||||
aspect_ratio_helper = textwrap.dedent("""
|
aspect_ratio_helper = textwrap.dedent("""
|
||||||
<style>
|
<style>
|
||||||
@ -74,6 +74,7 @@ def update_book_items(items):
|
|||||||
chapter['content'] = aspect_ratio_helper + chapter['content']
|
chapter['content'] = aspect_ratio_helper + chapter['content']
|
||||||
update_book_items(chapter['sub_items'])
|
update_book_items(chapter['sub_items'])
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
if sys.argv[1] == "supports":
|
if sys.argv[1] == "supports":
|
||||||
@ -82,4 +83,3 @@ if __name__ == '__main__':
|
|||||||
context, book = json.load(sys.stdin)
|
context, book = json.load(sys.stdin)
|
||||||
update_book_items(book['sections'])
|
update_book_items(book['sections'])
|
||||||
print(json.dumps(book))
|
print(json.dumps(book))
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@
|
|||||||
},
|
},
|
||||||
"exec": {
|
"exec": {
|
||||||
"commands": [{
|
"commands": [{
|
||||||
|
"command": "yapf3",
|
||||||
|
"exts": ["py"]
|
||||||
|
}, {
|
||||||
"command": "rustfmt --edition 2021",
|
"command": "rustfmt --edition 2021",
|
||||||
"exts": ["rs"]
|
"exts": ["rs"]
|
||||||
}, {
|
}, {
|
||||||
|
Reference in New Issue
Block a user