use lists instead of sets

This commit is contained in:
Istvan Ruzman
2020-08-17 09:24:13 +02:00
parent 65fafa6d91
commit 705645195a

View File

@@ -224,7 +224,7 @@ class Dictionary:
def _parse_vendor(self, tokens: Sequence[str], line_num: int): def _parse_vendor(self, tokens: Sequence[str], line_num: int):
"""Parse the vendor definition""" """Parse the vendor definition"""
filename = self.filestack[-1] filename = self.filestack[-1]
if len(tokens) not in {3, 4}: if len(tokens) not in [3, 4]:
raise ParseError( raise ParseError(
filename, "Incorrect number of tokens for vendor statement" filename, "Incorrect number of tokens for vendor statement"
) )
@@ -244,13 +244,13 @@ class Dictionary:
try: try:
vendor_format = vendor_format[1].split(",") vendor_format = vendor_format[1].split(",")
t_len, l_len = (int(a) for a in vendor_format[:2]) t_len, l_len = (int(a) for a in vendor_format[:2])
if t_len not in {1, 2, 4}: if t_len not in [1, 2, 4]:
raise ParseError( raise ParseError(
filename, filename,
f'Invalid type length definition "{t_len}" for vendor {vendor_name}', f'Invalid type length definition "{t_len}" for vendor {vendor_name}',
line_num, line_num,
) )
if l_len not in {0, 1, 2}: if l_len not in [0, 1, 2]:
raise ParseError( raise ParseError(
filename, filename,
f'Invalid length definition "{l_len}" for vendor {vendor_name}', f'Invalid length definition "{l_len}" for vendor {vendor_name}',
@@ -399,7 +399,7 @@ class Dictionary:
def _parse_attribute(self, tokens: Sequence[str], line_num: int): def _parse_attribute(self, tokens: Sequence[str], line_num: int):
"""Parse an ATTRIBUTE line of (Free)RADIUS dictionaries.""" """Parse an ATTRIBUTE line of (Free)RADIUS dictionaries."""
filename = self.filestack[-1] filename = self.filestack[-1]
if not len(tokens) in {4, 5}: if not len(tokens) in [4, 5]:
raise ParseError( raise ParseError(
filename, filename,
"Incorrect number of tokens for attribute definition", "Incorrect number of tokens for attribute definition",
@@ -410,7 +410,7 @@ class Dictionary:
name, attr_code, datatype = tokens[1:4] name, attr_code, datatype = tokens[1:4]
if ( if (
datatype in {"concat", "extended", "evs", "long-extended"} datatype in ["concat", "extended", "evs", "long-extended"]
and self.cur_vendor != self.rfc_vendor and self.cur_vendor != self.rfc_vendor
): ):
raise ParseError( raise ParseError(