summaryrefslogtreecommitdiff
path: root/dns/enum.py
Commit message (Collapse)AuthorAgeFilesLines
* run black on enum.pyBob Halley2023-04-061-2/+2
|
* Enum typing (#923)Brian Wellington2023-04-061-8/+19
| | | | | | | | | | | | | | | | | | | | | | * IntEnum improvements. This changes make() to always return an instance of the subclass, creating one on the fly if the value is not known, and updates the typ registration code to deal with this. It also adds typing annotations to make(). * Add missing int check. Some older versions of python weren't rejecting non-int values. * Fix int check. Raise TypeError for non-int, not ValueError, to make tests happy. * Annotate to_text/from_text. * Remove many the_ prefixed variables. These were needed in the past to work around typing issues.
* more lintBob Halley2022-10-021-2/+2
|
* Fix dns.rdatatype special cases.Brian Wellington2022-07-151-2/+17
| | | | | | | | | | | | | | | Prior to this change, there was logic in dns.rdatatype.from_text() and to_text() to deal with types not handled by the RdataType enum; specifically, the NSAP-PTR type (the enum value has a different name, because of the hyphen) and user-registered types. This was fine when internal code called these methods, but most callers of from_text() were converted to dns.rdatatype.RdataType.make(), which supports both integer and text input, and it doesn't handle the special cases. This change adds more hooks into the enum wrapper and moves the special case handling for RdataType into them.
* black autoformattingBob Halley2022-03-151-3/+4
|
* Add no cover for abstract method.Bob Halley2020-07-231-1/+1
|
* Remove dns.rdata{type,class}.to_enum.Brian Wellington2020-05-211-1/+14
| | | | | | | These methods (which convert a str/int into an enum/int) shouldn't be commonly used by external code, so don't need to exist at the module level. The make() method on the enum class (renamed from to_enum()) can still be used, and the internal callers have been updated to use it.
* raise NotImplememtedError, not NotImplementedBob Halley2020-05-201-1/+1
|
* Enum refactoring.Brian Wellington2020-05-191-0/+77
Consolidate the common methods related to enum classes.