Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcd16a35

Browse files
committed
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 achange made in a docstring.
1 parentadd46d9 commitcd16a35

37 files changed

+2370
-1892
lines changed

‎git/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
#
44
# This module is part of GitPython and is released under
55
# the BSD License: https://opensource.org/license/bsd-3-clause/
6+
67
# flake8: noqa
78
# @PydevCodeAnalysisIgnore
9+
810
fromgit.excimport*# @NoMove @IgnorePep8
911
fromtypingimportList,Optional,Sequence,Tuple,Union,TYPE_CHECKING
1012
fromgit.typesimportPathLike

‎git/cmd.py

Lines changed: 184 additions & 173 deletions
Large diffs are not rendered by default.

‎git/compat.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
# -*- coding: utf-8 -*-
2-
#config.py
2+
#compat.py
33
# Copyright (C) 2008, 2009 Michael Trier (mtrier@gmail.com) and contributors
44
#
55
# This module is part of GitPython and is released under
66
# the BSD License: https://opensource.org/license/bsd-3-clause/
7-
"""utilities to help provide compatibility with python 3"""
7+
8+
"""Utilities to help provide compatibility with Python 3."""
9+
810
# flake8: noqa
911

1012
importlocale
@@ -50,7 +52,7 @@ def safe_decode(s: AnyStr) -> str:
5052

5153

5254
defsafe_decode(s:Union[AnyStr,None])->Optional[str]:
53-
"""Safelydecodes a binary string tounicode"""
55+
"""Safelydecode a binary string toUnicode."""
5456
ifisinstance(s,str):
5557
returns
5658
elifisinstance(s,bytes):
@@ -72,7 +74,7 @@ def safe_encode(s: AnyStr) -> bytes:
7274

7375

7476
defsafe_encode(s:Optional[AnyStr])->Optional[bytes]:
75-
"""Safelyencodes a binary string tounicode"""
77+
"""Safelyencode a binary string toUnicode."""
7678
ifisinstance(s,str):
7779
returns.encode(defenc)
7880
elifisinstance(s,bytes):
@@ -94,7 +96,7 @@ def win_encode(s: AnyStr) -> bytes:
9496

9597

9698
defwin_encode(s:Optional[AnyStr])->Optional[bytes]:
97-
"""Encodeunicodes for process arguments on Windows."""
99+
"""EncodeUnicode strings for process arguments on Windows."""
98100
ifisinstance(s,str):
99101
returns.encode(locale.getpreferredencoding(False))
100102
elifisinstance(s,bytes):

‎git/config.py

Lines changed: 122 additions & 103 deletions
Large diffs are not rendered by default.

‎git/db.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
"""Module with our own gitdb implementation - it uses the git command"""
1+
"""Module with our own gitdb implementation - it uses the git command."""
2+
23
fromgit.utilimportbin_to_hex,hex_to_bin
34
fromgitdb.baseimportOInfo,OStream
45
fromgitdb.dbimportGitDB
@@ -22,17 +23,17 @@
2223

2324

2425
classGitCmdObjectDB(LooseObjectDB):
25-
2626
"""A database representing the default git object store, which includes loose
27-
objects, pack files and an alternates file
27+
objects, pack files and an alternates file.
2828
2929
It will create objects only in the loose object database.
30-
:note: for now, we use the git command to do all the lookup, just until he
31-
have packs and the other implementations
30+
31+
:note: For now, we use the git command to do all the lookup, just until we
32+
have packs and the other implementations.
3233
"""
3334

3435
def__init__(self,root_path:PathLike,git:"Git")->None:
35-
"""Initialize this instance with the root and a git command"""
36+
"""Initialize this instance with the root and a git command."""
3637
super(GitCmdObjectDB,self).__init__(root_path)
3738
self._git=git
3839

@@ -48,11 +49,15 @@ def stream(self, binsha: bytes) -> OStream:
4849
# { Interface
4950

5051
defpartial_to_complete_sha_hex(self,partial_hexsha:str)->bytes:
51-
""":return: Full binary 20 byte sha from the given partial hexsha
52+
"""
53+
:return: Full binary 20 byte sha from the given partial hexsha
54+
5255
:raise AmbiguousObjectName:
5356
:raise BadObject:
54-
:note: currently we only raise BadObject as git does not communicate
55-
AmbiguousObjects separately"""
57+
58+
:note: Currently we only raise :class:`BadObject` as git does not communicate
59+
AmbiguousObjects separately.
60+
"""
5661
try:
5762
hexsha,_typename,_size=self._git.get_object_header(partial_hexsha)
5863
returnhex_to_bin(hexsha)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp