Overloads intro prompt with network-aware version if you can reach
        psiTurk.org, request system status message
969717
def get_intro_prompt(self):
        ''' '''
        server_msg = self.web_services.get_system_status()
        return server_msg + colorize('psiTurk version ' + version_number +
                                     '\nType "help" for more information.',
                                     'green', False)
842010
def system_info(conf, args):
    """"""
    src = conf.config['instances'][args.src]
    src_url = api.build_system_url(build_instance_url(src))
    src_auth = tuple([conf.creds['instances'][args.src]['user'],
                      conf.creds['instances'][args.src]['pass']])
    verify_ssl = src.get('verify_ssl', True)
    sysinfo_json = api.system_info(src_url, src_auth, verify_ssl)
    return sysinfo_json
413273
def indication(self, pdu):
        """"""
        if _debug: TCPClient._debug("indication %r", pdu)

        self.request += pdu.pduData
1128787
def probe(cls, resource, enable, disable, test, host, interval,
              http_method, http_response, threshold, timeout, url, window):
        
        params = {
            'host': host,
            'interval': interval,
            'method': http_method,
            'response': http_response,
            'threshold': threshold,
            'timeout': timeout,
            'url': url,
            'window': window
        }
        if enable:
            params['enable'] = True
        elif disable:
            params['enable'] = False
        if test:
            result = cls.call(
                'hosting.rproxy.probe.test', cls.usable_id(resource), params)
        else:
            result = cls.call(
                'hosting.rproxy.probe.update', cls.usable_id(resource), params)
            cls.display_progress(result)
        return result
1115285
def get_welcome(self, connId='default'):
        
        thisConn = self.__getConnection(connId)
        outputMsg = ""
        try:
            outputMsg += thisConn.getwelcome()
        except ftplib.all_errors as e:
            raise FtpLibraryError(str(e))
        if self.printOutput:
            logger.info(outputMsg)
        return outputMsg
1263053
def _handle_status(self, key, value):
        
        if key == "IMPORTED":
            # this duplicates info we already see in import_ok & import_problem
            pass
        elif key == "PINENTRY_LAUNCHED":
            log.warn(("GnuPG has just attempted to launch whichever pinentry "
                      "program you have configured, in order to obtain the "
                      "passphrase for this key.  If you did not use the "
                      "`passphrase=` parameter, please try doing so.  Otherwise, "
                      "see Issues #122 and #137:"
                      "\nhttps://github.com/isislovecruft/python-gnupg/issues/122"
                      "\nhttps://github.com/isislovecruft/python-gnupg/issues/137"))
        elif key == "KEY_CONSIDERED":
            self.results.append({
                'status': key.replace("_", " ").lower(),
            })
        elif key == "NODATA":
            self.results.append({'fingerprint': None,
                                 'status': 'No valid data found'})
        elif key == "IMPORT_OK":
            reason, fingerprint = value.split()
            reasons = []
            for code, text in self._ok_reason.items():
                if int(reason) == int(code):
                    reasons.append(text)
            reasontext = '\n'.join(reasons) + "\n"
            self.results.append({'fingerprint': fingerprint,
                                 'status': reasontext})
            self.fingerprints.append(fingerprint)
        elif key == "IMPORT_PROBLEM":
            try:
                reason, fingerprint = value.split()
            except:
                reason = value
                fingerprint = '<unknown>'
            self.results.append({'fingerprint': fingerprint,
                                 'status': self._problem_reason[reason]})
        elif key == "IMPORT_RES":
            import_res = value.split()
            for x in self.counts.keys():
                self.counts[x] = int(import_res.pop(0))
        elif key == "KEYEXPIRED":
            res = {'fingerprint': None,
                   'status': 'Key expired'}
            self.results.append(res)
        ## Accoring to docs/DETAILS L859, SIGEXPIRED is obsolete:
        ## "Removed on 2011-02-04. This is deprecated in favor of KEYEXPIRED."
        elif key == "SIGEXPIRED":
            res = {'fingerprint': None,
                   'status': 'Signature expired'}
            self.results.append(res)
        else:
            raise ValueError("Unknown status message: %r" % key)
