You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2021/07/21 19:05:45 UTC

[GitHub] [superset] john-bodley opened a new pull request #15823: chore: Mypy fix **kwargs type

john-bodley opened a new pull request #15823:
URL: https://github.com/apache/superset/pull/15823


   ### SUMMARY
   
   A follow up to https://github.com/apache/superset/pull/15757#discussion_r674140292, per the Mypy [documentation](https://mypy.readthedocs.io/en/stable/getting_started.html#more-function-signatures), 
   
   > *args and **kwargs arguments can be annotated like so:
   >
   > ```python
   > def stars(*args: int, **kwargs: float) -> None:
   >    # 'args' has type 'Tuple[int, ...]' (a tuple of ints)
   >    # 'kwargs' has type 'Dict[str, float]' (a dict of strs to floats)
   >    for arg in args:
   >        print(arg)
   >    for key, value in kwargs:
   >        print(key, value)
   > ```
   
   though `kwargs` is a `Dict[str, ...]` the typing of `**kwargs` is actually the value typ.
   
   ### TESTING INSTRUCTIONS
   
   CI. Found all violations by running `git grep "**kwargs: Dict"`. 
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] john-bodley merged pull request #15823: chore: Mypy fix **kwargs type

Posted by GitBox <gi...@apache.org>.
john-bodley merged pull request #15823:
URL: https://github.com/apache/superset/pull/15823


   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] ktmud commented on a change in pull request #15823: chore: Mypy fix **kwargs type

Posted by GitBox <gi...@apache.org>.
ktmud commented on a change in pull request #15823:
URL: https://github.com/apache/superset/pull/15823#discussion_r677999053



##########
File path: superset/charts/api.py
##########
@@ -683,7 +683,7 @@ def data_from_cache(self, cache_key: str) -> Response:
         f".cache_screenshot",
         log_to_statsd=False,
     )
-    def cache_screenshot(self, pk: int, **kwargs: Dict[str, bool]) -> WerkzeugResponse:
+    def cache_screenshot(self, pk: int, **kwargs: Any) -> WerkzeugResponse:

Review comment:
       can we maybe move rison_dict to named arg and get rid of kwargs?




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] john-bodley commented on a change in pull request #15823: chore: Mypy fix **kwargs type

Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #15823:
URL: https://github.com/apache/superset/pull/15823#discussion_r674254543



##########
File path: superset/charts/api.py
##########
@@ -683,7 +683,7 @@ def data_from_cache(self, cache_key: str) -> Response:
         f".cache_screenshot",
         log_to_statsd=False,
     )
-    def cache_screenshot(self, pk: int, **kwargs: Dict[str, bool]) -> WerkzeugResponse:
+    def cache_screenshot(self, pk: int, **kwargs: Any) -> WerkzeugResponse:

Review comment:
       The `bool` is incorrect given the logic below, 
   
   ```
   rison_dict = kwargs["rison"]
   window_size = rison_dict.get("window_size")
   ```
   
   i.e., clearly the type of the `kwargs` value (`rison_dict`) is of type `Dict[str, ...]` rather than `bool`.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] john-bodley commented on a change in pull request #15823: chore: Mypy fix **kwargs type

Posted by GitBox <gi...@apache.org>.
john-bodley commented on a change in pull request #15823:
URL: https://github.com/apache/superset/pull/15823#discussion_r678490473



##########
File path: superset/charts/api.py
##########
@@ -683,7 +683,7 @@ def data_from_cache(self, cache_key: str) -> Response:
         f".cache_screenshot",
         log_to_statsd=False,
     )
-    def cache_screenshot(self, pk: int, **kwargs: Dict[str, bool]) -> WerkzeugResponse:
+    def cache_screenshot(self, pk: int, **kwargs: Any) -> WerkzeugResponse:

Review comment:
       @ktmud I think it's a tad more complex that that as I believe the information is being provided by the [`@rison`](https://github.com/dpgaspar/Flask-AppBuilder/blob/3dd1eb28cb7646de2739491ca5e3e2c703ab7201/flask_appbuilder/api/__init__.py#L95) decorator.




-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] codecov[bot] commented on pull request #15823: chore: Mypy fix **kwargs type

Posted by GitBox <gi...@apache.org>.
codecov[bot] commented on pull request #15823:
URL: https://github.com/apache/superset/pull/15823#issuecomment-884435182


   # [Codecov](https://codecov.io/gh/apache/superset/pull/15823?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#15823](https://codecov.io/gh/apache/superset/pull/15823?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (8c69cff) into [master](https://codecov.io/gh/apache/superset/commit/ab4e3b9bf962f4eb5526e7ff65efee40e647e5d8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ab4e3b9) will **decrease** coverage by `0.01%`.
   > The diff coverage is `100.00%`.
   
   > :exclamation: Current head 8c69cff differs from pull request most recent head 0f9d05b. Consider uploading reports for the commit 0f9d05b to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/superset/pull/15823/graphs/tree.svg?width=650&height=150&src=pr&token=KsB0fHcx6l&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/superset/pull/15823?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #15823      +/-   ##
   ==========================================
   - Coverage   76.91%   76.89%   -0.02%     
   ==========================================
     Files         984      984              
     Lines       51662    51622      -40     
     Branches     6991     6991              
   ==========================================
   - Hits        39736    39697      -39     
   + Misses      11702    11701       -1     
     Partials      224      224              
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | mysql | `81.56% <100.00%> (ø)` | |
   | postgres | `81.56% <100.00%> (-0.03%)` | :arrow_down: |
   | python | `81.65% <100.00%> (-0.03%)` | :arrow_down: |
   | sqlite | `81.19% <100.00%> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/superset/pull/15823?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [superset/annotation\_layers/annotations/api.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvYW5ub3RhdGlvbl9sYXllcnMvYW5ub3RhdGlvbnMvYXBpLnB5) | `84.96% <ø> (ø)` | |
   | [superset/reports/logs/api.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvcmVwb3J0cy9sb2dzL2FwaS5weQ==) | `94.11% <ø> (ø)` | |
   | [superset/charts/api.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY2hhcnRzL2FwaS5weQ==) | `86.80% <100.00%> (ø)` | |
   | [superset/dashboards/api.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9hcGkucHk=) | `92.95% <100.00%> (ø)` | |
   | [superset/utils/decorators.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvZGVjb3JhdG9ycy5weQ==) | `92.59% <100.00%> (-0.27%)` | :arrow_down: |
   | [superset/models/dashboard.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvbW9kZWxzL2Rhc2hib2FyZC5weQ==) | `74.77% <0.00%> (-2.22%)` | :arrow_down: |
   | [superset/common/query\_context.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvY29tbW9uL3F1ZXJ5X2NvbnRleHQucHk=) | `81.42% <0.00%> (-0.40%)` | :arrow_down: |
   | [superset/utils/cache.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvdXRpbHMvY2FjaGUucHk=) | `74.28% <0.00%> (-0.25%)` | :arrow_down: |
   | [superset/reports/notifications/base.py](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQvcmVwb3J0cy9ub3RpZmljYXRpb25zL2Jhc2UucHk=) | `95.23% <0.00%> (-0.22%)` | :arrow_down: |
   | ... and [8 more](https://codecov.io/gh/apache/superset/pull/15823/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/superset/pull/15823?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/superset/pull/15823?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ab4e3b9...0f9d05b](https://codecov.io/gh/apache/superset/pull/15823?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

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



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org