Feature: Adding callback module to implement custom filters#9
Open
lhpt2 wants to merge 23 commits intoSirRodriguez:mainfrom
Open
Feature: Adding callback module to implement custom filters#9lhpt2 wants to merge 23 commits intoSirRodriguez:mainfrom
lhpt2 wants to merge 23 commits intoSirRodriguez:mainfrom
Conversation
added 22 commits
April 30, 2024 16:32
This adds a command line flag for giving a filename to write a dotfile to.
The dotfile can than be processed further and be plotted by tools like graphviz.
Merge branch 'dev' of github.com:lhpt2/PythonImportVisualizer into dev
…opmodule or specific submodules (or both) The function `add_immediate_deps_to_modules` and `get_fq_immediate_deps` get two additional keyword arguments for handing over callback functions that take module names and return a boolean value advertising if a module should be processed (return true) or not (return false). The lookup for these callback functions happens in a module called modfilter and the callback functions are named `pkgfilterfunc` and `modfilterfunc` by default. If the module is not existent, standard behavior is assumed (no custom filtering). If the module exists but neither `pkgfilterfunc` nor `modfilterfunc` are defined in the module, a notice is logged to stderr at the end. For logging to stderr, a convenience function eprint is introduced.
…zer into ft-filterfuncs
module from the graph.
to return False to exclude a module
… in `get_fq_immediate_deps`) and remove debug prints.
of `import_mod_filter_func` and fix/improve `eprint` convenience function
function implemented.
Owner
|
Looks good. Can you fix the merge conflicts and I'll review it again. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ok, this will be my last suggestion :D
Problem: No ability to easily implement a custom filter logic.
Solution: Adding a module
modfilter.pythat implements two callback functionsimport_mod_filter_funcandparent_mod_filter_functo allow for custom checks on module names for the import module names as well as for the listed project module names. The main modulevis.pychecks for the existence ofmodfilter.pyand the according callback functions and calls the callback functions accordingly, so that a non existent modfilter module or callback functions doesn't break functionality.