Fixes the options, if necessary. I.e., it adds all required elements to the dictionary.

        :param options: the options to fix
        :type options: dict
        :return: the (potentially) fixed options
        :rtype: dict
169379
def fix_config(self, options):
        
        options = super(DeleteFile, self).fix_config(options)

        opt = "regexp"
        if opt not in options:
            options[opt] = ".*"
        if opt not in self.help:
            self.help[opt] = "The regular expression that the files must match (string)."

        return options
784140
def fix_config(self, options):
        
        options = super(RenameRelation, self).fix_config(options)

        opt = "name"
        if opt not in options:
            options[opt] = "newname"
        if opt not in self.help:
            self.help[opt] = "The new relation name to use (string)."

        return options
487884
def addOption(classobj, name, default, dtype=str, doc=None):
        
        # make a config object
        if not hasattr(classobj, '_config'):
            classobj._config = Kittens.config.SectionParser(ConfigFile, "render-" + classobj.renderer_id)
        # make a class-specific copy of the current option set
        if classobj._options_owner is not classobj:
            classobj.options = dict(DefaultRenderer.options)
            classobj._options_owner = classobj
        # overrid default value from config file
        if dtype is bool:
            value = classobj._config.getbool(name, default)
        else:
            value = dtype(classobj._config.get(name, default))
        # insert into dict
        classobj.options[name] = (value, default, dtype, doc)
606786
def fix_config(self, options):
        
        options = super(DeleteStorageValue, self).fix_config(options)

        opt = "storage_name"
        if opt not in options:
            options[opt] = "unknown"
        if opt not in self.help:
            self.help[opt] = "The name of the storage value to delete (string)."

        return options
362445
def fix_config(self, options):
        
        opt = "search"
        if opt not in options:
            options[opt] = attsel.ASSearch(classname="weka.attributeSelection.BestFirst")
        if opt not in self.help:
            self.help[opt] = "The search algorithm to use (ASSearch)."

        opt = "eval"
        if opt not in options:
            options[opt] = attsel.ASEvaluation(classname="weka.attributeSelection.CfsSubsetEval")
        if opt not in self.help:
            self.help[opt] = "The evaluation algorithm to use (ASEvaluation)."

        return super(AttributeSelection, self).fix_config(options)
1206554
def fix(args):
    
    p = OptionParser(fix.__doc__)
    p.add_option("--minspan", default=0, type="int",
                 help="Enforce minimum span [default: %default]")
    p.set_outfile()
    opts, args = p.parse_args(args)

    if len(args) != 1:
        sys.exit(not p.print_help())

    bedfile, = args
    minspan = opts.minspan
    fp = open(bedfile)
    fw = must_open(opts.outfile, "w")
    nfixed = nfiltered = ntotal = 0
    for row in fp:
        atoms = row.strip().split("\t")
        assert len(atoms) >= 3, "Must be at least 3 columns"
        seqid, start, end = atoms[:3]
        start, end = int(start), int(end)
        orientation = '+'
        if start > end:
            start, end = end, start
            orientation = '-'
            nfixed += 1

        atoms[1:3] = [str(start), str(end)]
        if len(atoms) > 6:
            atoms[6] = orientation
        line = "\t".join(atoms)
        b = BedLine(line)

        if b.span >= minspan:
            print(b, file=fw)
            nfiltered += 1

        ntotal += 1

    if nfixed:
        logging.debug("Total fixed: {0}".format(percentage(nfixed, ntotal)))
    if nfiltered:
        logging.debug("Total filtered: {0}".format(percentage(nfiltered, ntotal)))
968388
def options(self):
        
        if self._options is None:
            self._options = Option.View(self)
        return self._options
