[Pkg-privacy-commits] [pyptlib] 31/136: Reformatted according to PEP 8 guidelines
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:25:03 UTC 2015
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository pyptlib.
commit e0c5ddff9864e880d43f3abc74a3f77ed5603ed3
Author: Brandon Wiley <brandon at blanu.net>
Date: Fri Jun 29 14:11:36 2012 -0500
Reformatted according to PEP 8 guidelines
---
src/examples/client.py | 21 +++++++++++++--------
src/examples/server.py | 23 ++++++++++++++---------
src/pyptlib/easy/client.py | 27 +++++++++++++++++++--------
src/pyptlib/easy/server.py | 25 +++++++++++++++++--------
4 files changed, 63 insertions(+), 33 deletions(-)
diff --git a/src/examples/client.py b/src/examples/client.py
index 048cdb5..e7e2f7d 100755
--- a/src/examples/client.py
+++ b/src/examples/client.py
@@ -1,24 +1,29 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-from pyptlib.easy.client import init, reportSucess, reportFailure, reportEnd
+from pyptlib.easy.client import init, reportSucess, reportFailure, \
+ reportEnd
+
class TransportLaunchException(Exception):
- pass
+
+ pass
+
def launchClient(self, name, port):
if name != 'dummy':
raise TransportLaunchException('Tried to launch unsupported transport %s'
% name)
+
if __name__ == '__main__':
supportedTransports = ['dummy', 'rot13']
- matchedTransports=init(supportedTransports)
+ matchedTransports = init(supportedTransports)
for transport in matchedTransports:
- try:
- launchClient(transport, 8182)
- reportSuccess(transport, 5, ('127.0.0.1', 8182), None, None)
- except TransportLaunchException:
- reportFailure(transport, 'Failed to launch')
+ try:
+ launchClient(transport, 8182)
+ reportSuccess(transport, 5, ('127.0.0.1', 8182), None, None)
+ except TransportLaunchException:
+ reportFailure(transport, 'Failed to launch')
reportEnd()
diff --git a/src/examples/server.py b/src/examples/server.py
index 4f1b968..daa5878 100755
--- a/src/examples/server.py
+++ b/src/examples/server.py
@@ -1,24 +1,29 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
-from pyptlib.easy.server import init, reportSucess, reportFailure, reportEnd
+from pyptlib.easy.server import init, reportSucess, reportFailure, \
+ reportEnd
+
class TransportLaunchException(Exception):
- pass
+
+ pass
+
def launchServer(self, name, port):
if name != 'dummy':
raise TransportLaunchException('Tried to launch unsupported transport %s'
% name)
+
if __name__ == '__main__':
supportedTransports = ['dummy', 'rot13']
- matchedTransports=init(supportedTransports)
+ matchedTransports = init(supportedTransports)
for transport in matchedTransports:
- try:
- launchServer(transport, 8182)
- reportSuccess(transport, ('127.0.0.1', 8182), None)
- except TransportLaunchException:
- reportFailure(transport, 'Failed to launch')
- reportEnd()
\ No newline at end of file
+ try:
+ launchServer(transport, 8182)
+ reportSuccess(transport, ('127.0.0.1', 8182), None)
+ except TransportLaunchException:
+ reportFailure(transport, 'Failed to launch')
+ reportEnd()
diff --git a/src/pyptlib/easy/client.py b/src/pyptlib/easy/client.py
index 5461f8b..a2be812 100644
--- a/src/pyptlib/easy/client.py
+++ b/src/pyptlib/easy/client.py
@@ -12,13 +12,14 @@ from socket import inet_ntoa
from pyptlib.config import EnvException
from pyptlib.client import ClientConfig
+
def init(transports):
supportedTransportVersion = '1'
-
+
try:
- config = ClientConfig()
+ config = ClientConfig()
except EnvException:
- return []
+ return []
if config.checkManagedTransportVersion(supportedTransportVersion):
config.writeVersion(supportedTransportVersion)
@@ -26,19 +27,29 @@ def init(transports):
config.writeVersionError()
return []
- matchedTransports=[]
+ matchedTransports = []
for transport in transports:
- if config.checkTransportEnabled(supportedTransport):
- matchedTransports.append(transport)
+ if config.checkTransportEnabled(supportedTransport):
+ matchedTransports.append(transport)
return matchedTransports
-def reportSuccess(name, socksVersion, address, args, optArgs):
+
+def reportSuccess(
+ name,
+ socksVersion,
+ address,
+ args,
+ optArgs,
+ ):
config.writeMethod(name, socksVersion, address, args, optArgs)
-
+
+
def reportFailure(name, message):
config.writeMethodError(name, message)
+
def reportEnd():
config.writeMethodEnd()
+
diff --git a/src/pyptlib/easy/server.py b/src/pyptlib/easy/server.py
index 0be7441..c8f6a15 100644
--- a/src/pyptlib/easy/server.py
+++ b/src/pyptlib/easy/server.py
@@ -12,13 +12,14 @@ from socket import inet_ntoa
from pyptlib.config import EnvException
from pyptlib.client import ServerConfig
+
def init(transports):
supportedTransportVersion = '1'
-
+
try:
- config = ServerConfig()
+ config = ServerConfig()
except EnvException:
- return []
+ return []
if config.checkManagedTransportVersion(supportedTransportVersion):
config.writeVersion(supportedTransportVersion)
@@ -26,19 +27,27 @@ def init(transports):
config.writeVersionError()
return []
- matchedTransports=[]
+ matchedTransports = []
for transport in transports:
- if config.checkTransportEnabled(supportedTransport):
- matchedTransports.append(transport)
+ if config.checkTransportEnabled(supportedTransport):
+ matchedTransports.append(transport)
return matchedTransports
-def reportSuccess(name, address, args, options):
+
+def reportSuccess(
+ name,
+ address,
+ args,
+ options,
+ ):
config.writeMethod(name, address, options)
-
+
+
def reportFailure(name, message):
config.writeMethodError(name, message)
+
def reportEnd():
config.writeMethodEnd()
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-privacy/packages/pyptlib.git
More information about the Pkg-privacy-commits
mailing list