1
0
mirror of https://github.com/github/octodns.git synced 2024-05-11 05:55:00 +00:00
Files
github-octodns/octodns/context.py
2023-07-29 12:10:00 -07:00

21 lines
641 B
Python

#
#
#
class ContextDict(dict):
'''
This is used by things that call `Record.new` to pass in a `data`
dictionary that includes some context as to where the data came from to be
printed along with exceptions or validations of the record.
It breaks lots of stuff if we stored the context in an extra key and the
python `dict` object doesn't allow you to set attributes on the object so
this is a very thin wrapper around `dict` that allows us to have a context
attribute.
'''
def __init__(self, *args, context=None, **kwargs):
super().__init__(*args, **kwargs)
self.context = context