Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revise comments, docstrings, some messages, and a bit of code #1725

Merged
merged 36 commits into from
Oct 30, 2023

Commits on Oct 22, 2023

  1. Fix docstrings that intend '\' literally

    This intended '\' literally, but it was actually '' because the \'
    became just ' (backslash-apostrophe becomes just aspostrophe).
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    7dd2095 View commit details
    Browse the repository at this point in the history
  2. Put all regex patterns in r-strings

    This improves consistency, because most were already. For a few it
    allows backslashes to removed, improving readability. Even for the
    others, some editors will highlight them as regular expressions now
    that they are raw string literals.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    ffcbf07 View commit details
    Browse the repository at this point in the history
  3. Remove r prefix from strings that need not be raw

    These are a couple strings that, in addition to not having any
    escape sequences, don't represent regular expressions, Windows
    paths, or anything else that would be clarified by raw literals.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    2c94b6a View commit details
    Browse the repository at this point in the history
  4. Fix _index_from_*_format docstrings (proc reading)

    In the git.diff.Diff class, the _index_from_patch_format and
    _index_from_raw_format methods' docstrings had still described them
    as reading from streams, even though they have instead read from
    processes (and taken "proc", not "stream", arguments) since gitpython-developers#519
    when the change was made in a5db3d3 to fix a freezing bug.
    
    This updates the docstrings to reflect that they read from
    processes.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    35fd65b View commit details
    Browse the repository at this point in the history
  5. Fix case in IndexObject.abspath exception message

    The message refers to the (public) working_tree_dir attribute by
    name, so that should be uncapitalized to reflect the case by which
    it must be accessed, even when it appears at the beginning of a
    sentence.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    5af7446 View commit details
    Browse the repository at this point in the history
  6. Remove Commit._deserialize doc for param_from_rev_list

    The git.objects.commit.Commit._deserialize method stopped accepting
    a param_from_rev_list argument in ae5a69f, but the documentation
    for that parameter was never removed.
    
    Because that was the only part of the method's docstring, and it is
    a nonpublic method, and the associated _serialize method does not
    have a docstring, this change simply removes the _deserialize
    method's docstring without adding anything.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    692e59e View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    ab46192 View commit details
    Browse the repository at this point in the history
  8. Remove obsolete comment in Submodule.module

    The local (i.e. late) import was removed in 7b3ef45, but the
    comment about it on (what was) the preceding line has persisted
    until now.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    1114828 View commit details
    Browse the repository at this point in the history
  9. Clarify "master repository" in RootModule docs

    This changes
    
        master repository
    
    to
        superproject (master repository)
    
    in the RootModule class docstring and in the tutorial, to make even
    clearer what this is referring to. This way, users who are less
    familiar with submodules will be less likely to confuse this with
    a "master" branch (since "master" is one of the popular default
    branch names), while users who are more familiar with submodules
    and may search for the official term "superproject" will find the
    docs when doing so.
    
    This retains "master repository" parenthesized rather than
    completely replacing it because although "superproject" is the
    official term for this, it is a bit obscure and unintuitive.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    f95d4fd View commit details
    Browse the repository at this point in the history
  10. Change spelling from "commit'ish" to "commit-ish"

    Since the hyphen spelling is what the official Git docs use.
    
    This change affects only docstrings.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    9fea488 View commit details
    Browse the repository at this point in the history
  11. Update git-source citation in Reference.set_object

    Reference.set_object explains its handling of oldbinsha by quoting
    a comment from refs.c in the Git source code. However, that comment
    now appears in refs/files-backend.c in that codebase. This updates
    the reference so readers can look it up and find the comment in its
    surrounding context.
    
    The commit to the git project's source code that moved the code
    that includes that comment is:
    
    git/git@7bd9bcf
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    4536b63 View commit details
    Browse the repository at this point in the history
  12. Fix message in SymbolicReference.from_path

    This rarely-seen ValueError message had said SymbolicRef, and is
    now changed to SymbolicReference.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    59d208c View commit details
    Browse the repository at this point in the history
  13. Use "is" to compare __class__

    Since the value of __class__ is a type, comparing it to another
    type object should use "is" rather than "==".
    
    Some of these, involving type(), were fixed in bf7af69, but flake8
    did not catch the .__class__ variation addressed here.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    add46d9 View commit details
    Browse the repository at this point in the history
  14. Revise docstrings and comments for clarity and formatting

    In the git module (including the modules it contains).
    
    This also makes one small change in doc/ to synchronize with a
    change made in a docstring.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    cd16a35 View commit details
    Browse the repository at this point in the history
  15. Firm up comment about is_win in util.is_cygwin_git

    The is_cygwin_git function returns False when we have is_win,
    because is_win is not True on Cygwin systems. The existing comment
    explained why, but was tentative. The claims are accurate, so this
    rewrites the comment to state it more definitively.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    e8343e2 View commit details
    Browse the repository at this point in the history
  16. Remove explicit inheritance from object

    Within the git module.
    
    In Python 2, it was necessary to inherit from object to have a
    new-style class. In Python 3, all classes are new-style classes,
    and inheritance from object is implied.
    
    Usually, removing explicit inheritance from object is only a small
    clarity benefit while modernizing Python codebases. However, in
    GitPython, the benefit is greater, because it is possible to
    confuse object (the root of the Python class hierarchy) with
    Object (the root of the GitPython subhierarchy of classes
    representing things in the git object model).
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    f78587f View commit details
    Browse the repository at this point in the history
  17. Make all one-element __slots__ be tuples

    Most already were, but a few were strings.
    EliahKagan committed Oct 22, 2023
    Configuration menu
    Copy the full SHA
    0327f8f View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    d4a87c1 View commit details
    Browse the repository at this point in the history

