[Repo Assist] refactor(graph_learners): replace wildcard imports with explicit imports - #1815
Open
github-actions[bot] wants to merge 1 commit into
Open
github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
Replace wildcard imports from graph_operations with explicit imports of the required symbols (adjacency_matrix_to_graph, str_to_dot). This improves code clarity, makes dependencies explicit, and enables better static analysis and import ordering. Changes: - GES: add explicit numpy import - CDT: add explicit networkx and numpy imports - LINGAM: add explicit numpy import No functional changes; all three modules now have clear visibility into their dependencies. Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Refactors graph learner modules to improve clarity and static analysis by replacing wildcard imports from dowhy.utils.graph_operations with explicit symbol imports.
Changes:
- Replaced
from dowhy.utils.graph_operations import *withadjacency_matrix_to_graphandstr_to_dotimports in GES/CDT/LiNGAM. - Added explicit third-party imports (
numpy,networkx) where needed to avoid implicit dependencies.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| dowhy/graph_learners/ges.py | Replaces wildcard graph_operations import with explicit imports; adds explicit numpy import. |
| dowhy/graph_learners/cdt.py | Replaces wildcard graph_operations import with explicit imports; adds explicit networkx and numpy imports. |
| dowhy/graph_learners/lingam.py | Replaces wildcard graph_operations import with explicit imports; adds explicit numpy import. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
🤖 This is an automated response from Repo Assist.
Summary
Improved code clarity by replacing wildcard imports from
graph_operationswith explicit imports of required symbols in the graph learner modules (GES, CDT, LINGAM). This is a coding improvement for better maintainability and static analysis.Changes
GES (
dowhy/graph_learners/ges.py):import numpy as npfrom dowhy.utils.graph_operations import *with explicit imports ofadjacency_matrix_to_graphandstr_to_dotCDT (
dowhy/graph_learners/cdt.py):import networkx as nxandimport numpy as npadjacency_matrix_to_graphandstr_to_dotLINGAM (
dowhy/graph_learners/lingam.py):import numpy as npadjacency_matrix_to_graphandstr_to_dotRationale
Wildcard imports obscure dependencies and make static analysis harder. Explicit imports clarify what symbols each module depends on, improving code maintainability and enabling better import ordering tools (isort, black).
Test Status
✅ Python syntax validation passed for all three modified files