refactor: Change for loop to list comprehensions

Not only more concise and shorter, it's notably faster

Signed-off-by: nothingbutlucas <69118979+nothingbutlucas@users.noreply.github.com>
This commit is contained in:
nothingbutlucas 2024-04-24 00:24:22 -03:00
parent 465695b9ae
commit cf41187e2f
No known key found for this signature in database
GPG Key ID: 31DE05DB3B0D9074

View File

@ -96,11 +96,7 @@ def main():
args = parser.parse_args()
ops = 0;
for t in [args.encrypt, args.decrypt, args.validate, args.sign]:
if t:
ops += 1
ops = sum(1 for t in [args.encrypt, args.decrypt, args.validate, args.sign] if t)
if ops > 1:
RNS.log("This utility currently only supports one of the encrypt, decrypt, sign or verify operations per invocation", RNS.LOG_ERROR)
exit(1)