Retrieve descriptor
767255
async function retrieveDescriptor(descriptor) {
  if (isPlainObject(descriptor)) {
    return cloneDeep(descriptor)
  }
  if (isString(descriptor)) {

    // Remote
    if (isRemotePath(descriptor)) {
      try {
        const response = await axios.get(descriptor)
        return response.data
      } catch (error) {
        const message = `Can not retrieve remote descriptor "${descriptor}"`
        throw new DataPackageError(message)
      }

    // Local
    } else {
      if (config.IS_BROWSER) {
        const message = `Local descriptor "${descriptor}" in browser is not supported`
        throw new DataPackageError(message)
      }
      try {
        // TODO: rebase on promisified fs.readFile (async)
        const contents = fs.readFileSync(descriptor, 'utf-8')
        return JSON.parse(contents)
      } catch (error) {
        const message = `Can not retrieve local descriptor "${descriptor}"`
        throw new DataPackageError(message)
      }
    }

  }
  throw new DataPackageError('Descriptor must be String or Object')
}
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
1187527
function getPropertyDescriptor(target, name) {
        var pd = Object.getOwnPropertyDescriptor(target, name),
            proto = Object.getPrototypeOf(target);
        while (typeof pd === 'undefined' && proto !== null) {
            pd = Object.getOwnPropertyDescriptor(proto, name);
            proto = Object.getPrototypeOf(proto);
        }
        return pd;
    }
814520
function getDescriptors(images) {
  const result = [];
  for (let image of images) {
    result.push(extractHOG(image));
  }

  const heights = images.map((img) => img.height);
  const maxHeight = Math.max.apply(null, heights);
  const minHeight = Math.min.apply(null, heights);
  for (let i = 0; i < images.length; i++) {
    const img = images[i];
    let bonusFeature = 1;
    if (minHeight !== maxHeight) {
      bonusFeature = (img.height - minHeight) / (maxHeight - minHeight);
    }
    result[i].push(bonusFeature);
  }
  return result;
}
602604
def get_obj(ref):
    """"""
    oid = int(ref)
    return server.id2ref.get(oid) or server.id2obj[oid]
1194670
@Nonnull
    public Descriptor getDescriptorOrDie(Class<? extends Describable> type) {
        Descriptor d = getDescriptor(type);
        if (d==null)
            throw new AssertionError(type+" is missing its descriptor");
        return d;
    }
174652
def with_descriptor(self, descriptor):
        '''
        
        '''
        res = {}
        desc = "%s_descriptor" % descriptor
        for eid, ent in self.items():
            if desc in ent:
                res[eid] = ent
        return res
1040844
function(context, descriptor, args) {
		var name = args[0],
			value = args[1],
			hasValue = typeof value !== 'undefined';
		descriptor.attributes += ' ' + name + (hasValue ? ('="' + (value.__interpolable__ ? value.output(context) : value) + '"') : '');
	}
179052
def get_description(expression, options=None):
    
    descripter = ExpressionDescriptor(expression, options)
    return descripter.get_description(DescriptionTypeEnum.FULL)
54497
def get_pk_descriptors(cls):
    """"""
    pk_fields = {
        name: descriptor
        for name, descriptor in vars_class(cls).items()
        if isinstance(descriptor, ObjectField) and is_pk_descriptor(descriptor)
    }
    alt_pk_fields = defaultdict(list)
    for name, descriptor in vars_class(cls).items():
        if isinstance(descriptor, ObjectField):
            if descriptor.alt_pk is True:
                alt_pk_fields[0].append((name, descriptor))
            elif type(descriptor.alt_pk) is int:
                alt_pk_fields[descriptor.alt_pk].append((name, descriptor))
    if len(pk_fields) == 1:
        return ((pk_fields.popitem(),), (alt_pk_fields[0],))
    elif len(pk_fields) > 1:
        unique_pk_fields = {
            name: descriptor
            for name, descriptor in pk_fields.items()
            if descriptor.pk is True
        }
        if unique_pk_fields:
            raise AttributeError(
                "more than one field is marked as unique primary key: %s" % (
                    ', '.join(sorted(pk_fields))))
        pk_descriptors = tuple(sorted((
            (name, descriptor)
            for name, descriptor in pk_fields.items()
        ), key=lambda item: item[1].pk))
        alt_pk_descriptors = tuple(
            alt_pk_fields[idx]
            for idx, (name, descriptor) in enumerate(pk_descriptors)
        )
        return pk_descriptors, alt_pk_descriptors
    else:
        return tuple(), tuple()
