Skip to content

Commit

Permalink
Replace manual nested loops with set operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
bbannier committed Jan 10, 2023
1 parent 4a28a69 commit 90a80b4
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions zeekpkg/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import importlib.machinery
import os
import shutil
import string
import tarfile
import types

Expand Down Expand Up @@ -287,28 +288,8 @@ def is_sha1(s):
if len(s) != 40:
return False

for c in s:
if c not in {
"a",
"b",
"c",
"d",
"e",
"f",
"0",
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
}:
return False

return True
hexdigits = set(string.hexdigits.lower())
return all(c in hexdigits for c in s)


def is_exe(path):
Expand Down

0 comments on commit 90a80b4

Please sign in to comment.