當前位置: 首頁>>代碼示例>>Python>>正文


Python GraphNode.__init__方法代碼示例

本文整理匯總了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)
開發者ID:JJediny,項目名稱:assimilation-official,代碼行數:9,代碼來源:store_test.py

示例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]))
開發者ID:borgified,項目名稱:testroot,代碼行數:36,代碼來源:monitoring.py

示例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
開發者ID:JJediny,項目名稱:assimilation-official,代碼行數:11,代碼來源:systemnode.py

示例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
開發者ID:JJediny,項目名稱:assimilation-official,代碼行數:15,代碼來源:hbring.py

示例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
開發者ID:h4ck3rm1k3,項目名稱:assimilation-official,代碼行數:48,代碼來源:query.py


注:本文中的graphnodes.GraphNode.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。