From b497ee4bc5f9708f1a7b37cc86bf5150d028fb3a Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Sat, 3 Dec 2022 06:23:12 +0100 Subject: [PATCH] actually never implemented a simple list intersection? --- tools/tools.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/tools/tools.py b/tools/tools.py index 824c1a1..f70eeaa 100644 --- a/tools/tools.py +++ b/tools/tools.py @@ -3,7 +3,7 @@ import inspect import os.path import sys from functools import wraps -from typing import Any, Union +from typing import Any, Union, List def get_script_dir(follow_symlinks: bool = True) -> str: @@ -76,3 +76,11 @@ def cache(func): return result return newfunc + + +def list_intersection(*args) -> list: + ret = set(args[0]) + for l in args[1:]: + ret = ret.intersection(l) + + return list(ret) \ No newline at end of file