[tor-commits] [stem/master] Deprecated the DescriptorDownloader's get_microdescriptors()

atagar at torproject.org atagar at torproject.org
Mon Mar 7 21:05:13 UTC 2016


commit 2860a3f66bc59a8f33223980fa79046ce5dcdd0b
Author: Damian Johnson <atagar at torproject.org>
Date:   Sun Mar 6 17:29:11 2016 -0800

    Deprecated the DescriptorDownloader's get_microdescriptors()
    
    This methed never worked since it was never actually implemented in tor...
    
      https://trac.torproject.org/projects/tor/ticket/9271
---
 docs/change_log.rst             |  1 +
 stem/descriptor/remote.py       | 19 ++++---------------
 test/integ/descriptor/remote.py | 40 ++--------------------------------------
 3 files changed, 7 insertions(+), 53 deletions(-)

diff --git a/docs/change_log.rst b/docs/change_log.rst
index 26e9966..a414835 100644
--- a/docs/change_log.rst
+++ b/docs/change_log.rst
@@ -69,6 +69,7 @@ The following are only available within Stem's `git repository
   * TypeError under python3 when using 'use_mirrors = True' (:trac:`17083`)
   * Deprecated hidden service descriptor's *introduction_points_auth* field, which was never implemented in tor (:trac:`15190`, :spec:`9c218f9`)
   * :func:`~stem.control.Controller.get_hidden_service_descriptor` errored when provided a *servers* argument (:trac:`18401`)
+  * Deprecated :func:`~stem.descriptor.remote.DescriptorDownloader.get_microdescriptors` as it was never implemented in tor (:trac:`9271`)
   * Fixed parsing of server descriptor's *allow-single-hop-exits* and *caches-extra-info* lines
   * Bracketed IPv6 addresses were mistreated as being invalid content
   * Updated dannenberg's v3ident (:trac:`17906`)
diff --git a/stem/descriptor/remote.py b/stem/descriptor/remote.py
index 09aba84..859eb24 100644
--- a/stem/descriptor/remote.py
+++ b/stem/descriptor/remote.py
@@ -47,7 +47,6 @@ content. For example...
   get_instance - Provides a singleton DescriptorDownloader used for...
     |- get_server_descriptors - provides present server descriptors
     |- get_extrainfo_descriptors - provides present extrainfo descriptors
-    |- get_microdescriptors - provides present microdescriptors
     +- get_consensus - provides the present consensus or router status entries
 
   get_authorities - Provides tor directory information.
@@ -66,7 +65,6 @@ content. For example...
     |- use_directory_mirrors - use directory mirrors to download future descriptors
     |- get_server_descriptors - provides present server descriptors
     |- get_extrainfo_descriptors - provides present extrainfo descriptors
-    |- get_microdescriptors - provides present microdescriptors
     |- get_consensus - provides the present consensus or router status entries
     |- get_key_certificates - provides present authority key certificates
     +- query - request an arbitrary descriptor resource
@@ -123,7 +121,6 @@ def get_instance():
 
     * :func:`stem.descriptor.remote.get_server_descriptors`
     * :func:`stem.descriptor.remote.get_extrainfo_descriptors`
-    * :func:`stem.descriptor.remote.get_microdescriptors`
     * :func:`stem.descriptor.remote.get_consensus`
 
   .. versionadded:: 1.5.0
@@ -163,18 +160,6 @@ def get_extrainfo_descriptors(fingerprints = None, **query_args):
   return get_instance().get_extrainfo_descriptors(fingerprints, **query_args)
 
 
-def get_microdescriptors(hashes, **query_args):
-  """
-  Shorthand for
-  :func:`~stem.descriptor.remote.DescriptorDownloader.get_microdescriptors`
-  on our singleton instance.
-
-  .. versionadded:: 1.5.0
-  """
-
-  return get_instance().get_microdescriptors(hashes, **query_args)
-
-
 def get_consensus(authority_v3ident = None, **query_args):
   """
   Shorthand for
@@ -587,6 +572,10 @@ class DescriptorDownloader(object):
     that these are only provided via a microdescriptor consensus (such as
     'cached-microdesc-consensus' in your data directory).
 
+    .. deprecated:: 1.5.0
+       This function has never worked, as it was never implemented in tor
+       (:trac:`9271`).
+
     :param str,list hashes: microdescriptor hash or list of hashes to be
       retrieved
     :param query_args: additional arguments for the
diff --git a/test/integ/descriptor/remote.py b/test/integ/descriptor/remote.py
index ef556ae..5fe6cc1 100644
--- a/test/integ/descriptor/remote.py
+++ b/test/integ/descriptor/remote.py
@@ -6,12 +6,10 @@ import unittest
 
 import stem.descriptor
 import stem.descriptor.extrainfo_descriptor
-import stem.descriptor.microdescriptor
 import stem.descriptor.networkstatus
 import stem.descriptor.remote
 import stem.descriptor.router_status_entry
 import stem.descriptor.server_descriptor
-import test.runner
 
 from test.runner import (
   require_online,
@@ -28,15 +26,12 @@ class TestDescriptorDownloader(unittest.TestCase):
     descriptors.
     """
 
-    desc = list(stem.descriptor.remote.get_server_descriptors('9695DFC35FFEB861329B9F1AB04C46397020CE31'))[0]
+    desc = list(stem.descriptor.remote.get_server_descriptors('9695DFC35FFEB861329B9F1AB04C46397020CE31').run())[0]
     self.assertEqual('moria1', desc.nickname)
 
-    desc = list(stem.descriptor.remote.get_extrainfo_descriptors('9695DFC35FFEB861329B9F1AB04C46397020CE31'))[0]
+    desc = list(stem.descriptor.remote.get_extrainfo_descriptors('9695DFC35FFEB861329B9F1AB04C46397020CE31').run())[0]
     self.assertEqual('moria1', desc.nickname)
 
-    desc = list(stem.descriptor.remote.get_microdescriptors('6dCl6ab8CLo0LeMjxi/MZgVJiZgWN8WKTesWPBMtyTo'))[0]
-    self.assertEqual('moria1', desc.digest)
-
     consensus = list(stem.descriptor.remote.get_consensus())
     self.assertTrue(len(consensus) > 50)
 
@@ -171,37 +166,6 @@ class TestDescriptorDownloader(unittest.TestCase):
 
   @require_online
   @only_run_once
-  def test_get_microdescriptors(self):
-    """
-    Exercises the downloader's get_microdescriptors() method.
-    """
-
-    # TODO: method needs to be fixed - not quite sure what's going wrong...
-
-    test.runner.skip(self, '(test currently broken)')
-    return
-
-    downloader = stem.descriptor.remote.DescriptorDownloader(validate = True)
-
-    single_query = downloader.get_microdescriptors('6dCl6ab8CLo0LeMjxi/MZgVJiZgWN8WKTesWPBMtyTo')
-
-    multiple_query = downloader.get_microdescriptors([
-      '6dCl6ab8CLo0LeMjxi/MZgVJiZgWN8WKTesWPBMtyTo',  # moria1
-      'oXBV80OwMACBJpqNeZrYSXF18l9EJCi4/mB8UOl9sME',  # tor26
-    ])
-
-    single_query.run()
-    multiple_query.run()
-
-    single_query_results = list(single_query)
-    self.assertEqual(1, len(single_query_results))
-    self.assertEqual('moria1', single_query_results[0].digest)
-    self.assertTrue(isinstance(single_query_results[0], stem.descriptor.microdescriptor.Microdescriptor))
-
-    self.assertEqual(2, len(list(multiple_query)))
-
-  @require_online
-  @only_run_once
   def test_get_consensus(self):
     """
     Exercises the downloader's get_consensus() method.





More information about the tor-commits mailing list