fix E721 type-comparison

This commit is contained in:
linsui
2026-01-19 21:53:36 +08:00
parent 502433e0e6
commit 2d1e0be988
5 changed files with 6 additions and 6 deletions

View File

@@ -904,7 +904,7 @@ def parse_human_readable_size(size):
try:
return int(float(size))
except (ValueError, TypeError) as exc:
if type(size) != str:
if type(size) is not str:
raise ValueError(
_('Could not parse size "{size}", wrong type "{type}"').format(
size=size, type=type(size)
@@ -2516,7 +2516,7 @@ def is_strict_application_id(name):
def parse_srclib_spec(spec):
if type(spec) != str:
if type(spec) is not str:
raise MetaDataException(
_("can not parse scrlib spec (not a string): '{}'").format(spec)
)

View File

@@ -998,7 +998,7 @@ def upload_to_github_releases_repo(repo_conf, release_infos, global_gh_token):
)
return
conf_package_names = repo_conf.get("packageNames", [])
if type(conf_package_names) == str:
if type(conf_package_names) is str:
conf_package_names = [conf_package_names]
if not conf_package_names:
logging.warning(

View File

@@ -2360,7 +2360,7 @@ def lint_config(arg):
if type(data[key]) not in (str, list, dict):
passed = False
show_error = True
elif type(data[key]) != t:
elif type(data[key]) is not t:
passed = False
show_error = True
if show_error:

View File

@@ -390,7 +390,7 @@ class FieldValidator:
def check(self, v, appid):
if not v:
return
if type(v) == list:
if type(v) is list:
values = v
else:
values = [v]

View File

@@ -973,7 +973,7 @@ def insert_funding_yml_donation_links(apps):
)
)
logging.error(e)
if not data or type(data) != dict:
if not data or type(data) is not dict:
continue
if not app.get('Liberapay') and 'liberapay' in data:
s = sanitize_funding_yml_name(data['liberapay'])