commit 229a6319109372dc529106516a9fcb65f5c2eb73 Author: Damian Johnson atagar@torproject.org Date: Sun Dec 16 18:35:41 2012 -0800
Making the Controller's enabled_features private
The Controller's 'enabled_features' attribute wasn't documented so it was probably meant to be private. Changing its name to reflect that. --- stem/control.py | 10 +++++----- test/integ/control/controller.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/stem/control.py b/stem/control.py index a12609f..a1100c1 100644 --- a/stem/control.py +++ b/stem/control.py @@ -622,7 +622,7 @@ class Controller(BaseController):
# number of sequential 'GETINFO ip-to-country/*' lookups that have failed self._geoip_failure_count = 0 - self.enabled_features = [] + self._enabled_features = []
def connect(self): super(Controller, self).connect() @@ -1318,7 +1318,7 @@ class Controller(BaseController):
feature = feature.upper()
- if feature in self.enabled_features: + if feature in self._enabled_features: return True else: # check if this feature is on by default @@ -1330,9 +1330,9 @@ class Controller(BaseController): defaulted_version = stem.version.Requirement.FEATURE_VERBOSE_NAMES
if defaulted_version and self.get_version().meets_requirements(defaulted_version): - self.enabled_features.append(feature) + self._enabled_features.append(feature)
- return feature in self.enabled_features + return feature in self._enabled_features
def enable_feature(self, features): """ @@ -1366,7 +1366,7 @@ class Controller(BaseController):
raise stem.ProtocolError("USEFEATURE provided an invalid response code: %s" % response.code)
- self.enabled_features += [entry.upper() for entry in features] + self._enabled_features += [entry.upper() for entry in features]
def signal(self, signal): """ diff --git a/test/integ/control/controller.py b/test/integ/control/controller.py index 9efeb00..2672f5f 100644 --- a/test/integ/control/controller.py +++ b/test/integ/control/controller.py @@ -438,7 +438,7 @@ class TestController(unittest.TestCase): if orconn_output == '': if test.runner.require_online(self): return
- self.assertTrue("VERBOSE_NAMES" in controller.enabled_features) + self.assertTrue("VERBOSE_NAMES" in controller._enabled_features) self.assertRaises(stem.InvalidArguments, controller.enable_feature, ["NOT", "A", "FEATURE"]) try: controller.enable_feature(["NOT", "A", "FEATURE"])