You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "john-bodley (via GitHub)" <gi...@apache.org> on 2023/05/18 15:44:48 UTC
[GitHub] [superset] john-bodley opened a new pull request, #24117: chore: Refactor command exceptions
john-bodley opened a new pull request, #24117:
URL: https://github.com/apache/superset/pull/24117
<!---
Please write the PR title following the conventions at https://www.conventionalcommits.org/en/v1.0.0/
Example:
fix(dashboard): load charts correctly
-->
### SUMMARY
Whilst debugging an issue I came across a frequently repeated pattern:
```python
if exceptions:
exception = AnnotationInvalidError()
exception.add_list(exceptions)
raise exception
```
These exceptions are derived from the `CommandInvalidError` class which included the `add` and `add_list` methods and had no way of adding the exceptions when constructing the error. To adhere to the DRY principle this PR performs the following:
1. Renames `add` to `append`—akin to `list.append`.
2. Renames `add_list` to `extend`—akin to `list.extend`.
3. Add the ability to specify the exceptions in the `__init__` method.
where the later means that the snippet of code above reduces to,
```python
if exceptions:
raise AnnotationInvalidError(exceptions=exceptions)
```
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
<!--- Skip this if not applicable -->
### TESTING INSTRUCTIONS
CI.
### 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] codecov[bot] commented on pull request #24117: chore: Refactor command exceptions
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #24117:
URL: https://github.com/apache/superset/pull/24117#issuecomment-1553271546
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
> Merging [#24117](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (d75d1e1) into [master](https://app.codecov.io/gh/apache/superset/commit/2222073778b0cee193f34c2500f2c489bb2a4bbe?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) (2222073) will **decrease** coverage by `11.33%`.
> The diff coverage is `25.00%`.
> :exclamation: Current head d75d1e1 differs from pull request most recent head 8f88edb. Consider uploading reports for the commit 8f88edb to get more accurate results
```diff
@@ Coverage Diff @@
## master #24117 +/- ##
===========================================
- Coverage 68.30% 56.97% -11.33%
===========================================
Files 1952 1952
Lines 75432 75388 -44
Branches 8191 8191
===========================================
- Hits 51521 42954 -8567
- Misses 21807 30330 +8523
Partials 2104 2104
```
| Flag | Coverage Δ | |
|---|---|---|
| hive | `?` | |
| mysql | `?` | |
| postgres | `?` | |
| presto | `53.16% <9.37%> (+0.06%)` | :arrow_up: |
| python | `59.40% <25.00%> (-23.41%)` | :arrow_down: |
| sqlite | `?` | |
| unit | `53.14% <25.00%> (+0.05%)` | :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=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
| [Impacted Files](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [...t/annotation\_layers/annotations/commands/create.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvYW5ub3RhdGlvbl9sYXllcnMvYW5ub3RhdGlvbnMvY29tbWFuZHMvY3JlYXRlLnB5) | `39.02% <0.00%> (-47.03%)` | :arrow_down: |
| [...t/annotation\_layers/annotations/commands/update.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvYW5ub3RhdGlvbl9sYXllcnMvYW5ub3RhdGlvbnMvY29tbWFuZHMvdXBkYXRlLnB5) | `36.17% <0.00%> (-51.59%)` | :arrow_down: |
| [superset/annotation\_layers/commands/create.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvYW5ub3RhdGlvbl9sYXllcnMvY29tbWFuZHMvY3JlYXRlLnB5) | `48.14% <0.00%> (-41.51%)` | :arrow_down: |
| [superset/annotation\_layers/commands/update.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvYW5ub3RhdGlvbl9sYXllcnMvY29tbWFuZHMvdXBkYXRlLnB5) | `42.42% <0.00%> (-49.01%)` | :arrow_down: |
| [superset/charts/commands/create.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL2NyZWF0ZS5weQ==) | `35.41% <0.00%> (-56.59%)` | :arrow_down: |
| [superset/charts/commands/update.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY2hhcnRzL2NvbW1hbmRzL3VwZGF0ZS5weQ==) | `30.88% <0.00%> (-59.12%)` | :arrow_down: |
| [superset/commands/importers/v1/\_\_init\_\_.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL19faW5pdF9fLnB5) | `40.00% <0.00%> (-51.94%)` | :arrow_down: |
| [superset/commands/importers/v1/assets.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvY29tbWFuZHMvaW1wb3J0ZXJzL3YxL2Fzc2V0cy5weQ==) | `69.04% <0.00%> (-17.00%)` | :arrow_down: |
| [superset/dashboards/commands/create.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9jb21tYW5kcy9jcmVhdGUucHk=) | `32.55% <0.00%> (-61.06%)` | :arrow_down: |
| [superset/dashboards/commands/update.py](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGFzaGJvYXJkcy9jb21tYW5kcy91cGRhdGUucHk=) | `29.68% <0.00%> (-54.14%)` | :arrow_down: |
| ... and [12 more](https://app.codecov.io/gh/apache/superset/pull/24117?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | |
... and [285 files with indirect coverage changes](https://app.codecov.io/gh/apache/superset/pull/24117/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)
: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=apache)
--
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 #24117: chore: Refactor command exceptions
Posted by "john-bodley (via GitHub)" <gi...@apache.org>.
john-bodley merged PR #24117:
URL: https://github.com/apache/superset/pull/24117
--
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