Fix block parsing error and make 1.2.3 release pyslha-1.2.3

Sun, 10 Apr 2011 12:24:01 +0100

author
Andy Buckley <andy@insectnation.org>
date
Sun, 10 Apr 2011 12:24:01 +0100
changeset 141
869c16f9093b
parent 140
81b5c01084f4
child 142
a212058fa191

Fix block parsing error and make 1.2.3 release

ChangeLog file | annotate | diff | comparison | revisions
pyslha.py file | annotate | diff | comparison | revisions
     1.1 --- a/ChangeLog	Sun Apr 10 12:18:08 2011 +0100
     1.2 +++ b/ChangeLog	Sun Apr 10 12:24:01 2011 +0100
     1.3 @@ -1,5 +1,9 @@
     1.4  2011-04-10  Andy Buckley  <andy@insectnation.org>
     1.5  
     1.6 +	* Version 1.2.3.
     1.7 +
     1.8 +	* Fix insufficiently careful parsing of BLOCK "Q=" declarations.
     1.9 +
    1.10  	* Add little pre-release testing script, "test".
    1.11  
    1.12  	* Add missing IDHW / IDPDG mapping for W+- and Z0.
     2.1 --- a/pyslha.py	Sun Apr 10 12:18:08 2011 +0100
     2.2 +++ b/pyslha.py	Sun Apr 10 12:24:01 2011 +0100
     2.3 @@ -196,13 +196,13 @@
     2.4          ## Handle BLOCK/DECAY start lines
     2.5          if line.upper().startswith("BLOCK"):
     2.6              #print line
     2.7 -            match = re.match(r"BLOCK\s+(\w+)(\s+Q=\s*.+)?", line.upper())
     2.8 +            match = re.match(r"BLOCK\s+(\w+)(\s+Q\s*=\s*.+)?", line.upper())
     2.9              if not match:
    2.10                  continue
    2.11              blockname = match.group(1)
    2.12              qstr = match.group(2)
    2.13              if qstr is not None:
    2.14 -                qstr = qstr[2:].strip()
    2.15 +                qstr = qstr[qstr.find("=")+1:].strip()
    2.16              currentblock = blockname
    2.17              currentdecay = None
    2.18              blocks[blockname] = Block(blockname, q=qstr)
    2.19 @@ -293,7 +293,7 @@
    2.20      for bname, b in sorted(blocks.iteritems()):
    2.21          namestr = b.name
    2.22          if b.q is not None:
    2.23 -            namestr += " Q= %e" % b.q
    2.24 +            namestr += " Q= %e" % float(b.q)
    2.25          out += "BLOCK %s\n" % namestr
    2.26          for s in dict_hier_strs(b.entries):
    2.27              out += sep + s + "\n"

mercurial