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 2023/01/19 08:14:40 UTC

[GitHub] [superset] villebro opened a new pull request, #22782: chore(lint): fix numpy type errors

villebro opened a new pull request, #22782:
URL: https://github.com/apache/superset/pull/22782

   <!---
   Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
   <!--- Describe the change below, including rationale and design decisions -->
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] 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] villebro merged pull request #22782: chore(ci): fix numpy type errors and revert #22610

Posted by GitBox <gi...@apache.org>.
villebro merged PR #22782:
URL: https://github.com/apache/superset/pull/22782


-- 
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] villebro commented on a diff in pull request #22782: chore(lint): fix numpy type errors

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1080943036


##########
setup.cfg:
##########
@@ -17,9 +17,9 @@
 [metadata]
 name = Superset
 summary = a data exploration platform
-description-file = README.md
+description_file = README.md
 author = Apache Superset Dev
-author-email = dev@superset.apache.org
+author_email = dev@superset.apache.org

Review Comment:
   Bycatch; noticed this was being emitted by `pylint`:
   
   > /Users/ville/apple/apache-superset/.tox/pylint/lib/python3.8/site-packages/setuptools/dist.py:770: UserWarning: Usage of dash-separated 'description-file' will not be supported in future versions. Please use the underscore name 'description_file' instead
   >   warnings.warn(
   /Users/ville/apple/apache-superset/.tox/pylint/lib/python3.8/site-packages/setuptools/dist.py:770: UserWarning: Usage of dash-separated 'author-email' will not be supported in future versions. Please use the underscore name 'author_email' instead
   



-- 
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] villebro commented on a diff in pull request #22782: chore(ci): fix numpy type errors and revert #22610

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1081185050


##########
superset/views/datasource/views.py:
##########
@@ -228,7 +228,10 @@ class DatasetEditor(BaseSupersetView):
     @has_access
     @permission_name("read")
     def root(self) -> FlaskResponse:
-        return super().render_app_template()
+        dev = request.args.get("testing")
+        if dev is not None:
+            return super().render_app_template()
+        return redirect("/")

Review Comment:
   This is from the revert, not my change



-- 
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] dpgaspar commented on a diff in pull request #22782: chore(ci): fix numpy type errors and revert #22610

Posted by GitBox <gi...@apache.org>.
dpgaspar commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1081180100


##########
superset/views/datasource/views.py:
##########
@@ -228,7 +228,10 @@ class DatasetEditor(BaseSupersetView):
     @has_access
     @permission_name("read")
     def root(self) -> FlaskResponse:
-        return super().render_app_template()
+        dev = request.args.get("testing")
+        if dev is not None:
+            return super().render_app_template()
+        return redirect("/")

Review Comment:
   what is this? ^^^



-- 
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] villebro commented on a diff in pull request #22782: chore(lint): fix numpy type errors

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1081033394


##########
superset/reports/commands/alert.py:
##########
@@ -84,12 +85,12 @@ def run(self) -> bool:
         except (KeyError, json.JSONDecodeError) as ex:
             raise AlertValidatorConfigError() from ex
 
-    def _validate_not_null(self, rows: np.recarray) -> None:
+    def _validate_not_null(self, rows: NDArray[Any]) -> None:

Review Comment:
   This could have been typed as `np.recarray[Any, Any]`, but would have required Python >= 3.9. So for now we need to fall back to `NDArray[Any]`.



-- 
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] villebro commented on a diff in pull request #22782: chore(ci): fix numpy type errors and revert #22610

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1081187814


##########
superset/views/datasource/views.py:
##########
@@ -228,7 +228,10 @@ class DatasetEditor(BaseSupersetView):
     @has_access
     @permission_name("read")
     def root(self) -> FlaskResponse:
-        return super().render_app_template()
+        dev = request.args.get("testing")
+        if dev is not None:
+            return super().render_app_template()
+        return redirect("/")

Review Comment:
   I checked blame, the original code is from this PR: #20869



-- 
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] villebro commented on a diff in pull request #22782: chore(lint): fix numpy type errors

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1080930128


##########
superset/utils/pandas_postprocessing/boxplot.py:
##########
@@ -126,7 +129,7 @@ def outliers(series: Series) -> Set[float]:
     # nanpercentile needs numeric values, otherwise the isnan function
     # that's used in the underlying function will fail
     for column in metrics:
-        if df.dtypes[column] == np.object:
+        if df.dtypes[column] == np.object_:

Review Comment:
   Nowadays `np.object` is the same as `object`:
   ```python
   >>> import numpy as np
   >>> np.object
   <stdin>:1: DeprecationWarning: `np.object` is a deprecated alias for the builtin `object`. To silence this warning, use `object` by itself. Doing this will not modify any behavior and is safe.
   Deprecated in NumPy 1.20; for more details and guidance: https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
   <class 'object'>
   ```
   I'm opting for `np.object_` here as it seems cleaner and it also worked (there's a unit test for this, so we'll catch this if it changes in the future). Check https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations πŸ‘ 
   ![image](https://user-images.githubusercontent.com/33317356/213389899-09b7951c-4662-4e15-bd7f-344d700d8354.png)
   



-- 
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] villebro commented on a diff in pull request #22782: chore(lint): fix numpy type errors

