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

SIM108: autofix crashes due to introduced syntax error #2631

Closed
spaceone opened this issue Feb 7, 2023 · 3 comments · Fixed by #2637
Closed

SIM108: autofix crashes due to introduced syntax error #2631

spaceone opened this issue Feb 7, 2023 · 3 comments · Fixed by #2637
Assignees
Labels
bug Something isn't working

Comments

@spaceone
Copy link
Contributor

spaceone commented Feb 7, 2023

ruff --select SIM108 --fix

class JSONRPC(BaseComponent):

    def _on_request(self, event, req, res):
        if isinstance(params, dict):
            value = yield self.call(rpc.create(method, **params), self.rpc_channel)
        else:
            value = yield self.call(rpc.create(method, *params), self.rpc_channel)
@charliermarsh charliermarsh added the bug Something isn't working label Feb 7, 2023
@charliermarsh charliermarsh self-assigned this Feb 7, 2023
@charliermarsh
Copy link
Member

Oho!

@spaceone
Copy link
Contributor Author

spaceone commented Feb 7, 2023

with await it seems not to be a syntax error (but looks strange):

$ ruff --select SIM108 --fix --diff foo.py
--- foo.py
+++ foo.py
@@ -1,7 +1,4 @@
 class JSONRPC(BaseComponent):
 
     async def _on_request(self, event, req, res):
-        if isinstance(params, dict):
-            value = await self.call(rpc.create(method, **params), self.rpc_channel)
-        else:
-            value = await self.call(rpc.create(method, *params), self.rpc_channel)
+        value = await self.call(rpc.create(method, **params), self.rpc_channel) if isinstance(params, dict) else await self.call(rpc.create(method, *params), self.rpc_channel)

@charliermarsh
Copy link
Member

Disabling for now, for yield and awaits. Need to fix the underlying bug.

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 a pull request may close this issue.

2 participants