Fix two runtime warnings: non-writable array and docstring escape#348
Conversation
- _default_dataset.py: h5py-backed arrays are read-only, so torch.as_tensor emitted "NumPy array is not writable" when converting kpoint/eigenvalue data. Add .copy() to produce a writable array before the tensor conversion. - test_feast_wrapper.py: the docstring "Ax = \lambda Mx" used an invalid escape sequence (SyntaxWarning on Python 3.12+). Switch to a raw string. Local not-slow run: warnings drop 84 -> 75, 447 passed, 0 failed. The remaining warnings are all external-library debt (pythtb 1.x->2.x migration, spglib OLD_ERROR_HANDLING, ASE numpy 2.0 __array__, torch.jit) tracked in separate migration tasks.
|
Warning Review limit reached
More reviews will be available in 30 minutes and 21 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughDataset frame conversion now copies per-frame k-point and eigenvalue arrays before tensor creation. The unit test workflow now gates the build job by repository owner and removes a dependent job. One test docstring was changed to a raw string literal. ChangesDataset tensor copy and workflow cleanup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
This advisory review plan was generated from changed file names using trusted base-branch code. DeePTB PR Review Plan / DeePTB PR 审查计划Risk / 风险等级: Medium (中) · Changed files / 变更文件: 3 Why / 风险来源
Recommended Review / 建议审查重点
Detailed risk areas
Human review focus
Local commands and hold conditionsSuggested local commands:
Hold conditions:
Advisory only. / 仅作为审查辅助。 |
job2 depended on build only to echo unset/removed outputs ($OUTPUT1 was never declared in env; $OUTPUT2/$OUTPUT3 came from build outputs that the build steps never set — output3 was deleted back in deepmodeling#23 but job2's reference was left). It ran ~9s per PR with no effect. Drop job2 and the now-unread build outputs block.
The job checks out the PR, installs DeePTB, and runs ut.sh. It does no build/compile step and produces no artifact, so "build" is a historical misnomer. Rename to "test". No branch-protection required checks reference the old name, and no other workflow/job reads this job by name.
Summary
Two small DeePTB-side warning fixes from the dependency-baseline review (#346).
dptb/data/dataset/_default_dataset.py: h5py-backed arrays are read-only (writeable=False), sotorch.as_tensoremittedUserWarning: The given NumPy array is not writablewhen converting kpoint/eigenvalue data. Add.copy()to produce a writable array before the tensor conversion. ([:]slicing does not help — a slice of a read-only array stays read-only; only.copy()makes it writable.)dptb/tests/test_feast_wrapper.py: the docstringAx = \lambda Mxused an invalid escape sequence, raisingSyntaxWarningon Python 3.12+. Switch to a raw stringr"""...""".Scope
Two files, three lines. No behavioral change.
Tests
Local
not slow(Python 3.12, numpy 2.4.6, torch 2.12.1): 447 passed, 0 failed, warnings 84 → 75. The two targeted warnings are gone (grep count 0).Remaining warnings (not in this PR — all external-library debt)
tb_model/get_orbdeprecation → tracked: pythtb 1.x→2.x migrationOLD_ERROR_HANDLING→ tracked: spglib error-handling migration (2.8.0 flips the default)__array__copy keyword → ASE adapting to numpy 2.0 protocoltorch.jit.scriptdeprecated → TorchScript migration taskMerge decision
Mergeable. Independent of #346 (dependency baseline) and #347 (sfd fix); this is a standalone code cleanup.
Summary by CodeRabbit