#!/usr/bin/python3 from __future__ import division import unittest import math #import logging #logging.basicConfig(level = logging.DEBUG) import gi gi.require_version('Vips', '8.0') from gi.repository import Vips Vips.leak_set(True) unsigned_formats = [Vips.BandFormat.UCHAR, Vips.BandFormat.USHORT, Vips.BandFormat.UINT] signed_formats = [Vips.BandFormat.CHAR, Vips.BandFormat.SHORT, Vips.BandFormat.INT] float_formats = [Vips.BandFormat.FLOAT, Vips.BandFormat.DOUBLE] complex_formats = [Vips.BandFormat.COMPLEX, Vips.BandFormat.DPCOMPLEX] int_formats = unsigned_formats + signed_formats noncomplex_formats = int_formats + float_formats all_formats = int_formats + float_formats + complex_formats # an expanding zip ... if either of the args is not a list, duplicate it down # the other
#!/usr/bin/python3 from __future__ import division import unittest import math #import logging #logging.basicConfig(level = logging.DEBUG) from gi.repository import Vips Vips.leak_set(True) unsigned_formats = [ Vips.BandFormat.UCHAR, Vips.BandFormat.USHORT, Vips.BandFormat.UINT ] signed_formats = [ Vips.BandFormat.CHAR, Vips.BandFormat.SHORT, Vips.BandFormat.INT ] float_formats = [Vips.BandFormat.FLOAT, Vips.BandFormat.DOUBLE] complex_formats = [Vips.BandFormat.COMPLEX, Vips.BandFormat.DPCOMPLEX] int_formats = unsigned_formats + signed_formats noncomplex_formats = int_formats + float_formats all_formats = int_formats + float_formats + complex_formats # an expanding zip ... if either of the args is not a list, duplicate it down # the other def zip_expand(x, y): if isinstance(x, list) and isinstance(y, list): return list(zip(x, y))