Returns a flag with the state of the connection.
503383
def is_alive(self):
        """"""
        null = chr(0)
        if self.device is None:
            return {"is_alive": False}
        if self.transport == "telnet":
            try:
                # Try sending IAC + NOP (IAC is telnet way of sending command
                # IAC = Interpret as Command (it comes before the NOP)
                self.device.write_channel(telnetlib.IAC + telnetlib.NOP)
                return {"is_alive": True}
            except UnicodeDecodeError:
                # Netmiko logging bug (remove after Netmiko >= 1.4.3)
                return {"is_alive": True}
            except AttributeError:
                return {"is_alive": False}
        else:
            # SSH
            try:
                # Try sending ASCII null byte to maintain the connection alive
                self.device.write_channel(null)
                return {"is_alive": self.device.remote_conn.transport.is_active()}
            except (socket.error, EOFError):
                # If unable to send, we can tell for sure that the connection is unusable
                return {"is_alive": False}
        return {"is_alive": False}
44147
public State getWifiState() {
		if (connMan == null) {
			connMan = (ConnectivityManager) context
					.getSystemService(Context.CONNECTIVITY_SERVICE);
		}
		NetworkInfo wifiNetworkInfo = connMan.getNetworkInfo(TYPE_WIFI);
		if (wifiNetworkInfo == null) {
			return State.UNKNOWN;
		}

		return wifiNetworkInfo.getState();
	}
781309
def state(self):
        
        try:
            return libvirt_utils.Domain.resolve_state(self.raw_state())
        except vm_plugin.LagoVMDoesNotExistError:
            return 'down'
        except vm_plugin.LagoFailedToGetVMStateError:
            return 'failed to get state'
        except KeyError:
            return 'unknown state'
612420
def get_state(self, as_str=False):
        

        uid = self.user_id

        if self._iface_user.get_id() == uid:
            result = self._iface.get_my_state()

        else:
            result = self._iface.get_state(uid)

        if as_str:
            return UserState.get_alias(result)

        return result
1180191
@Transient
    public String getStatus()
    {
        if(hasFailed()) return FAILED; 
        if(hasSucceeded()) return SUCCESS; 
        if(ignored != 0) return IGNORED; 
        return NOT_RUNNED; 
    }
395528
private static ThreadState state()
    {
        ThreadState state=(ThreadState)__states.get();
        if (state==null)
        {
            state=new ThreadState();
            __states.set(state);
        }
        return state;
    }
556484
def is_state(self, state):
        
        state = state.format(relation_name=self.relation_name)
        value = _get_flag_value(state)
        if not value:
            return False
        return self.key in value['conversations']
252635
def get_flags():
    
    flags = unitdata.kv().getrange('reactive.states.', strip=True) or {}
    return sorted(flags.keys())
1149755
@Override
    public DevState state() {
        MDC.setContextMap(contextMap);
        xlogger.entry();
        try {
            state = getState();
        } catch (final DevFailed e) {
            try {
                stateImpl.stateMachine(DeviceState.UNKNOWN);
                statusImpl.statusMachine(DevFailedUtils.toString(e), DeviceState.UNKNOWN);
                state = DevState.UNKNOWN;
            } catch (final DevFailed e1) {
                logger.debug(NOT_IMPORTANT_ERROR, e1);
            }
            logger.debug(NOT_IMPORTANT_ERROR, e);
        }
        return state;
    }
1332360
def get_service_node_state(self, state, problem_has_been_acknowledged, in_scheduled_downtime):
        
        # If our node is acknowledged or in downtime, state is ok/up
        if problem_has_been_acknowledged or in_scheduled_downtime:
            state = 0

        # Maybe we are a NOT node, so manage this
        if self.not_value:
            # Critical -> OK
            if state == 2:
                return 0
            # OK -> CRITICAL (warning is untouched)
            if state == 0:
                return 2
        return state
52056
def get_state(self, state):
        """"""
        # Check to see if we have a change request pending; if we do
        # return the value we expect it to change to.
        for data in list(self._send_queue.queue):
            desired_states = data['desired_states']
            for desired_state in desired_states:
                if desired_state['state'] == state:
                    return desired_state['enabled']
        if state == States.FILTER_LOW_SPEED:
            return (States.FILTER.value & self._flashing_states) != 0
        return (state.value & self._states) != 0
719443
public String getState()
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getState");
    String state = 
      index.getState(aliasDest).toString();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) 
      SibTr.entry(tc, "getState");
    return state;
  }
518661
def get_status(self):
    
    self.__update_state()
    if self._state.active:
      return self.RUNNING
    else:
      return self._state.result_status
774139
public DDPSTATE getState() {
        // used by the UI to figure out what the current DDP connection state is
        if (getDDP().getState() == CONNSTATE.Closed) {
            mDDPState = DDPSTATE.Closed;
        }
        return mDDPState;
    }
1128867
def connection_status(self, userid):
        '''  '''
        response, status_code = self.__pod__.Connection.get_v1_connection_user_userId_info(
            sessionToken=self.__session__,
            userId=userid
        ).result()
        self.logger.debug('%s: %s' % (status_code, response))
        return status_code, response
472187
function ConnectionState(code, stringId, connected) {
  if (arguments.length === 2) {
    connected = stringId;
    stringId = 'NONAME';
  }
  if (!(this instanceof ConnectionState)) {
    return new ConnectionState(code, stringId, connected);
  }

  this.id = stringId;
  this.code = code;
  this.connected = connected;
}
179262
def state(self):
        """"""
        state = self._resource.get('state', self.default_state)

        if state in State:
            return state
        else:
            return getattr(State, state)