Callback for "state-get" command
973756
public function cmdGetState()
    {
        $result = $this->getListState();
        $this->outputFormat($result);
        $this->outputFormatTableState($result);
        $this->output();
    }
1343126
function getState (file) {
    // collect state for all possible data and recovery files
    var state = {};
    state.ephemeral = getFileInfo (file + ".eph");
    state.ready = getFileInfo (file + ".rdy");
    state.base = getFileInfo (file);
    state.backup = getFileInfo (file + ".bak");
    state.tertiary = getFileInfo (file + ".bk2");

    if (state.ephemeral.exists) {
        state.status = cc.SAFE_INTERVENE;
    } else if ((state.ready.exists) || (state.tertiary.exists)) {
        state.status = cc.SAFE_RECOVERABLE;
    } else if (state.base.exists) {
        state.status = cc.SAFE_NORMAL;
    } else {
        if (state.backup.exists) {
            state.status = cc.SAFE_RECOVERABLE;
        } else {
            state.status = cc.DOES_NOT_EXIST;
        }
    }

    return (state);
}
891386
def state_get(self, block_id, addresses):
        ''''''
        block = self._get_blocks([block_id.hex()])[0]
        block_header = BlockHeader()
        block_header.ParseFromString(block.header)

        try:
            state_view = self._state_view_factory.create_view(
                block_header.state_root_hash)
        except KeyError:
            LOGGER.error(
                'State from block %s requested, but root hash %s was missing. '
                'Returning empty state.',
                block_id.hex(),
                block_header.state_root_hash)
            # The state root does not exist, which may indicate a pruned root
            # from a dropped fork or an invalid state.
            return []

        result = []

        for address in addresses:
            # a fully specified address
            if len(address) == 70:
                try:
                    value = state_view.get(address)
                except KeyError:
                    # if the key is missing, leave it out of the response
                    continue

                result.append((address, value))
                continue

            # an address prefix
            leaves = state_view.leaves(address)

            for leaf in leaves:
                result.append(leaf)

        return result
1043348
def get_state(self, **kwargs):
        ''''''
        dbdata = self.dbdata
        if 'state' not in dbdata or kwargs:
            dbdata['state'] = ModelState(self, **kwargs)
        return dbdata['state']
512958
def do_state(args):
    
    rest_client = RestClient(args.url, args.user)

    if args.subcommand == 'list':
        response = rest_client.list_state(args.subtree, args.head)
        leaves = response['data']
        head = response['head']
        keys = ('address', 'size', 'data')
        headers = tuple(k.upper() for k in keys)

        def parse_leaf_row(leaf, decode=True):
            decoded = b64decode(leaf['data'])
            return (
                leaf['address'],
                len(decoded),
                str(decoded) if decode else leaf['data'])

        if args.format == 'default':
            fmt.print_terminal_table(headers, leaves, parse_leaf_row)
            print('HEAD BLOCK: "{}"'.format(head))

        elif args.format == 'csv':
            fmt.print_csv(headers, leaves, parse_leaf_row)
            print('(data for head block: "{}")'.format(head))

        elif args.format == 'json' or args.format == 'yaml':
            state_data = {
                'head': head,
                'data': [{k: d for k, d in zip(keys, parse_leaf_row(l, False))}
                         for l in leaves]}

            if args.format == 'yaml':
                fmt.print_yaml(state_data)
            elif args.format == 'json':
                fmt.print_json(state_data)
            else:
                raise AssertionError('Missing handler: {}'.format(args.format))

        else:
            raise AssertionError('Missing handler: {}'.format(args.format))

    if args.subcommand == 'show':
        output = rest_client.get_leaf(args.address, args.head)
        if output is not None:
            print('DATA: "{}"'.format(b64decode(output['data'])))
            print('HEAD: "{}"'.format(output['head']))
        else:
            raise CliException('No data available at {}'.format(args.address))
575067
def get_state(self, key):
        
        _data = self.state_db.get(key)
        if not _data:
            raise KeyError(key)
        else:
            return State().from_json(_data)
