Skip to content

Commit 67ad6e0

Browse files
[Python] Lint for unintentional tuples (#41131)
* Bump autopep8 version in restyled configuration * Check for unintentional tuple * Restyled by autopep8 * Improve codestyle --------- Co-authored-by: Restyled.io <[email protected]>
1 parent 2ec2062 commit 67ad6e0

File tree

31 files changed

+98
-95
lines changed

31 files changed

+98
-95
lines changed

.restyled.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ restylers:
224224
- "**/*.sh"
225225
- "**/*.bash"
226226
- name: autopep8
227-
image: restyled/restyler-autopep8:v2.0.0
227+
image: restyled/restyler-autopep8:v2.3.0
228228
command:
229229
- autopep8
230230
- "--in-place"

credentials/generate_revocation_set.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -864,7 +864,7 @@ def cli():
864864
@optgroup.option('--use-test-net-dcld', type=str, default='', metavar='PATH', help="Location of `dcld` binary, to use `dcld` for mirroring TestNet.")
865865
@optgroup.option('--use-main-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public MainNet observer.")
866866
@optgroup.option('--use-test-net-http', is_flag=True, type=str, help="Use RESTful API with HTTPS against public TestNet observer.")
867-
@optgroup.option('--use-local-data', is_flag=True, type=bool, help="Fake response directory: see \" DATA_DIR/",)
867+
@optgroup.option('--use-local-data', is_flag=True, type=bool, help="Fake response directory: see \" DATA_DIR/")
868868
@optgroup.group('Required arguments if use-local-data is used', cls=AllOptionGroup)
869869
@optgroup.option('--certificates', type=click.File('rb'), multiple=True, help='Paths to PEM formated certificates (i.e. PAA) in DCL but missing from the revocation-points-response file.')
870870
@optgroup.option('--crls', type=click.File('rb'), multiple=True, help='Paths to the crl der files')

pyproject.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ exclude = [
2222
]
2323

2424
[tool.ruff.lint]
25-
select = ["E4", "E7", "E9", "F"]
25+
select = ["COM", "E1", "E4", "E7", "E9", "F", "W6"]
2626
ignore = [
27+
"COM812", # Do not enforce trailing commas in multi-line collections
2728
"E721", # We use it for good reasons
2829
]

scripts/examples/tests/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def build_actual_output(root: str, out: str) -> List[str]:
4040
subprocess.run([
4141
binary,
4242
project,
43-
], stdout=subprocess.PIPE, check=True, encoding='UTF-8', )
43+
], stdout=subprocess.PIPE, check=True, encoding='UTF-8')
4444

4545
with open(cmake, 'rt') as f:
4646
for line in f.readlines():

scripts/py_matter_idl/matter/idl/test_matter_idl_parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,7 @@ def test_endpoints(self):
748748
ServerClusterInstantiation(
749749
name="Bar"),
750750
],
751-
client_bindings=["Bar", "Test"],)
751+
client_bindings=["Bar", "Test"])
752752
])
753753
self.assertIdlEqual(actual, expected)
754754

@@ -783,7 +783,7 @@ def test_cluster_instantiation(self):
783783
storage=AttributeStorage.CALLBACK, default=True),
784784
]),
785785
],
786-
client_bindings=[],)
786+
client_bindings=[])
787787
])
788788
self.assertIdlEqual(actual, expected)
789789

@@ -908,7 +908,7 @@ def test_cluster_reference_globals(self):
908908
],
909909
structs=[
910910
Struct(name="MyStruct", fields=[
911-
Field(name="subStruct", code=0, data_type=DataType(name="TestStruct"), qualities=FieldQuality.NULLABLE), ],
911+
Field(name="subStruct", code=0, data_type=DataType(name="TestStruct"), qualities=FieldQuality.NULLABLE)],
912912
),
913913
global_struct,
914914
],

scripts/py_matter_idl/matter/idl/test_zapxml.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ def testFeatures(self):
347347
Idl(clusters=[
348348
Cluster(name='TestFeatures',
349349
code=20, bitmaps=[bitmap])
350-
])),
350+
]))
351351

352352
def testGlobalStruct(self):
353353
idl = XmlToIdl('''<?xml version="1.0"?>
@@ -447,7 +447,7 @@ def testStruct(self):
447447
),
448448
qualities=AttributeQuality.READABLE,
449449
readacl=AccessPrivilege.VIEW,
450-
writeacl=AccessPrivilege.OPERATE)]), ]))
450+
writeacl=AccessPrivilege.OPERATE)])]))
451451

452452
def testSkipsNotProcessedFields(self):
453453
# Zap has extra fields that are generally not processed
@@ -497,7 +497,7 @@ def testSkipsNotProcessedFields(self):
497497
),
498498
qualities=AttributeQuality.READABLE,
499499
readacl=AccessPrivilege.VIEW,
500-
writeacl=AccessPrivilege.OPERATE)]), ]))
500+
writeacl=AccessPrivilege.OPERATE)])]))
501501

502502

503503
if __name__ == '__main__':

scripts/py_matter_yamltests/matter/yamltests/parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def __init__(self, content, target_name, candidate_names=[]):
8787

8888
class PostProcessCheckStatus(Enum):
8989
'''Indicates the post processing check step status.'''
90-
SUCCESS = 'success',
91-
WARNING = 'warning',
90+
SUCCESS = 'success'
91+
WARNING = 'warning'
9292
ERROR = 'error'
9393

9494

scripts/tests/run_fuzztest_coverage.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def run_fuzz_test(context):
137137

138138
try:
139139
if context.run_mode == FuzzTestMode.UNIT_TEST_MODE:
140-
subprocess.run([context.fuzz_test_binary_path, ], env=env, check=True)
140+
subprocess.run([context.fuzz_test_binary_path], env=env, check=True)
141141
logging.info("Fuzz Test Suite executed in Unit Test Mode.\n")
142142
elif context.run_mode == FuzzTestMode.CONTINUOUS_FUZZ_MODE:
143143
cmd_args = [context.fuzz_test_binary_path, f"--fuzz={context.selected_fuzz_test_case}"]

scripts/tools/bouffalolab/generate_factory_data.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ def convert_pem_to_der(chip_cert, action, pem):
227227

228228
der = Path(pem).with_suffix(".der")
229229
if not os.path.isfile(der):
230-
cmd = [chip_cert, action, pem, der, "--x509-der", ]
230+
cmd = [chip_cert, action, pem, der, "--x509-der"]
231231
subprocess.run(cmd)
232232

233233
return der

scripts/tools/memory/memdf/report.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def postprocess_report_by(config: Config, key: str, info: Mapping) -> None:
6969
"""For --report-by=region, select all sections."""
7070
assert key == 'report.by'
7171
if config.get(key) == 'region':
72-
config.put('section.select-all', True),
72+
config.put('section.select-all', True)
7373

7474

7575
REPORT_BY_CONFIG: ConfigDescription = {

0 commit comments

Comments
 (0)