Skip to content

Commit 160081b

Browse files
committed
Updated and fixed sphinx API docs, which included one quick skim-through
1 parent 6917ae4 commit 160081b

File tree

12 files changed

+124
-73
lines changed

12 files changed

+124
-73
lines changed

doc/reference.rst

+42-21
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,6 @@
33
API Reference
44
=============
55

6-
Actor
7-
-----
8-
9-
.. automodule:: git.actor
10-
:members:
11-
:undoc-members:
12-
136
Objects.Base
147
------------
158

@@ -45,12 +38,54 @@ Objects.Tree
4538
:members:
4639
:undoc-members:
4740

41+
Objects.Functions
42+
-----------------
43+
44+
.. automodule:: git.objects.fun
45+
:members:
46+
:undoc-members:
47+
48+
Objects.Submodule
49+
-----------------
50+
51+
.. automodule:: git.objects.submodule
52+
:members:
53+
:undoc-members:
54+
4855
Objects.Utils
4956
-------------
5057

5158
.. automodule:: git.objects.utils
5259
:members:
5360
:undoc-members:
61+
62+
Index.Base
63+
-------------
64+
65+
.. automodule:: git.index.base
66+
:members:
67+
:undoc-members:
68+
69+
Index.Functions
70+
---------------
71+
72+
.. automodule:: git.index.fun
73+
:members:
74+
:undoc-members:
75+
76+
Index.Types
77+
-----------
78+
79+
.. automodule:: git.index.typ
80+
:members:
81+
:undoc-members:
82+
83+
Index.Util
84+
-------------
85+
86+
.. automodule:: git.index.util
87+
:members:
88+
:undoc-members:
5489

5590
GitCmd
5691
------
@@ -81,13 +116,6 @@ Errors
81116
:members:
82117
:undoc-members:
83118

84-
Index
85-
------
86-
87-
.. automodule:: git.index
88-
:members:
89-
:undoc-members:
90-
91119

92120
Refs
93121
----
@@ -110,13 +138,6 @@ Repo
110138
:members:
111139
:undoc-members:
112140

113-
Stats
114-
-----
115-
116-
.. automodule:: git.stats
117-
:members:
118-
:undoc-members:
119-
120141
Utils
121142
-----
122143

