Set whether or not ntp servers are being used
 @param [TrueClass, FalseClass] use_ntp
 @raise [RuntimeError] if the request failed
 @return true
555702
def set_ntp(use_ntp)
      new_action = { 'Oem' => { 'Hp' => { 'DHCPv4' => { 'UseNTPServers' => use_ntp } } } }
      response = rest_patch('/redfish/v1/Managers/1/EthernetInterfaces/1/', body: new_action)
      response_handler(response)
      true
    end
860566
public boolean isTrustedForSensitiveHeaders(String hostAddr) {
        if (!useSensitivePrivateHeaders) {
            // trustedSensitiveHeaderOrigin list is either unset (defaults to "none") or explicitly set to "none"
            return false;
        }
        if (restrictSensitiveHeaderOrigin == null) {
            // trustedSensitiveHeaderOrigin is set to "*"
            return true;
        } else {
            // check trustedSensitiveHeaderOrigin list for given host IP
            return restrictSensitiveHeaderOrigin.contains(hostAddr.toLowerCase());
        }
    }
1037170
def is_available(self):
        
        # if the availability flag is raised, return True immediately.
        # NOTE: subsequent API failures will lower this flag. we do this here
        # to ensure we don't keep hitting Joe with requests while availability
        # is there.
        if self.server_available:
            return True

        # otherwise, we have to check with the cloud.
        else:

            try:
                self.server_available = self.jbx.server_online()
                return self.server_available
            except jbxapi.JoeException:
                pass

        self.server_available = False
        return False
1013626
public static ntp_server add(nitro_service client, ntp_server resource) throws Exception
	{
		resource.validate("add");
		return ((ntp_server[]) resource.perform_operation(client, "add"))[0];
	}
673779
public function useAssociatedPort() : bool
   {

      if ( $this->properties[ 'port' ] < 1 )
      {
         return true;
      }

      switch ( $this->properties[ 'scheme' ] )
      {

         case static::SCHEME_HTTP:
            return ( $this->properties[ 'port' ] === 80);

         case static::SCHEME_SSL:
            return ( $this->properties[ 'port' ] === 443 );

         case static::SCHEME_FTP:
            return ( $this->properties[ 'port' ] === 21 );

         default :
            return false;

      }

   }
1092064
def set_tcp_port(self, tcp_port):
        
        if tcp_port is None:
            self.tcp_port = None
            return
        self.tcp_port = int(tcp_port)
575467
def useNonce(self, server_url, timestamp, salt):
        
        if abs(timestamp - time.time()) > nonce.SKEW:
            return False

        if server_url:
            proto, rest = server_url.split('://', 1)
        else:
            # Create empty proto / rest values for empty server_url,
            # which is part of a consumer-generated nonce.
            proto, rest = '', ''

        domain = _filenameEscape(rest.split('/', 1)[0])
        url_hash = _safe64(server_url)
        salt_hash = _safe64(salt)

        filename = '%08x-%s-%s-%s-%s' % (timestamp, proto, domain,
                                         url_hash, salt_hash)

        filename = os.path.join(self.nonce_dir, filename)
        try:
            fd = os.open(filename, os.O_CREAT | os.O_EXCL | os.O_WRONLY, 0200)
        except OSError, why:
            if why.errno == EEXIST:
                return False
            else:
                raise
        else:
            os.close(fd)
            return True
1184784
private static boolean useInetAddress(NetworkInterface networkInterface, InetAddress interfaceAddress) {
        return checkMethod(networkInterface, isUp) &&
               checkMethod(networkInterface, supportsMulticast) &&
               // TODO: IpV6 support
               !(interfaceAddress instanceof Inet6Address) &&
               !interfaceAddress.isLoopbackAddress();
    }
629398
def sessions_supported?
      if topology.data_bearing_servers?
        return !!topology.logical_session_timeout
      end

      begin
        ServerSelector.get(mode: :primary_preferred).select_server(self)
        !!topology.logical_session_timeout
      rescue Error::NoServerAvailable
        false
      end
    end
18953
def is_available(self):
        
        if self.scheme in NOOP_PROTOCOLS:
            return True

        if not self.port:
            raise RuntimeError('port is required')

        s = socket.socket()
        try:
            s.connect((self.host, self.port))
        except Exception:
            return False
        else:
            return True
263286
protected boolean isConnectionOk(IoSession session) {
        SocketAddress remoteAddress = session.getRemoteAddress();
        if (remoteAddress instanceof InetSocketAddress) {
            InetSocketAddress addr = (InetSocketAddress) remoteAddress;
            long now = System.currentTimeMillis();

            if (clients.containsKey(addr.getAddress().getHostAddress())) {

                LOGGER.debug("This is not a new client");
                Long lastConnTime = clients.get(addr.getAddress()
                        .getHostAddress());

                clients.put(addr.getAddress().getHostAddress(), now);

                // if the interval between now and the last connection is
                // less than the allowed interval, return false
                if (now - lastConnTime < allowedInterval) {
                    LOGGER.warn("Session connection interval too short");
                    return false;
                }
                
                return true;
            }

            clients.put(addr.getAddress().getHostAddress(), now);
            return true;
        }

        return false;
    }
982822
def __isOpenThreadWpanRunning(self):
        
        print 'call __isOpenThreadWpanRunning'
        if self.__stripValue(self.__sendCommand(WPANCTL_CMD + 'getprop -v NCP:State')[0]) == 'associated':
            print '*****OpenThreadWpan is running'
            return True
        else:
            print '*****Wrong OpenThreadWpan state'
            return False
1173213
public static boolean isJTPSlot() {
        return Thread.currentThread().getName().startsWith(GlobalFacadeBase.JTP_BASE_NAME)
                || Thread.currentThread().getName().startsWith(GlobalFacadeBase.HPTP_BASE_NAME);
    }
299485
def _connect_nntp (self, nntpserver):
        
        tries = 0
        nntp = None
        while tries < 2:
            tries += 1
            try:
                nntp = nntplib.NNTP(nntpserver, usenetrc=False)
            except nntplib.NNTPTemporaryError:
                self.wait()
            except nntplib.NNTPPermanentError as msg:
                if re.compile("^50[45]").search(str(msg)):
                    self.wait()
                else:
                    raise
        if nntp is None:
            raise LinkCheckerError(
               _("NNTP server too busy; tried more than %d times.") % tries)
        if log.is_debug(LOG_CHECK):
            nntp.set_debuglevel(1)
        self.add_info(nntp.getwelcome())
        return nntp
154223
def server_delete(s_name, **connection_args):
    '''
    
    '''
    ret = True
    server = _server_get(s_name, **connection_args)
    if server is None:
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    try:
        NSServer.delete(nitro, server)
    except NSNitroError as error:
        log.debug('netscaler module error - NSServer.delete() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
875976
def conn_has_method(conn, method_name):
    '''
    
    '''
    if method_name in dir(conn):
        return True

    log.error('Method \'%s\' not yet supported!', method_name)
    return False
95140
def is_serving(self) -> bool:
        
        try:
            # Python ≥ 3.7
            return self.server.is_serving()  # type: ignore
        except AttributeError:  # pragma: no cover
            # Python < 3.7
            return self.server.sockets is not None