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

[MRG] Update hide_modules.py #852

Merged
merged 5 commits into from
Jul 20, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions pynetdicom/tests/hide_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,13 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.

try:
import importlib.abc
import importlib.abc

# py>=3.3 has MetaPathFinder
_ModuleHiderBase = getattr(importlib.abc, "MetaPathFinder", importlib.abc.Finder)
except ImportError:
# py2
_ModuleHiderBase = object
# py>=3.3 has MetaPathFinder
_ModuleHiderBase = getattr(importlib.abc, "MetaPathFinder")
Copy link
Member

@mrbean-bremen mrbean-bremen Jul 20, 2023

Choose a reason for hiding this comment

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

Why still use getattr? Actually, this variable should not be needed anymore, just use

from importlib.abc import MetaPathFinder

class ModuleHider(MetaPathFinder):
    ...



class ModuleHider(_ModuleHiderBase):
class ModuleHider(MetaPathFinder)::
Copy link
Member

Choose a reason for hiding this comment

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

Typo - double colon.
Can you also please add 3.11 and 3.12-dev to the CI tests as mentioned above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uh, how to add 3.11 and 3.12-dev to the CI tests?
Sorry but I'm not very well versed to development, git and so on

Copy link
Member

Choose a reason for hiding this comment

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

Ok, I can just do it myself if you don't mind.

Copy link
Member

Choose a reason for hiding this comment

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

Just did it - I hope you don't mind...

"""Import finder hook to hide specified modules
ModuleHider(hidden_modules) -> instance
hidden_modules is a list of strings naming modules to hide.
Expand Down