Changes the activity of default_shell in dconf
556566
def on_default_shell_changed(self, combo):
        
        citer = combo.get_active_iter()
        if not citer:
            return
        shell = combo.get_model().get_value(citer, 0)
        # we unset the value (restore to default) when user chooses to use
        # user shell as guake shell interpreter.
        if shell == USER_SHELL_VALUE:
            self.settings.general.reset('default-shell')
        else:
            self.settings.general.set_string('default-shell', shell)
25628
def default_hook(config):
    """"""
    if (any(arg.startswith('bdist') for arg in sys.argv) and
            os.path.isdir(PY2K_DIR) != IS_PY2K and os.path.isdir(LIB_DIR)):
        shutil.rmtree(LIB_DIR)

    if IS_PY2K and any(arg.startswith('install') or
                       arg.startswith('build') or
                       arg.startswith('bdist') for arg in sys.argv):
        generate_py2k(config)
        packages_root = get_cfg_value(config, 'files', 'packages_root')
        packages_root = os.path.join(PY2K_DIR, packages_root)
        set_cfg_value(config, 'files', 'packages_root', packages_root)
882094
def set_default_configuration
      ActiveSupport::Deprecation.warn("The environment variable RAILS_DATAROOT will be deprecated in an upcoming release, please use OOD_DATAROOT instead.") if ENV['RAILS_DATAROOT']
      self.dataroot = ENV['OOD_DATAROOT'] || ENV['RAILS_DATAROOT']
      self.dataroot ||= "~/#{ENV['OOD_PORTAL'] || "ondemand"}/data/#{ENV['APP_TOKEN']}" if ENV['APP_TOKEN']

      # Add markdown template support
      self.markdown = Redcarpet::Markdown.new(
        Redcarpet::Render::HTML,
        autolink: true,
        tables: true,
        strikethrough: true,
        fenced_code_blocks: true,
        no_intra_emphasis: true
      )

      # Initialize URL handlers for system apps
      self.public    = Urls::Public.new(
        title:    ENV['OOD_PUBLIC_TITLE'] || 'Public Assets',
        base_url: ENV['OOD_PUBLIC_URL']   || '/public'
      )
      self.dashboard = Urls::Dashboard.new(
        title:    ENV['OOD_DASHBOARD_TITLE'] || 'Open OnDemand',
        base_url: ENV['OOD_DASHBOARD_URL']   || '/pun/sys/dashboard'
      )
      self.shell     = Urls::Shell.new(
        title:    ENV['OOD_SHELL_TITLE'] || 'Shell',
        base_url: ENV['OOD_SHELL_URL']   || '/pun/sys/shell'
      )
      self.files     = Urls::Files.new(
        title:    ENV['OOD_FILES_TITLE'] || 'Files',
        base_url: ENV['OOD_FILES_URL']   || '/pun/sys/files'
      )
      self.editor    = Urls::Editor.new(
        title:    ENV['OOD_EDITOR_TITLE'] || 'Editor',
        base_url: ENV['OOD_EDITOR_URL']   || '/pun/sys/file-editor'
      )

      # Add routes for useful features
      self.routes = OpenStruct.new(
        files_rack_app: true,
        wiki: true
      )

      # Override Bootstrap SASS variables
      self.bootstrap = OpenStruct.new(
        navbar_inverse_bg: '#53565a',
        navbar_inverse_link_color: '#fff',
        navbar_inverse_color: '$navbar-inverse-link-color',
        navbar_inverse_link_hover_color: 'darken($navbar-inverse-link-color, 20%)',
        navbar_inverse_brand_color: '$navbar-inverse-link-color',
        navbar_inverse_brand_hover_color: '$navbar-inverse-link-hover-color'
      )
      ENV.each {|k, v| /^BOOTSTRAP_(?<name>.+)$/ =~ k ? self.bootstrap[name.downcase] = v : nil}

      self.enable_log_formatter = ::Rails.env.production?
    end
148172
def shell_config_cmd(argv):
    ""
    shell = supported_shell()
    if shell:
        print(pew_site / 'shell_config' / ('init.' + shell))
    else:
        err('Completions and prompts are unavailable for %s' %
            repr(os.environ.get('SHELL', '')))
752739
def on_change_dir_button(self, event=None):
        
        currentDirectory = self.WD #os.getcwd()
        change_dir_dialog = wx.DirDialog(self.panel,
                                         "Choose your working directory to create or edit a MagIC contribution:",
                                         defaultPath=currentDirectory,
                                         style=wx.DD_DEFAULT_STYLE | wx.DD_NEW_DIR_BUTTON | wx.DD_CHANGE_DIR)
        result = change_dir_dialog.ShowModal()
        if result == wx.ID_CANCEL:
            return
        if result == wx.ID_OK:
            self.WD = change_dir_dialog.GetPath()
            self.dir_path.SetValue(self.WD)
        change_dir_dialog.Destroy()
        self.get_wd_data()
783818
def default(self, line):
        '''
        '''
        cmdargs = line.split()
        remain = ' '.join(cmdargs[1:])
        if 'show'.startswith(cmdargs[0]):
            self.do_show(remain)
        elif 'set'.startswith(cmdargs[0]):
            self.do_set(remain)
        elif 'sendeth'.startswith(cmdargs[0]):
            self.do_sendeth(remain)
        elif 'load'.startswith(cmdargs[0]):
            self.do_load(remain)
        elif 'save'.startswith(cmdargs[0]):
            self.do_save(remain)
        elif 'monitor'.startswith(cmdargs[0]):
            self.do_monitor(remain)
        elif 'unmonitor'.startswith(cmdargs[0]):
            self.do_unmonitor(remain)
        elif 'exec'.startswith(cmdargs[0]):
            self.do_exec(remain)
        elif 'add'.startswith(cmdargs[0]):
            self.do_add(remain)
        elif 'remove'.startswith(cmdargs[0]):
            self.do_remove(remain)
        elif 'replay'.startswith(cmdargs[0]):
            self.do_replay(remain)
        else:
            print ("Unrecognized command '{}'".format(line))
118200
def set_base_prompt(
        self, pri_prompt_terminator="$", alt_prompt_terminator="#", delay_factor=1
    ):
        """"""
        return super(DellIsilonSSH, self).set_base_prompt(
            pri_prompt_terminator=pri_prompt_terminator,
            alt_prompt_terminator=alt_prompt_terminator,
            delay_factor=delay_factor,
        )
1260828
def set_default_init_cli_cmds(self):
        
        init_cli_cmds = []
        init_cli_cmds.append("set --retcode true")
        init_cli_cmds.append("echo off")
        init_cli_cmds.append("set --vt100 off")

        #set dut name as variable
        init_cli_cmds.append('set dut "'+self.name+'"')
        init_cli_cmds.append(['set testcase "' + self.testcase + '"', True])
        return init_cli_cmds
14168
def _default_cleanup(self):
        
        if not self.inplace:
            return

        shutil.move(
            os.path.join(self.build_lib, "bezier", "lib"),
            os.path.join("src", "bezier"),
        )
786566
protected function overrideNativeFuncs()
    {
        if (Daemon::supported(Daemon::SUPPORT_RUNKIT_INTERNAL_MODIFY)) {
            function define($k, $v)
            {
                if (defined($k)) {
                    runkit_constant_redefine($k, $v);
                } else {
                    runkit_constant_add($k, $v);
                }
            }

            $this->override('define', 'define');

            function header(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->header(...$args);
            }

            $this->override('header', 'header');

            function isUploadedFile(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->isUploadedFile(...$args);
            }

            $this->override('isUploadedFile', 'is_uploaded_file');

            function moveUploadedFile(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->moveUploadedFile(...$args);
            }

            $this->override('moveUploadedFile', 'move_uploaded_file');

            function headersSent(&$file = null, &$line = null)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->headers_sent($file, $line);
            }

            //$this->override('headersSent', 'headers_sent); // Commented out due to a runkit bug

            function headersList()
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->headers_list();
            }

            $this->override('headersList', 'headers_list');

            function setcookie(...$args)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->setcookie(...$args);
            }

            $this->override('setcookie', 'setcookie');

            /**
             * @param callable $cb
             */
            function registerShutdownFunction($cb)
            {
                if (!Daemon::$context instanceof \PHPDaemon\Request\Generic) {
                    return false;
                }
                return Daemon::$context->registerShutdownFunction($cb);
            }

            $this->override('registerShutdownFunction', 'register_shutdown_function');

            runkit_function_copy('create_function', 'create_function_native');
            runkit_function_redefine('create_function', '$arg,$body',
                'return \PHPDaemon\Core\Daemon::$process->createFunction($arg,$body);');
        }
    }
