Translate the given state string
495606
def translate_state(self, s):
        
        if not isinstance(s, basestring):
            return s
        s = s.capitalize().replace("_", " ")
        return t(_(s))
998380
function tokenAtString(stream, state) {
    var next;
    while ((next = stream.next()) != null) {
      if (next == '"' && !stream.eat('"')) {
        state.tokenize = null;
        break;
      }
    }
    return "string";
  }
216156
def match_transition(name, from_state)
      find(name).find { |trans| trans.matches?(from_state) }
    end
1083724
def translate(cls, val):
        """"""
        if val is None:
            return cls.translate_none(val)
        elif isinstance(val, string_types):
            return cls.translate_str(val)
        # Needs to be before integer checks
        elif isinstance(val, bool):
            return cls.translate_bool(val)
        elif isinstance(val, integer_types):
            return cls.translate_int(val)
        elif isinstance(val, float):
            return cls.translate_float(val)
        elif isinstance(val, dict):
            return cls.translate_dict(val)
        elif isinstance(val, list):
            return cls.translate_list(val)
        # Use this generic translation as a last resort
        return cls.translate_escaped_str(val)
1269642
def _coerce_state_from_string(value: Union[int, str]) -> str:
        """"""
        try:
            return STATE_MAP[int(value)]
        except KeyError:
            _LOGGER.error('Unknown state: %s', value)
            return STATE_UNKNOWN
218509
def translate(self, from_lang=None, to="de"):
        
        if from_lang is None:
            from_lang = self.translator.detect(self.string)
        return self.translator.translate(self.string,
                                         from_lang=from_lang, to_lang=to)
789241
function matchesState(state, desiredState) {
  if (desiredState === 'all') {
    return true;
  }
  if (desiredState[0] === '!') {
    return state !== desiredState.substring(1);
  }
  return state === desiredState;
}
501175
def translate(self, value):
        
        if self._check_if_already_proper(value):
            return value

        try:
            return self.search_table[value]
        except KeyError:
            raise ValueError("Value {value} doesn't match any state.".format(
                value=value
            ))
197297
def add_state(self, string):
        """"""
        parsed_string = string.split()
        if len(parsed_string) > 0:
            state, rules = parsed_string[0], parsed_string[1:]

            if len(rules) != len(self.alphabet):
                raise SyntaxError('Wrong count of rules ({cur}/{exp}): {string}'
                                  .format(cur=len(rules), exp=len(self.alphabet),
                                          string=string))

            if state in self.states or state == self.TERM_STATE:
                raise SyntaxError('Double definition of state: ' + state)
            else:
                self.states[state] = []

            for rule in rules:
                try:
                    self._add_rule(state, rule)
                except SyntaxError as err:
                    self.states.pop(state)
                    raise err
1293316
public static String from(int state) {
        switch (state) {
            case Bundle.ACTIVE:
                return ACTIVE;
            case Bundle.INSTALLED:
                return INSTALLED;
            case Bundle.RESOLVED:
                return RESOLVED;
            case Bundle.STARTING:
                return STARTING;
            case Bundle.STOPPING:
                return STOPPING;
            case Bundle.UNINSTALLED:
                return UNINSTALLED;
            default:
                return "UNKNOWN (" + Integer.toString(state) + ")";
        }
    }
318682
def is_(self, state):
    """"""
    translator = self._meta['translator']
    state = translator.translate(state)
    return self.actual_state == state
969292
private static Transition makeTransitionToStateLiteral(String literal, final HtmlContext state) {
    return new Transition(literal) {
      @Override
      Context computeNextContext(Context prior, Matcher matcher) {
        return prior.transitionToState(state);
      }
    };
  }
581522
def C_(ctx, s):
    
    translated = gettext.gettext('%s\x04%s' % (ctx, s))
    if '\x04' in translated:
        # no translation found, return input string
        return s
    return translated
504583
def print_state(state: State, file: TextIO = None) -> None:
    """"""
    state = state.vec.asarray()
    for index, amplitude in np.ndenumerate(state):
        ket = "".join([str(n) for n in index])
        print(ket, ":", amplitude, file=file)
269949
function translate($str, $tokens = [])
    {
        if (array_key_exists($str, $this->translation)) {
            $str = $this->translation[$str];
        }
        if (is_array($tokens) && sizeof($tokens) > 0) {
            $str = vsprintf($str, $tokens);
        }

        return $str;
    }
362375
def _match_state(self, state):
        """"""
        return (self.names == '*'
                or state in self.names
                or state.name in self.names)
1151567
def translate(patterns, *, flags=0):
    """"""

    flags = _flag_transform(flags)
    return _wcparse.translate(_wcparse.split(patterns, flags), flags)