Skip to content

Commit bf72147

Browse files
authored
[stubsabot] Use Literal and update reason field (#14904)
1 parent 56e74d0 commit bf72147

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/stubsabot.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __str__(self) -> str:
161161
@dataclass
162162
class Remove:
163163
distribution: str
164-
reason: str
164+
reason: Literal["ships py.typed file", "unmaintained"]
165165
links: dict[str, str]
166166

167167
def __str__(self) -> str:
@@ -171,7 +171,7 @@ def __str__(self) -> str:
171171
@dataclass
172172
class NoUpdate:
173173
distribution: str
174-
reason: str
174+
reason: Literal["obsolete", "no longer updated", "up to date"]
175175

176176
def __str__(self) -> str:
177177
return f"{colored('skipping', 'green')} ({self.reason})"
@@ -642,7 +642,7 @@ async def determine_action_no_error_handling(
642642
"Typeshed release": f"{pypi_info.pypi_root}",
643643
"Typeshed stubs": f"https://github.com/{TYPESHED_OWNER}/typeshed/tree/main/stubs/{stub_info.distribution}",
644644
}
645-
return Remove(stub_info.distribution, reason="older than 6 months", links=links)
645+
return Remove(stub_info.distribution, reason="ships py.typed file", links=links)
646646
else:
647647
return NoUpdate(stub_info.distribution, "obsolete")
648648
if stub_info.no_longer_updated:
@@ -654,7 +654,7 @@ async def determine_action_no_error_handling(
654654
"Typeshed release": f"{pypi_info.pypi_root}",
655655
"Typeshed stubs": f"https://github.com/{TYPESHED_OWNER}/typeshed/tree/main/stubs/{stub_info.distribution}",
656656
}
657-
return Remove(stub_info.distribution, reason="no longer updated", links=links)
657+
return Remove(stub_info.distribution, reason="unmaintained", links=links)
658658
else:
659659
return NoUpdate(stub_info.distribution, "no longer updated")
660660

0 commit comments

Comments
 (0)