Change all occurrences of `name` in a kernel boot line in the
        given `config` text.
168104
def edit(self, config, state, name, value=None):
        
        config = str(config)  # make a copy so we can alter it
        matches = list(self._GRUB_KERNEL_BOOT_ENTRY.finditer(config))
        # process matches in reverse order, so replacing one match
        # does not alter the start/end positions of other matches
        for match in reversed(matches):
            start = match.end()
            # Linux command line extends up to the newline
            if config[start] == '\n':
                cmdline = ''
            else:
                end = config.find('\n', start)
                cmdline = config[start:end]
            new_cmdline = _assemble_linux_cmdline(cmdline, state, name, value)
            config = config[:start] + new_cmdline + config[end:]
        return config
530640
def clear(name):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'comment': '',
           'result': True}
    if name in __reg__:
        __reg__[name].clear()
    return ret
547564
def rename(name):
    # type: (str) -> None
    
    from peltak.extra.gitflow import logic

    if name is None:
        name = click.prompt('Hotfix name')

    logic.hotfix.rename(name)
1147483
def override(settings, yaml=None, env=None):
    
    if yaml is not None:
        if hasattr(yaml, 'read'):
            settings.update(load_yaml(yaml.read()))
        else:
            if os.path.exists(yaml):
                with open(yaml) as f:
                    settings.update(load_yaml(f.read()))

    if env is not None:
        for k, v in os.environ.items():
            if k.startswith(env):
                settings[k[len(env):]] = load_yaml(v)
790373
def reset_namespace(self, warning=False, message=False):
        """"""
        reset_str = _("Remove all variables")
        warn_str = _("All user-defined variables will be removed. "
                     "Are you sure you want to proceed?")
        kernel_env = self.kernel_manager._kernel_spec.env

        if warning:
            box = MessageCheckBox(icon=QMessageBox.Warning, parent=self)
            box.setWindowTitle(reset_str)
            box.set_checkbox_text(_("Don't show again."))
            box.setStandardButtons(QMessageBox.Yes | QMessageBox.No)
            box.setDefaultButton(QMessageBox.Yes)

            box.set_checked(False)
            box.set_check_visible(True)
            box.setText(warn_str)

            answer = box.exec_()

            # Update checkbox based on user interaction
            CONF.set('ipython_console', 'show_reset_namespace_warning',
                     not box.is_checked())
            self.ipyclient.reset_warning = not box.is_checked()

            if answer != QMessageBox.Yes:
                return

        try:
            if self._reading:
                self.dbg_exec_magic('reset', '-f')
            else:
                if message:
                    self.reset()
                    self._append_html(_("<br><br>Removing all variables..."
                                        "\n<hr>"),
                                      before_prompt=False)
                self.silent_execute("%reset -f")
                if kernel_env.get('SPY_AUTOLOAD_PYLAB_O') == 'True':
                    self.silent_execute("from pylab import *")
                if kernel_env.get('SPY_SYMPY_O') == 'True':
                    sympy_init = """
                        from __future__ import division
                        from sympy import *
                        x, y, z, t = symbols('x y z t')
                        k, m, n = symbols('k m n', integer=True)
                        f, g, h = symbols('f g h', cls=Function)
                        init_printing()"""
                    self.silent_execute(dedent(sympy_init))
                if kernel_env.get('SPY_RUN_CYTHON') == 'True':
                    self.silent_execute("%reload_ext Cython")
                self.refresh_namespacebrowser()

                if not self.external_kernel:
                    self.silent_execute(
                        'get_ipython().kernel.close_all_mpl_figures()')
        except AttributeError:
            pass
492759
def _upstart_delete(name):
    '''
    
    '''
    if HAS_UPSTART:
        if os.path.exists('/etc/init/{0}.conf'.format(name)):
            os.rename('/etc/init/{0}.conf'.format(name),
                      '/etc/init/{0}.conf.removed'.format(name))
    return True
479157
private static String[] adjustConf(String[] argv, Configuration conf) {
    String[] serviceId = new String[] { "" };
    String[] filteredArgv = DFSUtil.getServiceName(argv, serviceId);
    
    if (!serviceId[0].equals("")) {
      NameNode.checkServiceName(conf, serviceId[0]);
      DFSUtil.setGenericConf(conf, serviceId[0],
          NameNode.NAMESERVICE_SPECIFIC_KEYS);
      NameNode.setupDefaultURI(conf);
    }
    
    // make it avatar aware (manual option)
    if (optionExist(argv, "-one")) {
      updateConfKeys(conf, "1", serviceId[0]);
    } else {
      updateConfKeys(conf, "0", serviceId[0]);
    }
    return filteredArgv;
  }
