Incorrect signature of operators
See original GitHub issueHello,
Currently, the signatures of most operators look similar to the following.
@apply_defaults
def __init__(
self, sql: str, conn_id: Optional[str] = None, *args, **kwargs
) -> None:
super().__init__(*args, **kwargs)
self.conn_id = conn_id
self.sql = sql
There are two problems here.
- The
apply_default
decorator forces all arguments to be passed as keyword arguments, but this information is not marked in the signature. As of Python 3 it is possible to mark arguments as keyword-only argument. - The
*args
is passed to the BaseOperator class, but this class does not accept positional arguments.
The new operator signature may look like folllow
@apply_defaults
def __init__(
self, *, sql: str, conn_id: Optional[str] = None, **kwargs
) -> None:
super().__init__(**kwargs)
self.conn_id = conn_id
self.sql = sql
This change will allow the detection of improper operator initialization by static code analysis tools. This will also improve the operator’s documentation as the method signature is available in the Python API Reference.
This change is backward-compatible because the positional arguments were not accepted before, but this was not enforced by the Python interpreter, but by an ddecorator.
We can use Bowler to do it.
Best regards, Kamil
Issue Analytics
- State:
- Created 3 years ago
- Reactions:4
- Comments:5 (5 by maintainers)
Top Results From Across the Web
C++ -- Incorrect signature for assignment operator?
Assignment meant you assign a value to something that already exists. · The assignment operator should take its argument as a const-reference: A& ......
Read more >scheduled apex - Incorrect signature for a SchedulableContext
I'm trying to create a daily export of a .csv report on Salesforce Apex. The problem is I can't test this code beacause...
Read more >Report warning on 'contains' function with 'operator' annotation and ...
Report warning on 'contains' function with 'operator' annotation and incorrect signature ; Project, Kotlin ; Priority, Not specified ; Type, Bug B ;...
Read more >Method does not exist or incorrect signature: [Id].equals(String)
Hi,. I am still new to Apex, and learning more functions and expected this to work: trigger DelCustPrevent on Account (before delete) {...
Read more >161109 - An internal error has occurred. Incorrect Operator ...
Message. An internal error has occurred. Incorrect Operator Signature. Domain, CCLScript. Code, 161109. Severity, Error.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@LeonY1 CLA is not required.
@LeonY1 You can start. You are already assigned to this ticket so I cannot assign you again.