-
Notifications
You must be signed in to change notification settings - Fork 21
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 STUserDict
#191
Remove STUserDict
#191
Conversation
Leaving this as a draft until all the regression tests are functional again. This will need to be carefully tested. |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #191 +/- ##
==========================================
- Coverage 97.93% 97.84% -0.10%
==========================================
Files 9 8 -1
Lines 1258 1204 -54
==========================================
- Hits 1232 1178 -54
Misses 26 26
☔ View full report in Codecov by Sentry. |
def find_mod_objs_patched(*args, **kwargs): | ||
from sphinx_automodapi.utils import find_mod_objs | ||
|
||
return find_mod_objs(args[0], onlylocals=True) | ||
|
||
|
||
def patch_automodapi(app): | ||
"""Monkey-patch the automodapi extension to exclude imported members""" | ||
from sphinx_automodapi import automodsumm | ||
|
||
automodsumm.find_mod_objs = find_mod_objs_patched | ||
|
||
|
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.
Monkey patches like this are generally a bad idea. The whole reason for the need of this patch was poor construction of stuserdict.py
module to begin with. #156 (comment) details a couple of different ways of properly resolving this without monkey patching. However, all of those options are moot because this PR removes stuserdict.py
, which side steps the issue completely.
0694c53
to
3962d7c
Compare
The regression tests passed: https://plwishmaster.stsci.edu:8081/job/RT/job/Roman-devdeps/298/ so this is ready. |
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.
LGTM
85b1346
to
0bf3808
Compare
These are important to demonstrate the copy behavior does not change when we remove STUserDict
We imply these stnode based objects should be self copyable, so this makes them self copyable.
It is no longer being used.
0bf3808
to
0dac8ab
Compare
STUserDict
is essentially a copy of the Python standard library'scollections.UserDict
source code with the change of name and the change of thedata
(UserDict
) variable to_data
(STUserDict
). This copy was a little while ago and is no longer "in-sync" with the standard library's version.It turns out that this approach is a bit "overkill" for what
DNode
(what usesSTUserDict
) actually needs. Instead it just needs to be an abstract mutable mapping (abc.MutableMapping).This PR switches
DNode
from usingSTUserDict
toabc.MutableMapping
which solves this issue. It also removesSTUserDict
because it is no-longer necessary.Checklist
CHANGES.rst
under the corresponding subsection