1import collections
2import copy
3from .Utils import _write_complex_object
4
5class StackFrame(object):
6    """Data contract class for type StackFrame.
7    """
8    _defaults = collections.OrderedDict([
9        ('level', None),
10        ('method', None),
11        ('assembly', None),
12        ('fileName', None),
13        ('line', None)
14    ])
15
16    def __init__(self):
17        """Initializes a new instance of the class.
18        """
19        self._values = {
20            'level': None,
21            'method': None,
22        }
23        self._initialize()
24
25    @property
26    def level(self):
27        """The level property.
28
29        Returns:
30            (int). the property value. (defaults to: None)
31        """
32        return self._values['level']
33
34    @level.setter
35    def level(self, value):
36        """The level property.
37
38        Args:
39            value (int). the property value.
40        """
41        self._values['level'] = value
42
43    @property
44    def method(self):
45        """The method property.
46
47        Returns:
48            (string). the property value. (defaults to: None)
49        """
50        return self._values['method']
51
52    @method.setter
53    def method(self, value):
54        """The method property.
55
56        Args:
57            value (string). the property value.
58        """
59        self._values['method'] = value
60
61    @property
62    def assembly(self):
63        """The assembly property.
64
65        Returns:
66            (string). the property value. (defaults to: None)
67        """
68        if 'assembly' in self._values:
69            return self._values['assembly']
70        return self._defaults['assembly']
71
72    @assembly.setter
73    def assembly(self, value):
74        """The assembly property.
75
76        Args:
77            value (string). the property value.
78        """
79        if value == self._defaults['assembly'] and 'assembly' in self._values:
80            del self._values['assembly']
81        else:
82            self._values['assembly'] = value
83
84    @property
85    def file_name(self):
86        """The file_name property.
87
88        Returns:
89            (string). the property value. (defaults to: None)
90        """
91        if 'fileName' in self._values:
92            return self._values['fileName']
93        return self._defaults['fileName']
94
95    @file_name.setter
96    def file_name(self, value):
97        """The file_name property.
98
99        Args:
100            value (string). the property value.
101        """
102        if value == self._defaults['fileName'] and 'fileName' in self._values:
103            del self._values['fileName']
104        else:
105            self._values['fileName'] = value
106
107    @property
108    def line(self):
109        """The line property.
110
111        Returns:
112            (int). the property value. (defaults to: None)
113        """
114        if 'line' in self._values:
115            return self._values['line']
116        return self._defaults['line']
117
118    @line.setter
119    def line(self, value):
120        """The line property.
121
122        Args:
123            value (int). the property value.
124        """
125        if value == self._defaults['line'] and 'line' in self._values:
126            del self._values['line']
127        else:
128            self._values['line'] = value
129
130    def _initialize(self):
131        """Initializes the current instance of the object.
132        """
133        pass
134
135    def write(self):
136        """Writes the contents of this object and returns the content as a dict object.
137
138        Returns:
139            (dict). the object that represents the same data as the current instance.
140        """
141        return _write_complex_object(self._defaults, self._values)
142
143