From 832b8b76acfb4532af6c5a6944bbc85b4a05e718 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Mon, 9 Oct 2017 22:12:58 +0200 Subject: [PATCH] [util] extend global namespace for filter expressions --- gallery_dl/util.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gallery_dl/util.py b/gallery_dl/util.py index 1ba032db..eadfe489 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -8,6 +8,7 @@ """Utility functions and classes""" +import re import os import sys import hmac @@ -196,7 +197,12 @@ class UniquePredicate(): class FilterPredicate(): """Predicate; True if evaluating the given expression returns True""" - globalsdict = {"safe_int": safe_int, "datetime": datetime.datetime} + globalsdict = { + "safe_int": safe_int, + "urlsplit": urllib.parse.urlsplit, + "datetime": datetime.datetime, + "re": re, + } def __init__(self, codeobj): self.codeobj = codeobj