File tree Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Expand file tree Collapse file tree 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -129,15 +129,12 @@ def github_object(self) -> GithubDraftIssue | GithubIssue:
129
129
content = self .extra ["content" ]
130
130
typename = content .pop ("__typename" )
131
131
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 ]] = {
135
- "Issue" : GithubIssue ,
136
- "DraftIssue" : GithubDraftIssue ,
137
- }
138
-
139
- obj = CONTENT_TYPE_MAP [typename ].model_validate (content )
140
- return obj
132
+ if typename == "Issue" :
133
+ return GithubIssue .model_validate (content )
134
+ elif typename == "DraftIssue" :
135
+ return GithubDraftIssue .model_validate (content )
136
+ else :
137
+ raise ValueError ("Other types are not supported" )
141
138
142
139
def get_project (self ) -> GithubProject :
143
140
return GithubProject .model_validate (self .extra ["project" ])
You can’t perform that action at this time.
0 commit comments