Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add binary bool type #30

Merged
merged 16 commits into from
Nov 14, 2023
Merged

Feature/add binary bool type #30

merged 16 commits into from
Nov 14, 2023

Conversation

yu23ki14
Copy link
Collaborator

@yu23ki14 yu23ki14 commented Nov 1, 2023

"0", "1" で真偽値が入っているパラメータを扱うためのBinaryBoolクラスを実装

to_boolメソッドでtrue, falseに変換する関数を追加している。

@yu23ki14
Copy link
Collaborator Author

yu23ki14 commented Nov 1, 2023

@osoken

以下のエラーで落ちちゃうのですが、なにが問題かわかりますか?

birdxplorer/models.py:104: error: Returning Any from function declared to return "bool"  [no-any-return]

@yu23ki14 yu23ki14 requested a review from osoken November 1, 2023 08:59
@osoken
Copy link
Collaborator

osoken commented Nov 1, 2023

vAny なので、 (Any) == (str)Any っぽいっす。意図通りかわかんないけど、

    @classmethod
    def to_bool(cls: Type["BinaryBool"], v: Any) -> bool:
        return str(v) == "1"

これでとりあえず型エラーは消えました

@osoken osoken marked this pull request as ready for review November 14, 2023 14:56
@osoken osoken merged commit f8314be into main Nov 14, 2023
1 check passed
@osoken osoken deleted the feature/addBinaryBoolType branch November 14, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants