How to use the clu.predicates.or_none function in clu

To help you get started, we’ve selected a few clu examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github fish2000 / instakit / instakit / utils / mode.py View on Github external
def attr_or_none(self, name):
        return or_none(self, name)
github fish2000 / instakit / instakit / utils / mode.py View on Github external
def __init__(self, image, mode, **kwargs):
        assert Image.isImageType(image)
        assert Mode.is_mode(mode)
        if DEBUG:
            label = or_none(image, 'filename') \
                and os.path.basename(getattr(image, 'filename')) \
                or str(image)
            print(f"ModeContext.__init__: configured with image: {label}")
        self.initial_image = image
        self.image = None
        self.final_image = None
        self.original_mode = Mode.of(image)
        self.mode = mode