[Pkg-privacy-commits] [pyptlib] 40/136: PEP 8
Ximin Luo
infinity0 at moszumanska.debian.org
Sat Aug 22 13:25:05 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 786556acd0a078ac3d8259f356442c23b0799141
Author: Brandon Wiley <brandon at blanu.net>
Date: Wed Jul 18 15:02:47 2012 -0500
PEP 8
---
src/pyptlib/client.py | 3 +++
src/pyptlib/config.py | 10 ++++++++--
src/pyptlib/easy/client.py | 3 ++-
src/pyptlib/easy/server.py | 3 ++-
src/pyptlib/easy/util.py | 3 +++
src/pyptlib/server.py | 12 ++++++++++--
6 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/src/pyptlib/client.py b/src/pyptlib/client.py
index b240630..31cdaf5 100644
--- a/src/pyptlib/client.py
+++ b/src/pyptlib/client.py
@@ -14,6 +14,7 @@ __docformat__ = 'restructuredtext'
class ClientConfig(Config):
+
"""
The ClientConfig class contains a low-level API which closely follows the Tor Proposal 180: Pluggable transports for circumvention.
This class inherits from pyptlib.config.Config and contains just the parts of the API which are specific to the client implementations of the protocol.
@@ -73,3 +74,5 @@ class ClientConfig(Config):
""" Write a message to stdout specifying that the list of supported transports has ended """
self.emit('CMETHODS DONE')
+
+
diff --git a/src/pyptlib/config.py b/src/pyptlib/config.py
index ce0e49a..142bba6 100644
--- a/src/pyptlib/config.py
+++ b/src/pyptlib/config.py
@@ -13,10 +13,12 @@ __docformat__ = 'restructuredtext'
class Config:
+
"""
The Config module class a low-level API which closely follows the Tor Proposal 180: Pluggable transports for circumvention.
This class contains the parts of the API which are shared by both client and server implementations of the protocol.
"""
+
stateLocation = None # TOR_PT_STATE_LOCATION
managedTransportVer = [] # TOR_PT_MANAGED_TRANSPORT_VER
transports = [] # TOR_PT_SERVER_TRANSPORTS or TOR_PT_CLIENT_TRANSPORTS
@@ -105,15 +107,19 @@ class Config:
raise EnvException(message)
def emit(self, msg):
- print(msg)
- logging.error(msg)
+ print msg
+ logging.error(msg)
+
# Exception thrown when there is an error parsing the configuration parameters provided by Tor in environment variables
class EnvException(Exception):
+
""" The EnvException exception is thrown whenever a required environment variable is not presented or cannot be parsed. """
message = None
def __init__(self, message):
self.message = message
+
+
diff --git a/src/pyptlib/easy/client.py b/src/pyptlib/easy/client.py
index 5ccb3a3..1dd642f 100644
--- a/src/pyptlib/easy/client.py
+++ b/src/pyptlib/easy/client.py
@@ -4,7 +4,6 @@
from pyptlib.config import EnvException
from pyptlib.client import ClientConfig
-""" The pyptlib.easy.client module provides a high-level API for implementing pluggable transport clients. """
def init(transports):
"""
@@ -70,3 +69,5 @@ def reportEnd():
config = ClientConfig()
config.writeMethodEnd()
+
+
diff --git a/src/pyptlib/easy/server.py b/src/pyptlib/easy/server.py
index 9912173..86f684c 100644
--- a/src/pyptlib/easy/server.py
+++ b/src/pyptlib/easy/server.py
@@ -4,7 +4,6 @@
from pyptlib.config import EnvException
from pyptlib.server import ServerConfig
-""" The pyptlib.easy.client module provides a high-level API for implementing pluggable transport clients. """
def init(transports):
"""
@@ -64,3 +63,5 @@ def reportEnd():
config = ServerConfig()
config.writeMethodEnd()
+
+
diff --git a/src/pyptlib/easy/util.py b/src/pyptlib/easy/util.py
index fa0ec81..6c3412b 100644
--- a/src/pyptlib/easy/util.py
+++ b/src/pyptlib/easy/util.py
@@ -5,6 +5,7 @@
from pyptlib.config import Config, EnvException
+
def checkClientMode():
""" Checks to see if the daemon has been launched in client mode or server mode. Returns True if it is in client mode, otherwise False. """
@@ -13,3 +14,5 @@ def checkClientMode():
return c.checkClientMode()
except EnvException:
return False
+
+
diff --git a/src/pyptlib/server.py b/src/pyptlib/server.py
index bab98f3..098be53 100644
--- a/src/pyptlib/server.py
+++ b/src/pyptlib/server.py
@@ -14,10 +14,12 @@ __docformat__ = 'restructuredtext'
class ServerConfig(Config):
+
"""
The ServerConfig class contains a low-level API which closely follows the Tor Proposal 180: Pluggable transports for circumvention.
This class inherits from pyptlib.config.Config and contains just the parts of the API which are specific to the client implementations of the protocol.
"""
+
extendedServerPort = None # TOR_PT_EXTENDED_SERVER_PORT
ORPort = None # TOR_PT_ORPORT
serverBindAddr = {} # TOR_PT_SERVER_BINADDR
@@ -64,6 +66,7 @@ class ServerConfig(Config):
def getServerTransports(self):
""" Returns a list of strings representing the server transports reported by Tor. If present, '*' is stripped from this list and used to set allTransportsEnabled to True. """
+
return self.transports
def writeMethod( # SMETHOD
@@ -79,9 +82,10 @@ class ServerConfig(Config):
if options:
self.emit('SMETHOD %s %s:%s %s' % (name, address[0],
- address[1], options))
+ address[1], options))
else:
- self.emit('SMETHOD %s %s:%s' % (name, address[0], address[1]))
+ self.emit('SMETHOD %s %s:%s' % (name, address[0],
+ address[1]))
def writeMethodError(self, name, message): # SMETHOD-ERROR
"""
@@ -93,10 +97,12 @@ class ServerConfig(Config):
def writeMethodEnd(self): # SMETHODS DONE
""" Write a message to stdout specifying that the list of supported transports has ended """
+
self.emit('SMETHODS DONE')
class MethodOptions:
+
""" The MethodOptions class represents the method options: FORWARD, ARGS, DECLARE, and USE-EXTENDED-PORT. """
forward = False # FORWARD
@@ -150,3 +156,5 @@ class MethodOptions:
options.append('USE-EXTENDED-PORT:1')
return ' '.join(options)
+
+
--
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