style: apply ruff suggestion

Fixes the only error reported by ruff using default settings:
	E721 Do not compare types, use `isinstance()`
This commit is contained in:
Dimitri Papadopoulos
2023-12-31 13:02:23 +01:00
committed by Adrien Vergé
parent ef61384491
commit 1d65ab62cb
2 changed files with 2 additions and 2 deletions

View File

@@ -62,7 +62,7 @@ def build_temp_workspace(files):
if not os.path.exists(os.path.dirname(path)): if not os.path.exists(os.path.dirname(path)):
os.makedirs(os.path.dirname(path)) os.makedirs(os.path.dirname(path))
if type(content) is list: if isinstance(content, list):
os.mkdir(path) os.mkdir(path)
else: else:
mode = 'wb' if isinstance(content, bytes) else 'w' mode = 'wb' if isinstance(content, bytes) else 'w'

View File

@@ -205,7 +205,7 @@ def validate_rule_conf(rule, conf):
# Example: CONF = {option: ['flag1', 'flag2', int]} # Example: CONF = {option: ['flag1', 'flag2', int]}
# → {option: [flag1]} → {option: [42, flag1, flag2]} # → {option: [flag1]} → {option: [42, flag1, flag2]}
elif isinstance(options[optkey], list): 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 any(flag not in options[optkey] and
type(flag) not in options[optkey] type(flag) not in options[optkey]
for flag in conf[optkey])): for flag in conf[optkey])):