commit 90cb14b9e0d46a38e522d0e2d29f67099822cee1
Author: Damian Johnson <atagar(a)torproject.org>
Date: Mon May 1 11:59:29 2017 -0700
Rename _get_descriptor_components()
When able we're dropping the 'get_' prefix from methods. This one's private so
trivial to tweak.
---
stem/descriptor/__init__.py | 2 +-
stem/descriptor/extrainfo_descriptor.py | 4 ++--
stem/descriptor/hidden_service_descriptor.py | 6 +++---
stem/descriptor/microdescriptor.py | 4 ++--
stem/descriptor/networkstatus.py | 12 ++++++------
stem/descriptor/router_status_entry.py | 4 ++--
stem/descriptor/server_descriptor.py | 4 ++--
stem/descriptor/tordnsel.py | 4 ++--
8 files changed, 20 insertions(+), 20 deletions(-)
diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py
index 2b8ed5b..c414a4c 100644
--- a/stem/descriptor/__init__.py
+++ b/stem/descriptor/__init__.py
@@ -936,7 +936,7 @@ def _get_pseudo_pgp_block(remaining_contents):
return None
-def _get_descriptor_components(raw_contents, validate, extra_keywords = (), non_ascii_fields = ()):
+def _descriptor_components(raw_contents, validate, extra_keywords = (), non_ascii_fields = ()):
"""
Initial breakup of the server descriptor contents to make parsing easier.
diff --git a/stem/descriptor/extrainfo_descriptor.py b/stem/descriptor/extrainfo_descriptor.py
index 848ba3e..2843c8a 100644
--- a/stem/descriptor/extrainfo_descriptor.py
+++ b/stem/descriptor/extrainfo_descriptor.py
@@ -82,7 +82,7 @@ from stem.descriptor import (
Descriptor,
_descriptor_content,
_read_until_keywords,
- _get_descriptor_components,
+ _descriptor_components,
_value,
_values,
_parse_simple_line,
@@ -862,7 +862,7 @@ class ExtraInfoDescriptor(Descriptor):
"""
super(ExtraInfoDescriptor, self).__init__(raw_contents, lazy_load = not validate)
- entries = _get_descriptor_components(raw_contents, validate)
+ entries = _descriptor_components(raw_contents, validate)
if validate:
for keyword in self._required_fields():
diff --git a/stem/descriptor/hidden_service_descriptor.py b/stem/descriptor/hidden_service_descriptor.py
index 9c87500..fb88368 100644
--- a/stem/descriptor/hidden_service_descriptor.py
+++ b/stem/descriptor/hidden_service_descriptor.py
@@ -33,7 +33,7 @@ import stem.util.str_tools
from stem.descriptor import (
PGP_BLOCK_END,
Descriptor,
- _get_descriptor_components,
+ _descriptor_components,
_read_until_keywords,
_bytes_for_block,
_value,
@@ -232,7 +232,7 @@ class HiddenServiceDescriptor(Descriptor):
def __init__(self, raw_contents, validate = False):
super(HiddenServiceDescriptor, self).__init__(raw_contents, lazy_load = not validate)
- entries = _get_descriptor_components(raw_contents, validate, non_ascii_fields = ('introduction-points'))
+ entries = _descriptor_components(raw_contents, validate, non_ascii_fields = ('introduction-points'))
if validate:
for keyword in REQUIRED_FIELDS:
@@ -371,7 +371,7 @@ class HiddenServiceDescriptor(Descriptor):
break # reached the end
attr = dict(INTRODUCTION_POINTS_ATTR)
- entries = _get_descriptor_components(content, False)
+ entries = _descriptor_components(content, False)
for keyword, values in list(entries.items()):
value, block_type, block_contents = values[0]
diff --git a/stem/descriptor/microdescriptor.py b/stem/descriptor/microdescriptor.py
index ce3eb08..a1e5346 100644
--- a/stem/descriptor/microdescriptor.py
+++ b/stem/descriptor/microdescriptor.py
@@ -70,7 +70,7 @@ import stem.exit_policy
from stem.descriptor import (
Descriptor,
- _get_descriptor_components,
+ _descriptor_components,
_read_until_keywords,
_values,
_parse_simple_line,
@@ -259,7 +259,7 @@ class Microdescriptor(Descriptor):
def __init__(self, raw_contents, validate = False, annotations = None):
super(Microdescriptor, self).__init__(raw_contents, lazy_load = not validate)
self._annotation_lines = annotations if annotations else []
- entries = _get_descriptor_components(raw_contents, validate)
+ entries = _descriptor_components(raw_contents, validate)
if validate:
self.digest = hashlib.sha256(self.get_bytes()).hexdigest().upper()
diff --git a/stem/descriptor/networkstatus.py b/stem/descriptor/networkstatus.py
index cb801f0..2b00ebc 100644
--- a/stem/descriptor/networkstatus.py
+++ b/stem/descriptor/networkstatus.py
@@ -66,7 +66,7 @@ from stem.descriptor import (
PGP_BLOCK_END,
Descriptor,
DocumentHandler,
- _get_descriptor_components,
+ _descriptor_components,
_read_until_keywords,
_value,
_parse_simple_line,
@@ -471,7 +471,7 @@ class NetworkStatusDocumentV2(NetworkStatusDocument):
self.routers = dict((desc.fingerprint, desc) for desc in router_iter)
- entries = _get_descriptor_components(document_content + b'\n' + document_file.read(), validate)
+ entries = _descriptor_components(document_content + b'\n' + document_file.read(), validate)
if validate:
self._check_constraints(entries)
@@ -978,7 +978,7 @@ class NetworkStatusDocumentV3(NetworkStatusDocument):
def _header(self, document_file, validate):
content = bytes.join(b'', _read_until_keywords((AUTH_START, ROUTERS_START, FOOTER_START), document_file))
- entries = _get_descriptor_components(content, validate)
+ entries = _descriptor_components(content, validate)
header_fields = [attr[0] for attr in HEADER_STATUS_DOCUMENT_FIELDS]
if validate:
@@ -1011,7 +1011,7 @@ class NetworkStatusDocumentV3(NetworkStatusDocument):
self._entries.update(entries)
def _footer(self, document_file, validate):
- entries = _get_descriptor_components(document_file.read(), validate)
+ entries = _descriptor_components(document_file.read(), validate)
footer_fields = [attr[0] for attr in FOOTER_STATUS_DOCUMENT_FIELDS]
if validate:
@@ -1294,7 +1294,7 @@ class DirectoryAuthority(Descriptor):
else:
self.key_certificate = None
- entries = _get_descriptor_components(content, validate)
+ entries = _descriptor_components(content, validate)
if validate and 'dir-source' != list(entries.keys())[0]:
raise ValueError("Authority entries are expected to start with a 'dir-source' line:\n%s" % (content))
@@ -1446,7 +1446,7 @@ class KeyCertificate(Descriptor):
def __init__(self, raw_content, validate = False):
super(KeyCertificate, self).__init__(raw_content, lazy_load = not validate)
- entries = _get_descriptor_components(raw_content, validate)
+ entries = _descriptor_components(raw_content, validate)
if validate:
if 'dir-key-certificate-version' != list(entries.keys())[0]:
diff --git a/stem/descriptor/router_status_entry.py b/stem/descriptor/router_status_entry.py
index 3cdb4ed..129f6f7 100644
--- a/stem/descriptor/router_status_entry.py
+++ b/stem/descriptor/router_status_entry.py
@@ -31,7 +31,7 @@ from stem.descriptor import (
Descriptor,
_value,
_values,
- _get_descriptor_components,
+ _descriptor_components,
_parse_protocol_line,
_read_until_keywords,
)
@@ -435,7 +435,7 @@ class RouterStatusEntry(Descriptor):
super(RouterStatusEntry, self).__init__(content, lazy_load = not validate)
self.document = document
- entries = _get_descriptor_components(content, validate)
+ entries = _descriptor_components(content, validate)
if validate:
for keyword in self._required_fields():
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index d764588..9367d1c 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -53,7 +53,7 @@ from stem.descriptor import (
PGP_BLOCK_END,
Descriptor,
_descriptor_content,
- _get_descriptor_components,
+ _descriptor_components,
_read_until_keywords,
_bytes_for_block,
_value,
@@ -609,7 +609,7 @@ class ServerDescriptor(Descriptor):
# influences the resulting exit policy, but for everything else the order
# does not matter so breaking it into key / value pairs.
- entries, self._unparsed_exit_policy = _get_descriptor_components(stem.util.str_tools._to_unicode(raw_contents), validate, extra_keywords = ('accept', 'reject'), non_ascii_fields = ('contact', 'platform'))
+ entries, self._unparsed_exit_policy = _descriptor_components(stem.util.str_tools._to_unicode(raw_contents), validate, extra_keywords = ('accept', 'reject'), non_ascii_fields = ('contact', 'platform'))
if validate:
self._parse(entries, validate)
diff --git a/stem/descriptor/tordnsel.py b/stem/descriptor/tordnsel.py
index 731dbfa..d8b2b42 100644
--- a/stem/descriptor/tordnsel.py
+++ b/stem/descriptor/tordnsel.py
@@ -17,7 +17,7 @@ import stem.util.tor_tools
from stem.descriptor import (
Descriptor,
_read_until_keywords,
- _get_descriptor_components,
+ _descriptor_components,
)
@@ -63,7 +63,7 @@ class TorDNSEL(Descriptor):
def __init__(self, raw_contents, validate):
super(TorDNSEL, self).__init__(raw_contents)
raw_contents = stem.util.str_tools._to_unicode(raw_contents)
- entries = _get_descriptor_components(raw_contents, validate)
+ entries = _descriptor_components(raw_contents, validate)
self.fingerprint = None
self.published = None