Skip to content

Commit 6ef6519

Browse files
committed
fix type check
1 parent 6129156 commit 6ef6519

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

intbot/core/integrations/github.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,23 +129,25 @@ def github_object(self) -> GithubDraftIssue | GithubIssue:
129129
content = self.extra["content"]
130130
typename = content.pop("__typename")
131131

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]] = {
133135
"Issue": GithubIssue,
134136
"DraftIssue": GithubDraftIssue,
135137
}
136138

137-
obj = CONTENT_TYPE_MAP[typename].parse_obj(content)
139+
obj = CONTENT_TYPE_MAP[typename].model_validate(content)
138140
return obj
139141

140142
def get_project(self) -> GithubProject:
141-
return GithubProject.parse_obj(self.extra["project"])
143+
return GithubProject.model_validate(self.extra["project"])
142144

143145
def get_repository(self):
144146
# Not relevnat at the moment
145147
return ...
146148

147149
def get_sender(self) -> GithubSender:
148-
return GithubSender.parse_obj(self.content["sender"])
150+
return GithubSender.model_validate(self.content["sender"])
149151

150152
def changes(self) -> dict:
151153
if "changes" in self.content:

0 commit comments

Comments
 (0)