Gimp 3 (2.99 for the time being) uses Pythonv3. Gimp 2.x uses Python v2.
The scripts you find in Gimp source code are included in your installed Gimp if the developers think they work well enough.
The source of Gimp 2.x Python scripts is
here. The source code repository has "branches", i.e. separate variants of the code where some (many in the case of the 2.x branches) of the files are different(*). The default branch is called
master (though on some overly politically correct system (GitHub) this has been renamed
main. You switch to a branch in the repository using the branch selector.
A (hopefully coherent) state of the code is called a "commit" which happens when a developer decides so. The commit is identified by a "hash" (which is a string of 40 hexadecimal digits, usually shortened to the first 8), so a branch is a sequence of commits. Specific commits can be given a "tag", so for instance you can retrieve the code used in the published 2.10.34 version by using the
GIMP_2_10_36 tag which has been set on commit
1651e6e7 (which is itself a shortening of the true hash
1651e6e767965cf055e05d13e075095d226f1c66).
TL;DR: If you aren't a developer, looking at the source code serves little purpose, if it works, it has been published, and if it isn't published, it is probably buggy.
(*) branches have two uses:
- Somewhat permanent branches to maintain different versions of the code: Gimp 2.x versus Gimp 3 for instance
- Temporary branches where developers can work without impacting others. When they do so they can periodically "rebase" their code by importing changes made to the branch they forked off, and when they are done "merge" their branch back to the code they forked off. Until the merge, "what happens in the branch stays in the branch"