Returns a table source matching the descriptor.
10186
public static <T> TableSource<T> findAndCreateTableSource(Descriptor descriptor) {
		Map<String, String> properties = descriptor.toProperties();

		TableSource tableSource;
		try {
			tableSource = TableFactoryService
				.find(TableSourceFactory.class, properties)
				.createTableSource(properties);
		} catch (Throwable t) {
			throw new TableException("findAndCreateTableSource failed.", t);
		}

		return tableSource;
	}
875567
public static Map<String, CoprocessorInfo> getCoprocessorInfo(HTableDescriptor tableDescriptor) {
    Map<String, CoprocessorInfo> info = Maps.newHashMap();

    // Extract information about existing data janitor coprocessor
    // The following logic is copied from RegionCoprocessorHost in HBase
    for (Map.Entry<ImmutableBytesWritable, ImmutableBytesWritable> entry: tableDescriptor.getValues().entrySet()) {
      String key = Bytes.toString(entry.getKey().get()).trim();
      String spec = Bytes.toString(entry.getValue().get()).trim();

      if (!HConstants.CP_HTD_ATTR_KEY_PATTERN.matcher(key).matches()) {
        continue;
      }

      try {
        Matcher matcher = HConstants.CP_HTD_ATTR_VALUE_PATTERN.matcher(spec);
        if (!matcher.matches()) {
          continue;
        }

        String className = matcher.group(2).trim();
        Path path = matcher.group(1).trim().isEmpty() ? null : new Path(matcher.group(1).trim());
        int priority = matcher.group(3).trim().isEmpty() ? Coprocessor.PRIORITY_USER
          : Integer.valueOf(matcher.group(3));
        String cfgSpec = null;
        try {
          cfgSpec = matcher.group(4);
        } catch (IndexOutOfBoundsException ex) {
          // ignore
        }

        Map<String, String> properties = Maps.newHashMap();
        if (cfgSpec != null) {
          cfgSpec = cfgSpec.substring(cfgSpec.indexOf('|') + 1);
          // do an explicit deep copy of the passed configuration
          Matcher m = HConstants.CP_HTD_ATTR_VALUE_PARAM_PATTERN.matcher(cfgSpec);
          while (m.find()) {
            properties.put(m.group(1), m.group(2));
          }
        }
        info.put(className, new CoprocessorInfo(className, path, priority, properties));
      } catch (Exception ex) {
        LOG.warn("Coprocessor attribute '{}' has invalid coprocessor specification '{}'", key, spec, ex);
      }
    }

    return info;
  }
776219
def table(self):
        """"""
        if self._table is None:
            self._table = list(self._iter_rows())

        return self._table
100036
def _TableFactory(tag, stream, offset, length):
    
    TableClass = {
        'head': _HeadTable,
        'name': _NameTable,
    }.get(tag, _BaseTable)
    return TableClass(tag, stream, offset, length)
683912
def table(self):
        
        if not self.has_table:
            raise ValueError('shape does not contain a table')
        tbl = self._element.graphic.graphicData.tbl
        return Table(tbl, self)
1200515
def get_bq_table(self, database, schema, identifier):
        """"""
        conn = self.get_thread_connection()
        table_ref = self.table_ref(database, schema, identifier, conn)
        return conn.handle.get_table(table_ref)
543255
def create_source_table(scan_shape):
    

    cols_dict = collections.OrderedDict()
    cols_dict['Source_Name'] = dict(dtype='S48', format='%s')
    cols_dict['name'] = dict(dtype='S48', format='%s')
    cols_dict['class'] = dict(dtype='S32', format='%s')
    cols_dict['SpectrumType'] = dict(dtype='S32', format='%s')
    cols_dict['SpatialType'] = dict(dtype='S32', format='%s')
    cols_dict['SourceType'] = dict(dtype='S32', format='%s')
    cols_dict['SpatialModel'] = dict(dtype='S32', format='%s')
    cols_dict['RAJ2000'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['DEJ2000'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['GLON'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['GLAT'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['ts'] = dict(dtype='f8', format='%.3f')
    cols_dict['loglike'] = dict(dtype='f8', format='%.3f')
    cols_dict['npred'] = dict(dtype='f8', format='%.3f')
    cols_dict['offset'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['offset_ra'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['offset_dec'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['offset_glon'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['offset_glat'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['offset_roi_edge'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['pivot_energy'] = dict(dtype='f8', format='%.3f', unit='MeV')
    cols_dict['flux_scan'] = dict(dtype='f8', format='%.3f',
                                  shape=scan_shape)
    cols_dict['eflux_scan'] = dict(dtype='f8', format='%.3f',
                                   shape=scan_shape)
    cols_dict['norm_scan'] = dict(dtype='f8', format='%.3f',
                                  shape=scan_shape)
    cols_dict['dloglike_scan'] = dict(dtype='f8', format='%.3f',
                                      shape=scan_shape)
    cols_dict['loglike_scan'] = dict(dtype='f8', format='%.3f',
                                     shape=scan_shape)

    # Add source dictionary columns
    for k, v in sorted(defaults.source_output.items()):
        if not k in cols_dict.keys():
            if v[2] == float:
                cols_dict[k] = dict(dtype='f8', format='%f')
            elif k == 'Spectrum_Filename' or k == 'Spatial_Filename':
                cols_dict[k] = dict(dtype='S128', format='%s')
            elif v[2] == str:
                cols_dict[k] = dict(dtype='S32', format='%s')

    cols_dict['param_names'] = dict(dtype='S32', format='%s', shape=(10,))
    cols_dict['param_values'] = dict(dtype='f8', format='%f', shape=(10,))
    cols_dict['param_errors'] = dict(dtype='f8', format='%f', shape=(10,))

    # Catalog Parameters
    cols_dict['Flux_Density'] = dict(
        dtype='f8', format='%.5g', unit='1 / (MeV cm2 s)')
    cols_dict['Spectral_Index'] = dict(dtype='f8', format='%.3f')
    cols_dict['Pivot_Energy'] = dict(dtype='f8', format='%.3f', unit='MeV')
    cols_dict['beta'] = dict(dtype='f8', format='%.3f')
    cols_dict['Exp_Index'] = dict(dtype='f8', format='%.3f')
    cols_dict['Cutoff'] = dict(dtype='f8', format='%.3f', unit='MeV')
    cols_dict['Expfactor'] = dict(dtype='f8', format='%.3f')

    cols_dict['Conf_68_PosAng'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['Conf_68_SemiMajor'] = dict(
        dtype='f8', format='%.3f', unit='deg')
    cols_dict['Conf_68_SemiMinor'] = dict(
        dtype='f8', format='%.3f', unit='deg')
    cols_dict['Conf_95_PosAng'] = dict(dtype='f8', format='%.3f', unit='deg')
    cols_dict['Conf_95_SemiMajor'] = dict(
        dtype='f8', format='%.3f', unit='deg')
    cols_dict['Conf_95_SemiMinor'] = dict(
        dtype='f8', format='%.3f', unit='deg')

    for t in ['eflux', 'eflux100', 'eflux1000', 'eflux10000']:
        cols_dict[t] = dict(dtype='f8', format='%.3f', unit='MeV / (cm2 s)')
        cols_dict[t + '_err'] = dict(dtype='f8',
                                     format='%.3f', unit='MeV / (cm2 s)')

    for t in ['eflux_ul95', 'eflux100_ul95', 'eflux1000_ul95', 'eflux10000_ul95']:
        cols_dict[t] = dict(dtype='f8', format='%.3f', unit='MeV / (cm2 s)')

    for t in ['flux', 'flux100', 'flux1000', 'flux10000']:
        cols_dict[t] = dict(dtype='f8', format='%.3f', unit='1 / (cm2 s)')
        cols_dict[t + '_err'] = dict(dtype='f8',
                                     format='%.3f', unit='1 / (cm2 s)')

    for t in ['flux_ul95', 'flux100_ul95', 'flux1000_ul95', 'flux10000_ul95']:
        cols_dict[t] = dict(dtype='f8', format='%.3f', unit='1 / (cm2 s)')

    for t in ['dnde', 'dnde100', 'dnde1000', 'dnde10000']:
        cols_dict[t] = dict(dtype='f8', format='%.3f', unit='1 / (MeV cm2 s)')
        cols_dict[t + '_err'] = dict(dtype='f8',
                                     format='%.3f', unit='1 / (MeV cm2 s)')

    cols = [Column(name=k, **v) for k, v in cols_dict.items()]
    tab = Table(cols)
    return tab
587062
def get_descriptor_for_idcode(idcode):
    """"""
    idcode = idcode&0x0fffffff
    id_str = "XXXX"+bin(idcode)[2:].zfill(28)

    descr_file_path = _check_cache_for_idcode(id_str)
    if descr_file_path:
        with open(descr_file_path, 'r') as f:
            dat = json.load(f)
        if dat.get("_file_version",-1) == JTAGDeviceDescription.version:
            return JTAGDeviceDescription(dat.get('idcode'),
                                         dat.get('name'),
                                         dat.get('ir_length'),
                                         dat.get('instruction_opcodes'),
                                         dat.get('registers'),
                                         dat.get('instruction_register_map'))

    print("    Device detected ("+id_str+"). Fetching missing descriptor...")
    sid = get_sid(id_str)
    details = get_details(sid)
    attribs = decode_bsdl(sid)

    #VERIFYING PARSED DATA FROM 2 SOURCES. MESSY BUT USEFUL.
    instruction_length = 0
    if attribs.get('INSTRUCTION_LENGTH') ==\
       details.get('INSTRUCTION_LENGTH'):
        instruction_length = attribs.get('INSTRUCTION_LENGTH')
    elif attribs.get('INSTRUCTION_LENGTH') and\
       details.get('INSTRUCTION_LENGTH'):
        raise Exception("INSTRUCTION_LENGTH can not be determined")
    elif attribs.get('INSTRUCTION_LENGTH'):
        instruction_length = attribs.get('INSTRUCTION_LENGTH')
    else:
        instruction_length = details.get('INSTRUCTION_LENGTH')

    for instruction_name in details.get('instructions'):
        if instruction_name not in\
           attribs.get('INSTRUCTION_OPCODE',[]):
            raise Exception("INSTRUCTION_OPCODE sources do not match")

    #print(attribs['IDCODE_REGISTER'])
    descr = JTAGDeviceDescription(attribs['IDCODE_REGISTER'].upper(),
                                  details['name'], instruction_length,
                                  attribs['INSTRUCTION_OPCODE'],
                                  attribs['REGISTERS'],
                                  attribs['INSTRUCTION_TO_REGISTER'])

    #CACHE DESCR AS FILE!
    if not os.path.isdir(base_descr_dir):
        os.makedirs(base_descr_dir)
    descr_file_path = os.path.join(base_descr_dir,
                                   attribs['IDCODE_REGISTER']\
                                   .upper()+'.json')
    with open(descr_file_path, 'w') as f:
        json.dump(descr._dump(), f)

    return descr
685706
def _GetTable(self):
    
    result = []
    # Avoid the global lookup cost on each iteration.
    lstr = str
    for row in self._table:
      result.append(
          '%s\n' %
          self.separator.join(lstr(v) for v in row))

    return ''.join(result)
1073534
def name(self):
        

        from rows.plugins.utils import slug

        name = self.meta.get("name", None)
        if name is not None:
            return slug(name)

        source = self.meta.get("source", None)
        if source and source.uri:
            return slug(os.path.splitext(Path(source.uri).name)[0])

        return "table1"
573353
def get_table_name table
			if table.is_a? String
				return table
			elsif table.methods.include? :name
				return table.name
			end
			return table
		end
187105
def _name_to_index(self, cursor, table_name):
        
        return dict([(d[0], i) for i, d in enumerate(self.get_table_description(cursor, table_name, identity_check=False))])
650466
def get(self, table_name):
        """"""
        assert table_name in self.tabs, \
            "Table not avaiable. Avaiable tables: {}".format(
                ", ".join(self.tabs.keys())
            )
        return self.tabs[table_name]
688958
def describe(self, tablename, refresh=False, metrics=False, require=False):
        
        table = self.cached_descriptions.get(tablename)
        if refresh or table is None or (metrics and not table.consumed_capacity):
            desc = self.connection.describe_table(tablename)
            if desc is None:
                if require:
                    raise RuntimeError("Table %r not found" % tablename)
                else:
                    return None
            table = TableMeta.from_description(desc)
            self.cached_descriptions[tablename] = table
            if metrics:
                read, write = self.get_capacity(tablename)
                table.consumed_capacity["__table__"] = {"read": read, "write": write}
                for index_name in table.global_indexes:
                    read, write = self.get_capacity(tablename, index_name)
                    table.consumed_capacity[index_name] = {"read": read, "write": write}

        return table
283037
def describe(table_name, region=None, key=None, keyid=None, profile=None):
    '''
    
    '''
    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)
    table = Table(table_name, connection=conn)
    return table.describe()
37758
def get_descriptor(ctx):
    
    d_net = gluon.nn.Sequential()
    with d_net.name_scope():

        d_net.add(SNConv2D(num_filter=64, kernel_size=4, strides=2, padding=1, in_channels=3, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=128, kernel_size=4, strides=2, padding=1, in_channels=64, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=256, kernel_size=4, strides=2, padding=1, in_channels=128, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=512, kernel_size=4, strides=2, padding=1, in_channels=256, ctx=ctx))
        d_net.add(gluon.nn.LeakyReLU(0.2))

        d_net.add(SNConv2D(num_filter=1, kernel_size=4, strides=1, padding=0, in_channels=512, ctx=ctx))

    return d_net
633304
async function infer(source, options={}) {
  const table = await Table.load(source, options)
  const descriptor = await table.infer({limit: options.limit})
  return descriptor
}