185015
def process_default(self, raw_event, to_append=None):
        
        watch_ = self._watch_manager.get_watch(raw_event.wd)
        if raw_event.mask & (IN_DELETE_SELF | IN_MOVE_SELF):
            # Unfornulately this information is not provided by the kernel
            dir_ = watch_.dir
        else:
            dir_ = bool(raw_event.mask & IN_ISDIR)
        dict_ = {'wd': raw_event.wd,
                 'mask': raw_event.mask,
                 'path': watch_.path,
                 'name': raw_event.name,
                 'dir': dir_}
        if COMPATIBILITY_MODE:
            dict_['is_dir'] = dir_
        if to_append is not None:
            dict_.update(to_append)
        return Event(dict_)
83009
def _dscl(cmd, ctype='create'):
    '''
    
    '''
    if __grains__['osrelease_info'] < (10, 8):
        source, noderoot = '.', ''
    else:
        source, noderoot = 'localhost', '/Local/Default'
    if noderoot:
        cmd[0] = noderoot + cmd[0]

    return __salt__['cmd.run_all'](
        ['dscl', source, '-' + ctype] + cmd,
        output_loglevel='quiet' if ctype == 'passwd' else 'debug',
        python_shell=False
    )
492694
def _set_defaults(self, log_level=logging.INFO, redirect_stdout=False):
        """"""

        # Remove all previous handlers
        for handler in self.handlers[:]:
            self.removeHandler(handler)

        # Set levels
        self.setLevel(logging.DEBUG)

        # Set up the stdout handler
        self.fh = None
        self.sh = logging.StreamHandler()
        self.sh.emit = colored_formatter
        self.addHandler(self.sh)

        self.sh.setLevel(log_level)

        # warnings.showwarning = self._show_warning

        # Redirects all stdout to the logger
        if redirect_stdout:
            sys.stdout = LoggerStdout(self._print)

        # Catches exceptions
        sys.excepthook = self._catch_exceptions
1338239
def expand_defaults(self, client=False, getenv=True, getshell=True):
        
        if not isinstance(self._default, six.string_types):
            self.expanded_default = self._default
        else:
            self.expanded_default = coerce(self.type, expand_defaults(
                self._default, client, getenv, getshell))
106132
def initializenb():
    

    logger.info('Working directory: {0}'.format(os.getcwd()))
    logger.info('Run on {0}'.format(asctime()))
    try:
        fileroot = os.environ['fileroot']
        logger.info('Setting fileroot to {0} from environment variable.\n'.format(fileroot))
        candsfile = 'cands_{0}_merge.pkl'.format(fileroot)
        noisefile = 'noise_{0}_merge.pkl'.format(fileroot)
    except KeyError:
        sdmdir = os.getcwd()
        logger.info('Setting sdmdir to current directory {0}\n'.format(os.path.abspath(sdmdir)))
        candsfiles = glob.glob('cands_*_merge.pkl')
        noisefiles = glob.glob('noise_*_merge.pkl')
        if len(candsfiles) == 1 and len(noisefiles) == 1:
            logger.info('Found one cands/merge file set')
        else:
            logger.warn('Found multiple cands/noise file sets. Taking first.')

        candsfile = candsfiles[0]
        noisefile = noisefiles[0]
        fileroot = candsfile.rstrip('_merge.pkl').lstrip('cands_')
    logger.info('Set: \n\t candsfile {} \n\t noisefile {} \n\t fileroot {} '.format(candsfile, noisefile, fileroot))
    return (candsfile, noisefile, fileroot)
530539
def shell(name=None, **attrs):
    
    attrs.setdefault('cls', Shell)
    return click.command(name, **attrs)
578848
private void changeDirectoryPermissions(String dir, String mode, 
                                              boolean isRecursive) {
    int ret = 0;
    try {
      ret = FileUtil.chmod(dir, mode, isRecursive);
    } catch (Exception e) {
      LOG.warn("Exception in changing permissions for directory " + dir + 
                  ". Exception: " + e.getMessage());
    }
    if (ret != 0) {
      LOG.warn("Could not change permissions for directory " + dir);
    }
  }