-
Notifications
You must be signed in to change notification settings - Fork 590
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In the case of the Str (which translates to a StrEnum for choices) the explicit list isinstance check is incorrect. There are many cases where it would be valid to send an `Iterable` such as with `dict.keys()` returning a `dict_keys`. As we do not want to explictly cast to `list` type this commit results in a check of iterable type instead of list.
- Loading branch information
1 parent
ed7cc89
commit 2692447
Showing
4 changed files
with
18 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from cog import BasePredictor, Input | ||
|
||
|
||
class Predictor(BasePredictor): | ||
def predict(self, text: str = Input(choices={"foo": "x", "bar": "y"}.keys())) -> str: | ||
assert type(text) == str | ||
return text |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters