Skip to content

Commit

Permalink
style: apply ruff suggestion
Browse files Browse the repository at this point in the history
Fixes the only error reported by ruff using default settings:
	E721 Do not compare types, use `isinstance()`
  • Loading branch information
DimitriPapadopoulos authored and adrienverge committed Jan 4, 2024
1 parent ef61384 commit 1d65ab6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def build_temp_workspace(files):
if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path))

if type(content) is list:
if isinstance(content, list):
os.mkdir(path)
else:
mode = 'wb' if isinstance(content, bytes) else 'w'
Expand Down
2 changes: 1 addition & 1 deletion yamllint/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def validate_rule_conf(rule, conf):
# Example: CONF = {option: ['flag1', 'flag2', int]}
# → {option: [flag1]} → {option: [42, flag1, flag2]}
elif isinstance(options[optkey], list):
if (type(conf[optkey]) is not list or
if (not isinstance(conf[optkey], list) or
any(flag not in options[optkey] and
type(flag) not in options[optkey]
for flag in conf[optkey])):
Expand Down

0 comments on commit 1d65ab6

Please sign in to comment.