Skip to content
Snippets Groups Projects
Commit ed47dd9f authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab
Browse files

scripts/xls_to_doc.py: make pylint happy


Pylint is too picky. Still, it is useful to run it, as sometimes
it could point to real issues.

So, let's make it happy by:
- disabling R0902, which is one of those "too many" warnings
  (IMO, it doesn't make sense to limit the number of times some
  thing can be used inside a code;

- disabling another warning about not using .items(). On that
  particular case, IMO it will make the code less clearer for
  reviewers and future maintainership, e. g.:

	test_nr = self.tests[testname].get("Test")

  and similar occurrences for self.tests[testname] is a lot clearer
  than:

	for testname, value in self.tests.items():
		...
		test_nr = value.get("Test")
		...
		value["subtests"][subtest][k] = val

	(and other similar occurrences)

  ok, a better name than "value" might help, but still the
  obvious choice would be "test", "test_testname" and such,
  which just makes the code more obfuscated.

  So, ignore the warning for good.

- remove a blank line before a docstring comment;

- remove a currently unused argument from update_files;

- fix indent on a single line.

No functional changes.

Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
Acked-by: default avatarKamil Konieczny <kamil.konieczny@linux.intel.com>
parent 14d955cc
No related branches found
No related tags found
No related merge requests found
Pipeline #1128554 passed
#!/usr/bin/env python3 #!/usr/bin/env python3
# pylint: disable=C0301,R0912,R0913,R0914,R0915,R1702 # pylint: disable=C0301,R0902,R0912,R0913,R0914,R0915,R1702
# SPDX-License-Identifier: (GPL-2.0 OR MIT) # SPDX-License-Identifier: (GPL-2.0 OR MIT)
## Copyright (C) 2023 Intel Corporation ## ## Copyright (C) 2023 Intel Corporation ##
...@@ -97,7 +97,6 @@ class FillTests(TestList): ...@@ -97,7 +97,6 @@ class FillTests(TestList):
dic[field] = value dic[field] = value
def process_spreadsheet_sheet(self, sheet): def process_spreadsheet_sheet(self, sheet):
""" """
Convert a single sheet into a dictionary. Convert a single sheet into a dictionary.
...@@ -299,7 +298,7 @@ class FillTests(TestList): ...@@ -299,7 +298,7 @@ class FillTests(TestList):
print("Handling common information on test from subtests") print("Handling common information on test from subtests")
for testname in self.tests: for testname in self.tests: # pylint: disable=C0206
# Get common properties # Get common properties
common = {} common = {}
test_nr = self.tests[testname].get("Test") test_nr = self.tests[testname].get("Test")
...@@ -363,7 +362,7 @@ class FillTests(TestList): ...@@ -363,7 +362,7 @@ class FillTests(TestList):
for k, val in common.items(): for k, val in common.items():
self.doc[test_nr][k] = val self.doc[test_nr][k] = val
def update_test_file(self, testname, args): def update_test_file(self, testname):
""" """
Update a C source file using the contents of self.tests as Update a C source file using the contents of self.tests as
the source of data to be filled at the igt_doc documentation the source of data to be filled at the igt_doc documentation
...@@ -419,7 +418,7 @@ class FillTests(TestList): ...@@ -419,7 +418,7 @@ class FillTests(TestList):
for field in sorted(fields): for field in sorted(fields):
if field not in self.update_fields: if field not in self.update_fields:
continue continue
value = subtest_content.get(field, "") value = subtest_content.get(field, "")
doc_value = doc_content.get(field, "") doc_value = doc_content.get(field, "")
...@@ -472,7 +471,7 @@ class FillTests(TestList): ...@@ -472,7 +471,7 @@ class FillTests(TestList):
except EnvironmentError: except EnvironmentError:
print(f'Failed to write to {sourcename}') print(f'Failed to write to {sourcename}')
def update_test_files(self, args): def update_test_files(self):
""" """
Populate all test files with the documentation from self.tests. Populate all test files with the documentation from self.tests.
""" """
...@@ -481,7 +480,7 @@ class FillTests(TestList): ...@@ -481,7 +480,7 @@ class FillTests(TestList):
print("Update source files") print("Update source files")
for testname in self.tests: for testname in self.tests:
self.update_test_file(testname, args) self.update_test_file(testname)
###### ######
# Main # Main
...@@ -525,7 +524,7 @@ def main(): ...@@ -525,7 +524,7 @@ def main():
with open("doc.json", "w", encoding='utf8') as write_file: with open("doc.json", "w", encoding='utf8') as write_file:
json.dump(fill_test.doc, write_file, indent=4) json.dump(fill_test.doc, write_file, indent=4)
fill_test.update_test_files(parse_args) fill_test.update_test_files()
if __name__ == '__main__': if __name__ == '__main__':
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment