hamilton
hamilton copied to clipboard
Parses module in more robust way for fn gathering
inspect.getmodule(fn) depends on the state of sys.modules. This can break if you're doing repeated parsing -- E.G. running it then wiping sys.modules. Instead, we can just ask the function for its module. It's simpler, and won't break.
[Short description explaining the high-level reason for the pull request]
Changes
How I tested this
Notes
Checklist
- [ ] PR has an informative and human-readable title (this will be pulled into the release notes)
- [ ] Changes are limited to a single goal (no scope creep)
- [ ] Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
- [ ] Any change in functionality is tested
- [ ] New functions are documented (with a description, list of inputs, and expected output)
- [ ] Placeholder code is flagged / future TODOs are captured in comments
- [ ] Project documentation has been updated if adding/changing functionality.