From: Brian Wellington Date: Tue, 19 May 2020 17:08:15 +0000 (-0700) Subject: Replace dicts with sets. X-Git-Tag: v2.0.0rc1~192^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=485c33d17c9e28c081daad6377578e00ef34928c;p=thirdparty%2Fdnspython.git Replace dicts with sets. --- diff --git a/dns/rdataclass.py b/dns/rdataclass.py index 300de40b..828812c7 100644 --- a/dns/rdataclass.py +++ b/dns/rdataclass.py @@ -36,10 +36,7 @@ class RdataClass(enum.IntEnum): globals().update(RdataClass.__members__) -_metaclasses = { - NONE: True, - ANY: True -} +_metaclasses = {NONE, ANY} _unknown_class_pattern = re.compile('CLASS([0-9]+)$', re.I) diff --git a/dns/rdatatype.py b/dns/rdatatype.py index 68a5c2b9..fc8c7173 100644 --- a/dns/rdatatype.py +++ b/dns/rdatatype.py @@ -102,17 +102,9 @@ _registered_by_value = {} globals().update(RdataType.__members__.items()) -_metatypes = { - OPT: True -} - -_singletons = { - SOA: True, - NXT: True, - DNAME: True, - NSEC: True, - CNAME: True, -} +_metatypes = {OPT} + +_singletons = {SOA, NXT, DNAME, NSEC, CNAME} _unknown_type_pattern = re.compile('TYPE([0-9]+)$', re.I) diff --git a/dns/tokenizer.py b/dns/tokenizer.py index 547e030f..791e9948 100644 --- a/dns/tokenizer.py +++ b/dns/tokenizer.py @@ -24,16 +24,8 @@ import dns.exception import dns.name import dns.ttl -_DELIMITERS = { - ' ': True, - '\t': True, - '\n': True, - ';': True, - '(': True, - ')': True, - '"': True} - -_QUOTING_DELIMITERS = {'"': True} +_DELIMITERS = {' ', '\t', '\n', ';', '(', ')', '"'} +_QUOTING_DELIMITERS = {'"'} EOF = 0 EOL = 1