Init object storage
977167
public function attachAll()
    {
        foreach ($this->managedCurrencies as $managedCurrency) {
            $this->addCurrency($managedCurrency);
        }

        $defaultRate = 1;

        // Add default currency (euro in this example)
        $euro = new $this->currencyClass;
        $euro->setCode('EUR');
        $euro->setRate($defaultRate);

        $this[$euro->getCode()] = $euro;

        // Build YQL query
        $strCodes = '';
        foreach ($this->currencyCodes as $index=>$currencyCode) {
            $strCodes .= "'EUR".$currencyCode."'";
            if ($index != count($this->currencyCodes) - 1) {
                $strCodes .= ", ";
            }
        }

        $yqlQuery = "select id,Rate from yahoo.finance.xchange where pair in (".$strCodes.")";

        $args = array(
            'q' => $yqlQuery,
            'format' => "json",
            'env' => "store://datatables.org/alltableswithkeys",
        );

        $yqlQueryURL = $this->yahooUrl
            . "?q=" . urlencode($yqlQuery)
            . "&format=json"
            . "&env=store://datatables.org/alltableswithkeys";

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $yqlQueryURL);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
        $json = curl_exec($ch);

        // Convert JSON response to PHP object
        $data = json_decode($json);
        $results = $data->query->results->rate;

        // Check if query was okay and result is given
        if (is_null($results)) {
            new \RuntimeException('YQL query failed!');
        }

        $currencies = array();

        foreach ($results as $row) {
            $code = substr($row->id, 3);
            $rate = $row->Rate;

            $currencies[$code] = $rate;
        }

        foreach ($currencies as $code => $rate) {
            if (in_array($code, $this->managedCurrencies)) { // you can check if the currency is in the managed currencies
                $currency = new $this->currencyClass;
                $currency->setCode($code);
                $currency->setRate($rate);

                $this[$currency->getCode()] = $currency;
            }
        }

        // get the default rate from the default currency defined in the configuration
        if (isset($this[$this->defaultCurrency])) {
            $defaultRate = $this[$this->defaultCurrency]->getRate();
        }

        // convert rates according to the default one.
        $this->convertAll($defaultRate);
    }
730913
function init(config) {
            Object.keys(config).forEach(function (property) {
                this[property] = config[property];
            }, this);
        }
228232
private void initializeApplication(ApplicationDefinition currAppDef, ApplicationDefinition appDef) {
        getStorageService(appDef).initializeApplication(currAppDef, appDef);
        storeApplicationSchema(appDef);
    }
788701
public static void init(Object object)
	{
		if (object instanceof Collection)
		{
			initCollection((Collection<?>)object);
		}
		else if (object instanceof Marshalizable)
		{
			Marshalizable m = (Marshalizable)object;
			m.marshallize();
		}
	}
330343
public void init(Object obj)
    {
        m_bookmark = null;
        m_objectID = null;
        m_dataSource = null;
        m_objectSource = null;
        m_buffer = null;
    }
702966
def init_contents
      self[:Contents] = self[:Contents][:referenced_object][:indirect_without_dictionary] if self[:Contents].is_a?(Hash) && self[:Contents][:referenced_object] && self[:Contents][:referenced_object].is_a?(Hash) && self[:Contents][:referenced_object][:indirect_without_dictionary]
      self[:Contents] = [self[:Contents]] unless self[:Contents].is_a?(Array)
      self[:Contents].delete(is_reference_only: true, referenced_object: { indirect_reference_id: 0, raw_stream_content: '' })
      # un-nest any referenced arrays
      self[:Contents].map! { |s| actual_value(s).is_a?(Array) ? actual_value(s) : s }
      self[:Contents].flatten!
      self[:Contents].compact!
      # wrap content streams
      insert_content 'q', 0
      insert_content 'Q'

      # Prep content
      @contents = ''
      insert_content @contents
      @contents
    end
257630
function(callback) {
                var _this = this

                var initStorage = function() {
                    var obj = JSON.stringify([])
                    var _set = {}
                    _set[_this.key] = obj
                    storage.set(_set)

                    obj = JSON.parse(obj)

                    return obj
                }

                storage.get(this.key, function(items) {
                    var obj
                    if (Object.keys(items).length > 0) {
                        for (itemKey in items) {
                            obj = items[itemKey]
                            if (obj) {
                                obj = JSON.parse(obj)
                            }

                            if (obj === null || typeof obj === 'undefined') {
                                obj = initStorage()
                            } 
                            
                            if (callback) {
                                callback(obj)
                            }
                        }
                    } else {
                        obj = initStorage()
                        callback(obj)
                    }
                })
            }
291171
function init(storageConfiguration) {
  var config = storageConfiguration;
  if (!config || !config.mongoUrl) {
    throw Error("Missing mongoUrl parameter for GridFs storage");
  }
  var deferred = q.defer();
  MongoClient.connect(config.mongoUrl, function(err, connection) {
    if (err) {
      console.log("Cannot connect to mongodb server. Gridfs storage will be disabled");
      return deferred.reject(err);
    }
    var gfs = Grid(connection, mongo);
    deferred.resolve(gfs);
  });
  gfsPromise = deferred.promise;
}
1371606
def init(self):
        
        if os.path.isdir(self.path):
            self.fetch()
        else:
            self.clone()