1179501
def on_ok(self):
        
        def popup(thr, add_type, title):
            """
            Start the thread and display a popup of the plugin being cloned
            until the thread is finished
            """
            thr.start()
            tool_str = 'Cloning repository...'
            if add_type == 'image':
                tool_str = 'Pulling image...'
            npyscreen.notify_wait(tool_str, title=title)
            while thr.is_alive():
                time.sleep(1)
            return

        if self.image.value and self.link_name.value:
            api_action = Tools()
            api_image = Image(System().manifest)
            api_system = System()
            thr = threading.Thread(target=api_image.add, args=(),
                                   kwargs={'image': self.image.value,
                                           'link_name': self.link_name.value,
                                           'tag': self.tag.value,
                                           'registry': self.registry.value,
                                           'groups': self.groups.value})
            popup(thr, 'image', 'Please wait, adding image...')
            npyscreen.notify_confirm('Done adding image.', title='Added image')
            editor_args = {'tool_name': self.image.value,
                           'version': self.tag.value,
                           'get_configure': api_system.get_configure,
                           'save_configure': api_system.save_configure,
                           'restart_tools': api_system.restart_tools,
                           'start_tools': api_action.start,
                           'from_registry': True,
                           'just_downloaded': True,
                           'link_name': self.link_name.value,
                           'groups': self.groups.value}
            self.parentApp.addForm('CONFIGUREIMAGE', EditorForm,
                                   name='Specify vent.template settings for '
                                   'image pulled (optional)', **editor_args)
            self.parentApp.change_form('CONFIGUREIMAGE')
        elif self.image.value:
            npyscreen.notify_confirm('A name needs to be supplied for '
                                     'the image being added!',
                                     title='Specify a name for the image',
                                     form_color='CAUTION')
        elif self.repo.value:
            self.parentApp.repo_value['repo'] = self.repo.value.lower()
            api_repo = Repository(System().manifest)
            api_repo.repo = self.repo.value.lower()
            thr = threading.Thread(target=api_repo._clone, args=(),
                                   kwargs={'user': self.user.value,
                                           'pw': self.pw.value})
            popup(thr, 'repository', 'Please wait, adding repository...')
            self.parentApp.addForm('ADDOPTIONS',
                                   AddOptionsForm,
                                   name='Set options for new plugin'
                                        '\t\t\t\t\t\t^Q to quit',
                                   color='CONTROL')
            self.parentApp.change_form('ADDOPTIONS')
        else:
            npyscreen.notify_confirm('Either a repository or an image '
                                     'name must be specified!',
                                     title='Specify plugin to add',
                                     form_color='CAUTION')
        return
901299
async def sysinfo(dev: Device):
    """"""
    click.echo(await dev.get_system_info())
    click.echo(await dev.get_interface_information())
615222
private boolean listenForDiscoveryMcRequests(Configuration pConfig) {
        // Check for system props, system env and agent config
        boolean sysProp = System.getProperty("jolokia." + ConfigKey.DISCOVERY_ENABLED.getKeyValue()) != null;
        boolean env     = System.getenv("JOLOKIA_DISCOVERY") != null;
        boolean config  = pConfig.getAsBoolean(ConfigKey.DISCOVERY_ENABLED);
        return sysProp || env || config;
    }
1179303
def process():
    '''  '''
    invoked_as = os.path.basename(sys.argv[0])

    if invoked_as == "psiturk":
        launch_shell()
    elif invoked_as == "psiturk-server":
        launch_server()
    elif invoked_as == "psiturk-shell":
        launch_shell()
    elif invoked_as == "psiturk-setup-example":
        setup_example()
    elif invoked_as == "psiturk-install":
        install_from_exchange()