Commits on Oct 23, 2023

  1. Revise docstrings/comments in most other test modules

    Intentionally untouched test modules in this commit:
    
    - Modules where there are no such changes to be made.
    
    - Modules in test/performance/ -- will be done separately.
    
    - test/lib/ modules (these are test *helpers* and will be done
      separately).
    
    - test/test_util.py, because although it has a few comments that
      might be improved, it may make more sense to do that together
      with some further refactoring changes.
    EliahKagan committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    11fce8a View commit details
    Browse the repository at this point in the history
  2. Add a module docstring to tstrunner.py

    It benefits from a docstring because it is not referenced in code
    or documentation, and its purpose is/was otherwise unclear.
    
    The docstring includes a reference to gitpython-developers#1188 for more information.
    EliahKagan committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    cf9243a View commit details
    Browse the repository at this point in the history
  3. Slightly improve readability of installation-test strings

    This modifies content of the strings themselves, but only slightly.
    
    - Make an exception message more readable.
    
    - Improve spacing of the "python -c" script string in the sys.path
      test.
    EliahKagan committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    b5c3ca4 View commit details
    Browse the repository at this point in the history
  4. More wording improvements (in git module)

    This futher improves some wording in docstrings and comments in a
    handful of places within the git module.
    EliahKagan committed Oct 23, 2023
    Configuration menu
    Copy the full SHA
    f444470 View commit details
    Browse the repository at this point in the history