1056877
def auto_change_docstring(app, what, name, obj, options, lines):
    
    """
    if what == 'module' and name.startswith('pylatex'):
        lines.insert(0, len(name) * '=')
        lines.insert(0, name)

    hits = 0
    for i, line in enumerate(lines.copy()):
        if line.endswith('\\'):
            lines[i - hits] += lines.pop(i + 1 - hits)
            hits += 1
626982
def patch_config(config, data):
    """"""
    is_changed = False
    for name, value in data.items():
        if value is None:
            if config.pop(name, None) is not None:
                is_changed = True
        elif name in config:
            if isinstance(value, dict):
                if isinstance(config[name], dict):
                    if patch_config(config[name], value):
                        is_changed = True
                else:
                    config[name] = value
                    is_changed = True
            elif str(config[name]) != str(value):
                config[name] = value
                is_changed = True
        else:
            config[name] = value
            is_changed = True
    return is_changed
644529
def source_debianize_name(name):
    ""
    name = name.replace('_','-')
    name = name.replace('.','-')
    name = name.lower()
    return name
776197
def get_boot_config(self, name, info_cb=None):
    """"""
    result = {}
    def default_info_cb(msg):
      """Default Info CB."""
      if not msg.message:
        return
      key, value = msg.message.split(':', 1)
      result[key.strip()] = value.strip()
    info_cb = info_cb or default_info_cb
    final_result = self.oem('bootconfig %s' % name, info_cb=info_cb)
    # Return INFO messages before the final OKAY message.
    if name in result:
      return result[name]
    return final_result
118128
def _normalize_compare_config(self, diff):
        """"""
        ignore_strings = [
            "Contextual Config Diffs",
            "No changes were found",
            "ntp clock-period",
        ]
        if self.auto_file_prompt:
            ignore_strings.append("file prompt quiet")

        new_list = []
        for line in diff.splitlines():
            for ignore in ignore_strings:
                if ignore in line:
                    break
            else:  # nobreak
                new_list.append(line)
        return "\n".join(new_list)
1162232
def set_config(self, **config):
        """"""
        reinit = False
        if 'stdopt' in config:
            stdopt = config.pop('stdopt')
            reinit = (stdopt != self.stdopt)
            self.stdopt = stdopt
        if 'attachopt' in config:
            attachopt = config.pop('attachopt')
            reinit = reinit or (attachopt != self.attachopt)
            self.attachopt = attachopt
        if 'attachvalue' in config:
            attachvalue = config.pop('attachvalue')
            reinit = reinit or (attachvalue != self.attachvalue)
            self.attachvalue = attachvalue
        if 'auto2dashes' in config:
            self.auto2dashes = config.pop('auto2dashes')
        if 'name' in config:
            name = config.pop('name')
            reinit = reinit or (name != self.name)
            self.name = name
        if 'help' in config:
            self.help = config.pop('help')
            self._set_or_remove_extra_handler(
                self.help, ('--help', '-h'), self.help_handler)
        if 'version' in config:
            self.version = config.pop('version')
            self._set_or_remove_extra_handler(
                self.version is not None,
                ('--version', '-v'),
                self.version_handler)
        if 'case_sensitive' in config:
            case_sensitive = config.pop('case_sensitive')
            reinit = reinit or (case_sensitive != self.case_sensitive)
            self.case_sensitive = case_sensitive
        if 'optionsfirst' in config:
            self.options_first = config.pop('optionsfirst')
        if 'appearedonly' in config:
            self.appeared_only = config.pop('appearedonly')
        if 'namedoptions' in config:
            namedoptions = config.pop('namedoptions')
            reinit = reinit or (namedoptions != self.namedoptions)
            self.namedoptions = namedoptions
        if 'extra' in config:
            self.extra.update(self._formal_extra(config.pop('extra')))

        if config:  # should be empty
            raise ValueError(
                '`%s` %s not accepted key argument%s' % (
                    '`, `'.join(config),
                    'is' if len(config) == 1 else 'are',
                    '' if len(config) == 1 else 's'
                ))

        if self.doc is not None and reinit:
            logger.warning(
                'You changed the config that requires re-initialized'
                ' `Docpie` object. Create a new one instead'
            )
            self._init()
866718
def replace(state, host, name, match, replace, flags=None):
    '''
    
    '''

    yield sed_replace(name, match, replace, flags=flags)
1241344
def replace_name(expr: AST, old_name: str, new_name: str) -> AST:
    """"""
    return _NameReplacer(old_name, new_name).visit(deepcopy(expr))
1056520
def _set_name(self, name):
        
        if self._is_identifier_quoted(name):
            self._quoted = True
            name = self._trim_quotes(name)

        if "." in name:
            parts = name.split(".", 1)
            self._namespace = parts[0]
            name = parts[1]

        self._name = name
558102
def remove_value(self, name):
        """"""
        code = u"get_ipython().kernel.remove_value('%s')" % name
        if self._reading:
            self.kernel_client.input(u'!' + code)
        else:
            self.silent_execute(code)