From ebdfcd3cd3f76534a590ba08933ff7ea54813316 Mon Sep 17 00:00:00 2001 From: Unit 193 Date: Sat, 24 Dec 2022 17:14:46 -0500 Subject: New upstream version 1.24.2. --- gallery_dl/util.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'gallery_dl/util.py') diff --git a/gallery_dl/util.py b/gallery_dl/util.py index 8ce1fb4..23d5bc8 100644 --- a/gallery_dl/util.py +++ b/gallery_dl/util.py @@ -528,8 +528,8 @@ def parse_inputfile(file, log): yield line -class UniversalNone(): - """None-style object that supports more operations than None itself""" +class CustomNone(): + """None-style type that supports more operations than regular None""" __slots__ = () def __getattribute__(self, _): @@ -538,10 +538,28 @@ class UniversalNone(): def __getitem__(self, _): return self + def __iter__(self): + return self + + def __call__(self, *args, **kwargs): + return self + + @staticmethod + def __next__(): + raise StopIteration + @staticmethod def __bool__(): return False + @staticmethod + def __len__(): + return 0 + + @staticmethod + def __format__(_): + return "None" + @staticmethod def __str__(): return "None" @@ -549,7 +567,7 @@ class UniversalNone(): __repr__ = __str__ -NONE = UniversalNone() +NONE = CustomNone() EPOCH = datetime.datetime(1970, 1, 1) SECOND = datetime.timedelta(0, 1) WINDOWS = (os.name == "nt") -- cgit v1.2.3