commit 4ef767c9e07ac0d835355706625dafea19a57147 Author: Damian Johnson atagar@torproject.org Date: Tue Jun 20 13:44:25 2017 -0700
Add blank lines after functions
Evidently another new pycodestyle constraint.
* /home/atagar/Desktop/stem/stem/connection.py line 1301 - E305 expected 2 blank lines after class or function definition, found 1 | AUTHENTICATE_EXCEPTIONS = (
* /home/atagar/Desktop/stem/stem/util/log.py line 94 - E305 expected 2 blank lines after class or function definition, found 1 | if not LOGGER.handlers:
* /home/atagar/Desktop/stem/stem/util/test_tools.py line 622 - E305 expected 2 blank lines after class or function definition, found 1 | get_stylistic_issues = stylistic_issues
* /home/atagar/Desktop/stem/stem/descriptor/hidden_service_descriptor.py line 189 - E305 expected 2 blank lines after class or function definition, found 1 | _parse_rendezvous_service_descriptor_line = _parse_simple_line('rendezvous-service-descriptor', 'descriptor_id')
* /home/atagar/Desktop/stem/stem/util/connection.py line 757 - E305 expected 2 blank lines after class or function definition, found 1 | get_system_resolvers = system_resolvers
* /home/atagar/Desktop/stem/stem/__init__.py line 615 - E305 expected 2 blank lines after class or function definition, found 1 | Runlevel = stem.util.enum.UppercaseEnum(
* /home/atagar/Desktop/stem/stem/version.py line 335 - E305 expected 2 blank lines after class or function definition, found 1 | safecookie_req = _VersionRequirements()
* /home/atagar/Desktop/stem/stem/util/proc.py line 577 - E305 expected 2 blank lines after class or function definition, found 1 | get_system_start_time = system_start_time --- stem/__init__.py | 1 + stem/connection.py | 2 ++ stem/descriptor/__init__.py | 1 + stem/descriptor/hidden_service_descriptor.py | 1 + stem/util/connection.py | 1 + stem/util/log.py | 1 + stem/util/proc.py | 1 + stem/util/str_tools.py | 1 + stem/util/test_tools.py | 1 + stem/version.py | 1 + 10 files changed, 11 insertions(+)
diff --git a/stem/__init__.py b/stem/__init__.py index e9e621c..a033745 100644 --- a/stem/__init__.py +++ b/stem/__init__.py @@ -612,6 +612,7 @@ class SocketError(ControllerError): class SocketClosed(SocketError): 'Control socket was closed before completing the message.'
+ Runlevel = stem.util.enum.UppercaseEnum( 'DEBUG', 'INFO', diff --git a/stem/connection.py b/stem/connection.py index 967b766..a3f27a0 100644 --- a/stem/connection.py +++ b/stem/connection.py @@ -1297,7 +1297,9 @@ class NoAuthCookie(MissingAuthInfo): super(NoAuthCookie, self).__init__(message) self.is_safecookie = is_safecookie
+ # authentication exceptions ordered as per the authenticate function's pydocs + AUTHENTICATE_EXCEPTIONS = ( IncorrectSocketType, UnrecognizedAuthMethods, diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py index be28c7a..96cf0b4 100644 --- a/stem/descriptor/__init__.py +++ b/stem/descriptor/__init__.py @@ -1050,6 +1050,7 @@ def _descriptor_components(raw_contents, validate, extra_keywords = (), non_asci else: return entries
+ # importing at the end to avoid circular dependencies on our Descriptor class
import stem.descriptor.server_descriptor diff --git a/stem/descriptor/hidden_service_descriptor.py b/stem/descriptor/hidden_service_descriptor.py index b188012..d752369 100644 --- a/stem/descriptor/hidden_service_descriptor.py +++ b/stem/descriptor/hidden_service_descriptor.py @@ -186,6 +186,7 @@ def _parse_introduction_points_line(descriptor, entries): except TypeError: raise ValueError("'introduction-points' isn't base64 encoded content:\n%s" % block_contents)
+ _parse_rendezvous_service_descriptor_line = _parse_simple_line('rendezvous-service-descriptor', 'descriptor_id') _parse_permanent_key_line = _parse_key_block('permanent-key', 'permanent_key', 'RSA PUBLIC KEY') _parse_secret_id_part_line = _parse_simple_line('secret-id-part', 'secret_id_part') diff --git a/stem/util/connection.py b/stem/util/connection.py index a5d1edc..0925461 100644 --- a/stem/util/connection.py +++ b/stem/util/connection.py @@ -750,6 +750,7 @@ def _cryptovariables_equal(x, y): _hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, x) == _hmac_sha256(CRYPTOVARIABLE_EQUALITY_COMPARISON_NONCE, y))
+ # TODO: drop with stem 2.x # We renamed our methods to drop a redundant 'get_*' prefix, so alias the old # names for backward compatability. diff --git a/stem/util/log.py b/stem/util/log.py index adcdc41..e157c7c 100644 --- a/stem/util/log.py +++ b/stem/util/log.py @@ -91,6 +91,7 @@ class _NullHandler(logging.Handler): def emit(self, record): pass
+ if not LOGGER.handlers: LOGGER.addHandler(_NullHandler())
diff --git a/stem/util/proc.py b/stem/util/proc.py index ad24bc8..c470a8d 100644 --- a/stem/util/proc.py +++ b/stem/util/proc.py @@ -570,6 +570,7 @@ def _log_failure(parameter, exc):
log.debug('proc call failed (%s): %s' % (parameter, exc))
+ # TODO: drop with stem 2.x # We renamed our methods to drop a redundant 'get_*' prefix, so alias the old # names for backward compatability. diff --git a/stem/util/str_tools.py b/stem/util/str_tools.py index 4a76dc4..696e632 100644 --- a/stem/util/str_tools.py +++ b/stem/util/str_tools.py @@ -585,6 +585,7 @@ def _get_label(units, count, decimal, is_long): else: return count_label + short_label
+ # TODO: drop with stem 2.x # We renamed our methods to drop a redundant 'get_*' prefix, so alias the old # names for backward compatability. diff --git a/stem/util/test_tools.py b/stem/util/test_tools.py index 6aecbd8..cab96e5 100644 --- a/stem/util/test_tools.py +++ b/stem/util/test_tools.py @@ -614,6 +614,7 @@ def _python_files(paths): if not skip: yield file_path
+ # TODO: drop with stem 2.x # We renamed our methods to drop a redundant 'get_*' prefix, so alias the old # names for backward compatability, and account for pep8 being renamed to diff --git a/stem/version.py b/stem/version.py index 37232c3..6eb9485 100644 --- a/stem/version.py +++ b/stem/version.py @@ -332,6 +332,7 @@ class _VersionRequirements(object):
self.rules.append(new_rule)
+ safecookie_req = _VersionRequirements() safecookie_req.in_range(Version('0.2.2.36'), Version('0.2.3.0')) safecookie_req.greater_than(Version('0.2.3.13'))