[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Converted _required_fields() encounter TypeErrors
commit 8d5d2f14edf92c7240aae0b7894fea6e27b41699
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Sun Jan 27 16:17:34 2013 -0800
Converted _required_fields() encounter TypeErrors
The server and extrainfo descriptors' _required_fields() functions get
converted by 2to3 into a line that tries to concatenate a list with a tuple
(raising a TypeError). On reflection the converted version which uses list
comprehension is a little nicer than filter(), so using a variant of that which
makes everyone happy.
---
stem/descriptor/extrainfo_descriptor.py | 10 +++++-----
stem/descriptor/server_descriptor.py | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/stem/descriptor/extrainfo_descriptor.py b/stem/descriptor/extrainfo_descriptor.py
index 9d39f92..2c5b6dc 100644
--- a/stem/descriptor/extrainfo_descriptor.py
+++ b/stem/descriptor/extrainfo_descriptor.py
@@ -897,15 +897,15 @@ class BridgeExtraInfoDescriptor(ExtraInfoDescriptor):
ExtraInfoDescriptor._parse(self, entries, validate)
def _required_fields(self):
- excluded_fields = (
+ excluded_fields = [
"router-signature",
- )
+ ]
- included_fields = (
+ included_fields = [
"router-digest",
- )
+ ]
- return included_fields + filter(lambda e: not e in excluded_fields, REQUIRED_FIELDS)
+ return tuple(included_fields + [f for f in REQUIRED_FIELDS if not f in excluded_fields])
def _last_keyword(self):
return None
diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py
index 1cf4d31..9e5004b 100644
--- a/stem/descriptor/server_descriptor.py
+++ b/stem/descriptor/server_descriptor.py
@@ -910,17 +910,17 @@ class BridgeDescriptor(ServerDescriptor):
# bridge required fields are the same as a relay descriptor, minus items
# excluded according to the format page
- excluded_fields = (
+ excluded_fields = [
"onion-key",
"signing-key",
"router-signature",
- )
+ ]
- included_fields = (
+ included_fields = [
"router-digest",
- )
+ ]
- return included_fields + filter(lambda e: not e in excluded_fields, REQUIRED_FIELDS)
+ return tuple(included_fields + [f for f in REQUIRED_FIELDS if not f in excluded_fields])
def _single_fields(self):
return self._required_fields() + SINGLE_FIELDS
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits