From 825fbbdc5a6c0bac8fb630f34ccdeb9bfe491ed1 Mon Sep 17 00:00:00 2001
From: David Douard <david.douard@sdfa3.org>
Date: Tue, 23 Oct 2018 15:41:40 +0200
Subject: [PATCH] Fix rst formatting errors in hashutil.py

Summary: to make sphinx happy.

Test Plan: make -C docs

Reviewers: ardumont

Reviewed By: ardumont

Differential Revision: https://forge.softwareheritage.org/D571
---
 swh/model/hashutil.py | 29 +++++++++++++++--------------
 1 file changed, 15 insertions(+), 14 deletions(-)

diff --git a/swh/model/hashutil.py b/swh/model/hashutil.py
index 91250f4f..e58f6870 100644
--- a/swh/model/hashutil.py
+++ b/swh/model/hashutil.py
@@ -30,25 +30,26 @@ Basic usage examples:
 - To compute length, integrate the length to the set of algorithms to
   compute, for example:
 
-    h = MultiHash(hash_names=set({'length'}).union(DEFAULT_ALGORITHMS))
-    with open(filepath, 'rb') as f:
-        h.update(f.read(HASH_BLOCK_SIZE))
-    hashes = h.digest()  # returns a dict of {hash_algo_name: hash_in_bytes}
+  .. code-block:: python
 
-    for chunk in
-  # then use h as you would
+     h = MultiHash(hash_names=set({'length'}).union(DEFAULT_ALGORITHMS))
+     with open(filepath, 'rb') as f:
+         h.update(f.read(HASH_BLOCK_SIZE))
+     hashes = h.digest()  # returns a dict of {hash_algo_name: hash_in_bytes}
 
 - Write alongside computing hashing algorithms (from a stream), example:
 
-    h = MultiHash(length=length)
-    with open(filepath, 'wb') as f:
-        for chunk in r.iter_content():  # r a stream of sort
-            h.update(chunk)
-            f.write(chunk)
-    hashes = h.hexdigest()  # returns a dict of {hash_algo_name: hash_in_hex}
+  .. code-block:: python
+
+     h = MultiHash(length=length)
+     with open(filepath, 'wb') as f:
+         for chunk in r.iter_content():  # r a stream of sort
+             h.update(chunk)
+             f.write(chunk)
+     hashes = h.hexdigest()  # returns a dict of {hash_algo_name: hash_in_hex}
 
-    Note: Prior to this, we would have to use chunk_cb (cf. hash_file,
-          hash_path)
+  Note: Prior to this, we would have to use chunk_cb (cf. hash_file,
+        hash_path)
 
 
 This module also defines the following (deprecated) hashing functions:
-- 
GitLab