Some restructuredText fixes.
authorJelmer Vernooij <jelmer@samba.org>
Wed, 21 Jul 2010 13:17:59 +0000 (15:17 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 21 Jul 2010 13:17:59 +0000 (15:17 +0200)
dulwich/client.py
dulwich/file.py
dulwich/objects.py
dulwich/pack.py
dulwich/repo.py
dulwich/server.py
dulwich/web.py

index 3fe75374a9be7a673ed3c1b4966e19c9f9587c76..47e992b67477b426ae8f051bcffffd34772cf16e 100644 (file)
@@ -262,7 +262,7 @@ class GitClient(object):
 def can_read(f):
     """Check if a file descriptor is readable.
 
 def can_read(f):
     """Check if a file descriptor is readable.
 
-    :args f: either the number of the file descriptor or a file-like
+    :param f: either the number of the file descriptor or a file-like
              object which returns the fileno when f.fileno() is called.
     """
     return len(select.select([f], [], [], 0)[0]) > 0
              object which returns the fileno when f.fileno() is called.
     """
     return len(select.select([f], [], [], 0)[0]) > 0
index 9bd4892f3aa2f6d63e61943554e46d1534091c68..dd0fbb03a6fcdea3a33da99f86c3db4a938aff64 100644 (file)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
 
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
 
-
 """Safe access to git files."""
 
 """Safe access to git files."""
 
-
 import errno
 import os
 import tempfile
 import errno
 import os
 import tempfile
@@ -65,7 +63,9 @@ def fancy_rename(oldname, newname):
 def GitFile(filename, mode='r', bufsize=-1):
     """Create a file object that obeys the git file locking protocol.
 
 def GitFile(filename, mode='r', bufsize=-1):
     """Create a file object that obeys the git file locking protocol.
 
-    See _GitFile for a description of the file locking protocol.
+    :return: a builtin file object or a _GitFile object
+
+    :note: See _GitFile for a description of the file locking protocol.
 
     Only read-only and write-only (binary) modes are supported; r+, w+, and a
     are not.  To read and write from the same file, you can take advantage of
 
     Only read-only and write-only (binary) modes are supported; r+, w+, and a
     are not.  To read and write from the same file, you can take advantage of
@@ -86,8 +86,6 @@ def GitFile(filename, mode='r', bufsize=-1):
     Traceback (most recent call last):
         ...
     OSError: [Errno 17] File exists: 'filename.lock'
     Traceback (most recent call last):
         ...
     OSError: [Errno 17] File exists: 'filename.lock'
-
-    :return: a builtin file object or a _GitFile object
     """
     if 'a' in mode:
         raise IOError('append mode not supported for Git files')
     """
     if 'a' in mode:
         raise IOError('append mode not supported for Git files')
index fab297d6825eae7e5f6392298bd5d99e9dafe535..84c68b907ec4f659483df3aebf97d45462582249 100644 (file)
@@ -530,9 +530,9 @@ def _parse_tag_or_commit(text):
     """Parse tag or commit text.
 
     :param text: the raw text of the tag or commit object.
     """Parse tag or commit text.
 
     :param text: the raw text of the tag or commit object.
-    :yield: tuples of (field, value), one per header line, in the order read
-        from the text, possibly including duplicates. Includes a field named
-        None for the freeform tag/commit text.
+    :return: iterator of tuples of (field, value), one per header line, in the
+        order read from the text, possibly including duplicates. Includes a
+        field named None for the freeform tag/commit text.
     """
     f = StringIO(text)
     for l in f:
     """
     f = StringIO(text)
     for l in f:
@@ -677,7 +677,7 @@ def parse_tree(text):
     """Parse a tree text.
 
     :param text: Serialized text to parse
     """Parse a tree text.
 
     :param text: Serialized text to parse
-    :yields: tuples of (name, mode, sha)
+    :return: iterator of tuples of (name, mode, sha)
     """
     count = 0
     l = len(text)
     """
     count = 0
     l = len(text)
index 57b33dc249dc557438b92730044649a958596525..5bba811473a28e7b9c4054399a3fa4a883d5ea3c 100644 (file)
@@ -310,7 +310,8 @@ class PackIndex(object):
     def iterentries(self):
         """Iterate over the entries in this pack index.
 
     def iterentries(self):
         """Iterate over the entries in this pack index.
 
-        :yields: tuples with object name, offset in packfile and crc32 checksum.
+        :return: iterator over tuples with object name, offset in packfile and
+            crc32 checksum.
         """
         for i in range(len(self)):
             yield self._unpack_entry(i)
         """
         for i in range(len(self)):
             yield self._unpack_entry(i)
@@ -787,9 +788,9 @@ class PackData(object):
     def iterentries(self, progress=None):
         """Yield entries summarizing the contents of this pack.
 
     def iterentries(self, progress=None):
         """Yield entries summarizing the contents of this pack.
 
-        :param progress: Progress function, called with current and total object
-            count.
-        :yields: tuples with (sha, offset, crc32)
+        :param progress: Progress function, called with current and total
+            object count.
+        :return: iterator of tuples with (sha, offset, crc32)
         """
         for offset, type, obj, crc32 in self.iterobjects(progress=progress):
             assert isinstance(offset, int)
         """
         for offset, type, obj, crc32 in self.iterobjects(progress=progress):
             assert isinstance(offset, int)
@@ -801,8 +802,8 @@ class PackData(object):
     def sorted_entries(self, progress=None):
         """Return entries in this pack, sorted by SHA.
 
     def sorted_entries(self, progress=None):
         """Return entries in this pack, sorted by SHA.
 
-        :param progress: Progress function, called with current and total object
-            count
+        :param progress: Progress function, called with current and total
+            object count
         :return: List of tuples with (sha, offset, crc32)
         """
         ret = list(self.iterentries(progress=progress))
         :return: List of tuples with (sha, offset, crc32)
         """
         ret = list(self.iterentries(progress=progress))
index ffa0588fa4974679047ba212e70eea5a97353334..b53ee74002d8be3dc02cc9bc9c272f607cf2849e 100644 (file)
@@ -675,9 +675,8 @@ def _split_ref_line(line):
 def read_packed_refs(f):
     """Read a packed refs file.
 
 def read_packed_refs(f):
     """Read a packed refs file.
 
-    Yields tuples with SHA1s and ref names.
-
     :param f: file-like object to read from
     :param f: file-like object to read from
+    :return: Iterator over tuples with SHA1s and ref names.
     """
     for l in f:
         if l[0] == "#":
     """
     for l in f:
         if l[0] == "#":
@@ -777,7 +776,7 @@ class BaseRepo(object):
         """Write a file to the control dir with the given name and contents.
 
         :param path: The path to the file, relative to the control dir.
         """Write a file to the control dir with the given name and contents.
 
         :param path: The path to the file, relative to the control dir.
-        :contents: A string to write to the file.
+        :param contents: A string to write to the file.
         """
         raise NotImplementedError(self._put_named_file)
 
         """
         raise NotImplementedError(self._put_named_file)
 
@@ -1094,7 +1093,7 @@ class Repo(BaseRepo):
         """Write a file to the control dir with the given name and contents.
 
         :param path: The path to the file, relative to the control dir.
         """Write a file to the control dir with the given name and contents.
 
         :param path: The path to the file, relative to the control dir.
-        :contents: A string to write to the file.
+        :param contents: A string to write to the file.
         """
         path = path.lstrip(os.path.sep)
         f = GitFile(os.path.join(self.controldir(), path), 'wb')
         """
         path = path.lstrip(os.path.sep)
         f = GitFile(os.path.join(self.controldir(), path), 'wb')
@@ -1210,7 +1209,7 @@ class MemoryRepo(BaseRepo):
         """Write a file to the control dir with the given name and contents.
 
         :param path: The path to the file, relative to the control dir.
         """Write a file to the control dir with the given name and contents.
 
         :param path: The path to the file, relative to the control dir.
-        :contents: A string to write to the file.
+        :param contents: A string to write to the file.
         """
         self._named_files[path] = contents
 
         """
         self._named_files[path] = contents
 
index 524a2223262b72272940a4a13ee4f9c12bb99246..f4a3dbcf9c81b4c95f60453dbea75a9b6b3167b0 100644 (file)
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
 
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
 
-
 """Git smart network protocol server implementation.
 
 For more detailed implementation on the network protocol, see the
 Documentation/technical directory in the cgit distribution, and in particular:
 """Git smart network protocol server implementation.
 
 For more detailed implementation on the network protocol, see the
 Documentation/technical directory in the cgit distribution, and in particular:
-    Documentation/technical/protocol-capabilities.txt
-    Documentation/technical/pack-protocol.txt
+
+* Documentation/technical/protocol-capabilities.txt
+* Documentation/technical/pack-protocol.txt
 """
 
 
 """
 
 
index f689d180db23c8a4b25389216afc6115c5d703b8..b74f9d898ac014c0bea20e48217b5a9c939ad14d 100644 (file)
@@ -85,7 +85,7 @@ def send_file(req, f, content_type):
     :param req: The HTTPGitRequest object to send output to.
     :param f: An open file-like object to send; will be closed.
     :param content_type: The MIME type for the file.
     :param req: The HTTPGitRequest object to send output to.
     :param f: An open file-like object to send; will be closed.
     :param content_type: The MIME type for the file.
-    :yield: The contents of the file.
+    :return: Iterator over the contents of the file, as chunks.
     """
     if f is None:
         yield req.not_found('File not found')
     """
     if f is None:
         yield req.not_found('File not found')