[Repo Assist] fix: remove numpy/scipy symbol re-exports from datasets module (issue #981)#1429
Closed
github-actions[bot] wants to merge 1 commit intomainfrom
Closed
Conversation
…981) Remove bare 'from numpy.random import choice' and replace the three call sites with 'np.random.choice(...)'. This stops the numpy 'choice' symbol from appearing as part of dowhy.datasets's public API. Remove bare 'from scipy.stats import bernoulli, halfnorm, poisson, uniform' and replace all call sites in sales_dataset() with the already-imported alias 'ss.*' (scipy.stats is already imported as 'ss'). This stops four scipy distribution objects from polluting the module namespace and confusing Sphinx source-link generation. No functional change; behaviour is identical. Closes #981 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This was referenced Mar 31, 2026
Member
|
looks like this problem doesn't exist in the current docs. closing without merging. |
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 PR from Repo Assist, an AI assistant.
Summary
Closes #981.
Issue #981 reports that
dowhy.datasets.choiceanddowhy.datasets.randomappear in the generated documentation as if they were part of DoWhy's own API (they aren't — they leak in fromfrom numpy.random import choice). The same problem affectsbernoulli,halfnorm,poisson, anduniformfromscipy.stats.Root Cause
datasets.pyhad two bare star-like imports at module level:Because there is no
__all__in the module, every top-level name is exported. Sphinx picks them up and shows them in the module docs with broken[source]links (because their real source is in numpy/scipy, not datasets.py).Fix
choice(...)call sites withnp.random.choice(...)and remove the import.bernoulli/halfnorm/poisson/uniformcall sites insales_dataset()withss.bernoulli/ss.halfnorm/ss.poisson/ss.uniform—scipy.statsis already aliased asss— and remove thefrom scipy.stats import …line.No functional change; behaviour is identical.
Test Status
ast.parse)choice,bernoulli,halfnorm,poisson, oruniform(verified viagrep)Note
🔒 Integrity filtering filtered 109 items
Integrity filtering activated and filtered the following items during workflow execution.
This happens when a tool call accesses a resource that does not meet the required integrity or secrecy level of the workflow.
list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_pull_requests: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)list_issues: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".)