684090
def whoami(self):
        
        endpoint = '/ping/whoami'
        response = self._get_response(
            method='get', endpoint=endpoint,
        )

        return response.json()
12287
def prompt(self, msg):
        """"""
        try:
            # prompt_toolkit v2
            prompt = prompt_toolkit.PromptSession(history=self.history).prompt
        except AttributeError:
            # prompt_toolkit v1
            prompt = partial(prompt_toolkit.prompt, history=self.history)
        return prompt(
            msg,
            multiline=self.multiline,
            vi_mode=self.vi_mode,
            wrap_lines=self.wrap_lines,
            enable_history_search=self.history_search,
            lexer=PygmentsLexer(CoconutLexer),
            style=style_from_pygments_cls(
                pygments.styles.get_style_by_name(self.style),
            ),
        )
303251
def releaseCompleteMsToNet(Cause_presence=0, Facility_presence=0,
                           UserUser_presence=0, SsVersionIndicator_presence=0):
    """"""
    a = TpPd(pd=0x3)
    b = MessageType(mesType=0x2a)  # 00101010
    packet = a / b
    if Cause_presence is 1:
        c = CauseHdr(ieiC=0x08, eightBitC=0x0)
        packet = packet / c
    if Facility_presence is 1:
        d = FacilityHdr(ieiF=0x1C, eightBitF=0x0)
        packet = packet / d
    if UserUser_presence is 1:
        e = UserUserHdr(ieiUU=0x7E, eightBitUU=0x0)
        packet = packet / e
    if SsVersionIndicator_presence is 1:
        f = SsVersionIndicatorHdr(ieiSVI=0x7F, eightBitSVI=0x0)
        packet = packet / f
    return packet
73795
def main(uport):
    """"""
    # NOTE: structure of the UDP packet is different than that of information
    #       sent via HTTP
    json_body = {
        "tags": {
            "host": "server01",
            "region": "us-west"
        },
        "time": "2009-11-10T23:00:00Z",
        "points": [{
            "measurement": "cpu_load_short",
            "fields": {
                "value": 0.64
            }
        },
            {
                "measurement": "cpu_load_short",
                "fields": {
                    "value": 0.67
                }
        }]
    }

    # make `use_udp` True and  add `udp_port` number from `influxdb.conf` file
    # no need to mention the database name since it is already configured
    client = InfluxDBClient(use_udp=True, udp_port=uport)

    # Instead of `write_points` use `send_packet`
    client.send_packet(json_body)
617793
function _doLaunchAfterServerReady(initialDoc) {
        // update status
        _setStatus(STATUS_CONNECTING);
        _createLiveDocumentForFrame(initialDoc);

        // start listening for requests
        _server.start();

        // Install a one-time event handler when connected to the launcher page
        Inspector.one("connect", _onConnect);

        // open browser to the interstitial page to prepare for loading agents
        _openInterstitialPage();

        // Once all agents loaded (see _onInterstitialPageLoad()), begin Live Highlighting for preprocessor documents
        _openDeferred.done(function () {
            // Setup activeEditorChange event listener so that we can track cursor positions in
            // CSS preprocessor files and perform live preview highlighting on all elements with
            // the current selector in the preprocessor file.
            EditorManager.on("activeEditorChange", onActiveEditorChange);

            // Explicitly trigger onActiveEditorChange so that live preview highlighting
            // can be set up for the preprocessor files.
            onActiveEditorChange(null, EditorManager.getActiveEditor(), null);
        });
    }
891781
def status(name, init_system, verbose):
    
    try:
        status = Serv(init_system, verbose=verbose).status(name)
    except ServError as ex:
        sys.exit(ex)
    click.echo(json.dumps(status, indent=4, sort_keys=True))
588541
async def StatusHistory(self, requests):
        '''
        
        '''
        # map input types to rpc msg
        _params = dict()
        msg = dict(type='Client',
                   request='StatusHistory',
                   version=2,
                   params=_params)
        _params['requests'] = requests
        reply = await self.rpc(msg)
        return reply