File tree 1 file changed +6
-4
lines changed 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -129,23 +129,25 @@ def github_object(self) -> GithubDraftIssue | GithubIssue:
129
129
content = self .extra ["content" ]
130
130
typename = content .pop ("__typename" )
131
131
132
- CONTENT_TYPE_MAP = {
132
+ # The typing here is only to make mypy happy. If you have a better idea
133
+ # how to do it, please fix :)
134
+ CONTENT_TYPE_MAP : dict [str , type [GithubIssue ] | type [GithubDraftIssue ]] = {
133
135
"Issue" : GithubIssue ,
134
136
"DraftIssue" : GithubDraftIssue ,
135
137
}
136
138
137
- obj = CONTENT_TYPE_MAP [typename ].parse_obj (content )
139
+ obj = CONTENT_TYPE_MAP [typename ].model_validate (content )
138
140
return obj
139
141
140
142
def get_project (self ) -> GithubProject :
141
- return GithubProject .parse_obj (self .extra ["project" ])
143
+ return GithubProject .model_validate (self .extra ["project" ])
142
144
143
145
def get_repository (self ):
144
146
# Not relevnat at the moment
145
147
return ...
146
148
147
149
def get_sender (self ) -> GithubSender :
148
- return GithubSender .parse_obj (self .content ["sender" ])
150
+ return GithubSender .model_validate (self .content ["sender" ])
149
151
150
152
def changes (self ) -> dict :
151
153
if "changes" in self .content :
You can’t perform that action at this time.
0 commit comments