Prepare for public
772223
function view_session_message(req, msg) {
		var result = copy(msg);
		result.$ref = ref(req, opts.path + '/messages', msg.$id );
		return result;
	}
31592
public void makePublic() {
        if (!getPublicMarkerFile().exists()) {
            try {
                new FileOutputStream(getPublicMarkerFile()).close();
            } catch (IOException e) {
                throw Exceptions.handle(Storage.LOG, e);
            }
        }
        publicAccessCache.put(getName(), true);
    }
574352
def ready(self):
        """"""
        models_config.auto_load_configs()

        self.auto_load_app_modules(['layouts', 'signals'])

        app_menu.auto_load_model_menu()

        auto_register_search_models()
        tabs.auto_generate_missing_tabs()
930637
function publicModel(model, readyPromise) {
    var res = [];

    function find(filter) {
        var mergedFilter = _.merge({}, model.filter, filter);
        var filteredModel = getModel(model.io, model.name, model.itemDef, model.modelDef, mergedFilter);
        if (model.children.indexOf(filteredModel) === -1) model.children.push(filteredModel);

        return filteredModel;
    }


    function getByIds(ids) {
        var items = [];
        for (var i = 0; i < res.length; i++) {
            if (ids.indexOf(res[i].id) !== -1) items.push(res[i]);
        }
        return items;
    }

    utils.defineProperties(res, {
        _isModel: { value: true },
        name: { value: model.name },

        ready: { value: readyPromise },

        create: { value: function(props) {
            props = props || {};

            var item = modelItem(props, model);
            item.ready = item.update(props).then(function() {
                model._addItem(item);
            });
            return item;
        } },

        itemById: { value: function(id) {
            for (var i = 0; i < this.length; i++) {
                if (this[i].id === id) return this[i];
            }
            return false;
        } },

        find: { value: find },
        filter: { value: find },

        findOne: { value: function(filter) {
            return find(filter).then(function(val) {
                if (val.length) return val[0];
                return false;
            });
        } },

        refresh: { value: function() {
            return Promise.all(_.map(this, function(item) {
                return item.refresh();
            }));
        } },

        then: { value: function() {
            return readyPromise.then.apply(readyPromise, arguments);
        } },

        catch: { value: function() {
            return readyPromise.catch.apply(readyPromise, arguments);
        } },

        /**
         * Override array modification properties
         */

        _pop: { value: arrayPop },

        pop: { value: function() {
            var lastItem = arrayPop.call(this);
            lastItem.delete();
            return lastItem;
        } },

        _push: { value: arrayPush },

        push: { value: function() {
            for (var i = 0; i < arguments.length; i++) {
                this.create(arguments[i]);
            }
            return this.length;
        } },

        _shift: { value: arrayShift },

        shift: { value: function() {
            var firstItem = arrayShift.call(this);
            firstItem.delete();
            return firstItem;
        } },

        _splice: { value: arraySplice },

        splice: { value: function(start, deleteCount) {
            var items = _.map(arraySlice.call(arguments, 2), function(itm) {
                var item = modelItem(itm, model);
                item.ready = item.update(itm);
                return item;
            });

            items.unshift(start, deleteCount);

            var removed = arraySplice.apply(this, items);
            for (var i = 0; i < removed.length; i++) removed.delete();
            return removed;
        } },

        _unshift: { value: arrayUnshift },

        unshift: { value: function() {
            return arrayUnshift.apply(this, _.map(arguments, function(itm) {
                var item = modelItem(itm, model);
                item.ready = item.update(itm);
                return item;
            }));
        } },

        __connection: { value: model.name }
    });

    //Object.defineProperties(res, );

    _.merge(res, utils.createCalculateProperty(function(previous, flags) {
        if (!previous) return;

        var isArray = _.isArray(previous), prevId;
        if (isArray) {
            prevId = _.map(previous, function(val) {
                if (_.isNumber(val)) return val;
                return val.id;
            });
        } else prevId = [_.isNumber(previous) ? previous : previous.id];

        return readyPromise.then(function() {
            var itms = getByIds(prevId);

            function getItems() {
                if (isArray) return { _stWrapped: true, val: itms};

                return { _stWrapped: true, val: itms.length ? itms[0] : null };
            }

            if (!flags.noRefresh) {
                return Promise.all(_.map(itms, function(item) {
                    return item.refresh();
                })).then(getItems);
            }

            return getItems();
        });
    }.bind(this)));

    return res;
}
364582
def prepare(cls):
        """"""
        if cls._ask_openapi():
            napp_path = Path()
            tpl_path = SKEL_PATH / 'napp-structure/username/napp'
            OpenAPI(napp_path, tpl_path).render_template()
            print('Please, update your openapi.yml file.')
            sys.exit()
