Skip to content

Commit 0810e65

Browse files
committed
Update docs
1 parent 2e69c28 commit 0810e65

File tree

7 files changed

+45
-36
lines changed

7 files changed

+45
-36
lines changed

docs/config.rst

Lines changed: 9 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,22 @@
22
Configuration files
33
**********************************************************************
44

5-
.. autoattribute:: pygit2.Repository.config
5+
.. autoclass:: pygit2.Repository
6+
:members: config
7+
:noindex:
68

79

810
The Config type
911
================
1012

11-
.. automethod:: pygit2.Config.get_system_config
12-
.. automethod:: pygit2.Config.get_global_config
13-
.. automethod:: pygit2.Config.add_file
14-
.. automethod:: pygit2.Config.get_multivar
15-
.. automethod:: pygit2.Config.set_multivar
16-
17-
.. method:: Config.__iter__()
18-
19-
The :class:`Config` class has an iterator which can be used to loop
20-
through all the entries in the configuration. Each element is a
21-
``ConfigEntry`` object containing the name, level, and value of each
22-
configuration variable. Be aware that this may return multiple versions of
23-
each entry if they are set multiple times in the configuration files.
24-
25-
.. currentmodule:: pygit2
26-
27-
The :class:`Config` Mapping interface.
28-
29-
When using the mapping interface, the value is returned as a
30-
string. In order to apply the git-config parsing rules, you can use
31-
:meth:`Config.get_bool` or :meth:`Config.get_int`.
32-
33-
.. automethod:: pygit2.Config.get_bool
34-
.. automethod:: pygit2.Config.get_int
13+
.. autoclass:: pygit2.Config
14+
:members:
15+
:undoc-members:
16+
:special-members: __contains__, __delitem__, __getitem__, __iter__, __setitem__
3517

3618

3719
The ConfigEntry type
3820
====================
3921

40-
.. autoattribute:: pygit2.config.ConfigEntry.name
41-
.. autoattribute:: pygit2.config.ConfigEntry.value
42-
.. autoattribute:: pygit2.config.ConfigEntry.level
22+
.. autoclass:: pygit2.config.ConfigEntry
23+
:members: name, value, level

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ Table of Contents
8282
merge
8383
objects
8484
oid
85+
packing
8586
references
8687
remotes
8788
repository

docs/packing.rst

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
**********************************************************************
2+
Packing
3+
**********************************************************************
4+
5+
.. autoclass:: pygit2.Repository
6+
:members: pack
7+
:noindex:
8+
9+
10+
The PackBuilder
11+
================
12+
13+
.. autoclass:: pygit2.PackBuilder
14+
:members:
15+
:undoc-members:
16+
:special-members: __len__

docs/repository.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ Below there are some general attributes and methods:
5454

5555
.. autoclass:: pygit2.Repository
5656
:members: ahead_behind, applies, apply, create_reference, default_signature,
57-
descendant_of, describe, free, is_bare, is_empty, odb, path,
58-
path_is_ignored, reset, revert_commit, state_cleanup, workdir,
59-
write, write_archive, set_odb, set_refdb
57+
descendant_of, describe, free, is_bare, is_empty, is_shallow, odb,
58+
path, path_is_ignored, reset, revert_commit, state_cleanup,
59+
workdir, write, write_archive, set_odb, set_refdb
6060

6161
The Repository constructor will most commonly be called with one argument, the path of the repository to open.
6262

pygit2/config.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ def __contains__(self, key):
126126
return True
127127

128128
def __getitem__(self, key):
129+
"""
130+
When using the mapping interface, the value is returned as a string. In
131+
order to apply the git-config parsing rules, you can use
132+
:meth:`Config.get_bool` or :meth:`Config.get_int`.
133+
"""
129134
entry = self._get_entry(key)
130135

131136
return entry.value
@@ -151,6 +156,12 @@ def __delitem__(self, key):
151156
check_error(err)
152157

153158
def __iter__(self):
159+
"""
160+
Iterate over configuration entries, returning a ``ConfigEntry``
161+
objects. These contain the name, level, and value of each configuration
162+
variable. Be aware that this may return multiple versions of each entry
163+
if they are set multiple times in the configuration files.
164+
"""
154165
citer = ffi.new('git_config_iterator **')
155166
err = C.git_config_iterator_new(citer, self._config)
156167
check_error(err)

pygit2/packbuilder.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,18 @@ def __len__(self):
5353
return C.git_packbuilder_object_count(self._packbuilder)
5454

5555
@staticmethod
56-
def convert_object_to_oid(oid):
56+
def __convert_object_to_oid(oid):
5757
git_oid = ffi.new('git_oid *')
5858
ffi.buffer(git_oid)[:] = oid.raw[:]
5959
return git_oid
6060

6161
def add(self, oid):
62-
git_oid = self.convert_object_to_oid(oid)
62+
git_oid = self.__convert_object_to_oid(oid)
6363
err = C.git_packbuilder_insert(self._packbuilder, git_oid, ffi.NULL)
6464
check_error(err)
6565

6666
def add_recur(self, oid):
67-
git_oid = self.convert_object_to_oid(oid)
67+
git_oid = self.__convert_object_to_oid(oid)
6868
err = C.git_packbuilder_insert_recur(self._packbuilder, git_oid, ffi.NULL)
6969
check_error(err)
7070

pygit2/repository.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -265,11 +265,11 @@ def create_reference(self, name, target, force=False, message=None):
265265
266266
Keyword arguments:
267267
268-
force : bool
268+
force: bool
269269
If True references will be overridden, otherwise (the default) an
270270
exception is raised.
271271
272-
message : str
272+
message: str
273273
Optional message to use for the reflog.
274274
275275
Examples::

0 commit comments

Comments
 (0)