Get a table of values with the given OID prefix.
338293
def table(self, oid, columns=None, column_value_mapping=None, non_repeaters=0,
              max_repetitions=20, fetch_all_columns=True):
        
        snmpsecurity = self._get_snmp_security()
        base_oid = oid.strip(".")

        if not fetch_all_columns and not columns:
            raise ValueError("please use the columns argument to "
                             "indicate which columns to fetch")

        if fetch_all_columns:
            columns_to_fetch = [""]
        else:
            columns_to_fetch = ["." + str(col_id) for col_id in columns.keys()]

        full_obj_table = []

        for col in columns_to_fetch:
            try:
                engine_error, pdu_error, pdu_error_index, obj_table = self._cmdgen.bulkCmd(
                    snmpsecurity,
                    cmdgen.UdpTransportTarget((self.host, self.port), timeout=self.timeout,
                                              retries=self.retries),
                    non_repeaters,
                    max_repetitions,
                    oid + col,
                )

            except Exception as e:
                raise SNMPError(e)
            if engine_error:
                raise SNMPError(engine_error)
            if pdu_error:
                raise SNMPError(pdu_error.prettyPrint())

            # remove any trailing rows from the next subtree
            try:
                while not str(obj_table[-1][0][0].getOid()).lstrip(".").startswith(
                    base_oid + col + "."
                ):
                    obj_table.pop()
            except IndexError:
                pass

            # append this column to full result
            full_obj_table += obj_table

        t = Table(columns=columns, column_value_mapping=column_value_mapping)

        for row in full_obj_table:
            for name, value in row:
                oid = str(name.getOid()).strip(".")
                value = _convert_value_to_native(value)
                column, row_id = oid[len(base_oid) + 1:].split(".", 1)
                t._add_value(int(column), row_id, value)

        return t
68055
def get_next(self,oid):
		""""""
		try: # Nested try..except because of Python 2.4
			self.lock.acquire()
			try:
				# remove trailing zeroes from the oid
				while len(oid) > 0 and oid[-2:] == ".0" and oid not in self.data:
					oid = oid[:-2];
				return self.get(self.data_idx[self.data_idx.index(oid)+1])
			except ValueError:
				# Not found: try to match partial oid
				for real_oid in self.data_idx:
					if real_oid.startswith(oid):
						return self.get(real_oid)
				return "NONE" # Unknown OID
			except IndexError:
				return "NONE" # End of MIB
		finally:
			self.lock.release()
677059
def _get_goids(gostr):
        """"""
        if 'GO:' in gostr:
            return gostr.split(',')
        elif os.path.exists(gostr):
            return GetGOs().get_goids(None, gostr, sys.stdout)
612204
def _parse_PREFIX(value):
        ""
        channel_modes, channel_chars = value.split(')')
        channel_modes = channel_modes[1:]
        return collections.OrderedDict(zip(channel_chars, channel_modes))
497830
def _get_auto_increment_info(self, table):
        """"""
        query = ''
        seq_table = ''
        seq_column = ''
        seq_name = ''
        find_query = "\n".join([
            "SELECT",
            "  t.relname as related_table,",
            "  a.attname as related_column,",
            "  s.relname as sequence_name",
            "FROM pg_class s",
            "JOIN pg_depend d ON d.objid = s.oid",
            "JOIN pg_class t ON d.objid = s.oid AND d.refobjid = t.oid",
            "JOIN pg_attribute a ON (d.refobjid, d.refobjsubid) = (a.attrelid, a.attnum)",
            "JOIN pg_namespace n ON n.oid = s.relnamespace",
            "WHERE",
            "  s.relkind = 'S'",
            "AND",
            "  n.nspname = 'public'",
            "AND",
            "  t.relname = '{}'".format(table)
        ])

        pipe = self._run_queries([find_query], popen_kwargs={'stdout': subprocess.PIPE})
        stdout, stderr = pipe.communicate()
        if stdout:
            try:
                m = re.findall('^\s*(\S+)\s*\|\s*(\S+)\s*\|\s*(\S+)\s*$', stdout, flags=re.MULTILINE)
                seq_table, seq_column, seq_name = m[1]
                # http://www.postgresql.org/docs/9.2/static/functions-sequence.html
                # http://www.postgresql.org/docs/9.2/static/functions-conditional.html
                query = "\n".join([
                    "SELECT",
                    "  setval('{}',".format(seq_name.strip()),
                    "  coalesce(max({}), 1),".format(seq_column.strip()),
                    "  max({}) IS NOT null)".format(seq_column.strip()),
                    "FROM \"{}\"".format(seq_table.strip())
                ])

            except IndexError:
                query = ''

        return query, seq_table, seq_column, seq_name
