コード例 #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)
コード例 #2
0
ファイル: dictionary.py プロジェクト: tom-mi/pyrad
    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)
        # default: format=1,1 (see FreeRADIUS dictionary Manpage)
        self.vendor_format = defaultdict(lambda: (1, 1))
        self.attrindex = bidict.BiDict()
        self.attributes = {}
        self.defer_parse = []

        if dict:
            self.ReadDictionary(dict)

        for i in dicts:
            self.ReadDictionary(i)
コード例 #3
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)
コード例 #4
0
ファイル: dictionary.py プロジェクト: csib/pyrad-1
 def __init__(self,
              name,
              code,
              datatype,
              is_sub_attribute=False,
              vendor='',
              values=None,
              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()
     self.sub_attributes = {}
     self.parent = None
     self.is_sub_attribute = is_sub_attribute
     if values:
         for (key, value) in values.items():
             self.values.Add(key, value)