606584
function initConfig(obj) {
  Object.keys(obj).forEach(item => {
    if (!process.env[item]) {
      process.env[item] = obj[item];
    }
  });
}
549490
function init(cb) {
	Storage.read(goblin.config.files.db, {}, function(err, db) {
		if (err) {
			return cb(err);
		}

		goblin.db = db;
		cb();
	})
}
885967
function initializeObjectAttribute( $contentObjectAttribute, $currentVersion, $originalContentObjectAttribute )
    {
        if ( $currentVersion != false )
        {
            $originalContentObjectAttributeID = $originalContentObjectAttribute->attribute( 'id' );
            $contentObjectAttributeID = $contentObjectAttribute->attribute( 'id' );
            $contentObjectAttributeVersion = $contentObjectAttribute->attribute( 'version' );

            $db = eZDB::instance();
            $db->begin();

            // Delete stored object attributes when initialize translated attribute.
            if ( $originalContentObjectAttributeID != $contentObjectAttributeID )
                $this->deleteStoredObjectAttribute( $contentObjectAttribute, $currentVersion );

            $newVersionEnumObject = eZEnumObjectValue::fetchAllElements( $originalContentObjectAttributeID, $currentVersion );

            for ( $i = 0; $i < count( $newVersionEnumObject ); ++$i )
            {
                $enumobjectvalue =  $newVersionEnumObject[$i];
                $enumobjectvalue->setAttribute( 'contentobject_attribute_id', $contentObjectAttribute->attribute( 'id' ) );
                $enumobjectvalue->setAttribute( 'contentobject_attribute_version',  $contentObjectAttributeVersion );
                $enumobjectvalue->store();
            }

            $db->commit();
        }
    }
241063
private void init_storage_parameters()
    {
        first_quick_size_block = first_quick_size * grain_size;
        last_quick_size_block = last_quick_size * grain_size;
        last_ql_index = last_quick_size + 1 - first_quick_size;
        ql_heads = new Listhead[last_ql_index + 1];
    }
661151
def __init(self):
        """"""
        res = self._get(url=self._url,
                           param_dict={"f": "json"},
                           securityHandler=self._securityHandler,
                           proxy_url=self._proxy_url,
                           proxy_port=self._proxy_port)
        self._json_dict = res
        self._json_string = json.dumps(self._json_dict)
        for k,v in self._json_dict.items():
            setattr(self, k, v)
714192
def _init_object(self, catalog_id, proxy, runtime, db_name, cat_name, cat_class):
        """"""
        self._catalog_identifier = None
        self._init_proxy_and_runtime(proxy, runtime)

        uses_cataloging = False
        if catalog_id is not None and catalog_id.get_identifier() != PHANTOM_ROOT_IDENTIFIER:
            self._catalog_identifier = catalog_id.get_identifier()

            config = self._runtime.get_configuration()
            parameter_id = Id('parameter:' + db_name + 'CatalogingProviderImpl@mongo')

            try:
                provider_impl = config.get_value_by_parameter(parameter_id).get_string_value()
            except (AttributeError, KeyError, errors.NotFound):
                collection = JSONClientValidated(db_name,
                                                 collection=cat_name,
                                                 runtime=self._runtime)
                try:
                    self._my_catalog_map = collection.find_one({'_id': ObjectId(self._catalog_identifier)})
                except errors.NotFound:
                    if catalog_id.get_identifier_namespace() != db_name + '.' + cat_name:
                        self._my_catalog_map = self._create_orchestrated_cat(catalog_id, db_name, cat_name)
                    else:
                        raise errors.NotFound('could not find catalog identifier ' + catalog_id.get_identifier() + cat_name)
            else:
                uses_cataloging = True
                cataloging_manager = self._runtime.get_manager('CATALOGING',
                                                               provider_impl)  # need to add version argument
                lookup_session = cataloging_manager.get_catalog_lookup_session()
                # self._my_catalog_map = lookup_session.get_catalog(catalog_id)._my_map
                # self._catalog = Catalog(osid_object_map=self._my_catalog_map, runtime=self._runtime,
                #                         proxy=self._proxy)
                self._catalog = lookup_session.get_catalog(catalog_id)
        else:
            self._catalog_identifier = PHANTOM_ROOT_IDENTIFIER
            self._my_catalog_map = make_catalog_map(cat_name, identifier=self._catalog_identifier)

        if not uses_cataloging:
            self._catalog = cat_class(osid_object_map=self._my_catalog_map, runtime=self._runtime, proxy=self._proxy)

        self._catalog._authority = self._authority  # there should be a better way...
        self._catalog_id = self._catalog.get_id()
        self._forms = dict()
943132
def vis_init(self):
        '''
        
        '''
        init_dict = {}
        init_dict['kind'] = 'init'
        assert len(self.want_file_pos) == len(self.heads_and_tails)
        init_dict['want_file_pos'] = self.want_file_pos
        init_dict['files'] = self.file_list
        init_dict['heads_and_tails'] = self.heads_and_tails
        init_dict['num_pieces'] = self.num_pieces
        self.broadcast(init_dict)
1253899
def __init(self):
        """"""
        url = "%s/%s.json" % (self._url, self._itemId)
        params = {"f": "json"}
        json_dict = self._get(url, params,
                         securityHandler=self._securityHandler,
                         proxy_port=self._proxy_port,
                         proxy_url=self._proxy_url)
        self._json_dict = json_dict
        self._json = json.dumps(self._json_dict)
        setattr(self, "data", json_dict['data'])
        if 'data' in json_dict:
            for k,v in json_dict['data'].items():
                setattr(self, k, v)
                del k,v