Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use contextlib.surpress instead of passing on error #24896

Merged
merged 8 commits into from
Aug 29, 2023

Conversation

sebastianliebscher
Copy link
Contributor

@sebastianliebscher sebastianliebscher commented Aug 5, 2023

SUMMARY

This PR uses contextlib's suppress for passing a specific error, instead of passing in an exception handler. The context manager shortens the code a bit and explicitly states the authors intend to ignore specific errors, thus improving readability.

Also, if I found the possibility, I used the walrus (:=) operator.

TESTING INSTRUCTIONS

run unit and integration tests

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • 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

@sebastianliebscher sebastianliebscher changed the title Use contextlib chore: use contextlib.surpress instead of passing an error Aug 5, 2023
@codecov
Copy link

codecov bot commented Aug 5, 2023

Codecov Report

Merging #24896 (a9edbb5) into master (7397ab3) will increase coverage by 0.06%.
The diff coverage is 71.15%.

❗ Current head a9edbb5 differs from pull request most recent head c1d4e4e. Consider uploading reports for the commit c1d4e4e to get more accurate results

@@            Coverage Diff             @@
##           master   #24896      +/-   ##
==========================================
+ Coverage   68.96%   69.02%   +0.06%     
==========================================
  Files        1906     1906              
  Lines       74122    74075      -47     
  Branches     8208     8208              
==========================================
+ Hits        51116    51132      +16     
+ Misses      20883    20820      -63     
  Partials     2123     2123              
Flag Coverage Δ
hive 54.24% <44.23%> (+0.07%) ⬆️
mysql 79.29% <67.30%> (+0.07%) ⬆️
postgres 79.40% <67.30%> (?)
presto 54.14% <46.15%> (+0.07%) ⬆️
python 83.45% <71.15%> (+0.15%) ⬆️
sqlite 77.97% <67.30%> (+0.08%) ⬆️
unit 55.13% <42.30%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
superset/common/tags.py 0.00% <0.00%> (ø)
superset/db_engine_specs/trino.py 86.66% <33.33%> (+2.92%) ⬆️
superset/db_engine_specs/bigquery.py 71.06% <50.00%> (+0.62%) ⬆️
superset/views/core.py 70.69% <54.54%> (+1.23%) ⬆️
superset/db_engine_specs/presto.py 88.75% <66.66%> (+0.75%) ⬆️
superset/charts/data/api.py 88.69% <100.00%> (-0.27%) ⬇️
superset/db_engine_specs/gsheets.py 77.94% <100.00%> (+1.29%) ⬆️
superset/db_engine_specs/mysql.py 98.83% <100.00%> (-0.02%) ⬇️
superset/db_engine_specs/ocient.py 53.27% <100.00%> (+0.43%) ⬆️
superset/explore/commands/get.py 90.32% <100.00%> (-0.11%) ⬇️
... and 6 more

... and 9 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@sebastianliebscher sebastianliebscher marked this pull request as ready for review August 5, 2023 11:43
@sebastianliebscher sebastianliebscher marked this pull request as draft August 5, 2023 22:20
@sebastianliebscher sebastianliebscher marked this pull request as ready for review August 5, 2023 22:20
Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sebastianliebscher for the refactor and code cleanup.

@john-bodley john-bodley changed the title chore: use contextlib.surpress instead of passing an error chore: use contextlib.surpress instead of passing on error Aug 24, 2023
@rusackas rusackas merged commit e585db8 into apache:master Aug 29, 2023
31 checks passed
@sebastianliebscher sebastianliebscher deleted the use_contextlib branch August 30, 2023 02:05
darwinsubramaniam pushed a commit to darwinsubramaniam/superset that referenced this pull request Sep 7, 2023
)

Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com>
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
)

Co-authored-by: John Bodley <4567245+john-bodley@users.noreply.github.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants