Skip to content

Commit 0b81337

Browse files
committed
Fixed API reference docs as far as possible
1 parent 9d6310d commit 0b81337

File tree

5 files changed

+53
-26
lines changed

5 files changed

+53
-26
lines changed

‎doc/source/reference.rst

+20-6
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,24 @@ Objects.Functions
4545
:members:
4646
:undoc-members:
4747

48-
Objects.Submodule
49-
-----------------
48+
Objects.Submodule.base
49+
----------------------
50+
51+
.. automodule:: git.objects.submodule.base
52+
:members:
53+
:undoc-members:
54+
55+
Objects.Submodule.root
56+
----------------------
5057

51-
.. automodule:: git.objects.submodule
58+
.. automodule:: git.objects.submodule.root
59+
:members:
60+
:undoc-members:
61+
62+
Objects.Submodule.util
63+
----------------------
64+
65+
.. automodule:: git.objects.submodule.util
5266
:members:
5367
:undoc-members:
5468

@@ -109,10 +123,10 @@ Diff
109123
:members:
110124
:undoc-members:
111125

112-
Errors
113-
------
126+
Exceptions
127+
----------
114128

115-
.. automodule:: git.errors
129+
.. automodule:: git.exc
116130
:members:
117131
:undoc-members:
118132

‎lib/git/objects/submodule/base.py

+12-8
Original file line numberDiff line numberDiff line change
@@ -722,9 +722,10 @@ def module_exists(self):
722722
# END handle exception
723723

724724
def exists(self):
725-
""":return: True if the submodule exists, False otherwise. Please note that
726-
a submodule may exist (in the .gitmodules file) even though its module
727-
doesn't exist"""
725+
"""
726+
:return: True if the submodule exists, False otherwise. Please note that
727+
a submodule may exist (in the .gitmodules file) even though its module
728+
doesn't exist"""
728729
# keep attributes for later, and restore them if we have no valid data
729730
# this way we do not actually alter the state of the object
730731
loc = locals()
@@ -758,7 +759,8 @@ def branch(self):
758759

759760
@property
760761
def branch_path(self):
761-
""":return: full (relative) path as string to the branch we would checkout
762+
"""
763+
:return: full (relative) path as string to the branch we would checkout
762764
from the remote and track"""
763765
return self._branch_path
764766

@@ -792,17 +794,19 @@ def name(self):
792794
return self._name
793795

794796
def config_reader(self):
795-
""":return: ConfigReader instance which allows you to qurey the configuration values
796-
of this submodule, as provided by the .gitmodules file
797+
"""
798+
:return: ConfigReader instance which allows you to qurey the configuration values
799+
of this submodule, as provided by the .gitmodules file
797800
:note: The config reader will actually read the data directly from the repository
798801
and thus does not need nor care about your working tree.
799802
:note: Should be cached by the caller and only kept as long as needed
800803
:raise IOError: If the .gitmodules file/blob could not be read"""
801804
return self._config_parser_constrained(read_only=True)
802805

803806
def children(self):
804-
""":return: IterableList(Submodule, ...) an iterable list of submodules instances
805-
which are children of this submodule
807+
"""
808+
:return: IterableList(Submodule, ...) an iterable list of submodules instances
809+
which are children of this submodule
806810
:raise InvalidGitRepositoryError: if the submodule is not checked-out"""
807811
return self._get_intermediate_items(self)
808812

‎lib/git/objects/util.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,8 @@ def _get_intermediate_items(cls, item):
276276
raise NotImplementedError("To be implemented in subclass")
277277

278278
def list_traverse(self, *args, **kwargs):
279-
""":return: IterableList with the results of the traversal as produced by
279+
"""
280+
:return: IterableList with the results of the traversal as produced by
280281
traverse()"""
281282
out = IterableList(self._id_attribute_)
282283
out.extend(self.traverse(*args, **kwargs))

‎lib/git/refs.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -644,8 +644,9 @@ def __init__(self, repo, path=_HEAD_NAME):
644644
super(HEAD, self).__init__(repo, path)
645645

646646
def orig_head(self):
647-
""":return: SymbolicReference pointing at the ORIG_HEAD, which is maintained
648-
to contain the previous value of HEAD"""
647+
"""
648+
:return: SymbolicReference pointing at the ORIG_HEAD, which is maintained
649+
to contain the previous value of HEAD"""
649650
return SymbolicReference(self.repo, self._ORIG_HEAD_NAME)
650651

651652
def _set_reference(self, ref):
@@ -795,8 +796,10 @@ def delete(cls, repo, *heads, **kwargs):
795796

796797

797798
def set_tracking_branch(self, remote_reference):
798-
"""Configure this branch to track the given remote reference. This will alter
799-
this branch's configuration accordingly.
799+
"""
800+
Configure this branch to track the given remote reference. This will alter
801+
this branch's configuration accordingly.
802+
800803
:param remote_reference: The remote reference to track or None to untrack
801804
any references
802805
:return: self"""
@@ -820,7 +823,8 @@ def set_tracking_branch(self, remote_reference):
820823

821824

822825
def tracking_branch(self):
823-
""":return: The remote_reference we are tracking, or None if we are
826+
"""
827+
:return: The remote_reference we are tracking, or None if we are
824828
not a tracking branch"""
825829
reader = self.config_reader()
826830
if reader.has_option(self.k_config_remote) and reader.has_option(self.k_config_remote_ref):
@@ -896,12 +900,14 @@ def _config_parser(self, read_only):
896900
return SectionConstraint(parser, 'branch "%s"' % self.name)
897901

898902
def config_reader(self):
899-
""":return: A configuration parser instance constrained to only read
900-
this instance's values"""
903+
"""
904+
:return: A configuration parser instance constrained to only read
905+
this instance's values"""
901906
return self._config_parser(read_only=True)
902907

903908
def config_writer(self):
904-
""":return: A configuration writer instance with read-and write acccess
909+
"""
910+
:return: A configuration writer instance with read-and write acccess
905911
to options of this head"""
906912
return self._config_parser(read_only=False)
907913

‎lib/git/repo/base.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -226,12 +226,13 @@ def remote(self, name='origin'):
226226

227227
@property
228228
def submodules(self):
229-
""":return: git.IterableList(Submodule, ...) of direct submodules
229+
"""
230+
:return: git.IterableList(Submodule, ...) of direct submodules
230231
available from the current head"""
231232
return Submodule.list_items(self)
232233

233234
def submodule(self, name):
234-
""":return: Submodule with the given name
235+
""" :return: Submodule with the given name
235236
:raise ValueError: If no such submodule exists"""
236237
try:
237238
return self.submodules[name]
@@ -241,6 +242,7 @@ def submodule(self, name):
241242

242243
def create_submodule(self, *args, **kwargs):
243244
"""Create a new submodule
245+
244246
:note: See the documentation of Submodule.add for a description of the
245247
applicable parameters
246248
:return: created submodules"""
@@ -719,7 +721,7 @@ def clone_from(cls, url, to_path, **kwargs):
719721
"""Create a clone from the given URL
720722
:param url: valid git url, see http://www.kernel.org/pub/software/scm/git/docs/git-clone.html#URLS
721723
:param to_path: Path to which the repository should be cloned to
722-
:param **kwargs: see the ``clone`` method
724+
:param kwargs: see the ``clone`` method
723725
:return: Repo instance pointing to the cloned directory"""
724726
return cls._clone(Git(os.getcwd()), url, to_path, GitCmdObjectDB, **kwargs)
725727

0 commit comments

Comments
 (0)