Posted by GitBox <gi...@apache.org>.
villebro commented on code in PR #22782:
URL: https://github.com/apache/superset/pull/22782#discussion_r1080930784


##########
superset/result_set.py:
##########
@@ -62,16 +63,16 @@ def stringify(obj: Any) -> str:
     return json.dumps(obj, default=utils.json_iso_dttm_ser)
 
 
-def stringify_values(array: np.ndarray) -> np.ndarray:
+def stringify_values(array: NDArray[Any]) -> NDArray[Any]:
     result = np.copy(array)
 
-    with np.nditer(result, flags=["refs_ok"], op_flags=["readwrite"]) as it:
+    with np.nditer(result, flags=["refs_ok"], op_flags=[["readwrite"]]) as it:

Review Comment:
   Wow, this actually caught an incorrect type!



-- 
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 #22782: chore(lint): fix numpy type errors

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

   # [Codecov](https://codecov.io/gh/apache/superset/pull/22782?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 [#22782](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a0b2108) into [master](https://codecov.io/gh/apache/superset/commit/5026da50e1c525d48c526bdf3aec7fb52829b5b4?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5026da5) will **decrease** coverage by `11.50%`.
   > The diff coverage is `77.18%`.
   
   > :exclamation: Current head a0b2108 differs from pull request most recent head c3431e3. Consider uploading reports for the commit c3431e3 to get more accurate results
   
   ```diff
   @@             Coverage Diff             @@
   ##           master   #22782       +/-   ##
   ===========================================
   - Coverage   67.27%   55.78%   -11.50%     
   ===========================================
     Files        1875     1875               
     Lines       71820    71821        +1     
     Branches     7870     7870               
   ===========================================
   - Hits        48319    40066     -8253     
   - Misses      21473    29727     +8254     
     Partials     2028     2028               
   ```
   
   | Flag | Coverage Ξ” | |
   |---|---|---|
   | hive | `?` | |
   | mysql | `?` | |
   | postgres | `?` | |
   | presto | `52.50% <50.00%> (+<0.01%)` | :arrow_up: |
   | python | `57.95% <100.00%> (-23.94%)` | :arrow_down: |
   | sqlite | `?` | |
   | unit | `51.54% <100.00%> (+<0.01%)` | :arrow_up: |
   
   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/22782?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-frontend/src/SqlLab/App.jsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9BcHAuanN4) | `0.00% <ΓΈ> (ΓΈ)` | |
   | [...frontend/src/SqlLab/components/ResultSet/index.tsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL1Jlc3VsdFNldC9pbmRleC50c3g=) | `61.93% <ΓΈ> (ΓΈ)` | |
   | [...et-frontend/src/dashboard/components/Dashboard.jsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL0Rhc2hib2FyZC5qc3g=) | `65.51% <ΓΈ> (ΓΈ)` | |
   | [...rontend/src/dashboard/containers/DashboardPage.tsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb250YWluZXJzL0Rhc2hib2FyZFBhZ2UudHN4) | `7.14% <ΓΈ> (ΓΈ)` | |
   | [superset-frontend/src/views/components/Menu.tsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL3ZpZXdzL2NvbXBvbmVudHMvTWVudS50c3g=) | `49.23% <ΓΈ> (ΓΈ)` | |
   | [...hboard/components/resizable/ResizableContainer.jsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL3Jlc2l6YWJsZS9SZXNpemFibGVDb250YWluZXIuanN4) | `61.70% <36.00%> (ΓΈ)` | |
   | [...d/src/SqlLab/components/AceEditorWrapper/index.tsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FjZUVkaXRvcldyYXBwZXIvaW5kZXgudHN4) | `58.22% <42.85%> (ΓΈ)` | |
   | [...erset-frontend/src/SqlLab/components/App/index.jsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL1NxbExhYi9jb21wb25lbnRzL0FwcC9pbmRleC5qc3g=) | `57.89% <50.00%> (ΓΈ)` | |
   | [...rontend/src/dashboard/components/DashboardGrid.jsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL0Rhc2hib2FyZEdyaWQuanN4) | `55.35% <50.00%> (ΓΈ)` | |
   | [.../src/dashboard/components/gridComponents/Chart.jsx](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3VwZXJzZXQtZnJvbnRlbmQvc3JjL2Rhc2hib2FyZC9jb21wb25lbnRzL2dyaWRDb21wb25lbnRzL0NoYXJ0LmpzeA==) | `53.98% <50.00%> (ΓΈ)` | |
   | ... and [362 more](https://codecov.io/gh/apache/superset/pull/22782?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?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