-
Notifications
You must be signed in to change notification settings - Fork 248
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
Fix #747 by updating async SQLAlchemy OAuth example code #748
Conversation
Neel Arora seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add is_enterprise_install to example
fix #747 |
@@ -63,11 +63,11 @@ async def async_save(self, installation: Installation): | |||
b["client_id"] = self.client_id | |||
await database.execute(self.bots.insert(), b) | |||
|
|||
async def async_find_bot(self, *, enterprise_id: Optional[str], team_id: Optional[str]) -> Optional[Bot]: | |||
async def async_find_bot(self, *, enterprise_id: Optional[str], team_id: Optional[str], is_enterprise_install: Optional[bool]) -> Optional[Bot]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
flake8 detects lint errors. Can you these lines shorter than 125 chars?
Successfully installed flake8-5.0.4 mccabe-0.7.0 pycodestyle-2.9.1 pyflakes-2.5.0
examples/sqlalchemy/async_oauth_app.py:66:126: E501 line too long (148 > 125 characters)
examples/sqlalchemy/async_oauth_app.py:70:126: E501 line too long (130 > 125 characters)
Error: Process completed with exit code 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can fix these warnings by the following changes:
diff --git a/examples/sqlalchemy/async_oauth_app.py b/examples/sqlalchemy/async_oauth_app.py
index 5ec7be0..a2c52f0 100644
--- a/examples/sqlalchemy/async_oauth_app.py
+++ b/examples/sqlalchemy/async_oauth_app.py
@@ -63,11 +63,23 @@ class AsyncSQLAlchemyInstallationStore(AsyncInstallationStore):
b["client_id"] = self.client_id
await database.execute(self.bots.insert(), b)
- async def async_find_bot(self, *, enterprise_id: Optional[str], team_id: Optional[str], is_enterprise_install: Optional[bool]) -> Optional[Bot]:
+ async def async_find_bot(
+ self,
+ *,
+ enterprise_id: Optional[str],
+ team_id: Optional[str],
+ is_enterprise_install: Optional[bool],
+ ) -> Optional[Bot]:
c = self.bots.c
query = (
self.bots.select()
- .where(and_(c.enterprise_id == enterprise_id, c.team_id == team_id, c.is_enterprise_install == is_enterprise_install))
+ .where(
+ and_(
+ c.enterprise_id == enterprise_id,
+ c.team_id == team_id,
+ c.is_enterprise_install == is_enterprise_install,
+ )
+ )
.order_by(desc(c.installed_at))
.limit(1)
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ntarora Could you push the fix if you have a chance?
Codecov Report
@@ Coverage Diff @@
## main #748 +/- ##
=======================================
Coverage 92.06% 92.06%
=======================================
Files 172 172
Lines 5875 5875
=======================================
Hits 5409 5409
Misses 466 466 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Odd, I did push the formatting fix on my branch. I didn’t get picked up for some reason. Should I close this PR and create a new one? On Oct 26, 2022, at 1:39 AM, Kazuhiro Sera ***@***.***> wrote:
@seratch commented on this pull request.
In examples/sqlalchemy/async_oauth_app.py:
@@ -63,11 +63,11 @@ async def async_save(self, installation: Installation):
b["client_id"] = self.client_id
await database.execute(self.bots.insert(), b)
- async def async_find_bot(self, *, enterprise_id: Optional[str], team_id: Optional[str]) -> Optional[Bot]:
+ async def async_find_bot(self, *, enterprise_id: Optional[str], team_id: Optional[str], is_enterprise_install: Optional[bool]) -> Optional[Bot]:
@ntarora Could you push the fix if you have a chance?
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Thanks for your contribution! Your changes are merged at f5b40c7 and then I've added an additional commit to resolve the flake8 issue on my end. |
This pull request resolves #747