-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: replace 9 bare except clauses with except Exception #2772
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -607,7 +607,7 @@ def js_to_python( | |
| try: | ||
| if (line.replace(" ", ""))[line.find("!") + 1] != "=": | ||
| line = line.replace("!", "not ") | ||
| except: | ||
| except Exception: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| print("continue...") | ||
|
Comment on lines
+610
to
611
|
||
|
|
||
| line = line.rstrip() | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -546,7 +546,7 @@ def widget_template( | |
|
|
||
| try: | ||
| toolbar_button = ipywidgets.ToggleButton(**widget_args) | ||
| except: | ||
| except Exception: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| widget_args.pop("layout") | ||
| toolbar_button = ipywidgets.ToggleButton(**widget_args) | ||
| toolbar_button.layout.width = "28px" | ||
|
Comment on lines
547
to
552
|
||
|
|
@@ -555,7 +555,7 @@ def widget_template( | |
|
|
||
| try: | ||
| close_button = ipywidgets.ToggleButton(**close_button_args) | ||
| except: | ||
| except Exception: | ||
| close_button_args.pop("layout") | ||
| close_button = ipywidgets.ToggleButton(**close_button_args) | ||
| close_button.layout.width = "28px" | ||
|
Comment on lines
556
to
561
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4372,7 +4372,7 @@ def add_labels( | |
|
|
||
| try: | ||
| size = int(font_size.replace("pt", "")) | ||
| except: | ||
| except Exception: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| raise ValueError("font_size must be something like '10pt'") | ||
|
Comment on lines
+4375
to
4376
|
||
|
|
||
| labels = [] | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,7 +27,7 @@ | |
|
|
||
| try: | ||
| from PIL import Image, ImageDraw, ImageFont, ImageSequence | ||
| except: | ||
| except Exception: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| pass | ||
|
Comment on lines
+30
to
31
|
||
|
|
||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
tryblock performs dictionary lookups and callsmin()/max()on list comprehensions. These operations can raiseKeyError(if a key is missing) orValueError(if the list is empty). Catching these specific exceptions is preferred over the broadExceptionclass to avoid masking unrelated logic errors.