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

disc: remove the optional typing of client #1143

Merged
merged 1 commit into from
Sep 2, 2024

Conversation

WilliamBergamin
Copy link
Contributor

This PR opens the discussion to why the context.client property is Optional

Looking back to #31 its seems like the original implementation of the client property could return None, but this implementation has now changed.
Original implementation:

    @property
    def client(self) -> Optional[WebClient]:
        return self.get("client", None)

Can we now remove this Optional type annotation, I cannot come up with a use case where context.client could be None, let me know if missing context around this 🤔

Category (place an x in each of the [ ])

  • slack_bolt.App and/or its core components
  • slack_bolt.async_app.AsyncApp and/or its core components
  • Adapters in slack_bolt.adapter
  • Document pages under /docs
  • Others

Requirements (place an x in each [ ])

Please read the Contributing guidelines and Code of Conduct before creating this issue or pull request. By submitting, you are agreeing to those rules.

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I've run ./scripts/install_all_and_run_tests.sh after making the changes.

@@ -41,7 +41,7 @@ def listener_runner(self) -> "AsyncioListenerRunner": # type: ignore[name-defin
return self["listener_runner"]

@property
def client(self) -> Optional[AsyncWebClient]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant change ⬆️

@@ -42,7 +42,7 @@ def listener_runner(self) -> "ThreadListenerRunner": # type: ignore[name-define
return self["listener_runner"]

@property
def client(self) -> Optional[WebClient]:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant change ⬆️

Copy link

codecov bot commented Aug 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.02%. Comparing base (8188956) to head (03ebfa2).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1143   +/-   ##
=======================================
  Coverage   92.02%   92.02%           
=======================================
  Files         195      195           
  Lines        6631     6631           
=======================================
  Hits         6102     6102           
  Misses        529      529           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@seratch seratch added this to the 1.21.0 milestone Sep 2, 2024
@seratch seratch added bug Something isn't working and removed discussion labels Sep 2, 2024
Copy link
Member

@seratch seratch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, indeed the the type can be non-optional now; looks good to me

@seratch seratch merged commit aedac2c into slackapi:main Sep 2, 2024
12 checks passed
@WilliamBergamin WilliamBergamin deleted the remove-optional-client branch September 3, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants