diff --git a/docs/blame.rst b/docs/blame.rst index b0c7381..fc052e0 100644 --- a/docs/blame.rst +++ b/docs/blame.rst @@ -12,9 +12,9 @@ The Blame type ============== .. automethod:: pygit2.Blame.for_line -.. method:: iter(Blame) -.. method:: len(Blame) -.. method:: Blame[n] +.. method:: Blame.__iter__() +.. method:: Blame.__len__() +.. method:: Blame.__getitem__(n) The BlameHunk type diff --git a/docs/config.rst b/docs/config.rst index e9b5c64..348c347 100644 --- a/docs/config.rst +++ b/docs/config.rst @@ -14,7 +14,7 @@ The Config type .. automethod:: pygit2.Config.get_multivar .. automethod:: pygit2.Config.set_multivar -.. method:: for (name, value) in Config +.. method:: Config.__iter__() The :class:`Config` class has an iterator which can be used to loop through all the entries in the configuration. Each element is a tuple diff --git a/docs/diff.rst b/docs/diff.rst index 0e5fbaf..09fc9da 100644 --- a/docs/diff.rst +++ b/docs/diff.rst @@ -35,7 +35,7 @@ The Diff type ==================== .. autoattribute:: pygit2.Diff.patch -.. method:: len(Diff) +.. method:: Diff.__len__() Returns the number of deltas/patches in this diff. diff --git a/docs/objects.rst b/docs/objects.rst index 432481b..ecb39e9 100644 --- a/docs/objects.rst +++ b/docs/objects.rst @@ -18,7 +18,7 @@ In the previous chapter we learnt about Object IDs. With an oid we can ask the repository to get the associated object. To do that the ``Repository`` class implementes a subset of the mapping interface. -.. method:: Repository.get(oid, default=None) +.. automethod:: pygit2.Repository.get Return the Git object for the given *oid*, returns the *default* value if there's no object in the repository with that oid. The oid can be an Oid @@ -32,13 +32,13 @@ implementes a subset of the mapping interface. >>> obj <_pygit2.Commit object at 0x7ff27a6b60f0> -.. method:: Repository[oid] +.. method:: Repository.__getitem__(oid) Return the Git object for the given oid, raise ``KeyError`` if there's no object in the repository with that oid. The oid can be an Oid object, or an hexadecimal string. -.. method:: oid in Repository +.. method:: Repository.__contains__(oid) Returns True if there is an object in the Repository with that oid, False if there is not. The oid can be an Oid object, or an hexadecimal string. @@ -147,20 +147,20 @@ directory in a file system. Each entry points to another tree or a blob. A tree can be iterated, and partially implements the sequence and mapping interfaces. -.. method:: Tree[name] +.. method:: Tree.__getitem__(name) Return the TreeEntry object for the given *name*. Raise ``KeyError`` if there is not a tree entry with that name. -.. method:: name in Tree +.. method:: Tree.__contains__(name) Return True if there is a tree entry with the given name, False otherwise. -.. method:: len(Tree) +.. method:: Tree.__len__() Return the number of entries in the tree. -.. method:: iter(Tree) +.. method:: Tree.__iter__() Return an iterator over the entries of the tree. @@ -176,7 +176,7 @@ Tree entries .. autoattribute:: pygit2.TreeEntry.hex .. autoattribute:: pygit2.TreeEntry.filemode -.. method:: cmp(TreeEntry, TreeEntry) +.. method:: TreeEntry.__cmp__(TreeEntry) Rich comparison between tree entries. diff --git a/docs/oid.rst b/docs/oid.rst index ff5cad8..2d66bde 100644 --- a/docs/oid.rst +++ b/docs/oid.rst @@ -65,7 +65,7 @@ And the other way around, from an Oid object we can get the hexadecimal and raw forms. You can use the built-in `str()` (or `unicode()` in python 2) to get the hexadecimal representation of the Oid. -.. method:: str(pygit2.Oid) +.. method:: Oid.__str__() .. autoattribute:: pygit2.Oid.raw The Oid type supports: