Select dialect


    :param key: a key for your dabtabase you wanna use
548508
def select(table, key='default'):
    
    database = choice(__db[key + '.slave'])
    return database.select(table)
1288289
def set_dialect(dialect):
    '''
    '''
    global mavlink, current_dialect
    from .generator import mavparse
    if 'MAVLINK20' in os.environ:
        wire_protocol = mavparse.PROTOCOL_2_0
        modname = "pymavlink.dialects.v20." + dialect
    elif mavlink is None or mavlink.WIRE_PROTOCOL_VERSION == "1.0" or not 'MAVLINK09' in os.environ:
        wire_protocol = mavparse.PROTOCOL_1_0
        modname = "pymavlink.dialects.v10." + dialect
    else:
        wire_protocol = mavparse.PROTOCOL_0_9
        modname = "pymavlink.dialects.v09." + dialect

    try:
        mod = __import__(modname)
    except Exception:
        # auto-generate the dialect module
        from .generator.mavgen import mavgen_python_dialect
        mavgen_python_dialect(dialect, wire_protocol)
        mod = __import__(modname)
    components = modname.split('.')
    for comp in components[1:]:
        mod = getattr(mod, comp)
    current_dialect = dialect
    mavlink = mod
34366
def get(self, key: str) -> Optional[str]:
        
        return get_config(self.full_key(key))
1334868
def key(**kwargs):
  '''  '''
 
  output, err = cli_syncthing_adapter.key(device=True)
  click.echo("%s" % output, err=err)
1289699
def to_iso639_1(key):
    
    item = find(whatever=key)
    if not item:
        raise NonExistentLanguageError('Language does not exist.')
    return item[u'iso639_1']
1193178
def option(self, key=None):
        
        if key is None:
            return self._args.options()

        return self._args.option(key)
1224417
def _qualify_map(key, content):
    
    if not isinstance(key, basestring):
        return key, content

    min_len  = None
    max_len  = None
    modifier = []
    m        = RE_MATCH_CSTR(key)

    if not m:
        raise KeyError("Unable to parse, invalid key: %r" % key)

    if m.group(3) is not None:
        min_len = max_len = int(m.group(3))
    elif m.group(4) is not None:
        if m.group(4):
            min_len = int(m.group(4))
        else:
            min_len = 0
        if m.group(5):
            max_len = int(m.group(5))
    elif m.group(6) == '*':
        min_len = 0
    elif m.group(6) == '+':
        min_len = 1
    elif m.group(6) == '?':
        min_len = 0
        max_len = 1

    if m.group(7):
        modifier = m.group(7).split(',')

    if m.group(8) == '-':
        modifier.append('strip')

    if m.group(2) == '*':
        return m.group(1), OptionalNull(content, min_len, max_len, modifier)
    elif m.group(2) == '?':
        return m.group(1), Optional(content, min_len, max_len, modifier)
    elif m.group(2) == '+':
        return m.group(1), Mandatory(content, min_len, max_len, modifier)
    else:
        return m.group(1), Mandatory(content, min_len, max_len, modifier)
809020
def to_iso639_2(key, type='B'):
    
    if type not in ('B', 'T'):
        raise ValueError('Type must be either "B" or "T".')
    item = find(whatever=key)
    if not item:
        raise NonExistentLanguageError('Language does not exist.')
    if type == 'T' and item[u'iso639_2_t']:
        return item[u'iso639_2_t']
    return item[u'iso639_2_b']
67303
def _get_match(self, key):
        

        return self._get_string_match(key=key) or \
            self._get_non_string_match(key=key)
1328651
function(key) {
        var translation = options.translations[key];

        if (!translation) {
          grunt.fail.warn('No translation found for key:', key);
        }
        return translation;
      }
871209
def get_dialect(self):
        """"""

        parameters = {}

        for parameter in self.csv_params[2:]:
            pname, ptype, plabel, phelp = parameter

            widget = self._widget_from_p(pname, ptype)

            if ptype is types.StringType or ptype is types.UnicodeType:
                parameters[pname] = str(widget.GetValue())
            elif ptype is types.BooleanType:
                parameters[pname] = widget.GetValue()
            elif pname == 'quoting':
                choice = self.choices['quoting'][widget.GetSelection()]
                parameters[pname] = getattr(csv, choice)
            else:
                raise TypeError(_("{type} unknown.").format(type=ptype))

        has_header = parameters.pop("self.has_header")

        try:
            csv.register_dialect('user', **parameters)

        except TypeError, err:
            msg = _("The dialect is invalid. \n "
                    "\nError message:\n{msg}").format(msg=err)
            dlg = wx.MessageDialog(self.parent, msg, style=wx.ID_CANCEL)
            dlg.ShowModal()
            dlg.Destroy()
            raise TypeError(err)

        return csv.get_dialect('user'), has_header
742732
def get(self, key, default=None):
        
        """
        segments = key.split('.')
        result = reduce(
            lambda dct, k: dct and dct.get(k) or None,
            segments, self.data)

        return result or default
832802
public static String getFormatedDBProperty(final String _key,
                                               final Object... _args)
    {
        String language = null;
        try {
            language = Context.getThreadContext().getLanguage();
        } catch (final EFapsException e) {
            DBProperties.LOG.error("not able to read the language from the context", e);
        }
        return DBProperties.getFormatedDBProperty(_key, language, _args);
    }
1171487
def pick(self, keys):
        '''
        
        '''
        subset = dict([(key, self.criteria[key]) for key in keys])
        return self.__class__(**subset)
1129466
def _encode_key(self, key):
        
        if isinstance(key, str) or isinstance(key, unicode):
            key = key.encode(self._keyencoding)
        elif not isinstance(key, bytes):
            raise TypeError("key must be bytes or str")
        return codecs.encode(key, 'hex_codec').decode(self._keyencoding)
1372868
def key(self, key, strictkey=None):
        
        return self._select(self._pointer.key(key, strictkey))
373360
def words(self, key):
        
        if self.default_mappings is not None and key not in self.mappings:
            return self.default_mappings[key].encode('utf').split("|")
        else:
            return self.mappings[key].encode('utf').split("|")