1258573
Status initArgs(String[] args, DispatchCallback callback) {
    List<String> commands = new LinkedList<>();
    List<String> files = new LinkedList<>();
    String driver = null;
    String user = null;
    String pass = null;
    String url = null;
    String nickname = null;
    String logFile = null;
    String commandHandler = null;
    String appConfig = null;
    String promptHandler = null;

    for (int i = 0; i < args.length; i++) {
      if (args[i].equals("--help") || args[i].equals("-h")) {
        return Status.ARGS;
      }

      // -- arguments are treated as properties
      if (args[i].startsWith("--")) {
        String[] parts = split(args[i].substring(2), "=");
        debug(loc("setting-prop", Arrays.asList(parts)));
        if (parts.length > 0) {
          boolean ret;

          if (parts.length >= 2) {
            ret = getOpts().set(parts[0], parts[1], true);
          } else {
            ret = getOpts().set(parts[0], "true", true);
          }

          if (!ret) {
            return Status.ARGS;
          }
        }

        continue;
      }

      if (args[i].charAt(0) == '-') {
        if (i == args.length - 1) {
          return Status.ARGS;
        }
        if (args[i].equals("-d")) {
          driver = args[++i];
        } else if (args[i].equals("-ch")) {
          commandHandler = args[++i];
        } else if (args[i].equals("-n")) {
          user = args[++i];
        } else if (args[i].equals("-p")) {
          pass = args[++i];
        } else if (args[i].equals("-u")) {
          url = args[++i];
        } else if (args[i].equals("-e")) {
          commands.add(args[++i]);
        } else if (args[i].equals("-f")) {
          getOpts().setRun(args[++i]);
        } else if (args[i].equals("-log")) {
          logFile = args[++i];
        } else if (args[i].equals("-nn")) {
          nickname = args[++i];
        } else if (args[i].equals("-ac")) {
          appConfig = args[++i];
        } else if (args[i].equals("-ph")) {
          promptHandler = args[++i];
        } else {
          return Status.ARGS;
        }
      } else {
        files.add(args[i]);
      }
    }

    if (appConfig != null) {
      dispatch(COMMAND_PREFIX + "appconfig " + appConfig,
          new DispatchCallback());
    }

    if (url != null || user != null || pass != null || driver != null) {
      String com =
          COMMAND_PREFIX + "connect "
              + (url == null ? "\"\"" : url) + " "
              + (user == null || user.length() == 0 ? "''" : user) + " "
              + (pass == null || pass.length() == 0 ? "''" : pass) + " "
              + (driver == null ? "" : driver);
      debug("issuing: " + com);
      dispatch(com, new DispatchCallback());
    }

    if (nickname != null) {
      dispatch(COMMAND_PREFIX + "nickname " + nickname, new DispatchCallback());
    }

    if (logFile != null) {
      dispatch(COMMAND_PREFIX + "record " + logFile, new DispatchCallback());
    }

    if (commandHandler != null) {
      StringBuilder sb = new StringBuilder();
      for (String chElem : commandHandler.split(",")) {
        sb.append(chElem).append(" ");
      }
      dispatch(COMMAND_PREFIX + "commandhandler " + sb.toString(),
          new DispatchCallback());
    }

    if (promptHandler != null) {
      dispatch(COMMAND_PREFIX + "prompthandler "
          + promptHandler, new DispatchCallback());
    }

    // now load properties files
    for (String file : files) {
      dispatch(COMMAND_PREFIX + "properties " + file, new DispatchCallback());
    }

    if (commands.size() > 0) {
      // for single command execute, disable color
      getOpts().set(BuiltInProperty.COLOR, false);
      getOpts().set(BuiltInProperty.HEADER_INTERVAL, -1);

      for (String command : commands) {
        debug(loc("executing-command", command));
        dispatch(command, new DispatchCallback());
      }

      exit = true; // execute and exit
    }

    Status status = Status.OK;

    // if a script file was specified, run the file and quit
    if (getOpts().getRun() != null) {
      dispatch(COMMAND_PREFIX + "run \"" + getOpts().getRun() + "\"", callback);
      if (callback.isFailure()) {
        status = Status.OTHER;
      }
      dispatch(COMMAND_PREFIX + "quit", new DispatchCallback());
    }

    return status;
  }
334176
def get_state(self, sls, saltenv, cachedir=None):
        '''
        
        '''
        if '.' in sls:
            sls = sls.replace('.', '/')
        sls_url = salt.utils.url.create(sls + '.sls')
        init_url = salt.utils.url.create(sls + '/init.sls')
        for path in [sls_url, init_url]:
            dest = self.cache_file(path, saltenv, cachedir=cachedir)
            if dest:
                return {'source': path, 'dest': dest}
        return {}
462293
def command(state, args):
    """"""
    state.cache_manager.teardown()
    state.cache_manager.setup()
    EpisodeTypes.forget(state.db)
    del state.file_picker
620204
def allState(self, *args, **kwargs):
        

        return self._makeApiCall(self.funcinfo["allState"], *args, **kwargs)
866645
function get(command) {
        var commandID;
        if (!command) {
            console.error("Attempting to get a Sort method with a missing required parameter: command");
            return;
        }

        if (typeof command === "string") {
            commandID = command;
        } else {
            commandID = command.getID();
        }
        return _sorts[commandID];
    }
920748
async def update_state(self, name, state):
        

        await self.send_command(OPERATIONS.CMD_UPDATE_STATE,
                                {'name': name, 'new_status': state},
                                MESSAGES.UpdateStateResponse, timeout=5.0)
1054831
function cmd (action, url, params, fn) {
      var c, f;

      c = {
        cmd: action + ' ' + me._selectedEnv.apiroot + url
      };

      c.params = ('object' === typeof(params)) ? params: {};
      c.params.eventKey = key();
      c.params.sid = sid();

      f = ('function' === typeof(fn)) ? fn: console.log;
      _commandQ['' + c.params.eventKey] = f;

      return JSON.stringify(c);
    }
265709
def state(self):
        """"""
        response =  self.SOAPAction('GetSocketSettings', 'OPStatus', self.moduleParameters("1"))
        if response is None:
            return 'unknown'
        elif response.lower() == 'true':
            return ON
        elif response.lower() == 'false':
            return OFF
        else:
            _LOGGER.warning("Unknown state %s returned" % str(response.lower()))
            return 'unknown'
1243669
def load_state(self, fname=None):
        """"""
        with open(fname, 'rb') as fh:
            self.state = pickle.load(fh)
236199
def _get_states(self, result):
        """"""
        if 'devices' not in result.keys():
            return

        for device_states in result['devices']:
            device = self.__devices[device_states['deviceURL']]
            try:
                device.set_active_states(device_states['states'])
            except KeyError:
                pass
877877
function(command) {
    var obj     = wysihtml5.commands[command],
        args    = wysihtml5.lang.array(arguments).get(),
        method  = obj && obj.stateValue;
    if (method) {
      args.unshift(this.composer);
      return method.apply(obj, args);
    } else {
      return false;
    }
  }