709943
def prefix(tokens, operator_table):
    """"""
    operator, matched_tokens = operator_table.prefix.match(tokens)
    if operator:
        return TokenMatch(operator, None, matched_tokens)
1011217
def keys(self, prefix=None):
        """"""
        query = Setting.query
        if prefix:
            query = query.filter(Setting.key.startswith(prefix))

        # don't use iteritems: 'value' require little processing whereas we only
        # want 'key'
        return [i[0] for i in query.yield_per(1000).values(Setting.key)]
398391
def getextensibleindex(bunchdt, data, commdct, key, objname):
    """"""
    theobject = getobject(bunchdt, key, objname)
    if theobject == None:
        return None
    theidd = iddofobject(data, commdct, key)
    extensible_i = [
        i for i in range(len(theidd)) if 'begin-extensible' in theidd[i]]
    try:
        extensible_i = extensible_i[0]
    except IndexError:
        return theobject
1006420
def _get_dbid2goids(associations):
        """"""
        id2gos = cx.defaultdict(set)
        for ntd in associations:
            id2gos[ntd.DB_ID].add(ntd.GO_ID)
        return dict(id2gos)
976635
def get(cls, id):
        

        # cached?
        if CACHE:
            if id in _cache['Prefix']:
                log.debug('cache hit for prefix %d' % id)
                return _cache['Prefix'][id]
            log.debug('cache miss for prefix %d' % id)

        try:
            prefix = Prefix.list({'id': id})[0]
        except IndexError:
            raise NipapNonExistentError('no prefix with ID ' + str(id) + ' found')

        _cache['Prefix'][id] = prefix
        return prefix
921000
def get_online_symbol_data(database_id):
    """"""
    import pymysql
    import pymysql.cursors
    cfg = get_database_configuration()
    mysql = cfg['mysql_online']
    connection = pymysql.connect(host=mysql['host'],
                                 user=mysql['user'],
                                 passwd=mysql['passwd'],
                                 db=mysql['db'],
                                 cursorclass=pymysql.cursors.DictCursor)
    cursor = connection.cursor()
    sql = ("SELECT `id`, `formula_in_latex`, `unicode_dec`, `font`, "
           "`font_style` FROM  `wm_formula` WHERE  `id` =%i") % database_id
    cursor.execute(sql)
    datasets = cursor.fetchall()
    if len(datasets) == 1:
        return datasets[0]
    else:
        return None
1122837
def get_tables_for_bind(self, bind=None):
        """"""
        result = []
        for table in itervalues(self.Model.metadata.tables):
            if table.info.get('bind_key') == bind:
                result.append(table)
        return result
944828
def getIndicesFromInstId(self, instId):
        """"""
        if instId in self._idToIdxCache:
            return self._idToIdxCache[instId]

        indices = []
        for impliedFlag, modName, symName in self._indexNames:
            mibObj, = mibBuilder.importSymbols(modName, symName)
            try:
                syntax, instId = self.oidToValue(mibObj.syntax, instId, impliedFlag, indices)
            except PyAsn1Error as exc:
                debug.logger & debug.FLAG_INS and debug.logger(
                    'error resolving table indices at %s, %s: %s' % (self.__class__.__name__, instId, exc))
                indices = [instId]
                instId = ()
                break

            indices.append(syntax)  # to avoid cyclic refs

        if instId:
            raise error.SmiError(
                'Excessive instance identifier sub-OIDs left at %s: %s' %
                (self, instId)
            )

        indices = tuple(indices)
        self._idToIdxCache[instId] = indices

        return indices
