Produce a reasonable default.
485395
def defaultFile(self):
        """"""
        filename = self.curframe.f_code.co_filename
        if filename == '<string>' and self.mainpyfile:
            filename = self.mainpyfile
        return filename
1017455
def provides_defaults_for(self, rule: 'Rule', **values: Any) -> bool:
        """"""
        defaults_match = all(
            values[key] == self.defaults[key] for key in self.defaults if key in values  # noqa: S101, E501
        )
        return self != rule and bool(self.defaults) and defaults_match
89282
def set_default(self):
        """"""
        try:
            os.makedirs(os.path.dirname(self._configfile))
        except:
            pass

        self._config = configparser.RawConfigParser()
        self._config.add_section('Settings')

        for key, val in self.DEFAULTS.items():
            self._config.set('Settings', key, val)

        with open(self._configfile, 'w') as f:
            self._config.write(f)
222245
def defaults(self):
        """"""
        return {k: v.default for k, v in self.options().items()}
573027
def _insert_defaults(self):
        
        merged = merge_defaults(self.structure, self)
        self.update(merged)
880403
def set_default(self_,param_name,value):
        
        cls = self_.cls
        setattr(cls,param_name,value)
746623
def default_value(self):
        
        if callable(self.default) and self.call_default:
            return self.default()
        return self.default
350900
def value_or_default(self, value):
        '''  '''
        if value is None:
            if callable(self.default):
                return self.default()
            else:
                return self.default

        return value
1267734
def _resolve_default(data_type, listify=False):
    """"""
    if isinstance(data_type, _ATOMIC):
        # A Python's object type needs to be left as is instead of being
        # wrapped into a NumPy type.
        out = (data_type.default if isinstance(data_type, Object)
               else _get_atomic_dtype(data_type)(data_type.default))
    elif isinstance(data_type, Array):
        element_default = _resolve_default(data_type.element_type,
                                           listify=listify)
        Sequence = list if listify else tuple
        shape = ((data_type.shape,) if isinstance(data_type.shape, int)
                 else data_type.shape)
        out = element_default
        for dimension in shape:
            out = Sequence(copy.deepcopy(out) for _ in _range(dimension))
    elif isinstance(data_type, Structure):
        if listify:
            out = [_resolve_default(field.type, listify=listify)
                   for field in data_type.fields]
        else:
            field_defaults = collections.OrderedDict(
                (field.name, _resolve_default(field.type, listify=listify))
                for field in data_type.fields)
            name = ('StructureDefault_%s' % (data_type.name,)
                    if data_type.name else 'StructureDefault')
            struct = collections.namedtuple(name, field_defaults.keys())
            out = struct(**field_defaults)

    return out
56062
def _copy_default(cls, default):
        ''' 

        '''
        if not isinstance(default, types.FunctionType):
            return copy(default)
        else:
            return default()
597104
def fill_with_defaults(process_input, input_schema):
    """"""
    for field_schema, fields, path in iterate_schema(process_input, input_schema):
        if 'default' in field_schema and field_schema['name'] not in fields:
            dict_dot(process_input, path, field_schema['default'])
438217
def setDefault(self, key, value):
        
        if value is None:
            self._defaults.pop(key, None)
        else:
            self._defaults[key] = value
712450
def change_default(
    kls,
    key,
    new_default,
    new_converter=None,
    new_reference_value=None,
):
    """"""
    an_option = kls.get_required_config()[key].copy()
    an_option.default = new_default
    if new_converter:
        an_option.from_string_converter = new_converter
    if new_reference_value:
        an_option.reference_value_from = new_reference_value
    return an_option
773577
def provide_with_default(self, name, default=None):
        
        return self.provider.instantiate_by_name_with_default(name, default_value=default)
446787
def default(self, line):
        """"""
        args = self._split_args(line, 0, 99)
        d1_cli.impl.util.print_error("Unknown command: {}".format(args[0]))
450528
def default(self):
        """"""
        output = ensure_unicode(self.git.log(
            '-1',
            '-p',
            '--no-color',
            '--format=%s',
        ).stdout)
        lines = output.splitlines()
        return u'\n'.join(
            itertools.chain(
                lines[:1],
                itertools.islice(
                    itertools.dropwhile(
                        lambda x: not x.startswith('+++'),
                        lines[1:],
                    ),
                    1,
                    None,
                ),
            )
        )
885891
def override_spec(cls, **kwargs):
        """"""
        cls._default_spec.set(**kwargs)
        cls.spec.set(**kwargs)