Skip to content

Commit

Permalink
pylint: fix len-as-condition warning
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigc committed Sep 16, 2018
1 parent 0e11f25 commit e004059
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion master/buildbot/data/types.py
Expand Up @@ -180,7 +180,7 @@ def validate(self, name, object):
yield "%s - %r - is not a unicode string" % (name, object)
elif not self.identRe.match(object):
yield "%s - %r - is not an identifier" % (name, object)
elif len(object) < 1:
elif not object:
yield "%s - identifiers cannot be an empty string" % (name,)
elif len(object) > self.len:
yield "%s - %r - is longer than %d characters" % (name, object,
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/test/util/config.py
Expand Up @@ -24,7 +24,7 @@ class ConfigErrorsMixin(object):
def assertConfigError(self, errors, substr_or_re):
if len(errors.errors) > 1:
self.fail("too many errors: %s" % (errors.errors,))
elif len(errors.errors) < 1:
elif not errors.errors:
self.fail("expected error did not occur")
else:
curr_error = errors.errors[0]
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/test/util/validation.py
Expand Up @@ -113,7 +113,7 @@ def validate(self, name, object):
yield "{} - {!r} - is not a unicode string".format(name, object)
elif not self.ident_re.match(object):
yield "{} - {!r} - is not an identifier".format(name, object)
elif len(object) < 1:
elif not object:
yield "{} - identifiers cannot be an empty string".format(name)
elif len(object) > self.len:
yield "{} - {!r} - is longer than {} characters".format(
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/util/__init__.py
Expand Up @@ -457,7 +457,7 @@ def command_to_string(command):
stringWords.append(w)
words = stringWords

if len(words) < 1:
if not words:
return None
if len(words) < 3:
rv = "'%s'" % (' '.join(words))
Expand Down
2 changes: 1 addition & 1 deletion worker/buildbot_worker/scripts/runner.py
Expand Up @@ -160,7 +160,7 @@ def validateMasterArgument(self, master_arg):
else:
master, port = master_arg.split(":")

if len(master) < 1:
if not master:
raise usage.UsageError("invalid <master> argument '{}'".format(
master_arg))
try:
Expand Down

0 comments on commit e004059

Please sign in to comment.