Beispiel #1
0
 def __init__(self, dict=None, *dicts):
     """
     :param dict:  path of dictionary file or file-like object to read
     :type dict:   string or file
     :param dicts: list of dictionaries
     :type dicts:  sequence of strings or files
     """
     self.vendors = bidict.BiDict()
     self.vendors.Add('', 0)
     self.attrindex = bidict.BiDict()
     self.attributes = {}
     self.defer_parse = []
     if dict:
         self.ReadDictionary(dict)
     for i in dicts:
         self.ReadDictionary(i)
Beispiel #2
0
	def __init__(self, dict=None, *dicts):
		"""
		@param dict:  dictionary file to read
		@type dict:   string
		@param dicts: list of dictionary files to read
		@type dicts:  sequence of strings
		"""
		self.vendors=bidict.BiDict()
		self.vendors.Add("", 0)
		self.attrindex=bidict.BiDict()
		self.attributes={}

		if dict:
			self.ReadDictionary(dict)

		for i in dicts:
			self.ReadDictionary(i)
Beispiel #3
0
 def __init__(self, name, code, datatype, vendor="", values={}):
     assert datatype in ("string", "ipaddr", "integer", "date", "octets",
                         "abinary", "ipv6addr", "ifid")
     self.name = name
     self.code = code
     self.type = datatype
     self.vendor = vendor
     self.values = bidict.BiDict()
     for (key, value) in values.items():
         self.values.Add(key, value)
Beispiel #4
0
	def __init__(self, dict = None, *dicts):
		"""
		@param dict:  dictionary file to read
		@type dict:   string
		@param dicts: list of dictionary files to read
		@type dicts:  sequence of strings
		"""
		self.vendors = bidict.BiDict()
		self.vendors.Add("", 0)
		self.attrindex = bidict.BiDict()
		self.attributes = {}

		if dict:
			self.ReadDictionary(dict)
			#for key, value in self attributes.items():
			#	print ""
			self.ReadDictionary(dict, True, True)

		for i in dicts:
			self.ReadDictionary(i)
			self.ReadDictionary(i, True, True)
Beispiel #5
0
 def __init__(self,
              name,
              code,
              datatype,
              vendor='',
              values={},
              encrypt=0,
              has_tag=False):
     if datatype not in DATATYPES:
         raise ValueError('Invalid data type')
     self.name = name
     self.code = code
     self.type = datatype
     self.vendor = vendor
     self.encrypt = encrypt
     self.has_tag = has_tag
     self.values = bidict.BiDict()
     for key, value in values.items():
         self.values.Add(key, value)