Skip to content

Commit

Permalink
Merge pull request buildbot#8084 from Mic92/ruff-019
Browse files Browse the repository at this point in the history
ruff: apply rule RUF019
  • Loading branch information
p12tic authored Oct 7, 2024
2 parents 64512c6 + 35ac3d8 commit f6961e9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions master/buildbot/process/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,9 +364,9 @@ def colon_tilde(mo):
# if prop exists and is true (nonempty), use it; otherwise, use
# repl
prop, repl = mo.group(1, 2)
if prop in self.temp_vals and self.temp_vals[prop]:
if self.temp_vals.get(prop):
return self.temp_vals[prop]
elif prop in properties and properties[prop]:
elif prop in properties and properties[prop]: # noqa: RUF019
return properties[prop]
return repl

Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/test/util/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def validate(self, name, object):
class __metaclass__(type):
def __new__(mcs, name, bases, attrs):
cls = type.__new__(mcs, name, bases, attrs)
if 'name' in attrs and attrs['name']:
if attrs.get('name'):
assert attrs['name'] not in validatorsByName
validatorsByName[attrs['name']] = cls
return cls
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/worker/kubernetes.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def _get_request_kwargs(self):

kwargs = {}

if "headers" in config and config["headers"]:
if config.get("headers"):
kwargs.setdefault("headers", {}).update(config["headers"])

auth = yield self._kube_config.getAuthorization()
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/www/ldapuserinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def thd():
if not res:
return None
ldap_infos = res[0]['raw_attributes']
if self.avatarData in ldap_infos and ldap_infos[self.avatarData]:
if ldap_infos.get(self.avatarData):
data = ldap_infos[self.avatarData][0]
return self.findAvatarMime(data)
return None
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/www/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ def writeError(msg, errcode=399, jsonrpccode=JSONRPC_CODES["internal_error"]):
jsonRpcReply['id'] = id
ep, kwargs = yield self.getEndpoint(request, method, params)
userinfos = self.master.www.getUserInfos(request)
if 'anonymous' in userinfos and userinfos['anonymous']:
if userinfos.get('anonymous'):
owner = "anonymous"
else:
for field in ('email', 'username', 'full_name'):
Expand Down

0 comments on commit f6961e9

Please sign in to comment.