Tabs e vim
[cascardo/irpf-gui.git] / municipios.py
index 080a0e3..380ffa7 100644 (file)
 import xml.dom.minidom
 
 class Municipios:
-       def __init__(self, UF):
-               self.xml = xml.dom.minidom.parse("res/%s.xml" % (UF,))
-               self.l = []
-               self._list()
-       def _list(self):
-               for i in self.xml.childNodes[0].childNodes:
-                       if "COL3" in i.attributes.keys():
-                               self.l.append((i.attributes["COL1"].nodeValue, \
-                                       i.attributes["COL2"].nodeValue, \
-                                       i.attributes["COL3"].nodeValue))
-       def list(self):
-               return self.l
-       def get_municipio(self, code):
-               for i in self.l:
-                       if i[0] == code:
-                               return i
-               return None
-       def verify_cep(self, m, cep):
-               l = m[2][0:7]
-               h = m[2][9:16]
-               if cep >= l and cep <= h:
-                       return True
-               return False
+    def __init__(self, UF):
+        self.xml = xml.dom.minidom.parse("res/%s.xml" % (UF,))
+        self.l = []
+        self._list()
+    def _list(self):
+        for i in self.xml.childNodes[0].childNodes:
+            if "COL3" in i.attributes.keys():
+                self.l.append((i.attributes["COL1"].nodeValue, \
+                        i.attributes["COL2"].nodeValue, \
+                        i.attributes["COL3"].nodeValue))
+                def list(self):
+                    return self.l
+    def get_municipio(self, code):
+        for i in self.l:
+            if i[0] == code:
+                return i
+        return None
+    def verify_cep(self, m, cep):
+        l = m[2][0:7]
+        h = m[2][9:16]
+        if cep >= l and cep <= h:
+            return True
+        return False
 
 if __name__ == '__main__':
-       municipios = Municipios('MG')
-       m = municipios.get_municipio('4877')
-       print m[1]
-       print municipios.verify_cep(m, '36880000')
-       print municipios.verify_cep(m, '05020000')
+    municipios = Municipios('MG')
+    m = municipios.get_municipio('4877')
+    print m[1]
+    print municipios.verify_cep(m, '36880000')
+    print municipios.verify_cep(m, '05020000')
 
-       municipios = Municipios('SP')
-       m = municipios.get_municipio('7107')
-       print m[1]
-       print municipios.verify_cep(m, '05020000')
-       print municipios.verify_cep(m, '36880000')
+    municipios = Municipios('SP')
+    m = municipios.get_municipio('7107')
+    print m[1]
+    print municipios.verify_cep(m, '05020000')
+    print municipios.verify_cep(m, '36880000')
+
+# vim:tabstop=4:expandtab:smartindent