Ticket #13756: 0001-stem.descriptor.parse_file-Support-for-parsing-cache.patch

File 0001-stem.descriptor.parse_file-Support-for-parsing-cache.patch, 1.6 KB (added by oherrala, 4 years ago)
  • stem/descriptor/__init__.py

    From d11090726729bf1326f2c26ffea5d614b17016e1 Mon Sep 17 00:00:00 2001
    From: Ossi Herrala <oherrala@gmail.com>
    Date: Thu, 13 Nov 2014 15:59:16 +0200
    Subject: [PATCH] stem.descriptor.parse_file: Support for parsing
     cached-descriptors.new, cached-extrainfo.new and cached-microdescs.new like
     their counterparts without ".new".
    
    ---
     stem/descriptor/__init__.py | 6 +++---
     1 file changed, 3 insertions(+), 3 deletions(-)
    
    diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
    index c14d984..e45ce1e 100644
    a b def parse_file(descriptor_file, descriptor_type = None, validate = True, documen 
    197197  else:
    198198    # Cached descriptor handling. These contain multiple descriptors per file.
    199199
    200     if filename == 'cached-descriptors':
     200    if filename == 'cached-descriptors' or filename == 'cached-descriptors.new':
    201201      file_parser = lambda f: stem.descriptor.server_descriptor._parse_file(f, validate = validate, **kwargs)
    202     elif filename == 'cached-extrainfo':
     202    elif filename == 'cached-extrainfo' or filename == 'cached-extrainfo.new':
    203203      file_parser = lambda f: stem.descriptor.extrainfo_descriptor._parse_file(f, validate = validate, **kwargs)
    204     elif filename == 'cached-microdescs':
     204    elif filename == 'cached-microdescs' or filename == 'cached-microdescs.new':
    205205      file_parser = lambda f: stem.descriptor.microdescriptor._parse_file(f, validate = validate, **kwargs)
    206206    elif filename == 'cached-consensus':
    207207      file_parser = lambda f: stem.descriptor.networkstatus._parse_file(f, validate = validate, document_handler = document_handler, **kwargs)