Browse files

more pep8 stuff.

  • Loading branch information...
1 parent cfc1d69 commit a1aa1fb66aabf5a7b6e01394f284a80b9154a3d7 @gutomaia committed Jul 26, 2011
Showing with 17 additions and 20 deletions.
  1. +2 −2 MockClient.py
  2. +3 −1 Msnp8.py
  3. +2 −2 Notification.py
  4. +1 −1 SocketConnection.py
  5. +7 −12 Tweener.py
  6. +2 −2 TweenerTest.py
View
4 MockClient.py
@@ -23,13 +23,13 @@ def onConnected(self):
self.connected = True
def onAddContact(self, contact):
- self.contact = contact;
+ self.contact = contact
def onRemoveContact(self, contact):
pass
def onAddGroup(self, group):
- self.group = group;
+ self.group = group
def onRemoveGroup(self, group):
pass
View
4 Msnp8.py
@@ -10,7 +10,9 @@
import Msnp
import Notification
+
class Msnp8(Notification.Notification):
+
def __init__(self):
Notification.Notification.__init__(self)
#super(Msnp8,self).connect()
@@ -81,7 +83,7 @@ def execute(self, command):
elif cmd == "CHG":
self.onConnected()
elif cmd == "CHL":
- params = command.strip().split(' ');
+ params = command.strip().split(' ')
self.send(self.qry(params[2]))
# elif cmd == "QRY":
elif cmd == "207":
View
4 Notification.py
@@ -47,13 +47,13 @@ def login(self, username, password):
def logout(self):
self.send(self.out())
self.disconnect()
-
+
# public final function addConnectionListener($connectionListener){
# $this->_connectionListener = $connectionListener;
# public final function
def addContactListener(self, contactListener):
- self._contactListener = contactListener;
+ self._contactListener = contactListener
# $this->_contactListener = $contactListener;
# public final function addPresenceListener($presenceListener){
View
2 SocketConnection.py
@@ -27,7 +27,7 @@ def connect(self, host, port):
print host, port
if self.getSocket() != None:
self._socket.close()
- self._socket = None;
+ self._socket = None
self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
result = self._socket.connect((host,port))
#if ($this->getSocket()) {
View
19 Tweener.py
@@ -16,21 +16,19 @@ class Tweener:
def __init__(self):
self.EL = "\r\n"
self.passportProps = None
-
def extractHttpResponseHeader(self, httpResponse):
props = {}
cutter = httpResponse.find("\r\n\r\n")
header = httpResponse[0:cutter]
parameter_values = header.split(self.EL)
for i in range(1, len(parameter_values)):
- cutter = parameter_values[i].find(':')
- key = parameter_values[i][0:cutter]
- value = parameter_values[i][cutter+2:]
- props[key] = value
+ cutter = parameter_values[i].find(':')
+ key = parameter_values[i][0:cutter]
+ value = parameter_values[i][cutter+2:]
+ props[key] = value
return props
-
def extractVarParams(self, params):
props = {}
parameter_values = params.split(',')
@@ -71,7 +69,6 @@ def connectToTheNexus(self):
# $passportURLS = $responseHeader['PassportURLs'];
# $this->passportProps = $this->extractVarParams($passportURLS);
# }
- pass
def buildHttpRequestHeader(self, url, params = None):
requestHeader = ''
@@ -89,10 +86,10 @@ def buildParamVars(self, params):
paramVars = '';
for key, value in params.iteritems():
if key == 'lc':
- paramVars+=value
+ paramVars +=value
else:
- paramVars+=key+'='+value
- paramVars+=','
+ paramVars +=key+'='+value
+ paramVars +=','
return paramVars
# function buildParamVars($params){
@@ -115,8 +112,6 @@ def encode(self, var):
# return str_replace("@", "%40", $var);
# }
-
-
def request(self, url, port, httpRequest):
host = url[:url.find('/')]
request = url[url.find('/'):]
View
4 TweenerTest.py
@@ -19,7 +19,7 @@ def setUp(self):
def tearDown(self):
self._twn = None
- def testExtractHttpResponseHeader(self):
+ def test_extract_http_response_header(self):
self.assertTrue(True)
header = 'HTTP/1.1 200 OK' + self.EL
header += 'Date: Sun, 11 Jul 2010 18:46:58 GMT' + self.EL
@@ -76,7 +76,7 @@ def testBuildHttpRequestHeader(self):
'Authorization':'Passport1.4 OrgVerb=GET,OrgURL=http%3A%2F%2Fmessenger%2Emsn%2Ecom,sign-in=dvader%40empire.com,pwd=ih8jedis,ct=1278901179,rver=5.5.4182.0,wp=FS_40SEC_0_COMPACT,lc=1033,id=507,ru=http:%2F%2Fmessenger.msn.com,tw=0,kpp=1,kv=4,ver=2.1.6000.1,rn=1lgjBfIL,tpf=b0735e3a873dfb5e75054465196398e0',
'Host':'login.live.com'
}
- requestHeader = self._twn.buildHttpRequestHeader('login.live.com/login2.srf', requestParams);
+ requestHeader = self._twn.buildHttpRequestHeader('login.live.com/login2.srf', requestParams)
#self.assertEquals(expected, requestHeader)
def testEncode(self):

0 comments on commit a1aa1fb

Please sign in to comment.