Repository navigation
Conversation
Drop --preview from ruff in pre-commit and the Python code quality workflow, and remove the preview-only pydoclint (DOC) selection and ignores, which have no effect without preview.
rand() drew from the generator shared by the whole program, which hands out values to whichever thread asks first, so r.mapcalc evaluated expressions with rand() on one thread only, whatever nprocs was. Every rand() call draws one value per cell of a row, and every row evaluates every call once, so a row draws columns times calls values. r.mapcalc now builds an exact random number layout from the seed with a row as its unit (in r3.mapcalc, the rows of all depths one after another), and each row places a generator state of its own at its stream before it is evaluated. The state is local to the evaluation of the row, so the draws of different threads do not write to the same cache line. The streams of an exact layout are the parts of the sequence which the rows drew when they were evaluated one after another from the shared generator, so the result for a seed stays the same as in earlier versions and is the same for any nprocs, and rand() no longer turns off parallel evaluation. A warning is given when the whole computation draws more than 2^46 values, after which the values repeat plus a constant. The seed is read with G_random_seed_from_option(), so a seed outside -2147483648 to 4294967295 is now an error rather than being silently reduced to its low 32 bits, and a seed with trailing characters is an error rather than being cut off. The automatic seed comes from G_random_generate_seed(), so it can be set with GRASS_RANDOM_SEED or SOURCE_DATE_EPOCH, and is still written to the history. rand() stays in the calc library. The library gains calc_set_random_state(), through which a tool gives rand() a function returning the calling thread's generator state, and r.mapcalc sets it to the state it places for the row. When no function is set, rand() draws from the generator shared by the whole program as before, so other users of the library get the same values as before.
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.
Description
Stop using
--previewforruff checkin pre-commit and in the Python code quality workflow. The preview-only pydoclint (DOC) selection and its ignores are removed frompyproject.toml, since they have no effect without preview and make ruff emit a warning.Motivation and context
Preview mode brings less useful fixes; the stable rule set is preferred.
How has this been tested?
ruff check .passes with the stable settings and no warnings.Types of changes
Checklist
Generated by Claude Code