# Path: gsdtools/stats.py
# class HistogramRequest:
#     def __init__(self, hmin=None, hmax=None, nbuckets=None,
#                  include_out_of_range=False, computehistogram=True):
# 
#         #: Enable histogram computation.
#         self.computehistogram = computehistogram
# 
#         #: Histogram minimum.
#         self.hmin = hmin
# 
#         #: Histogram maximum.
#         self.hmax = hmax
# 
#         #: Number of buckets for histogram comutation.
#         self.nbuckets = nbuckets
# 
#         #: Flag for out of range values handling.
#         #:
#         #: If set then values below the histogram range will be mapped into
#         #: the first bucket, and values above will be mapped into last one.
#         #: Otherwise out of range values are discarded.
#         self.include_out_of_range = include_out_of_range
# 
#     def __str__(self):
#         return ('HistogramRequest(hmin=%(hmin)s, hmax=%(hmax)s, '
#                 'nbuckets=%(nbuckets)s, '
#                 'include_out_of_range=%(include_out_of_range)s, '
#                 'computehistogram=%(computehistogram)s)' % self.__dict__)
# 
#     def __bool__(self):
#         return bool(self.computehistogram)
# 
#     if sys.version_info < (3, 0):
#         __nonzero__ = __bool__
# 
#     def values(self):
#         return self.hmin, self.hmax, self.nbuckets
# 
#     def iscustom(self):
#         return all(
#             val is not None for val in (self.hmin, self.hmax, self.nbuckets))
# 
# Path: gsdview/utils.py
# def default_workdir():
# def _getresource(resource, package):
# def getresource(resource, package=None):
# def format_platform_info():
# def format_bugreport(exctype=None, excvalue=None, tracebackobj=None,
#                      extra_info=None):
#     def isexecutable(cmd):
#     def isexecutable(cmd):
# def isscript(filename):
# def scriptcmd(scriptname):
#     def get_tree_size(path):
#     def get_tree_size(path):
# def data_uuid(path, prefixlen=23):
# def geonormalize(x, angle_range=360.):
# 
# Path: gsdview/gdalbackend/gdalexectools.py
# class BaseGdalToolDescriptor(exectools.ToolDescriptor):
#     """Base class for GDAL tool descriptors."""
# 
#     def gdal_config_options(self, cmd=''):
#         extra_args = []
# 
#         if 'GDAL_CACHEMAX' not in cmd:
#             value = gdal.GetCacheMax()
#             extra_args.extend(('--config', 'GDAL_CACHEMAX', str(value)))
# 
#         for key in ('CPL_DEBUG', 'GDAL_SKIP', 'GDAL_DATA',
#                     'GDAL_DRIVER_PATH', 'OGR_DRIVER_PATH'):
#             if key not in cmd:
#                 value = gdal.GetConfigOption(key, None)
#                 if value:
#                     extra_args.extend(('--config', key, '"%s"' % value))
# 
#         return extra_args
# 
#     def cmdline(self, *args, **kwargs):
#         parts = super().cmdline(*args, **kwargs)
# 
#         extra_args = self.gdal_config_options(parts)
#         if extra_args:
#             if not self.executable or isinstance(self.executable, str):
#                 parts = [parts[0]] + extra_args + parts[1:]
#             else:
#                 executable = list(self.executable)
#                 parts = executable + extra_args + parts[len(executable):]
# 
#         return parts


import os
import shutil
import gsdtools
from gsdtools.stats import HistogramRequest
from gsdview import utils
from gsdview.gdalbackend.gdalexectools import BaseGdalToolDescriptor
            args = ['--no-stats'] + args
        if self.hist.computehistogram and '--hist' not in args:
            args = ['--hist'] + args
        if (self.band is not None
                and not {'-b', '--band'}.intersection(args)):
            args = ['--band', str(self.band)] + args
        if (self.approxok is not None
                and not {'-a', '--approxok'}.intersection(args)):
            args = ['--approxok'] + args
        if self.hist.minmaxonly is not None and '--minmax-only' not in args:
            args = ['--minmax-only'] + args
        if self.hist.iscustom() and '--histreq' not in args:
            values = [str(item) for item in self.hist.values()]
            args = ['--histreq'] + values + args
        if (self.hist.include_out_of_range is not None
                and not {'-i', '--include_out_of_range'}.intersection(args)):
            args = ['--include_out_of_range'] + args
        if self.srcwin and '--srcwin' not in args:
            values = [str(item) for item in self.srcwin]
            args = ['--srcwin'] + values + args
        if (self.outfile is not None
                and not {'-o', '--outfile'}.intersection(args)):
            args = ['--outfile', self.outfile] + args
        if (self.quiet is not None
                and not {'-q', '--quiet'}.intersection(args)):
            args = ['--quiet'] + args

        return super().cmdline(*args, **kwargs)



