/usr/share/pyshared/pyacidobasic/dozzz.py is in python-acidobasic 2.2-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102  | #-*- coding: utf-8 -*-
licence="""
    file dozz.py: part of the package pyacidobasic version %s:
    Copyright (C) 2010 Georges Khaznadar <georgesk@ofset.org>
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""
from xml.dom.minidom import parseString
from codecs import open
import string
import re
def sanitizeXML(s, firstline=1):
    """
    Assainit une chaîne XML en supprimant les caractères interdits
    dans le marquage XML.
    @param s du code XML incorrect
    @param firstline la première ligne où le code peut être incorrect
    @return du code XML assaini
    """
    invalid=u' !"#%\'()*+,-.:;=?@[\]^_`{|}~'
    valid  ="_"*len(invalid)
    tr = dict((ord(char), u'_') for char in invalid)
    #tr=string.maketrans(invalid,valid)###
    
    s=map(lambda l: l.strip(), s.split("\n"))
    for i in range(firstline, len(s)):
        if s[i][0]=="<":
            s[i]=s[i].translate(tr)
    return u" ".join(s)
def dozParse(fileName="/usr/share/dozzaqueux/base.equ"):
    """
    Lit un fichier chimique et renvoie un objet DOM
    @param fileName le nom du fichier à lire
    @return un objet DOM
    """
    dozzzSource=open(fileName,"r","utf-8").read()
    dozzzSource='<?xml version="1.0" encoding="ISO-8859-1"?> <dozzz>' + dozzzSource + "</dozzz>"
    dozzzSource=sanitizeXML(dozzzSource)
    return parseString(dozzzSource.encode("utf-8"))
def doz2html(s):
    """
    Traduit la notation d'identifiants Dozzzaqueux en code HTML
    @param s un identifiant Dozzzaqueux
    @return sa traduction HTML
    """
    s=s.strip()
    m=re.match("(.*)\[(.*)\]", s)
    if m:
        formule=m.group(1)
        charge=m.group(2)
    else:
        formule=s
        charge=""
    formule=re.sub("([0-9]+)", "<sub>\\1</sub>", formule)
    if charge:
        charge="<sup>"+charge+"</sup>"
    return formule+charge
    
    
def elementsAvecConductivite(doz):
    """
    Renvoie un dictionnaire d'éléments qui ont une conductivité renseignée
    @param doz un objet DOM
    @return un dictionnaire
    """
    result={}
    l=doz.getElementsByTagName("Element")
    for e in l:
        c=e.getElementsByTagName("Conductivite")
        if c:
            c=float( c[0].firstChild.data)
            if c != 0.0:
                identifiant=e.getElementsByTagName("Identifiant")[0].firstChild.data.encode("latin-1") ### quelque chose a dû être cassé avant ça, peut-être un bug dans parseString ?
                result[doz2html(identifiant)]=c
    return result
if __name__=="__main__":
    doz = dozParse()
    ec = elementsAvecConductivite(doz)
    for k in ec.keys():
        print k, ec[k]
    
 |