[Nym3-commit] r241 - trunk/nym3
laurent at conuropsis.org
laurent at conuropsis.org
Fri May 6 16:30:30 CEST 2005
Author: laurent
Date: 2005-05-06 16:30:29 +0200 (Fri, 06 May 2005)
New Revision: 241
Modified:
trunk/nym3/Message.py
Log:
Indentation.
Modified: trunk/nym3/Message.py
===================================================================
--- trunk/nym3/Message.py 2005-05-06 14:07:04 UTC (rev 240)
+++ trunk/nym3/Message.py 2005-05-06 14:30:29 UTC (rev 241)
@@ -126,32 +126,23 @@
return h
def readCommandCToS(self):
- """Read next CommandCToS from string"""
- try:
- ct = ord(self.next(1))
- cs = strToIntBE(self.next(3))
- if (ct == CToSCODE['Create']):
- a = Create()
- elif (ct == CToSCODE['Create2']):
- a = Create2()
- elif (ct == CToSCODE['Surb']):
- a = Surb()
- elif (ct == CToSCODE['Newpk']):
- a = Newpk()
- elif (ct == CToSCODE['Relay']):
- a = Relay()
- elif (ct == CToSCODE['Get']):
- a = Get()
- elif (ct == CToSCODE['Summarize']):
- a = Summarize()
- elif (ct == CToSCODE['Delete']):
- a = Delete()
- elif (ct == CToSCODE['Policy']):
- a = Policy()
- else:
- raise ParseError("Undefined Command Type")
- a.fromStrReader(self, cs)
- return a
+ """Read next CommandCToS from string"""
+ try:
+ ct = ord(self.next(1))
+ cs = strToIntBE(self.next(3))
+ if (ct == CToSCODE['Create']): a = Create()
+ elif (ct == CToSCODE['Create2']): a = Create2()
+ elif (ct == CToSCODE['Surb']): a = Surb()
+ elif (ct == CToSCODE['Newpk']): a = Newpk()
+ elif (ct == CToSCODE['Relay']): a = Relay()
+ elif (ct == CToSCODE['Get']): a = Get()
+ elif (ct == CToSCODE['Summarize']): a = Summarize()
+ elif (ct == CToSCODE['Delete']): a = Delete()
+ elif (ct == CToSCODE['Policy']): a = Policy()
+ else:
+ raise ParseError("Undefined Command Type")
+ a.fromStrReader(self, cs)
+ return a
except IndexError: #is it really necessary? is it not considered in the various fromStrReader ?
raise ParseError("Bad Formed Command")
@@ -164,29 +155,25 @@
return l
def readCommandSToC(self):
- """Read next CommandSToC from string"""
- try:
- ct = ord(self.next(1))
- cs = strToIntBE(self.next(3))
- if (ct == SToCCODE['Created']):
- a = Created()
- elif (ct == SToCCODE['Status']):
- a = Status()
- elif (ct == SToCCODE['Summary']):
- a = Summary()
- elif (ct == SToCCODE['Msg']):
- a = Msg()
- elif (ct == SToCCODE['Dropped']):
- a = Dropped()
- elif (ct == SToCCODE['Error']):
- a = Error()
- else:
- raise ParseError("Undefined Command Type")
- a.fromStrReader(self, cs)
- return a
- except IndexError: #is it really necessary? is it not considered in the various fromStrReader ?
- #it should, if not consider it a bug
- raise ParseError("Bad Formed Command")
+ """Read next CommandSToC from string"""
+ try:
+ ct = ord(self.next(1))
+ cs = strToIntBE(self.next(3))
+ if (ct == SToCCODE['Created']): a = Created()
+ elif (ct == SToCCODE['Status']): a = Status()
+ elif (ct == SToCCODE['Summary']): a = Summary()
+ elif (ct == SToCCODE['Msg']): a = Msg()
+ elif (ct == SToCCODE['Dropped']): a = Dropped()
+ elif (ct == SToCCODE['Error']): a = Error()
+ else:
+ print "Got ct %u" % ct
+ raise ParseError("Undefined Command Type")
+ a.fromStrReader(self, cs)
+ return a
+ except IndexError:
+ # is it really necessary? is it not considered in the various
+ # fromStrReader ? it should, if not consider it a bug
+ raise ParseError("Bad Formed Command")
def readCommandSToCList(self):
"""Read a list of CommandSToC from string, until
@@ -798,8 +785,7 @@
if not isMidList(l, seqNoLength):
raise BadArgument("Status.fromData : l is not a list of Sequence Number")
if 14 + seqNoLength * len(l) >= pow(256, 3):
- # 14 ? Why not 17 or 42 ? avoid numeric literals
- # where possible FIXME
+ # avoid numeric literals where possible TODO
raise BadArgument("Status.fromData : l is too long")
self.nMsg = nM
self.nSurb = nS
More information about the Nym3-commit
mailing list