# Path: gsdtools/stats.py
# class HistogramRequest:
#     def __init__(self, hmin=None, hmax=None, nbuckets=None,
#                  include_out_of_range=False, computehistogram=True):
# 
#         #: Enable histogram computation.
#         self.computehistogram = computehistogram
# 
#         #: Histogram minimum.
#         self.hmin = hmin
# 
#         #: Histogram maximum.
#         self.hmax = hmax
# 
#         #: Number of buckets for histogram comutation.
#         self.nbuckets = nbuckets
# 
#         #: Flag for out of range values handling.
#         #:
#         #: If set then values below the histogram range will be mapped into
#         #: the first bucket, and values above will be mapped into last one.
#         #: Otherwise out of range values are discarded.
#         self.include_out_of_range = include_out_of_range
# 
#     def __str__(self):
#         return ('HistogramRequest(hmin=%(hmin)s, hmax=%(hmax)s, '
#                 'nbuckets=%(nbuckets)s, '
#                 'include_out_of_range=%(include_out_of_range)s, '
#                 'computehistogram=%(computehistogram)s)' % self.__dict__)
# 
#     def __bool__(self):
#         return bool(self.computehistogram)
# 
#     if sys.version_info < (3, 0):
#         __nonzero__ = __bool__
# 
#     def values(self):
#         return self.hmin, self.hmax, self.nbuckets
# 
#     def iscustom(self):
#         return all(
#             val is not None for val in (self.hmin, self.hmax, self.nbuckets))
# 
# Path: gsdview/utils.py
# def default_workdir():
# def _getresource(resource, package):
# def getresource(resource, package=None):
# def format_platform_info():
# def format_bugreport(exctype=None, excvalue=None, tracebackobj=None,
#                      extra_info=None):
#     def isexecutable(cmd):
#     def isexecutable(cmd):
# def isscript(filename):
# def scriptcmd(scriptname):
#     def get_tree_size(path):
#     def get_tree_size(path):
# def data_uuid(path, prefixlen=23):
# def geonormalize(x, angle_range=360.):
# 
# Path: gsdview/gdalbackend/gdalexectools.py
# class BaseGdalToolDescriptor(exectools.ToolDescriptor):
#     """Base class for GDAL tool descriptors."""
# 
#     def gdal_config_options(self, cmd=''):
#         extra_args = []
# 
#         if 'GDAL_CACHEMAX' not in cmd:
#             value = gdal.GetCacheMax()
#             extra_args.extend(('--config', 'GDAL_CACHEMAX', str(value)))
# 
#         for key in ('CPL_DEBUG', 'GDAL_SKIP', 'GDAL_DATA',
#                     'GDAL_DRIVER_PATH', 'OGR_DRIVER_PATH'):
#             if key not in cmd:
#                 value = gdal.GetConfigOption(key, None)
#                 if value:
#                     extra_args.extend(('--config', key, '"%s"' % value))
# 
#         return extra_args
# 
#     def cmdline(self, *args, **kwargs):
#         parts = super().cmdline(*args, **kwargs)
# 
#         extra_args = self.gdal_config_options(parts)
#         if extra_args:
#             if not self.executable or isinstance(self.executable, str):
#                 parts = [parts[0]] + extra_args + parts[1:]
#             else:
#                 executable = list(self.executable)
#                 parts = executable + extra_args + parts[len(executable):]
# 
#         return parts


# Path: gsdview/plugins/gsdtoolsui/tooldescriptors.py
import os
import shutil
import gsdtools
from gsdtools.stats import HistogramRequest
from gsdview import utils
from gsdview.gdalbackend.gdalexectools import BaseGdalToolDescriptor

            args = ['--no-stats'] + args
        if self.hist.computehistogram and '--hist' not in args:
            args = ['--hist'] + args
        if (self.band is not None
                and not {'-b', '--band'}.intersection(args)):
            args = ['--band', str(self.band)] + args
        if (self.approxok is not None
                and not {'-a', '--approxok'}.intersection(args)):
            args = ['--approxok'] + args
        if self.hist.minmaxonly is not None and '--minmax-only' not in args:
            args = ['--minmax-only'] + args
        if self.hist.iscustom() and '--histreq' not in args:
            values = [str(item) for item in self.hist.values()]
            args = ['--histreq'] + values + args
        if (self.hist.include_out_of_range is not None
                and not {'-i', '--include_out_of_range'}.intersection(args)):
            args = ['--include_out_of_range'] + args
        if self.srcwin and '--srcwin' not in args:
            values = [str(item) for item in self.srcwin]
            args = ['--srcwin'] + values + args
        if (self.outfile is not None
                and not {'-o', '--outfile'}.intersection(args)):
            args = ['--outfile', self.outfile] + args
        if (self.quiet is not None
                and not {'-q', '--quiet'}.intersection(args)):
            args = ['--quiet'] + args

        return super().cmdline(*args, **kwargs)



class Ras2vecDescriptor(BaseGdalToolDescriptor):