1215113
def process_tables(key, value, fmt, meta):
    """"""

    global has_unnumbered_tables  # pylint: disable=global-statement

    # Process block-level Table elements
    if key == 'Table':

        # Inspect the table
        if len(value) == 5:  # Unattributed, bail out
            has_unnumbered_tables = True
            if fmt in ['latex']:
                return [RawBlock('tex', r'\begin{no-prefix-table-caption}'),
                        Table(*value),
                        RawBlock('tex', r'\end{no-prefix-table-caption}')]
            return None

        # Process the table
        table = _process_table(value, fmt)

        # Context-dependent output
        attrs = table['attrs']
        if table['is_unnumbered']:
            if fmt in ['latex']:
                return [RawBlock('tex', r'\begin{no-prefix-table-caption}'),
                        AttrTable(*value),
                        RawBlock('tex', r'\end{no-prefix-table-caption}')]

        elif fmt in ['latex']:
            if table['is_tagged']:  # Code in the tags
                tex = '\n'.join([r'\let\oldthetable=\thetable',
                                 r'\renewcommand\thetable{%s}'%\
                                 references[attrs[0]]])
                pre = RawBlock('tex', tex)
                tex = '\n'.join([r'\let\thetable=\oldthetable',
                                 r'\addtocounter{table}{-1}'])
                post = RawBlock('tex', tex)
                return [pre, AttrTable(*value), post]
        elif table['is_unreferenceable']:
            attrs[0] = ''  # The label isn't needed any further
        elif fmt in ('html', 'html5') and LABEL_PATTERN.match(attrs[0]):
            # Insert anchor
            anchor = RawBlock('html', '<a name="%s"></a>'%attrs[0])
            return [anchor, AttrTable(*value)]
        elif fmt == 'docx':
            # As per http://officeopenxml.com/WPhyperlink.php
            bookmarkstart = \
              RawBlock('openxml',
                       '<w:bookmarkStart w:id="0" w:name="%s"/>'
                       %attrs[0])
            bookmarkend = \
              RawBlock('openxml', '<w:bookmarkEnd w:id="0"/>')
            return [bookmarkstart, AttrTable(*value), bookmarkend]

    return None
34279
def get_tables_for_bind(self, bind=None):
        """"""
        result = []
        tables = Model.metadata.tables
        for key in tables:
            if tables[key].info.get("bind_key") == bind:
                result.append(tables[key])
        return result
374108
public byte[] getExtensionValue(String oid) {
        try {
            ObjectIdentifier findOID = new ObjectIdentifier(oid);
            String extAlias = OIDMap.getName(findOID);
            Extension certExt = null;
            CertificateExtensions exts = (CertificateExtensions)info.get(
                                     CertificateExtensions.NAME);

            if (extAlias == null) { // may be unknown
                // get the extensions, search thru' for this oid
                if (exts == null) {
                    return null;
                }

                for (Extension ex : exts.getAllExtensions()) {
                    ObjectIdentifier inCertOID = ex.getExtensionId();
                    if (inCertOID.equals((Object)findOID)) {
                        certExt = ex;
                        break;
                    }
                }
            } else { // there's sub-class that can handle this extension
                try {
                    certExt = (Extension)this.get(extAlias);
                } catch (CertificateException e) {
                    // get() throws an Exception instead of returning null, ignore
                }
            }
            if (certExt == null) {
                if (exts != null) {
                    certExt = exts.getUnparseableExtensions().get(oid);
                }
                if (certExt == null) {
                    return null;
                }
            }
            byte[] extData = certExt.getExtensionValue();
            if (extData == null) {
                return null;
            }
            DerOutputStream out = new DerOutputStream();
            out.putOctetString(extData);
            return out.toByteArray();
        } catch (Exception e) {
            return null;
        }
    }
1019190
def get_jid(jid):
    '''
    
    '''
    serv = _get_serv(ret=None)

    sql = "select id, full_ret from returns where jid = '{0}'".format(jid)

    data = serv.query(sql)
    ret = {}
    if data:
        points = data[0]['points']
        for point in points:
            ret[point[3]] = salt.utils.json.loads(point[2])

    return ret