You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/08/05 04:11:54 UTC

[GitHub] [airflow] coopergillan commented on pull request #10164: Add type annotations to S3 hook module

coopergillan commented on pull request #10164:
URL: https://github.com/apache/airflow/pull/10164#issuecomment-668968891


   When I ran the `mypy` report for this module using the command from #9708 I kept getting 25 out of 26 checks. I can't figure out which check is missing:
   
   ```bash
   $ MP_DIR=$(mktemp -d); mypy --linecount-report ${MP_DIR} airflow/providers/amazon/aws/hooks; \
   cat "${MP_DIR}/linecount.txt" | grep providers.amazon.aws.hooks.s3 | grep -v example_dags | \
   awk '$4 != 0 {print 100.00 * ($3/$4), $3, $4, $5}'| sort -g
   ```
   
   However, it looks like when I add annotations to `__init__`:
   
   ```python
   def __init__(self, *args: str, **kwargs: str):
       super().__init__(client_type='s3', *args, **kwargs)
   ```
   
   I can get to 26/26, but get this error:
   
   ```bash
   airflow/providers/amazon/aws/hooks/s3.py:110: error: "__init__" of "AwsBaseHook" gets multiple
   values for keyword argument "client_type"
               super().__init__(client_type='s3', *args, **kwargs)
               ^
   ```
   
   Any ideas what might be going on there? I'm guessing it doesn't like something about how `client_type` is not specified in the args, but that seems like it should be fine due to the `super`.
   
   Either way, I just pushed up 573d9a6d73cf565967598b806d411a4a84b6e567 to add these and ignore the type check. That gets us to 26/26. I would be happy to revert this if we can explain better what's going on here.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org