lib/git/cmd.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def execute(self, command,
272272
This merely is a workaround as data will be copied from the
273273
output pipe to the given output stream directly.
274274
275-
:param **subprocess_kwargs:
275+
:param subprocess_kwargs:
276276
Keyword arguments to be passed to subprocess.Popen. Please note that
277277
some of the valid kwargs are already set by this method, the ones you
278278
specify may not be the same ones.

lib/git/index/base.py

+15-11
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This module is part of GitPython and is released under
55
# the BSD License: http://www.opensource.org/licenses/bsd-license.php
66
"""Module containing Index implementation, allowing to perform all kinds of index
7-
manipulations such as querying and merging. """
7+
manipulations such as querying and merging."""
88
import tempfile
99
import os
1010
import sys
@@ -75,22 +75,26 @@
7575

7676

7777
class IndexFile(LazyMixin, diff.Diffable, Serializable):
78-
"""Implements an Index that can be manipulated using a native implementation in
78+
"""
79+
Implements an Index that can be manipulated using a native implementation in
7980
order to save git command function calls wherever possible.
80-
81+
8182
It provides custom merging facilities allowing to merge without actually changing
8283
your index or your working tree. This way you can perform own test-merges based
8384
on the index only without having to deal with the working copy. This is useful
8485
in case of partial working trees.
8586
8687
``Entries``
88+
8789
The index contains an entries dict whose keys are tuples of type IndexEntry
8890
to facilitate access.
8991
9092
You may read the entries dict or manipulate it using IndexEntry instance, i.e.::
93+
9194
index.entries[index.entry_key(index_entry_instance)] = index_entry_instance
92-
Otherwise changes to it will be lost when changing the index using its methods.
93-
"""
95+
96+
Make sure you use index.write() once you are done manipulating the index directly
97+
before operating on it using the git command"""
9498
__slots__ = ("repo", "version", "entries", "_extension_data", "_file_path")
9599
_VERSION = 2 # latest version we support
96100
S_IFGITLINK = 0160000 # a submodule
@@ -250,7 +254,7 @@ def new(cls, repo, *tree_sha):
250254
251255
:param repo: The repository treeish are located in.
252256
253-
:param *tree_sha:
257+
:param tree_sha:
254258
20 byte or 40 byte tree sha or tree objects
255259
256260
:return:
@@ -276,7 +280,7 @@ def from_tree(cls, repo, *treeish, **kwargs):
276280
:param repo:
277281
The repository treeish are located in.
278282
279-
:param *treeish:
283+
:param treeish:
280284
One, two or three Tree Objects, Commits or 40 byte hexshas. The result
281285
changes according to the amount of trees.
282286
If 1 Tree is given, it will just be read into a new index
@@ -287,7 +291,7 @@ def from_tree(cls, repo, *treeish, **kwargs):
287291
being the common ancestor of tree 2 and tree 3. Tree 2 is the 'current' tree,
288292
tree 3 is the 'other' one
289293
290-
:param **kwargs:
294+
:param kwargs:
291295
Additional arguments passed to git-read-tree
292296
293297
:return:
@@ -790,7 +794,7 @@ def remove(self, items, working_tree=False, **kwargs):
790794
removing the respective file. This may fail if there are uncommited changes
791795
in it.
792796
793-
:param **kwargs:
797+
:param kwargs:
794798
Additional keyword arguments to be passed to git-rm, such
795799
as 'r' to allow recurive removal of
796800
@@ -828,7 +832,7 @@ def move(self, items, skip_errors=False, **kwargs):
828832
:param skip_errors:
829833
If True, errors such as ones resulting from missing source files will
830834
be skpped.
831-
:param **kwargs:
835+
:param kwargs:
832836
Additional arguments you would like to pass to git-mv, such as dry_run
833837
or force.
834838
@@ -924,7 +928,7 @@ def checkout(self, paths=None, force=False, fprogress=lambda *args: None, **kwar
924928
explicit paths are given. Otherwise progress information will be send
925929
prior and after a file has been checked out
926930
927-
:param **kwargs:
931+
:param kwargs:
928932
Additional arguments to be pasesd to git-checkout-index
929933
930934
:return:

lib/git/index/fun.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ def write_cache(entries, stream, extension_data=None, ShaStreamCls=IndexFileSHA1
5151
:param entries: **sorted** list of entries
5252
:param stream: stream to wrap into the AdapterStreamCls - it is used for
5353
final output.
54+
5455
:param ShaStreamCls: Type to use when writing to the stream. It produces a sha
5556
while writing to it, before the data is passed on to the wrapped stream
57+
5658
:param extension_data: any kind of data to write as a trailer, it must begin
5759
a 4 byte identifier, followed by its size ( 4 bytes )"""
5860
# wrap the stream into a compatible writer
@@ -103,7 +105,7 @@ def read_header(stream):
103105

104106
def entry_key(*entry):
105107
""":return: Key suitable to be used for the index.entries dictionary
106-
:param *entry: One instance of type BaseIndexEntry or the path and the stage"""
108+
:param entry: One instance of type BaseIndexEntry or the path and the stage"""
107109
if len(entry) == 1:
108110
return (entry[0].path, entry[0].stage)
109111
else:

lib/git/index/typ.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,10 @@ def hexsha(self):
7878
def stage(self):
7979
"""Stage of the entry, either:
8080
81-
0 = default stage
82-
1 = stage before a merge or common ancestor entry in case of a 3 way merge
83-
2 = stage of entries from the 'left' side of the merge
84-
3 = stage of entries from the right side of the merge
81+
* 0 = default stage
82+
* 1 = stage before a merge or common ancestor entry in case of a 3 way merge
83+
* 2 = stage of entries from the 'left' side of the merge
84+
* 3 = stage of entries from the right side of the merge
8585
8686
:note: For more information, see http://www.kernel.org/pub/software/scm/git/docs/git-read-tree.html
8787
"""
@@ -112,10 +112,10 @@ class IndexEntry(BaseIndexEntry):
112112
See the properties for a mapping between names and tuple indices. """
113113
@property
114114
def ctime(self):
115-
""":return:
116-
Tuple(int_time_seconds_since_epoch, int_nano_seconds) of the
117-
file's creation time
118115
"""
116+
:return:
117+
Tuple(int_time_seconds_since_epoch, int_nano_seconds) of the
118+
file's creation time"""
119119
return unpack(">LL", self[4])
120120

121121
@property

lib/git/objects/blob.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def _set_cache_(self, attr):
2828

2929
@property
3030
def mime_type(self):
31-
""" :return:String describing the mime type of this file (based on the filename)
31+
"""
32+
:return: String describing the mime type of this file (based on the filename)
3233
:note: Defaults to 'text/plain' in case the actual file type is unknown. """
3334
guesses = None
3435
if self.path:

lib/git/objects/commit.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,11 @@ def iter_items(cls, repo, rev, paths='', **kwargs):
182182

183183
def iter_parents(self, paths='', **kwargs):
184184
"""Iterate _all_ parents of this commit.
185+
185186
:param paths:
186187
Optional path or list of paths limiting the Commits to those that
187188
contain at least one of the paths
188189
:param kwargs: All arguments allowed by git-rev-list
189-
190190
:return: Iterator yielding Commit objects which are parents of self """
191191
# skip ourselves
192192
skip = kwargs.get("skip", 1)

lib/git/objects/tree.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
__all__ = ("TreeModifier", "Tree")
2424

2525
class TreeModifier(object):
26-
"""A utility class providing methods to alter the underlying cache in a list-like
27-
fashion.
26+
"""A utility class providing methods to alter the underlying cache in a list-like fashion.
27+
2828
Once all adjustments are complete, the _cache, which really is a refernce to
2929
the cache of a tree, will be sorted. Assuring it will be in a serializable state"""
3030
__slots__ = '_cache'
@@ -57,6 +57,7 @@ def add(self, sha, mode, name, force=False):
5757
exists, nothing will be done, but a ValueError will be raised if the
5858
sha and mode of the existing item do not match the one you add, unless
5959
force is True
60+
6061
:param sha: The 20 or 40 byte sha of the item to add
6162
:param mode: int representing the stat compatible mode of the item
6263
:param force: If True, an item with your name and information will overwrite
@@ -203,10 +204,11 @@ def blobs(self):
203204

204205
@property
205206
def cache(self):
206-
""":return: An object allowing to modify the internal cache. This can be used
207-
to change the tree's contents. When done, make sure you call ``set_done``
208-
on the tree modifier, or serialization behaviour will be incorrect.
209-
See the ``TreeModifier`` for more information on how to alter the cache"""
207+
"""
208+
:return: An object allowing to modify the internal cache. This can be used
209+
to change the tree's contents. When done, make sure you call ``set_done``
210+
on the tree modifier, or serialization behaviour will be incorrect.
211+
See the ``TreeModifier`` for more information on how to alter the cache"""
210212
return TreeModifier(self._cache)
211213

212214
def traverse( self, predicate = lambda i,d: True,

lib/git/objects/utils.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,15 @@ def verify_utctz(offset):
103103
def parse_date(string_date):
104104
"""
105105
Parse the given date as one of the following
106+
106107
* Git internal format: timestamp offset
107108
* RFC 2822: Thu, 07 Apr 2005 22:13:13 +0200.
108109
* ISO 8601 2005-04-07T22:13:13
109-
The T can be a space as well
110+
The T can be a space as well
110111
111-
:return: Tuple(int(timestamp), int(offset), both in seconds since epoch
112+
:return: Tuple(int(timestamp), int(offset)), both in seconds since epoch
112113
:raise ValueError: If the format could not be understood
113-
:note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY
114-
"""
114+
:note: Date can also be YYYY.MM.DD, MM/DD/YYYY and DD.MM.YYYY"""
115115
# git time
116116
try:
117117
if string_date.count(' ') == 1 and string_date.rfind(':') == -1:

0 commit comments

Comments
 (0)