35106
def prepareToSolve(self):
        '''
        
        '''
        self.setAndUpdateValues(self.solution_next,self.IncomeDstn,self.LivPrb,self.DiscFac)
        self.defBoroCnst(self.BoroCnstArt)
956248
def prepare(self):

        self.body_html = markdown(
            codecs.open(self.abspath, 'r').read(),
            extras=['fenced-code-blocks', 'hilite', 'tables', 'metadata'])

        self.header = self.body_html.metadata
        """"""
        if 'tags' in self.header:  # pages can lack tags
            self.header['tags'] = [t.strip().lower() for t in
                                   self.header['tags'].split(',')]

        else:
            self.header['tags'] = ("",)

        self.date = self.header.get('published', datetime.datetime.now())

        if isinstance(self.date, str):
            self.date = datetime.datetime.strptime(self.date, "%Y-%m-%d")

        for k, v in self.header.items():
            try:
                setattr(self, k, v)
            except AttributeError:
                pass

        if self.id:
            return

        rec = {'filename': self.path,
               'mtime': int(os.path.getmtime(self.abspath))}

        if self.header['kind'] == 'writing':
            _id = Entry.db.posts.insert(rec)

        elif self.header['kind'] == 'page':
            _id = Entry.db.pages.insert(rec)

        self.id = _id
980665
public function prePersist()
    {
        $this->createdAt = $this->updatedAt = new \DateTime('now');

        if (!$this->metaTitle) {
            $this->setMetaTitle($this->pageName);
        }
    }
813020
function ready() {
  for (var i = 0; i < preloadTiles.length; i++) {
    var state = layerAbove.textureStore().query(preloadTiles[i]);
    if (!state.hasTexture) {
      return false;
    }
  }
  return true;
}
634664
def _prepare_ingest(self):
        """"""

        # see also commentary on DigitalObject.DUMMY_URIREF
        self.replace_uri(self.obj.DUMMY_URIREF, self.obj.uriref)
