summaryrefslogtreecommitdiff
path: root/dns/rdata.py
Commit message (Collapse)AuthorAgeFilesLines
* Minor Python 3 cleanups.Brian Wellington2020-06-031-2/+2
| | | | | | | Classes inherit from object by default; there's no need to explicitly include this. Replace super(Foo, self) with super().
* Improvements to dns.rdata.to_wire().Brian Wellington2020-06-011-10/+16
| | | | | | | | | | | | | | | This does two things. 1) Makes the file parameter optional, removing the requirement that callers create an io.BytesIO object if all they want is the bytes. This is done by renaming all of the rdata subclass to_wire() methods to _to_wire(), and making dns.rdata.to_wire() create the io.BytesIO internally if needed, and then delegate to the subclass. 2) Add canonicalize=False parameter, allowing code reuse for conversion to wire format and conversion to hashable format. This also removes all of the rdata subclass to_digestable routines that are no longer needed, as dns.rdata.to_digestable will work for all rdata types.
* make rdata objects picklable againPetr Špaček2020-05-271-0/+7
| | | | | | | | | | | __getstate__ implementation based on tuple and ordered __slots__ is slightly faster than implementation based on dicts. It also produces smaller blobs. Speed of this implementation is +- few percents the same as it was in dnspython 1.16.0 and it now produces smaller blobs. Fixes: #485
* Remove dns.rdata{type,class}.to_enum.Brian Wellington2020-05-211-4/+4
| | | | | | | 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.
* Finish rdatatype conversion.Brian Wellington2020-05-181-1/+6
| | | | | | Add more checking to dns.rdata.register_type, to ensure that an existing type mnemonic isn't overwritten. Use the enum functionality for mapping names to values and values to names, rather than duplicating it.
* Start converting rdatatype/rdataclass to enum.Brian Wellington2020-05-181-0/+4
|
* more documentationBob Halley2020-05-091-0/+1
|
* in doco, text->str, binary->bytesBob Halley2020-05-081-6/+6
|
* Add IDNA codec support to tokenizer and dns.rdata.from_text()Bob Halley2020-05-031-2/+9
|
* do not import BytesIO into rdata namespaceBob Halley2020-05-011-2/+1
|
* Fix documentation.Brian Wellington2020-04-211-1/+1
| | | | Rdata.to_wire() writes to the file, and doesn't return anything.
* Add dns.rdata.Rdata.to_generic()Brian Wellington2020-04-211-0/+10
|
* Add dns.rdata.Rdata.replace()Brian Wellington2020-04-021-0/+34
| | | | | | Now that Rdata instances are immutable, there needs to be a way to make a new Rdata based on an existing one. replace() creates a clone of the current Rdata, overriding fields with the specified parameters.
* Further improve get_rdata_class().Brian Wellington2020-04-021-0/+2
| | | | | | | When we find a class-independent type, cache it for both class ANY and the requested type, to avoid an extra dict lookup the next time. If we don't find anything, cache GenericRdata, to avoid extra module loads the next time.
* Optimize get_rdata_class().Brian Wellington2020-04-021-15/+16
| | | | | | | This replaces the module cache with a class cache, so that the getattr() call to retrieve the class happens only when a new type module is loaded, not in the common case. This also allows avoiding the calls to dns.rdataclass.to_text() and dns.rdatatype.to_text() in the common case.
* Use importlib.import_module.Brian Wellington2020-04-021-15/+1
| | | | Replace the open-coded import_module() with the one in importlib.
* more delintingBob Halley2020-04-021-3/+3
|
* delintBob Halley2020-04-021-1/+1
|
* Merge pull request #434 from bwelling/immutable-rdataBob Halley2020-04-021-3/+26
|\ | | | | Immutable rdata
| * Checkpoint immutable rdata.Brian Wellington2020-03-311-3/+26
| |
* | Remove dns.rdata.choose_relativity().Brian Wellington2020-03-311-5/+0
|/ | | | | | This method changes rdata in place, so prevents rdata from becoming immutable. There are no in-tree users, and if there are out of tree users, they are rate and hard to find.
* Add relativize_to to from_text().Brian Wellington2020-03-181-7/+13
| | | | | | | | | | | | | | | When calling from_text, the zone code needs to apply the current origin (which may or may not be the zone origin, if sub-zone $ORIGIN statements are present), and may also want to relativize the contents to the zone origin. Previously, this was done by explicitly reading records as absolute, and then relativizing them laster. With this change, the work is moved to the tokenizer. This gets rid of the remaining internal uses of dns.rdata.choose_relativity(), which prevents rdata from being immutable.
* remove bytearray() wrapping used for python 2 compatibilityBob Halley2019-01-051-1/+1
|
* Remove _compat module.Bob Halley2018-12-091-4/+3
|
* delintBob Halley2018-12-011-3/+0
|
* update copyrightBob Halley2018-12-011-0/+2
|
* Upgrade Python syntax with pyupgrade https://github.com/asottile/pyupgradeHugo2018-09-061-1/+1
|
* lock importing to avoid races with multiple threadsBob Halley2018-08-281-6/+12
|
* Add a way to dynamically register an rdata module.Bob Halley2018-07-171-0/+32
|
* Fix invalid escape warningNoa Resare2017-07-171-1/+1
| | | a literal string '\#' in python 3.6 causes a DeprecationWarning "invalid escape sequence" as there is no defined backslash escape that looks like that. This change changes the string to a raw string, which makes the intent clear. The text format for unknown RR types is defined in RFC3597 Section 5, and should indeed be the two ascii characters backslash (0x5c) followed by pound sign (0x23).
* rdata docoBob Halley2017-01-051-112/+73
|
* fix typoBob Halley2017-01-021-1/+1
|
* Pylint: enable undefined-loop-variable checkMartin Basti2016-06-271-2/+2
|
* Pylint: enable unused-import checkMartin Basti2016-06-271-1/+0
|
* Fix problems with escaping in quoted strings and names.Bob Halley2016-06-011-9/+4
| | | | [issue #168]
* Fix typosJakub Wilk2016-05-261-2/+2
|
* python3 supportArthur Gautier2016-04-211-78/+80
| | | | Signed-off-by: Arthur Gautier <baloo@gandi.net>
* fix unicode ipaddr crashes in rdata.from_text and tokenizer.Tokenizer, fixes #41Thomas Waldmann2015-02-241-1/+1
| | | | also added unit tests for both issues.
* All rdata comparsion now uses the digestable form.Bob Halley2014-09-041-18/+2
|
* docoBob Halley2011-07-181-2/+5
|
* update copyrightsBob Halley2011-05-121-1/+1
|
* do more careful bounds checking, and if checking fails, raise ↵Bob Halley2011-04-051-0/+2
| | | | dns.exception.FormErr
* deal with relative names in _wire_cmpBob Halley2011-03-241-2/+6
|
* Dnspython was erroneously doing case-insensitive comparisons of the names in ↵Bob Halley2011-02-091-0/+9
| | | | NSEC and RRSIG records
* add a __hash__() method for rdataBob Halley2010-12-101-0/+4
|
* create exceptions with arguments as "raise E(args)" instead of "raise E, args"Bob Halley2010-01-141-4/+2
|
* update copyrights for 2010Bob Halley2010-01-131-1/+1
|
* fix typoBob Halley2010-01-121-1/+1
|
* fix problems parsing generic rdata after tokenizer changesBob Halley2010-01-121-2/+3
|
* make a proper token object to facilitate future tokenization workBob Halley2010-01-121-5/+5
|