Skip to content

Commit

Permalink
style: Fix C0123: Use isinstance() rather than type() for a typecheck…
Browse files Browse the repository at this point in the history
  • Loading branch information
echoix committed Dec 27, 2024
1 parent 306d596 commit 989c540
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,6 @@ disable = [
"C0115", # Missing class docstring (missing-class-docstring)
"C0116", # Missing function or method docstring (missing-function-docstring)
"C0117", # Consider changing "not self.optype == 'boolean'" to "self.optype != 'boolean'" (unnecessary-negation)
"C0123", # Use isinstance() rather than type() for a typecheck. (unidiomatic-typecheck)
"C0200", # Consider using enumerate instead of iterating with range and len (consider-using-enumerate)
"C0201", # Consider iterating the dictionary directly instead of calling .keys() (consider-iterating-dictionary)
"C0204", # Metaclass class method %s should have %s as first argument (bad-mcs-classmethod-argument)
Expand Down
4 changes: 2 additions & 2 deletions python/grass/gunittest/reporters.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,7 +760,7 @@ def end_file_test(
# TODO: replace by better handling of potential lists when parsing
# TODO: create link to module if running in grass or in addons
# alternatively a link to module test summary
if type(modules) is not list:
if not isinstance(modules, list):
modules = [modules]

# here we would have also links to coverage, profiling, ...
Expand Down Expand Up @@ -1129,7 +1129,7 @@ def report_for_dir(self, root, directory, test_files):
test_file_authors = summary.get("test_file_authors")
if not test_file_authors:
test_file_authors = []
if type(test_file_authors) is not list:
if not isinstance(test_file_authors, list):
test_file_authors = [test_file_authors]
test_files_authors.extend(test_file_authors)

Expand Down

0 comments on commit 989c540

Please sign in to comment.