本文整理汇总了Python中graphnodes.GraphNode.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python GraphNode.__init__方法的具体用法?Python GraphNode.__init__怎么用?Python GraphNode.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graphnodes.GraphNode
的用法示例。
在下文中一共展示了GraphNode.__init__方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from graphnodes import GraphNode [as 别名]
# 或者: from graphnodes.GraphNode import __init__ [as 别名]
def __init__(self, MACaddr):
GraphNode.__init__(self, domain='global')
mac = pyNetAddr(MACaddr)
if mac is None or mac.addrtype() != ADDR_FAMILY_802:
raise ValueError('Not a legal MAC address [%s // %s]: %s (%s)'
% (MACaddr, str(mac), str(mac.addrtype()), mac.addrlen()))
self.MACaddr = str(mac)
示例2: __init__
# 需要导入模块: from graphnodes import GraphNode [as 别名]
# 或者: from graphnodes.GraphNode import __init__ [as 别名]
def __init__(
self, domain, monitorname, monitorclass, monitortype, interval, timeout, provider=None, arglist=None, argv=None
):
"Create the requested monitoring rule object."
GraphNode.__init__(self, domain)
self.monitorname = monitorname
self.monitorclass = monitorclass
self.monitortype = monitortype
self.interval = int(interval)
self.timeout = int(timeout)
self.provider = provider
self.isactive = False
self.isworking = True
self.reason = "initial monitor creation"
self.request_id = MonitorAction.request_id
self.argv = argv
MonitorAction.request_id += 1
if arglist is None:
self.arglist = None
self._arglist = {}
elif isinstance(arglist, list):
listlen = len(arglist)
if (listlen % 2) != 0:
raise (ValueError("arglist list must have an even number of elements"))
self._arglist = {}
for j in range(0, listlen, 2):
self._arglist[arglist[j]] = arglist[j + 1]
self.arglist = arglist
else:
self._arglist = arglist
self.arglist = []
for name in self._arglist:
self.arglist.append(name)
self.arglist.append(str(self._arglist[name]))
示例3: __init__
# 需要导入模块: from graphnodes import GraphNode [as 别名]
# 或者: from graphnodes.GraphNode import __init__ [as 别名]
def __init__(self, domain, designation, roles=None):
GraphNode.__init__(self, domain=domain)
self.designation = str(designation).lower()
self.monitors_activated = False
if roles is None or roles == []:
# Neo4j can't initialize node properties to empty arrays because
# it wants to know what kind of array it is...
roles = ['']
self.roles = roles
示例4: __init__
# 需要导入模块: from graphnodes import GraphNode [as 别名]
# 或者: from graphnodes.GraphNode import __init__ [as 别名]
def __init__(self, name, ringtype):
'''Constructor for a heartbeat ring.
'''
GraphNode.__init__(self, domain=CMAdb.globaldomain)
if ringtype < HbRing.SWITCH or ringtype > HbRing.THEONERING:
raise ValueError("Invalid ring type [%s]" % str(ringtype))
self.ringtype = ringtype
self.name = str(name)
self.ourreltype = HbRing.memberprefix + self.name # Our membership relationship type
self.ournexttype = HbRing.nextprefix + self.name # Our 'next' relationship type
self._ringinitfinished = False
self._insertpoint1 = None
self._insertpoint2 = None
示例5: __init__
# 需要导入模块: from graphnodes import GraphNode [as 别名]
# 或者: from graphnodes.GraphNode import __init__ [as 别名]
def __init__(self, queryname, JSON_metadata=None):
'''Parameters
----------
JSON_metadata - a JSON string containing
'cypher': a string containing our cypher query
'descriptions': a dict containing descriptions in various languages
'language-key': A locale-language key
'short' a short description of this query in 'language-key'
'long' a long description of this query in 'language-key'
'parameters': a dict containing
'name': name of the parameter to the query
'type': the type of the parameter one of several noted
'min': optional minimum value for 'name'
'max': optional maximum value for 'name'
'enumlist': array of possible enum values (type = enum only)
'lang': language for this description as a dict:
'short':a short description of 'name' in language 'lang'
'long': a long description of 'name' in language 'lang'
'enumlist': dict of explanations for enumlist above
Languages are the typical 'en' 'en_us', 'es', 'es_mx', as per the locale-usual
Currently-known types are as follows:
int - an integer
float - an floating point number
string - a string
ipaddr - an IP address either ipv4 or ipv6 (as a string)
macaddr - a 48 or 64 bit MAC address (as a string)
bool - a boolean value
hostname- a host name (as string - always converted to lower case)
dnsname - a DNS name (as a string - always converted to lower case)
enum - a finite enumeration of permissible values (case-insensitive)
'''
GraphNode.__init__(self, domain='metadata')
self.queryname = queryname
self.JSON_metadata = JSON_metadata
if JSON_metadata is None:
self._JSON_metadata = None
else:
self._JSON_metadata = pyConfigContext(JSON_metadata)
if self._JSON_metadata is None:
raise ValueError('Parameter JSON_metadata is invalid [%s]' % JSON_metadata)
self.validate_json()
self._store = None
self._db = None
self._query = None