Align src codebase with latest Ruff ruleset - #47
Conversation
Co-authored-by: enryH <2833836+enryH@users.noreply.github.com>
src codebase with latest Ruff ruleset
| if offset > 1: | ||
| return xticks[::offset] | ||
| else: | ||
| xticks |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b25e7d7657
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| nx.set_node_attributes(graph, betweenness, "betweenness") | ||
| nx.set_node_attributes(graph, ev_centrality, "eigenvector") | ||
| except Exception as e: | ||
| except (nx.NetworkXException, ValueError) as e: |
There was a problem hiding this comment.
Keep handling eigensolver convergence failures
When nx.eigenvector_centrality_numpy fails to converge for a valid 6–149-edge input graph, SciPy raises scipy.sparse.linalg.ArpackNoConvergence, which is neither a NetworkXException nor a ValueError. The previous broad handler allowed get_network to continue rendering with degree-based sizing, but this narrowed tuple now lets that exception abort the entire network visualization; include the documented eigensolver exception in the fallback handling.
Useful? React with 👍 / 👎.
This updates
srcto satisfy the latestruff check srcrequirements by addressing each reported error type with targeted refactors. Changes are scoped to lint-driven correctness/style updates without introducing new features.Lint-driven cleanups across
srcManual fixes for non-auto-fixable findings
open(...)usage with context managers in file-upload helpers.enumerate(...)where required.ifblocks into single conditions where semantics were unchanged.except Exceptionhandlers with narrower exception tuples in touched paths..items()when both key/value are used.Behavior-preserving return-path corrections
xticksdirectly in fallback paths).