Skip to content

fix: use except Exception and is not None in data_selection/utils.py#365

Closed
harshadkhetpal wants to merge 265 commits intomicrosoft:mainfrom
harshadkhetpal:fix/pep8-utils
Closed

fix: use except Exception and is not None in data_selection/utils.py#365
harshadkhetpal wants to merge 265 commits intomicrosoft:mainfrom
harshadkhetpal:fix/pep8-utils

Conversation

@harshadkhetpal
Copy link
Copy Markdown

Summary

Two PEP8 / correctness fixes in data_selection/utils.py:

  1. Bare except:except Exception: — The import guard for transformers.mpu used a bare except: which silently catches KeyboardInterrupt and SystemExit. Since there is no re-raise, except Exception: is the correct choice — it catches all regular import errors while letting system signals propagate.

  2. != Noneis not None — PEP8 E711: comparisons to None should always use is / is not, not == / !=.

Changes:

# Before
except:
    mpu = None

# After
except Exception:
    mpu = None
# Before
if args.save != None:

# After
if args.save is not None:

Testing

No behavior change — style/correctness fixes only.

Tianzhu Ye and others added 28 commits November 17, 2025 19:51
update model checkpoint link
GAD add more installation guide in readme
GAD add data preparation script
GAD add code walk-through and explain about rouge-l
add code for OEL(online experiential learning)
Two PEP8/correctness fixes:
1. Replace bare `except:` with `except Exception:` on import guard
2. Replace `!= None` comparison with `is not None` (PEP8 E711)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.