From 505a55474ae476c9949b73178cbfdf4d33eda547 Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Sat, 1 Sep 2018 22:44:31 +0530 Subject: [PATCH] feat: Add is_subset utility --- frappe/utils/data.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frappe/utils/data.py b/frappe/utils/data.py index 59c5cd9c30..a5a0ab7684 100644 --- a/frappe/utils/data.py +++ b/frappe/utils/data.py @@ -964,3 +964,7 @@ def get_source_value(source, key): return source.get(key) else: return getattr(source, key) + +def is_subset(list_a, list_b): + '''Returns whether list_a is a subset of list_b''' + return len(list(set(list_a) & set(list_b))) == len(list_a) \ No newline at end of file