664551
def fix_config(self, options):
        
        options = super(LinePlot, self).fix_config(options)

        opt = "attributes"
        if opt not in options:
            options[opt] = None
        if opt not in self.help:
            self.help[opt] = "The list of 0-based attribute indices to print; None for all (int)."

        opt = "percent"
        if opt not in options:
            options[opt] = 100.0
        if opt not in self.help:
            self.help[opt] = "The percentage of the data to display (0-100, float)."

        opt = "seed"
        if opt not in options:
            options[opt] = 1
        if opt not in self.help:
            self.help[opt] = "The seed value for randomizing the plot when viewing a subset (int)."

        opt = "title"
        if opt not in options:
            options[opt] = None
        if opt not in self.help:
            self.help[opt] = "The title for the plot (str)."

        opt = "outfile"
        if opt not in options:
            options[opt] = None
        if opt not in self.help:
            self.help[opt] = "The file to store the plot in (str)."

        opt = "wait"
        if opt not in options:
            options[opt] = True
        if opt not in self.help:
            self.help[opt] = "Whether to wait for user to close the plot window (bool)."

        return options
848721
def add_option(self, option):
        
        assert isinstance(option, Option)
        repeatable = defines.OptionRegistry.LIST[option.number].repeatable
        if not repeatable:
            ret = self._already_in(option)
            if ret:
                raise TypeError("Option : %s is not repeatable", option.name)
            else:
                self._options.append(option)
        else:
            self._options.append(option)
786002
def add_option(name, parameters)
      self.class.handle_warnings(name, **parameters.dup)
      chain_options.merge(name => parameters.merge(method_hash(parameters)))
    end
795369
def fix_config(self, options):
        
        opt = "incremental"
        if opt not in options:
            options[opt] = False
        if opt not in self.help:
            self.help[opt] = "Whether to load the dataset incrementally (bool)."

        opt = "use_custom_loader"
        if opt not in options:
            options[opt] = False
        if opt not in self.help:
            self.help[opt] = "Whether to use a custom loader."

        opt = "custom_loader"
        if opt not in options:
            options[opt] = converters.Loader(classname="weka.core.converters.ArffLoader")
        if opt not in self.help:
            self.help[opt] = "The custom loader to use (Loader)."

        return super(LoadDataset, self).fix_config(options)
124210
def update(self, **kwargs):
        
        # Override the template values with the override values.
        for s in config.sections():
            for o in config.options(s):
                override = kwargs.pop(o, None)
                if override:
                    config.set(s, o, override)
963969
def fix_config(self, options):
        
        options = super(UpdateStorageValue, self).fix_config(options)

        opt = "storage_name"
        if opt not in options:
            options[opt] = "unknown"
        if opt not in self.help:
            self.help[opt] = "The name of the storage value to update (string)."

        opt = "expression"
        if opt not in options:
            options[opt] = "int({X} + 1)"
        if opt not in self.help:
            self.help[opt] = "The expression for updating the storage value; use {X} for current value (string)."

        return options
1002569
def register_optionables(self, optionables):
    
    if not isinstance(optionables, Iterable):
      raise TypeError('The optionables must be an iterable, given {}'.format(optionables))
    optionables = tuple(optionables)
    if not optionables:
      return

    invalid_optionables = [s
                           for s in optionables
                           if not isinstance(s, type) or not issubclass(s, Optionable)]
    if invalid_optionables:
      raise TypeError('The following items from the given optionables are not Optionable '
                      'subclasses:\n\t{}'.format('\n\t'.join(str(i) for i in invalid_optionables)))

    self._optionables.update(optionables)
670026
def add_option(self, section, option, value=None):
        
        # check if section exists; create if not
        if not self.config.has_section(section):
            message = self.add_section(section)
            if not message[0]:
                return message

        if not self.config.has_option(section, option):
            if value:
                self.config.set(section, option, value)
            else:
                self.config.set(section, option)
            return(True, self.config.options(section))
        return(False, 'Option: {} already exists @ {}'.format(option, section))
556277
def _SetOptions(self, options, options_class_name):
    
    self._options = options
    self._options_class_name = options_class_name

    # Does this descriptor have non-default options?
    self.has_options = options is not None
1116761
def options(self, new):
        
        options = self._create_options(new)
        if self.widget.value:
            self.widget.set_param(options=options, value=list(options.values())[:1])
        else:
            self.widget.options = options
            self.widget.value = list(options.values())[:1]