[style] bump yapf version to 0.31.0 (#6434)

This commit is contained in:
Simon Lin
2021-04-12 07:30:27 -07:00
committed by GitHub
parent 850468a68a
commit d5855ab74b
8 changed files with 36 additions and 38 deletions
+1 -1
View File
@@ -50,7 +50,7 @@ jobs:
run: |
sudo rm /etc/apt/sources.list.d/* && sudo apt-get update
sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9 shellcheck
python3 -m pip install yapf==0.29.0
python3 -m pip install yapf==0.31.0
sudo snap install shfmt
- name: Check
run: |
+1 -1
View File
@@ -109,7 +109,7 @@ This will open up a text editor where you can specify which commits to squash.
#### Coding Conventions and Style
OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use `script/make-pretty` and `script/make-pretty check` to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.29.0](https://github.com/google/yapf) for Python.
OpenThread uses and enforces the [OpenThread Coding Conventions and Style](STYLE_GUIDE.md) on all code, except for code located in [third_party](third_party). Use `script/make-pretty` and `script/make-pretty check` to automatically reformat code and check for code-style compliance, respectively. OpenThread currently requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.31.0](https://github.com/google/yapf) for Python.
As part of the cleanup process, you should also run `script/make-pretty check` to ensure that your code passes the baseline code style checks.
+1 -1
View File
@@ -116,7 +116,7 @@
- OpenThread uses `script/make-pretty` to reformat code and enforce code format and style. `script/make-pretty check` build target is included in OpenThread's continuous integration and must pass before a pull request is merged.
- `script/make-pretty` requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.29.0](https://github.com/google/yapf) for Python.
- `script/make-pretty` requires [clang-format v9.0.0](https://releases.llvm.org/download.html#9.0.0) for C/C++ and [yapf v0.31.0](https://github.com/google/yapf) for Python.
### File Names
+1 -1
View File
@@ -41,7 +41,7 @@ install_packages_pretty_format()
sudo apt-get --no-install-recommends install -y clang-format-9 clang-tidy-9 || echo 'WARNING: could not install clang-format-9 and clang-tidy-9, which is useful if you plan to contribute C/C++ code to the OpenThread project.'
# add yapf for pretty
python3 -m pip install yapf==0.29.0 || echo 'WARNING: could not install yapf, which is useful if you plan to contribute python code to the OpenThread project.'
python3 -m pip install yapf==0.31.0 || echo 'WARNING: could not install yapf, which is useful if you plan to contribute python code to the OpenThread project.'
# add mdv for local size report
python3 -m pip install mdv || echo 'WARNING: could not install mdv, which is required to post markdown size report for OpenThread.'
+19 -19
View File
@@ -388,15 +388,15 @@ def check_prefix(prefix):
def check_child_update_request_from_child(
command_msg,
source_address=CheckType.OPTIONAL,
leader_data=CheckType.OPTIONAL,
challenge=CheckType.OPTIONAL,
time_out=CheckType.OPTIONAL,
address_registration=CheckType.OPTIONAL,
tlv_request_tlv=CheckType.OPTIONAL,
active_timestamp=CheckType.OPTIONAL,
CIDs=(),
command_msg,
source_address=CheckType.OPTIONAL,
leader_data=CheckType.OPTIONAL,
challenge=CheckType.OPTIONAL,
time_out=CheckType.OPTIONAL,
address_registration=CheckType.OPTIONAL,
tlv_request_tlv=CheckType.OPTIONAL,
active_timestamp=CheckType.OPTIONAL,
CIDs=(),
):
command_msg.assertMleMessageContainsTlv(mle.Mode)
@@ -485,16 +485,16 @@ def check_child_update_request_from_parent(
def check_child_update_response(
command_msg,
timeout=CheckType.OPTIONAL,
address_registration=CheckType.OPTIONAL,
address16=CheckType.OPTIONAL,
leader_data=CheckType.OPTIONAL,
network_data=CheckType.OPTIONAL,
response=CheckType.OPTIONAL,
link_layer_frame_counter=CheckType.OPTIONAL,
mle_frame_counter=CheckType.OPTIONAL,
CIDs=(),
command_msg,
timeout=CheckType.OPTIONAL,
address_registration=CheckType.OPTIONAL,
address16=CheckType.OPTIONAL,
leader_data=CheckType.OPTIONAL,
network_data=CheckType.OPTIONAL,
response=CheckType.OPTIONAL,
link_layer_frame_counter=CheckType.OPTIONAL,
mle_frame_counter=CheckType.OPTIONAL,
CIDs=(),
):
"""Verify a properly formatted Child Update Response from parent
"""
+3 -3
View File
@@ -108,7 +108,7 @@ def any_uri_path():
class TestCoapMessageOptionHeader(unittest.TestCase):
def test_should_return_passed_on_value_when_read_extended_value_is_called_with_value_different_than_13_and_14(
self):
self):
# GIVEN
value = any_4bits_value_different_than_13_and_14()
@@ -119,7 +119,7 @@ class TestCoapMessageOptionHeader(unittest.TestCase):
self.assertEqual(value, actual_value)
def test_should_return_value_stored_in_first_byte_plus_13_when_read_extended_value_is_called_with_value_equal_13(
self):
self):
# GIVEN
value = 13
extended_value = any_value()
@@ -133,7 +133,7 @@ class TestCoapMessageOptionHeader(unittest.TestCase):
self.assertEqual(extended_value + 13, actual_value)
def test_should_return_value_stored_in_first_byte_plus_269_when_read_extended_value_is_called_with_value_equal_14(
self):
self):
# GIVEN
value = 14
extended_value = any_value()
+5 -6
View File
@@ -2246,12 +2246,11 @@ class OpenThreadTHCI(object):
if 'recv' in infoValue else PlatformDiagnosticPacket_Direction.OUT if
'send' in infoValue else PlatformDiagnosticPacket_Direction.UNKNOWN)
elif 'type' in infoType:
EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req
if 'JOIN_FIN.req' in infoValue else
PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp' in infoValue
else PlatformDiagnosticPacket_Type.JOIN_ENT_req if 'JOIN_ENT.ntf' in
infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp if 'JOIN_ENT.rsp'
in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN)
EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req if 'JOIN_FIN.req' in infoValue
else PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp'
in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_req if
'JOIN_ENT.ntf' in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp
if 'JOIN_ENT.rsp' in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN)
elif 'len' in infoType:
bytesInEachLine = 16
EncryptedPacket.TLVsLength = int(infoValue)
+5 -6
View File
@@ -2149,12 +2149,11 @@ class OpenThread_WpanCtl(IThci):
if 'recv' in infoValue else PlatformDiagnosticPacket_Direction.OUT if
'send' in infoValue else PlatformDiagnosticPacket_Direction.UNKNOWN)
elif 'type' in infoType:
EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req
if 'JOIN_FIN.req' in infoValue else
PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp' in infoValue
else PlatformDiagnosticPacket_Type.JOIN_ENT_req if 'JOIN_ENT.ntf' in
infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp if 'JOIN_ENT.rsp'
in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN)
EncryptedPacket.Type = (PlatformDiagnosticPacket_Type.JOIN_FIN_req if 'JOIN_FIN.req' in infoValue
else PlatformDiagnosticPacket_Type.JOIN_FIN_rsp if 'JOIN_FIN.rsp'
in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_req if
'JOIN_ENT.ntf' in infoValue else PlatformDiagnosticPacket_Type.JOIN_ENT_rsp
if 'JOIN_ENT.rsp' in infoValue else PlatformDiagnosticPacket_Type.UNKNOWN)
elif 'len' in infoType:
bytesInEachLine = 16
EncryptedPacket.TLVsLength = int(infoValue)