[tor-commits] [stem/master] Inverting save_processed_files arg order

atagar at torproject.org atagar at torproject.org
Mon Mar 26 00:10:01 UTC 2012


commit 7faf52e5d122c9266baefec4a31e4d3a3b40ce9f
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Mar 13 09:18:24 2012 -0700

    Inverting save_processed_files arg order
    
    Little nicer when the usually-static argument is first imho.
---
 stem/descriptor/reader.py       |    4 ++--
 test/integ/descriptor/reader.py |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/stem/descriptor/reader.py b/stem/descriptor/reader.py
index 4a0c351..ca987e8 100644
--- a/stem/descriptor/reader.py
+++ b/stem/descriptor/reader.py
@@ -151,15 +151,15 @@ def load_processed_files(path):
   
   return processed_files
 
-def save_processed_files(processed_files, path):
+def save_processed_files(path, processed_files):
   """
   Persists a dictionary of 'path => last modified timestamp' mappings (as
   provided by the DescriptorReader's get_processed_files() method) so that they
   can be loaded later and applied to another DescriptorReader.
   
   Arguments:
-    processed_files (dict) - 'path => last modified' mappings
     path (str)             - location to save the processed files dictionary to
+    processed_files (dict) - 'path => last modified' mappings
   
   Raises:
     IOError if unable to write to the file
diff --git a/test/integ/descriptor/reader.py b/test/integ/descriptor/reader.py
index a34533a..0344b99 100644
--- a/test/integ/descriptor/reader.py
+++ b/test/integ/descriptor/reader.py
@@ -116,7 +116,7 @@ class TestDescriptorReader(unittest.TestCase):
     
     # saves the initial_listing to a file then reloads it
     test_listing_path = _get_processed_files_path()
-    stem.descriptor.reader.save_processed_files(initial_listing, test_listing_path)
+    stem.descriptor.reader.save_processed_files(test_listing_path, initial_listing)
     loaded_listing = stem.descriptor.reader.load_processed_files(test_listing_path)
     
     self.assertEquals(initial_listing, loaded_listing)
@@ -131,7 +131,7 @@ class TestDescriptorReader(unittest.TestCase):
     string_timestamp = {"/tmp": "123a"}
     
     for listing in (missing_filename, relative_filename, string_timestamp):
-      self.assertRaises(TypeError, stem.descriptor.reader.save_processed_files, listing, "/tmp/foo")
+      self.assertRaises(TypeError, stem.descriptor.reader.save_processed_files, "/tmp/foo", listing)
   
   def test_basic_example(self):
     """





More information about the tor-commits mailing list