64260
private function _prepare()
    {
        if ($this->_pluginName === null) {
            // Figure out which OS we are running on, and detect support
            if (!file_exists(PSI_APP_ROOT.'/includes/os/class.'.PSI_OS.'.inc.php')) {
                $this->error->addError("file_exists(class.".PSI_OS.".inc.php)", PSI_OS." is not currently supported");
            }

            if (!defined('PSI_MBINFO') && (!$this->_blockName || in_array($this->_blockName, array('voltage','current','temperature','fans','power','other')))) {
                // check if there is a valid sensor configuration in phpsysinfo.ini
                $foundsp = array();
                if (defined('PSI_SENSOR_PROGRAM') && is_string(PSI_SENSOR_PROGRAM)) {
                    if (preg_match(ARRAY_EXP, PSI_SENSOR_PROGRAM)) {
                        $sensorprograms = eval(strtolower(PSI_SENSOR_PROGRAM));
                    } else {
                        $sensorprograms = array(strtolower(PSI_SENSOR_PROGRAM));
                    }
                    foreach ($sensorprograms as $sensorprogram) {
                        if (!file_exists(PSI_APP_ROOT.'/includes/mb/class.'.$sensorprogram.'.inc.php')) {
                            $this->error->addError("file_exists(class.".htmlspecialchars($sensorprogram).".inc.php)", "specified sensor program is not supported");
                        } else {
                            $foundsp[] = $sensorprogram;
                        }
                    }
                }

                /**
                 * motherboard information
                 *
                 * @var string serialized array
                 */
                define('PSI_MBINFO', serialize($foundsp));
            }

            if (!defined('PSI_UPSINFO') && (!$this->_blockName || ($this->_blockName==='ups'))) {
                // check if there is a valid ups configuration in phpsysinfo.ini
                $foundup = array();
                if (defined('PSI_UPS_PROGRAM') && is_string(PSI_UPS_PROGRAM)) {
                    if (preg_match(ARRAY_EXP, PSI_UPS_PROGRAM)) {
                        $upsprograms = eval(strtolower(PSI_UPS_PROGRAM));
                    } else {
                        $upsprograms = array(strtolower(PSI_UPS_PROGRAM));
                    }
                    foreach ($upsprograms as $upsprogram) {
                        if (!file_exists(PSI_APP_ROOT.'/includes/ups/class.'.$upsprogram.'.inc.php')) {
                            $this->error->addError("file_exists(class.".htmlspecialchars($upsprogram).".inc.php)", "specified UPS program is not supported");
                        } else {
                            $foundup[] = $upsprogram;
                        }
                    }
                }
                /**
                 * ups information
                 *
                 * @var string serialized array
                 */
                define('PSI_UPSINFO', serialize($foundup));
            }

            // if there are errors stop executing the script until they are fixed
            if ($this->error->errorsExist()) {
                $this->error->errorsAsXML();
            }

            // Create the XML
            $this->_xml = new XML($this->_completeXML, '', $this->_blockName);
        } else {
            // Create the XML
            $this->_xml = new XML(false, $this->_pluginName);
        }
    }
1255444
public function prePersist()
    {
        if (!$this->getDefaultProfile())
        {
            // When we create a new User, we automatically give them a Buyer profile
            $profile = new Profile();
            $profile->setName($this->getFullname());

            $location = new Location();
            $location->setName('Default');
            $location->setPostalCode($this->postal_code);

            $profile->addLocation($location);

            $this->addProfile($profile);
        }
    }
734378
def _prepare_first_step(self):
        """"""
        if self.townhalls:
            self._game_info.player_start_location = self.townhalls.first.position
        self._game_info.map_ramps = self._game_info._find_ramps()
946201
function Ready()
	{
		if (options.autoconnect)
		{
			// make a connection request immediately (optional)
			parent.GetPSN(true, function() {
				if (options.onReady) options.onReady();
				return;
			});
		}
		else
		{
			// just callback that we're ready (if anyone is listening)
			if (options.onReady) options.onReady();
			return;
		}
	}
888774
protected function preparePrep(){
        $this->prepList = array();
        $this->invalidList = array();
        $this->rewind();
        if (array_key_exists('SellerSKUList.Id.1',$this->options)){
            $this->options['Action'] = 'GetPrepInstructionsForSKU';
            $this->resetASINs();
        } else if (array_key_exists('ASINList.Id.1',$this->options)){
            $this->options['Action'] = 'GetPrepInstructionsForASIN';
            $this->resetSKUs();
        }
    }
1085551
function prepare (o) {
    try {
      var input = checkInput(o)
      var q = Queries.mkQuery(input)

      // we have win!
      return [q]
    } catch (err) {
      // other than spewing, we ignore errors
      console.error(err.stack)

      // so this request will be flatmapped away
      return []
    }
  }
67994
protected function prepare()
    {
        /** @var CollectionView $collection */
        $collection = $this->getComponent('collection_view');
        $collection->setData($this->getDataProvider());
        if ($collection->getDataInjector() === null) {
            $collection->setDataInjector($this->makeDataInjector());
        }
        $this->applyOperations();
        $this->hideSubmitButtonIfNotUsed();
    }