Get new template which represents the values of this point in a
        [PointDataObject](./Point.m.html#IoticAgent.IOT.Point.PointDataObject). If data is set (to a dictionary), use
        this to populate the created template.
171668
def get_template(self, data=None):  # noqa (complexity)
        """"""
        with self.__lock:
            if self.__value_templates is None and self.__last_parse_ok:
                try:
                    self.__refresh()
                except RefreshException:
                    # Point has no (useable) values - don't try to refetch again
                    self.__last_parse_ok = False
                    raise
            if self.__value_templates is None:
                raise ValueError('Point has no values')
            if data is None:
                template = PointDataObject(self.__value_templates, self.__filter)
            else:
                while True:
                    try:
                        template = PointDataObject._from_dict(self.__value_templates, self.__filter, data)
                    except:
                        # parsing has failed for first time since refresh so try again
                        if self.__last_parse_ok:
                            logger.debug('Failed to parse data from for point %s, refreshing', self.__point)
                            self.__last_parse_ok = False
                            try:
                                self.__refresh()
                            except RefreshException:
                                break
                        else:
                            raise
                    else:
                        self.__last_parse_ok = True
                        break
            return template
1053081
def cls(self):
        
        # TODO: register the resulting type?
        return SmartTemplate(self.name)(", ".join(map(str, self.params)))
1211985
def load_template(self, name, *parameters):
        
        template, fields, header_fields = self._set_templates_fields_and_header_fields(name, parameters)
        self._init_new_message_stack(template, fields, header_fields)
1082526
function() {
            var self = this;

            this.template = this.options.template;
            this.args = this.options.args || {};

            // Related view
            this.view = this.options.view || null;

            // Init template context
            _.extend(this.args, {
                "_": _,
                "hr": {
                    "configs": configs,
                    "urls": Urls,
                    "i18n": I18n,
                    "offline": Offline
                },
                "view": {
                    "component": function(cid, args, name, subid) {
                        name = name || cid;

                        if (!self.view) {
                            throw new Error("Error in template " + self.template + " : try to import component in a non view-related template ");
                        }

                        if (Template.components[cid] == null) {
                            throw new Error("Error in template " + self.template + " : try to import component "+cid);
                        }

                        var view = new Template.components[cid].Class(args || {}, self.view);
                        
                        self.view.addComponent(name, view);

                        var component = $("<component/>", {
                            "data-component": view.cid
                        });

                        return component[0].outerHTML;
                    }
                },
                "template": {
                    "args": this.args,
                    "name": this.template,
                    "import": function(name, args, cname) {
                        cname = cname || name;
                        return this.args.view.component("template", {template: name, args: args}, cname);
                    },
                    "htmlid": function(h) {
                        return _.escape(h);
                    }
                }
            }, Template.options);

            return this;
        }
1184027
function () {
      var atts = this.atts, att, eh = this.eh, pvs = this.parent.vscope;
      if (atts) {
          // this template has no controller
          // let's propagate the new attribute values to the current scope
          var vscope = this.vscope;
          for (var i = 0, sz = this.atts.length; sz > i; i++) {
              att = atts[i];
              json.set(vscope, att.name, att.getValue(eh, pvs, null));
          }
      }
  }
1178660
function () {
    var atts = this.atts, att, ctlAtt, eh = this.eh, ctl = this.controller, v;
    var vs = this.isCptAttElement? this.vscope : this.parent.vscope;
    if (atts && ctl && ctl.$attributes) {
      // this template has a controller
      // let's propagate the new attribute values to the controller attributes
      for (var i = 0, sz = this.atts.length; sz > i; i++) {
        att = atts[i];
        ctlAtt = ctl.$attributes[att.name];
        // propagate changes for 1- and 2-way bound attributes
        if (ctlAtt.type!=="template" && ctlAtt._binding !== 0) {
          v = att.getValue(eh, vs, null);
          if (ctlAtt.type==="object" || ctlAtt.type==="array") {
            json.set(ctl, att.name, v);
          } else if ('' + v != '' + ctl[att.name]) {
            // values may have different types - this is why we have to check that values are different to
            // avoid creating loops
            json.set(ctl, att.name, v);
          }
        }
      }
    }
  }
786129
def template_dict(self):
        
        slvr = self

        D = {
            # Constants
            'LIGHTSPEED': montblanc.constants.C,
        }

        # Map any types
        D.update(self.type_dict())

        # Update with dimensions
        D.update(self.dim_local_size_dict())

        # Add any registered properties to the dictionary
        for p in self._properties.itervalues():
            D[p.name] = getattr(self, p.name)

        return D
932827
function() {

		var data_source = this._foreach_scope.getValue(),
			new_uids = data_source.getUIDs(),
			new_uid_to_index_map = data_source.getUIDToIndexMap(),
			count = data_source.getCount(),
			i = 0,
			uid,
			template,
			removed_templates = [],
			child_properties,
			current_templates = [];

		for (; i < this._current_count; i++) {

			uid = this._current_uids[i];

			if (!(uid in new_uid_to_index_map)) {

				removed_templates.push(this._current_hash[uid]);
				delete this._current_hash[uid];

			}

		}

		for (i = 0; i < count; i++) {

			uid = new_uids[i];

			child_properties = {
				foreach_index: i,
				foreach_name: data_source.getNameAt(new_uid_to_index_map[uid])
			};
			child_properties[this._as] = data_source.getValueAt(new_uid_to_index_map[uid]);

			if (uid in this._current_hash) {

				template = this._current_hash[uid];
				template.batchSetProperties(child_properties);

			} else {

				template = new Lava.system.Template(this._config.template, this._widget, this, child_properties);
				this._current_hash[uid] = template;

			}

			current_templates.push(template);

		}

		removed_templates.length && this._removeTemplates(removed_templates);

		this._current_count = count;
		this._current_uids = new_uids;
		this._current_templates = current_templates;
		this._requires_refresh_children = false;

	}
552052
def template(cls, userdata):
        """"""
        ud = Userdata(cls.normalize(cls.create_empty(None), userdata))
        return ud
563139
def new(template, target=None, name=None):
    
    if template not in TEMPLATES:
        raise ValueError("Template argument must be one of the followings: {}"
                         .format(", ".join(TEMPLATES)))
    if target is not None and target not in TARGETS.keys():
        raise ValueError("Target argument must be one of the followings: {}"
                         .format(TARGETS.keys()))
    name = name or template
    if NAME_REGEX.match(name) is None:
        raise ValueError("Invalid {} name".format(template))
    with open("{}.py".format(name), 'w') as f:
        target_imp = "" if target is None else "from {} import {}\n" \
                                               .format(*target.split('.'))
        main = MAIN.format(base=TARGETS.get(target) or "")
        if template == "script":
            f.write(SHEBANG + IMPORTS.format(target=target_imp) + "\n\n" + main)
        elif template == "tool":
            f.write(SHEBANG + TOOL_METADATA + TOOL_SECTIONS \
                    .format(imports=IMPORTS.format(target=target_imp)) + main)
1225896
def _get_template_dict(template):
    
    if isinstance(template, str):
        return parse_template(template)

    if isinstance(template, dict):
        return copy.deepcopy(template)

    raise ValueError('Input template should be a string or dictionary')
325091
def get_slot_header(self, item):
        
        obj = item["obj"]
        obj = api.get_object(obj)

        # Prepare the template data
        data = {
            "obj": obj,
            "item": item,
            "position": item["Pos"],
        }
        # update the data
        data.update(self.get_slot_header_data(obj))

        template = ViewPageTemplateFile("../templates/slot_header.pt")
        return template(self, data=data)
1490
def get_template_info(self, obj):
        
        client = self.get_client()
        client_uid = api.get_uid(client) if client else ""

        profile = obj.getAnalysisProfile()
        profile_uid = api.get_uid(profile) if profile else ""
        profile_title = profile.Title() if profile else ""

        sample_type = obj.getSampleType()
        sample_type_uid = api.get_uid(sample_type) if sample_type else ""
        sample_type_title = sample_type.Title() if sample_type else ""

        sample_point = obj.getSamplePoint()
        sample_point_uid = api.get_uid(sample_point) if sample_point else ""
        sample_point_title = sample_point.Title() if sample_point else ""

        service_uids = []
        analyses_partitions = {}
        analyses = obj.getAnalyses()

        for record in analyses:
            service_uid = record.get("service_uid")
            service_uids.append(service_uid)
            analyses_partitions[service_uid] = record.get("partition")

        info = self.get_base_info(obj)
        info.update({
            "analyses_partitions": analyses_partitions,
            "analysis_profile_title": profile_title,
            "analysis_profile_uid": profile_uid,
            "client_uid": client_uid,
            "composite": obj.getComposite(),
            "partitions": obj.getPartitions(),
            "remarks": obj.getRemarks(),
            "sample_point_title": sample_point_title,
            "sample_point_uid": sample_point_uid,
            "sample_type_title": sample_type_title,
            "sample_type_uid": sample_type_uid,
            "service_uids": service_uids,
        })
        return info
707230
def generic_objects_for_object_template(name, params = {})
      api_call(:get, "/object_templates/#{name}/generic_objects", params) do |response|
         Calculated::Models::ObjectTemplate.new(response["object_template"])
      end
    end
333072
def _buildTemplates(self):
        

        c_mylist = build_D3treeStandard(0, 99, 1,
                                        self.ontospy_graph.toplayer_classes)
        p_mylist = build_D3treeStandard(0, 99, 1,
                                        self.ontospy_graph.toplayer_properties)
        s_mylist = build_D3treeStandard(0, 99, 1,
                                        self.ontospy_graph.toplayer_skos)

        c_total = len(self.ontospy_graph.all_classes)
        p_total = len(self.ontospy_graph.all_properties)
        s_total = len(self.ontospy_graph.all_skos_concepts)

        if False:
            # testing how a single tree would look like
            JSON_DATA_CLASSES = json.dumps({
                'children': [{
                    'children': c_mylist,
                    'name': 'Classes',
                    'id': "classes"
                },
                             {
                                 'children': p_mylist,
                                 'name': 'Properties',
                                 'id': "properties"
                             },
                             {
                                 'children': s_mylist,
                                 'name': 'Concepts',
                                 'id': "concepts"
                             }],
                'name':
                'Entities',
                'id':
                "root"
            })

        # hack to make sure that we have a default top level object
        JSON_DATA_CLASSES = json.dumps({
            'children': c_mylist,
            'name': 'owl:Thing',
            'id': "None"
        })
        JSON_DATA_PROPERTIES = json.dumps({
            'children': p_mylist,
            'name': 'Properties',
            'id': "None"
        })
        JSON_DATA_CONCEPTS = json.dumps({
            'children': s_mylist,
            'name': 'Concepts',
            'id': "None"
        })

        extra_context = {
            "ontograph": self.ontospy_graph,
            "TOTAL_CLASSES": c_total,
            "TOTAL_PROPERTIES": p_total,
            "TOTAL_CONCEPTS": s_total,
            'JSON_DATA_CLASSES': JSON_DATA_CLASSES,
            'JSON_DATA_PROPERTIES': JSON_DATA_PROPERTIES,
            'JSON_DATA_CONCEPTS': JSON_DATA_CONCEPTS,
        }

        # Ontology - MAIN PAGE
        contents = self._renderTemplate(
            "d3/d3tree.html", extraContext=extra_context)
        FILE_NAME = "index.html"
        main_url = self._save2File(contents, FILE_NAME, self.output_path)

        return main_url
950322
function(point) {
        var node = this.createElementNS(this.namespaces.gpx, "trkpt");
        node.setAttribute("lon", point.x);
        node.setAttribute("lat", point.y);
        return node;
    }
1028417
def template(*args, **kwargs):
    
    tpl = args[0] if args else None
    for dictarg in args[1:]:
        kwargs.update(dictarg)
    adapter = kwargs.pop('template_adapter', SimpleTemplate)
    lookup = kwargs.pop('template_lookup', TEMPLATE_PATH)
    tplid = (id(lookup), tpl)
    if tplid not in TEMPLATES or DEBUG:
        settings = kwargs.pop('template_settings', {})
        if isinstance(tpl, adapter):
            TEMPLATES[tplid] = tpl
            if settings: TEMPLATES[tplid].prepare(**settings)
        elif "\n" in tpl or "{" in tpl or "%" in tpl or '$' in tpl:
            TEMPLATES[tplid] = adapter(source=tpl, lookup=lookup, **settings)
        else:
            TEMPLATES[tplid] = adapter(name=tpl, lookup=lookup, **settings)
    if not TEMPLATES[tplid]:
        abort(500, 'Template (%s) not found' % tpl)
    return TEMPLATES[tplid].render(kwargs)