🌐 [translation-sync] [numba.md] Update np.random → Generator API#133
Conversation
✅ Deploy Preview for majestic-griffin-10b166 ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-15 📝 Translation Quality
Summary: ترجمه بخش تغییر یافته 'Exercises' با کیفیت بالا، دقت مفهومی خوب، رعایت اصطلاحات فنی مطابق گلاسری، و حفظ کامل ساختار Markdown/MyST انجام شده است. هیچ خطای نحوی یافت نشد و مشکلات جدی در محتوا مشاهده نمیشود؛ نکات ارائهشده صرفاً پیشنهادهای جزئی سبک نگارشی هستند. ترجمه بخش Exercises دقیق، روان و با حفظ کامل ساختار MyST/Markdown از جمله دایرکتیوهای exercise/solution انجام شده است اصطلاحات فنی مانند 'data race'، 'thread-safe'، 'Generator' و 'prange' با توضیحات مناسب و ارجاع به گلاسری حفظ شدهاند معادلات ریاضی، بلوکهای کد و ارجاعات متقابل (cross-references) بهدرستی بدون تغییر باقی ماندهاند لحن آکادمیک و طبیعی فارسی در توضیحات تمرینها و راهحلها بهخوبی رعایت شده است Suggestions:
🔍 Diff Quality
Summary: The translation sync correctly added all new content (intro paragraph, code cells, two new exercises/solutions, note block) in matching positions within the single modified file, with no heading changes required or missed. This review was generated automatically by action-translation review mode. |
✅ Translation Quality ReviewVerdict: PASS | Model: claude-sonnet-5 | Date: 2026-07-15 📝 Translation Quality
Summary: The translation of the Exercises section is highly accurate, fluent, and terminologically consistent with the established glossary. Technical concepts around Numba, parallelization, Monte Carlo simulation, and data races are rendered clearly in Persian while preserving all code, math, and MyST formatting. Minor stylistic inconsistencies exist in code comment translation choices and occasional informal phrasing, but these do not impact comprehension or technical accuracy. Technical terminology (Monte Carlo, JIT, parallelization, data race, generator) is translated accurately and consistently with appropriate transliteration where needed (e.g., 'رقابت داده' for data race) Mathematical notation and LaTeX equations are preserved correctly throughout the Exercises section Code blocks, MyST directives (exercise, solution-start/end, hint), and cross-references (e.g., {ref} Suggestions:
🔍 Diff Quality
Summary: The translation sync correctly added all new content (intro paragraph, modified exercises, two new exercises, and the note block) in the same positions as the source, with proper translation and no structural or scope issues. This review was generated automatically by action-translation review mode. |
There was a problem hiding this comment.
Pull request overview
This PR syncs the Persian (fa) translation of the Numba lecture with upstream changes that migrate examples away from legacy np.random.* usage toward the NumPy Generator API, including new material explaining correctness/performance tradeoffs under parallel execution.
Changes:
- Pre-generates Monte Carlo draws using
np.random.default_rng()and passes them into JIT-compiled functions instead of drawing vianp.random.uniform()inside loops. - Adds new exercises/solutions discussing RNG data races in
prangeand safe approaches under parallel Numba execution. - Updates translation sync state metadata (source SHA, sync date, model, tool version).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| lectures/numba.md | Updates translated lecture content and exercises to use Generator-based RNG patterns and adds explanations about parallel RNG safety. |
| .translate/state/numba.md.yml | Updates translation sync metadata to match the upstream source commit and tooling/model versions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @jit(parallel=True) | ||
| def calculate_pi(n=1_000_000): | ||
| def calculate_pi_parallel(u_draws, v_draws): | ||
| n = len(u_draws) |
Ports the fix from QuantEcon/lecture-python-programming.fr#7. This repo has the identical trigger list and no concurrency guard, and the bug is already reproducing here: PR #133 carries two "Translation Quality Review" comments, scoring 9.2/10 and 8.8/10, both posted at 23:51:37. A single translation sync fires `opened` plus one `labeled` event per label applied, all within a couple of seconds. Each starts its own run of this workflow, and the review action's "update existing comment, else create" logic is a check-then-act with no lock: concurrent runs all see "no comment yet" and each create one. On PR #133 three runs fired; two logged `Posted review comment` and one logged `Updated existing review comment`, leaving two independent reports of the same diff and three full model calls where one was intended. Add a per-PR concurrency group so runs queue instead of racing — the first creates the comment, any later run updates it. cancel-in-progress is left false on purpose: the labels are applied in one API call so event order is not guaranteed, and cancelling would let a `labeled` event for 'automated' kill the in-flight review and then skip its own job, leaving no review at all. Also ignore `labeled` events for labels other than 'action-translation', which removes the redundant review triggered by the 'automated' label. The underlying unsynchronised upsert is tracked in QuantEcon/action-translation#96. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Ports the fix from QuantEcon/lecture-python-programming.fr#7. This repo has the identical trigger list and no concurrency guard, and the bug is already reproducing here: PR #133 carries two "Translation Quality Review" comments, scoring 9.2/10 and 8.8/10, both posted at 23:51:37. A single translation sync fires `opened` plus one `labeled` event per label applied, all within a couple of seconds. Each starts its own run of this workflow, and the review action's "update existing comment, else create" logic is a check-then-act with no lock: concurrent runs all see "no comment yet" and each create one. On PR #133 three runs fired; two logged `Posted review comment` and one logged `Updated existing review comment`, leaving two independent reports of the same diff and three full model calls where one was intended. Add a per-PR concurrency group so runs queue instead of racing — the first creates the comment, any later run updates it. cancel-in-progress is left false on purpose: the labels are applied in one API call so event order is not guaranteed, and cancelling would let a `labeled` event for 'automated' kill the in-flight review and then skip its own job, leaving no review at all. Also ignore `labeled` events for labels other than 'action-translation', which removes the redundant review triggered by the 'automated' label. The underlying unsynchronised upsert is tracked in QuantEcon/action-translation#96. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Automated Translation Sync
This PR contains automated translations from QuantEcon/lecture-python-programming.
Source PR
#550 - [numba.md] Update np.random → Generator API
Files Updated
lectures/numba.md.translate/state/numba.md.ymlDetails
This PR was created automatically by the translation action.