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

remove deprecated imp, fix docstring warning #1331

Merged
merged 1 commit into from Feb 22, 2024

Conversation

perib
Copy link
Contributor

@perib perib commented Nov 28, 2023

imp is deprecated in Python 12. This was only used in one function which I replaced with the equivalent function found in the types module.

Also, the docstrings that contained backslashes were causing a warning to be called every time that was imported. These were probably intended for latex formatting, but Python reads them differently. I turned those into literal docstrings so that the Python interpretation of escape sequences was ignored, which stopped the warnings.

@perib
Copy link
Contributor Author

perib commented Nov 28, 2023

Forgot to mention this issue was brought up in #1327

@jay-m-dev
Copy link
Contributor

The suggested fix seems to work, but the Python docs suggest using importlib instead of imp.
We should further assess which solution is better: the suggested types.ModuleType or importlib.util.module_from_spec() as documented here.

Copy link
Contributor

@jay-m-dev jay-m-dev left a comment

Choose a reason for hiding this comment

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

The Python docs recommend using importlib instead of the imp package. However, upon further research and testing types.ModuleType works here as well. There's no clear benefit of using one over the other.
Accepting this update as-is.

@jay-m-dev jay-m-dev merged commit a8f7eb0 into EpistasisLab:master Feb 22, 2024
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.

None yet

2 participants