From 01811621a6c47de5fbd141c9737fc92a5fc32f3e Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Tue, 18 Oct 2016 17:25:16 -0500 Subject: [PATCH] shorten is_valid_blobhash logic --- lbrynet/core/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lbrynet/core/utils.py b/lbrynet/core/utils.py index 46f39f7dc..3efc1314d 100644 --- a/lbrynet/core/utils.py +++ b/lbrynet/core/utils.py @@ -49,14 +49,14 @@ def is_valid_hashcharacter(char): def is_valid_blobhash(blobhash): - """ + """Checks whether the blobhash is the correct length and contains only + valid characters (0-9, a-f) + @param blobhash: string, the blobhash to check - @return: Whether the blobhash is the correct length and contains only valid characters (0-9, a-f) + @return: True/False """ - if len(blobhash) != blobhash_length: - return False - return all(is_valid_hashcharacter(l) for l in blobhash) + return len(blobhash) == blobhash_length and all(is_valid_hashcharacter(l) for l in blobhash) def version_is_greater_than(a, b):