File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed
Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -344,24 +344,16 @@ class AlertDefinition(Base):
344344 def __init__ (self , client , id , json = None ):
345345 super ().__init__ (client , id , json )
346346
347- # @property
348- # def type(self):
349- # return self._type
350-
351- # @type.setter
352- # def type(self, value):
353- # self._type = value
354-
355347 def _populate (self , json ):
356348 """
357349 Populates this object with data from a JSON dictionary.
358350 """
359351 for key , value in json .items ():
360- # Map " class" to "_class" because "class" is a reserved word in Python.
361- if key == "class" :
362- setattr ( self , "_class" , value )
363- else :
364- setattr (self , key , value )
352+ #class and type are reserved words in Python.
353+ reserved = { "class" : "_class" , "type" : "_type" }
354+ for json_key , json_value in json . items ():
355+ attr = reserved . get ( json_key , json_key )
356+ setattr (self , attr , json_value )
365357
366358
367359@dataclass
You can’t perform that action at this time.
0 commit comments