Open bh2smith opened 1 month ago
@bh2smith I would like to contribute. Can you assign me this issue?
Sure thing. Go for it.
List of Functions that need to be revamped.
Module dune_client.client_async dune_client/client_async.py:232:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments) dune_client/client_async.py:266:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments) dune_client/client_async.py:356:4: R0917: Too many positional arguments (9/5) (too-many-positional-arguments) dune_client/client_async.py:391:4: R0917: Too many positional arguments (9/5) (too-many-positional-arguments) dune_client/client_async.py:426:4: R0917: Too many positional arguments (8/5) (too-many-positional-arguments) dune_client/client_async.py:463:4: R0917: Too many positional arguments (8/5) (too-many-positional-arguments) dune_client/client_async.py:512:4: R0917: Too many positional arguments (8/5) (too-many-positional-arguments) Module dune_client.api.execution dune_client/api/execution.py:75:4: R0917: Too many positional arguments (9/5) (too-many-positional-arguments) dune_client/api/execution.py:101:4: R0917: Too many positional arguments (8/5) (too-many-positional-arguments) Module dune_client.api.custom dune_client/api/custom.py:24:4: R0917: Too many positional arguments (9/5) (too-many-positional-arguments) Module dune_client.api.query dune_client/api/query.py:57:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments) Module dune_client.api.extensions dune_client/api/extensions.py:47:4: R0917: Too many positional arguments (10/5) (too-many-positional-arguments) dune_client/api/extensions.py:91:4: R0917: Too many positional arguments (9/5) (too-many-positional-arguments) dune_client/api/extensions.py:133:4: R0917: Too many positional arguments (9/5) (too-many-positional-arguments) dune_client/api/extensions.py:168:4: R0917: Too many positional arguments (8/5) (too-many-positional-arguments) dune_client/api/extensions.py:241:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments) dune_client/api/extensions.py:274:4: R0917: Too many positional arguments (7/5) (too-many-positional-arguments) dune_client/api/extensions.py:327:4: R0917: Too many positional arguments (8/5) (too-many-positional-arguments) Module dune_client.api.table dune_client/api/table.py:55:4: R0917: Too many positional arguments (6/5) (too-many-positional-arguments) ***** Module dune_client.api.base dune_client/api/base.py:33:4: R0917: Too many positional arguments (6/5) (too-many-positional-arguments) dune_client/api/base.py:90:4: R0917: Too many positional arguments (9/5) (too-many-positional-arguments)
@bh2smith How to handle params for create_table function?
We can create a dict with all the params and pass it in line 75.
Thoughts?
PR raised for this issue - #139
This came up in #136 - Here are some AI suggestions:
The Pylint error R0917: Too many positional arguments (8/5) indicates that a function or method is being called with more than the recommended number of positional arguments (the default limit is 5). This is generally considered a code smell because it suggests that the function might be doing too much or its parameters could be better organized.
Solutions
How to Address the Issue in Your Code
In your case, you can:
Example Solution
Let’s assume the method some_function is causing the issue. Here’s how you can refactor it:
Original Method (Example)
If this is being called with 8 positional arguments like:
This will trigger the R0917 error.
Refactored Solution
Then call it like this:
If you want more structure, use a named tuple or a data class:
Then call it like this:
This way, you reduce the number of positional arguments passed to the function and increase the readability of your code.
Applying the Solution to Your Case
Given the specific function signature you shared, you can apply either of the two approaches above based on your preference and the specific codebase context. If you provide me with the exact method signature and context where the error is occurring, I can give a more targeted solution tailored to that code snippet!