<|BOS|> attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================
return attr_value == "entities"
def eval_attr15(self, attr_value, this):
#===============================================================================
# This code is executed when evaluating if a node shall be matched by this rule.
# You can access the value of the current node's attribute value by: attr_value.
# You can access any attribute x of this node by: this['x'].
# If the constraint relies on attribute values from other nodes,
# use the LHS/NAC constraint instead.
# The given constraint must evaluate to a boolean expression.
#===============================================================================
return attr_value == "features"
def constraint(self, PreNode, graph):
"""
Executable constraint code.
@param PreNode: Function taking an integer as parameter
and returns the node corresponding to that label.
"""
#===============================================================================
# This code is executed after the nodes in the LHS have been matched.
# You can access a matched node labelled n by: PreNode('n').
# To access attribute x of node n, use: PreNode('n')['x'].
# The given constraint must evaluate to a boolean expression:
# returning True enables the rule to be applied,
# returning False forbids the rule from being applied.
#===============================================================================
return True
<|EOS|># Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# MIT License. See license.txt
# For license information, please see license.txt
from __future__ import unicode_literals
from webnotes.model.doc import Document, make_autoname
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
def validate(self):
self.get_equipmentid_record()
def get_equipmentid_record(self):
#webnotes.errprint(self.doc.equipment_id)
eid=webnotes.conn.sql("select name from `tabTransformer` where equipment_id='"+self.doc.equipment_id+"'",as_list=1)
if eid:
webnotes.msgprint("Equipment ID which you select is aleready assign in Transformer Entry='"+eid[0][0]+"'",raise_exception=1)
else:
pass
def get_new_equipmentid(self,args):
dic=eval(args)
d = Document("Reporting Person History")
d.ad_type='Transformer'
d.plant=(dic['plant'])
d.client = (dic['client'])
d.sub_station= (dic['sub station'])
d.functional_location=(dic['functional_location'])
d.equipment_id=(dic['equipment_id'])
d.save()
return{
"equipment_id":'',
"sample_no":'',
"make":'',
"rating":'',
"ratio":'',
"phase":'',
"year_of_mfg":'',
"serial_no":'',
"voltage_ratio":''
}<|EOS|>#!/usr/bin/python
#-*-coding: utf-8 -*-
from decimal import *
getcontext().prec = 8
# Insert a new square into the HTML file with the specified parameters:
def makeNewSquare(edge_size, offset_left, offset_top, color):
new_square_string = "\t\t\t\t<i style=\"position:absolute;display:inline-block;width: %sem;height: %sem;border:none;left: %sem;top: %sem;background-color: %s \"></i>\n" % (edge_size, edge_size, offset_left, offset_top, color)
output_file.write(new_square_string)
# How long the shortest edge will be (for now in ems)
spiral_size_short_edge = Decimal('30')
# The smallest square is guaranteed to be larger than this:
short