commit f735fbc11973fd03435df0bc306d800433bbbeae Author: Damian Johnson atagar@torproject.org Date: Sun Jan 6 20:06:55 2013 -0800
Conforming to E221 (multiple spaces before operator)
I'd forgotten that PEP8 forbade aligned assignments. This is another spot that I think PEP8 is in the wrong in terms of readability but I don't care overly much. --- stem/descriptor/__init__.py | 8 ++++---- stem/descriptor/server_descriptor.py | 12 ++++++------ stem/util/system.py | 24 ++++++++++++------------ test/check_whitespace.py | 2 +- 4 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/stem/descriptor/__init__.py b/stem/descriptor/__init__.py index c66f298..98388a3 100644 --- a/stem/descriptor/__init__.py +++ b/stem/descriptor/__init__.py @@ -34,11 +34,11 @@ try: except ImportError: from stem.util.ordereddict import OrderedDict
-KEYWORD_CHAR = "a-zA-Z0-9-" -WHITESPACE = " \t" -KEYWORD_LINE = re.compile("^([%s]+)(?:[%s]+(.*))?$" % (KEYWORD_CHAR, WHITESPACE)) +KEYWORD_CHAR = "a-zA-Z0-9-" +WHITESPACE = " \t" +KEYWORD_LINE = re.compile("^([%s]+)(?:[%s]+(.*))?$" % (KEYWORD_CHAR, WHITESPACE)) PGP_BLOCK_START = re.compile("^-----BEGIN ([%s%s]+)-----$" % (KEYWORD_CHAR, WHITESPACE)) -PGP_BLOCK_END = "-----END %s-----" +PGP_BLOCK_END = "-----END %s-----"
Flag = stem.util.enum.Enum( ("AUTHORITY", "Authority"), diff --git a/stem/descriptor/server_descriptor.py b/stem/descriptor/server_descriptor.py index 8f73cdd..e51de8b 100644 --- a/stem/descriptor/server_descriptor.py +++ b/stem/descriptor/server_descriptor.py @@ -350,11 +350,11 @@ class ServerDescriptor(stem.descriptor.Descriptor): elif not (router_comp[2].isdigit() and router_comp[3].isdigit() and router_comp[4].isdigit()): continue
- self.nickname = router_comp[0] - self.address = router_comp[1] - self.or_port = int(router_comp[2]) + self.nickname = router_comp[0] + self.address = router_comp[1] + self.or_port = int(router_comp[2]) self.socks_port = None if router_comp[3] == '0' else int(router_comp[3]) - self.dir_port = None if router_comp[4] == '0' else int(router_comp[4]) + self.dir_port = None if router_comp[4] == '0' else int(router_comp[4]) elif keyword == "bandwidth": # "bandwidth" bandwidth-avg bandwidth-burst bandwidth-observed bandwidth_comp = value.split() @@ -373,8 +373,8 @@ class ServerDescriptor(stem.descriptor.Descriptor): if not validate: continue raise ValueError("Bandwidth line's observed rate isn't numeric: %s" % bandwidth_comp[2])
- self.average_bandwidth = int(bandwidth_comp[0]) - self.burst_bandwidth = int(bandwidth_comp[1]) + self.average_bandwidth = int(bandwidth_comp[0]) + self.burst_bandwidth = int(bandwidth_comp[1]) self.observed_bandwidth = int(bandwidth_comp[2]) elif keyword == "platform": # "platform" string diff --git a/stem/util/system.py b/stem/util/system.py index 080b080..bfdeb14 100644 --- a/stem/util/system.py +++ b/stem/util/system.py @@ -44,20 +44,20 @@ CMD_AVAILABLE_CACHE = {}
SHELL_COMMANDS = ['ulimit']
-IS_RUNNING_PS_LINUX = "ps -A co command" -IS_RUNNING_PS_BSD = "ps -ao ucomm=" -GET_PID_BY_NAME_PGREP = "pgrep -x %s" -GET_PID_BY_NAME_PIDOF = "pidof %s" +IS_RUNNING_PS_LINUX = "ps -A co command" +IS_RUNNING_PS_BSD = "ps -ao ucomm=" +GET_PID_BY_NAME_PGREP = "pgrep -x %s" +GET_PID_BY_NAME_PIDOF = "pidof %s" GET_PID_BY_NAME_PS_LINUX = "ps -o pid -C %s" -GET_PID_BY_NAME_PS_BSD = "ps axc" -GET_PID_BY_NAME_LSOF = "lsof -tc %s" -GET_PID_BY_PORT_NETSTAT = "netstat -npltu" +GET_PID_BY_NAME_PS_BSD = "ps axc" +GET_PID_BY_NAME_LSOF = "lsof -tc %s" +GET_PID_BY_PORT_NETSTAT = "netstat -npltu" GET_PID_BY_PORT_SOCKSTAT = "sockstat -4l -P tcp -p %s" -GET_PID_BY_PORT_LSOF = "lsof -wnP -iTCP -sTCP:LISTEN" -GET_PID_BY_FILE_LSOF = "lsof -tw %s" -GET_CWD_PWDX = "pwdx %s" -GET_CWD_LSOF = "lsof -a -p %s -d cwd -Fn" -GET_BSD_JAIL_ID_PS = "ps -p %s -o jid" +GET_PID_BY_PORT_LSOF = "lsof -wnP -iTCP -sTCP:LISTEN" +GET_PID_BY_FILE_LSOF = "lsof -tw %s" +GET_CWD_PWDX = "pwdx %s" +GET_CWD_LSOF = "lsof -a -p %s -d cwd -Fn" +GET_BSD_JAIL_ID_PS = "ps -p %s -o jid"
def is_windows(): """ diff --git a/test/check_whitespace.py b/test/check_whitespace.py index 06e5560..d6ad946 100644 --- a/test/check_whitespace.py +++ b/test/check_whitespace.py @@ -47,7 +47,7 @@ def pep8_issues(base_path = DEFAULT_TARGET): # We're gonna trim these down by cateogry but include the pep8 checks to # prevent regression.
- ignored_issues = "E111,E121,W293,E501,E302,E701,E251,E261,W391,E127,E241,E128,E226,E231,E202,E201,E203,E124,E211,E222,E225,E221" + ignored_issues = "E111,E121,W293,E501,E302,E701,E251,E261,W391,E127,E241,E128,E226,E231,E202,E201,E203,E124,E211,E222,E225"
issues = {} pep8_output = system.call("pep8 --ignore %s %s" % (ignored_issues, base_path))
tor-commits@lists.torproject.org