1001464
def get_fileobject(self, dir=None, **kwargs):
        ''''''
        if dir is None:
            dir = os.path.normpath(os.path.dirname(self._path))
        descriptor, name = tempfile.mkstemp(dir=dir)
        # io.open() will take either the descriptor or the name, but we need
        # the name later for commit()/replace_atomic() and couldn't find a way
        # to get the filename from the descriptor.
        os.close(descriptor)
        kwargs['mode'] = self._mode
        kwargs['file'] = name
        return io.open(**kwargs)
769420
def get_descriptor(self, number):
        """"""
        # Create stdout file and get file descriptor
        stdout_path = os.path.join(self.config_dir,
                                   'pueue_process_{}.stdout'.format(number))
        if os.path.exists(stdout_path):
            os.remove(stdout_path)
        out_descriptor = open(stdout_path, 'w+')

        # Create stderr file and get file descriptor
        stderr_path = os.path.join(self.config_dir,
                                   'pueue_process_{}.stderr'.format(number))
        if os.path.exists(stderr_path):
            os.remove(stderr_path)
        err_descriptor = open(stderr_path, 'w+')

        self.descriptors[number] = {}
        self.descriptors[number]['stdout'] = out_descriptor
        self.descriptors[number]['stdout_path'] = stdout_path
        self.descriptors[number]['stderr'] = err_descriptor
        self.descriptors[number]['stderr_path'] = stderr_path
        return out_descriptor, err_descriptor
260133
int getFieldIndex(TypeElement declaringClass, String name, String descriptor)
    {
        String fullyQualifiedForm = declaringClass.getQualifiedName().toString();
        return getRefIndex(Fieldref.class, fullyQualifiedForm, name, descriptor);
    }
623000
def security_descriptor(self):
    """"""
    fwnt_security_descriptor = pyfwnt.security_descriptor()
    fwnt_security_descriptor.copy_from_byte_stream(self._fsntfs_attribute.data)
    return fwnt_security_descriptor
63089
function locateDescriptor(descriptor) {
  let basePath

  // Infer from path/url
  if (isString(descriptor)) {
    basePath = descriptor.split('/').slice(0, -1).join('/') || '.'

  // Current dir by default
  } else {
    basePath = '.'
  }

  return basePath
}
728062
public function getDescriptor()
    {
        if (is_null($this->_descriptor) && isset($this->object)) {
            $this->_descriptor = $this->object->descriptor;
        }

        return $this->_descriptor;
    }
530076
function getVisualizersDescriptor() {
        //we merge the contents of the CONFIG.visualizerDescriptors by id
        var indexById = function (objectArray, id) {
                var i,
                    index = -1;
                for (i = 0; i < objectArray.length; i++) {
                    if (objectArray[i].id === id) {
                        index = i;
                        break;
                    }
                }

                return index;
            },
            getVisualizerDescriptor = function (path) {
                try {
                    var descriptor = fs.readFileSync(path, 'utf-8');
                    descriptor = JSON.parse(descriptor);
                    return descriptor;
                } catch (e) {
                    //we do not care much of the error just give back an empty array
                    logger.error(e);
                    return [];
                }
            },
            allVisualizersDescriptor = [],
            i, j;

        for (i = 0; i < gmeConfig.visualization.visualizerDescriptors.length; i++) {
            var descriptor = getVisualizerDescriptor(gmeConfig.visualization.visualizerDescriptors[i]);
            if (descriptor.length) {
                for (j = 0; j < descriptor.length; j++) {
                    var index = indexById(allVisualizersDescriptor, descriptor[j].id);
                    if (index !== -1) {
                        allVisualizersDescriptor[index] = descriptor[j];
                    } else {
                        allVisualizersDescriptor.push(descriptor[j]);
                    }
                }
            }
        }
        return allVisualizersDescriptor.sort(function (a, b) {
            if (a.id < b.id) {
                return -1;
            }
            if (a.id > b.id) {
                return 1;
            }
            return 0;
        });
    }