Format the returned data object into a fixtures object, with the fixture ID as the key and the fixture class as the value.
519589
function(err, files, results) {
    if(err) {
      cb(err);
    } else {
      for(var i = 0; i < results.length; i++) {
        if(results[i] !== undefined && results[i].error === undefined && results[i].id !== undefined) {
          fixtures[results[i].id] = results[i];
        }
      }
      cb(undefined, fixtures);
    }
  }
1330497
def from_json(cls, data):
        
        required_keys = ('location', 'design_days')
        for key in required_keys:
            assert key in data, 'Required key "{}" is missing!'.format(key)

        return cls(Location.from_json(data['location']),
                   [DesignDay.from_json(des_day) for des_day in data['design_days']])
187628
def use_home_fixture(name)
      path = File.join spec_root, 'home_fixtures', name.to_s
      copy_fixture path, active_home_fixture_dir
      nil
    end
725637
def generate_fixtures(datasets, reuses):
    ''''''
    user = UserFactory()
    log.info('Generated user "{user.email}".'.format(user=user))

    organization = OrganizationFactory(members=[Member(user=user)])
    log.info('Generated organization "{org.name}".'.format(org=organization))

    for _ in range(datasets):
        dataset = VisibleDatasetFactory(organization=organization)
        DiscussionFactory(subject=dataset, user=user)
        ReuseFactory.create_batch(reuses, datasets=[dataset], owner=user)

    msg = 'Generated {datasets} dataset(s) with {reuses} reuse(s) each.'
    log.info(msg.format(**locals()))
750002
public function populateFields(DataObject $object, $data, $fixtures)
    {
        // Iterate Data:
        
        foreach ($data as $name => $value) {
            
            if ($this->isField($object, $name)) {
                $this->populateField($object, $name, $value);
            }
            
        }
        
        // Answer Object:
        
        return $object;
    }
68083
def load_json_fixture(fixture_path: str) -> Dict[str, Any]:
    
    with open(fixture_path) as fixture_file:
        file_fixtures = json.load(fixture_file)
    return file_fixtures
160748
def _format_list_objects(result):
    """"""

    all_keys = set()
    for item in result:
        all_keys = all_keys.union(item.keys())

    all_keys = sorted(all_keys)
    table = Table(all_keys)

    for item in result:
        values = []
        for key in all_keys:
            value = iter_to_table(item.get(key))
            values.append(value)

        table.add_row(values)

    return table
699050
def _format_ret(self, full_ret):
        '''
        
        '''
        ret = {}
        out = ''
        retcode = 0
        for key, data in six.iteritems(full_ret):
            ret[key] = data['ret']
            if 'out' in data:
                out = data['out']
            ret_retcode = self._get_retcode(data)
            if ret_retcode > retcode:
                retcode = ret_retcode
        return ret, out, retcode
455298
def _load_data(self):
        
        filenames = []
        model_identifiers = defaultdict(list)

        # attempt to load fixture files from given directories (first pass)
        # for each valid model fixture file, read it into the cache and get the
        # list of identifier keys from it
        for fixtures_dir in self.fixture_dirs:
            for filename in os.listdir(fixtures_dir):
                path = os.path.join(fixtures_dir, filename)
                file_ext = filename[filename.find('.')+1:]

                # make sure it's a valid fixture file
                if os.path.isfile(path) and file_ext in {'yml', 'yaml'}:
                    filenames.append(filename)
                    with open(path) as f:
                        self._cache[filename] = f.read()

                    # preload to determine identifier keys
                    with self._preloading_env() as env:
                        rendered_yaml = env.get_template(filename).render()
                        data = yaml.load(rendered_yaml)
                        if data:
                            class_name = filename[:filename.rfind('.')]
                            model_identifiers[class_name] = list(data.keys())

        # second pass where we can render the jinja templates with knowledge of all
        # the model identifier keys (allows random_model and random_models to work)
        for filename in filenames:
            self._load_from_yaml(filename, model_identifiers)

        self._loaded = True
880656
function (store, type, fixtureRecord) {
    var fixture = fixtureRecord || {};
    type = this._parseModelOrType(store, type);
    if (!fixtureRecord.id) {
      fixtureRecord.id = this.generateId(store, type);
    }
    if (this.fixtureForId(store, type, fixture.id)) {
      throw new Error('Fixture `' + type.typeKey + '` with id `' + fixture.id + '` already exists.');
    }
    return this.updateFixtures(store, type, fixture);
  }
658604
def prepare(data):
    """"""
    result = {}
    result["mode"] = data.get("mode")
    result["path"] = data.get("path")
    result["type"] = data.get("type")
    result["sha"] = data.get("sha")
    return result
302302
def construct_fixture_middleware(fixtures):
    
    def fixture_middleware(make_request, web3):
        def middleware(method, params):
            if method in fixtures:
                result = fixtures[method]
                return {'result': result}
            else:
                return make_request(method, params)
        return middleware
    return fixture_middleware
385714
function (store, type, fixtureRecord) {
    var fixture, fixturesArray;
    if (fixtureRecord.id) {
      fixture = this.fixtureForId(store, type, fixtureRecord.id);
      if (fixture) {
        fixturesArray = this.fixturesForType(store, type);
        fixturesArray.splice(fixturesArray.indexOf(fixtureRecord), 1);
      }
    }
    else {
      throw new Error('Deleting a fixture requires an ID.');
    }
    return null;
  }
638203
def _parse(cls, data, key=None):
        
        parse = cls.parse if cls.parse is not None else cls.get_endpoint()

        if callable(parse):
            data = parse(data)
        elif isinstance(parse, str):
            data = data[key]
        else:
            raise Exception('"parse" should be a callable or string got, {0}'
                            .format(parse))
        return data
977181
def format_variables(variables, join_lines=True):
  """"""
  rows = []
  rows.append(("Variable", "Shape", "Type", "Collections", "Device"))
  var_to_collections = _get_vars_to_collections(variables)
  for var in sorted(variables, key=lambda var: var.op.name):
    if var.get_shape().is_fully_defined():
      shape = "x".join(str(dim) for dim in var.get_shape().as_list())
    else:
      shape = "undefined"
    dtype = repr(var.dtype.base_dtype).replace("tf.", "")
    coll = ", ".join(sorted(var_to_collections[var]))
    rows.append((var.op.name, shape, dtype, coll, _format_device(var)))
  return _format_table(rows, join_lines)
71711
def from_response(cls, response, attrs):
        
        proj = response['Projection']
        hash_key = attrs.get(response['KeySchema'][0]['AttributeName'])
        range_key = None
        if len(response['KeySchema']) > 1:
            range_key = attrs[response['KeySchema'][1]['AttributeName']]
        throughput = Throughput.from_response(
            response['ProvisionedThroughput'])
        index = cls(proj['ProjectionType'], response['IndexName'], hash_key,
                    range_key, proj.get('NonKeyAttributes'), throughput)
        index.response = response
        return index
144937
def format_variable_map(variable_map, join_lines=True):
  """"""
  rows = []
  rows.append(("Key", "Variable", "Shape", "Type", "Collections", "Device"))
  var_to_collections = _get_vars_to_collections(variable_map)

  sort_key = lambda item: (item[0], item[1].name)
  for key, var in sorted(variable_map_items(variable_map), key=sort_key):
    shape = "x".join(str(dim) for dim in var.get_shape().as_list())
    dtype = repr(var.dtype.base_dtype).replace("tf.", "")
    coll = ", ".join(sorted(var_to_collections[var]))
    rows.append((key, var.op.name, shape, dtype, coll, _format_device(var)))
  return _format_table(rows, join_lines)