Commits on Oct 24, 2023

  1. Change :returns: to :return:

    :return: was used extensively, while :returns: only appeared in two
    docstrings.
    EliahKagan committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    db317f1 View commit details
    Browse the repository at this point in the history
  2. Fix TestBigRepoR.setUp info message

    Changes that fix the message itself:
    
    - Add a missing space between words (two parts were concatenated,
      with no space at the edge of either).
    
    - Capitalize "GitPython" since that is the repo and project name.
    
    Changes that improve how the message is produced:
    
    - Make the entire literal part of the string the format string,
      instead of formatting the first part and concatenating the second
      part.
    
    - Pass the format string and k_env_git_repo variable as separate
      arguments to logging.info, so the logging machinery takes care of
      substituting it for %s, rather than doing the substitution.
    EliahKagan committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    720e4bb View commit details
    Browse the repository at this point in the history
  3. Remove outdated git_daemon_launched Windows info

    This removes the Windows-specific information in the warning
    message in git_daemon_launched.
    
    After the associated functionality was updated in gitpython-developers#1684 and the
    warning message was abridged accordingly, the functionality was
    updated again in gitpython-developers#1697, causing the message to be outdated and no
    longer helpeful (since having git-daemon.exe in a PATH directory is
    no longer necessary or useful), without any corresponding change to
    the message.
    EliahKagan committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    faa19ac View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    bffc537 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    30f49d9 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    8d3efc5 View commit details
    Browse the repository at this point in the history
  7. Improve consistency of "END" comments

    In the git module (including modules it contains).
    
    This does not add any new "# end" or "# END" comments. Instead, it
    improves the consistency and clarity of existing ones by converting
    each "# end" comment to "# END" (since capitalization was not used
    systematically to indicate nesting level or other semantic
    information, and capitalizing "END" makes clear the nature of the
    comment), and by adding some information to a few of the comments.
    
    This also removes end comments that did not provide information or
    significant visual indication that a "section" was ending, or where
    the visual indication they provided was at least as well provided
    by replacing them with a blank line. However, it does *not* attempt
    to apply this change everywhere it might be applicable.
    EliahKagan committed Oct 24, 2023
    Configuration menu
    Copy the full SHA
    a5fc1d8 View commit details
    Browse the repository at this point in the history

Commits on Oct 30, 2023

  1. Configuration menu
    Copy the full SHA
    c2eb6b5 View commit details
    Browse the repository at this point in the history
  2. Improve consistency of "END" comments in test suite

    As in the recent roughly corresponding change inside git/, this
    does not add new END comments (and actually removes some), but
    instead focuses on making the existing ones more consistent in
    style, mainly adjusting capitalization (turning "end" to "END").
    EliahKagan committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    ddb4417 View commit details
    Browse the repository at this point in the history
  3. Avoid making "END" notation more verbose

    This changes the style "END" comments appearing after local
    function definitions from "END def X" to "END X".
    
    Note that this still does not add such comments where they were not
    present, it only adjusts their style where they already existed.
    EliahKagan committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    1d3f275 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    81dad7e View commit details
    Browse the repository at this point in the history
  5. Shorten some docstring references with tilde notation

    This uses the Sphinx ~ notation to express references like:
    
        :class:`Z <a.b.c.Z>`
    
    In the abbreviated form, which Sphinx renders the same way:
    
        :class:`~a.b.c.Z`
    
    (This commit also makes some other polishing changes to affected
    and nearby text.)
    EliahKagan committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    a040edb View commit details
    Browse the repository at this point in the history
  6. Fix commented *.py names at the top of modules

    A number of them were incorrect, due to how files were renamed, and
    code moved between them, over time. Some were corrected earlier,
    and most of the rest are corrected here.
    
    Not all modules have these at all. This does not add any to modules
    that don't have them. It only fixes them where present but wrong.
    EliahKagan committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    af1b5d4 View commit details
    Browse the repository at this point in the history
  7. Remove encoding declarations

    In Python 3, UTF-8 is the default encoding when no encoding
    declaration is present, and omitting the encoding declaration when
    UTF-8 is intended is officially suggested.
    
    - https://docs.python.org/3/reference/lexical_analysis.html
    - https://pep8.org/#source-file-encoding
    
    Furthermore, not all files in this project had them (and their
    presence or absence seems to have been mainly for historical
    reasons rather than file contents).
    EliahKagan committed Oct 30, 2023
    Configuration menu
    Copy the full SHA
    b970d42 View commit details
    Browse the repository at this point in the history