Quebra de linha entre funções
authorEduardo Elias Camponez <camponez@gmail.com>
Sat, 4 May 2013 15:16:46 +0000 (12:16 -0300)
committerThadeu Lima de Souza Cascardo <cascardo@cascardo.info>
Tue, 7 May 2013 11:00:25 +0000 (08:00 -0300)
src/bens.py
src/contribuinte.py
src/municipios.py
src/ocupacoes.py

index 95d09ec..a098e79 100644 (file)
@@ -34,14 +34,18 @@ class Bens:
                 self.items = []
                 for i in self.bens.getElementsByTagName("item"):
                     self.items.append(Bem(i))
+
     def _get_attr(self, el, attr):
         if attr in el.attributes.keys():
             return el.attributes[attr].nodeValue
         return None
+
     def _set_attr(self, el, attr, val):
         el.attributes[attr].nodeValue = val
+
     def get_bens(self, attr):
         return self._get_attr(self.bens, attr)
+
     def set_bens(self, attr, val):
         self._set_attr(self.bens, attr, val)
 
index 317237c..587762c 100644 (file)
@@ -24,6 +24,7 @@ class Contribuinte:
         self.declaracao = self._find_id()
         self.dados = xml.dom.minidom.parse("aplicacao/dados/%s/%s.xml" % (self.cpf, self.cpf))
         self.contribuinte = self.dados.getElementsByTagName("contribuinte")[0]
+
     def _find_id(self):
         cpf = self._normalize_cpf(self.cpf)
         self.declaracoes = xml.dom.minidom.parse("aplicacao/dados/iddeclaracoes.xml")
@@ -32,6 +33,7 @@ class Contribuinte:
                 if i.attributes["cpf"].nodeValue == cpf:
                     return i
         return None
+
     # CPF normalizado se parece com 000.000.000-00
     def _normalize_cpf(self, cpf):
         ncpf = ""
@@ -47,6 +49,7 @@ class Contribuinte:
         if len(ncpf) != 14:
             raise RuntimeError("Invalid CPF")
         return ncpf
+
     # CPF minimizado se parece com 01234567890
     def _minimize_cpf(self, cpf):
         ncpf = bytearray(self._normalize_cpf(cpf))
@@ -54,6 +57,7 @@ class Contribuinte:
         del ncpf[7]
         del ncpf[3]
         return str(ncpf)
+
     def _validate_cpf(self, cpf):
         ncpf = self._minimize_cpf(cpf)
         if len(ncpf) != 11:
@@ -69,6 +73,7 @@ class Contribuinte:
         if v != ord(ncpf[10]) - ord('0'):
             return False
         return True
+
     def save(self):
         self.dados.writexml(open("aplicacao/dados/%s/%s.xml" % (self.cpf, self.cpf), "w"))
         self.declaracoes.writexml(open("aplicacao/dados/iddeclaracoes.xml", "w"))
@@ -76,20 +81,27 @@ class Contribuinte:
         if attr in el.attributes.keys():
             return el.attributes[attr].nodeValue
         return None
+
     def _set_attr(self, el, attr, val):
         el.attributes[attr].nodeValue = val
+
     def get_declaracao(self, attr):
         return self._get_attr(self.declaracao, attr)
+
     def set_declaracao(self, attr, val):
         self._set_attr(self.declaracao, attr, val)
+
     def get_nome(self):
         return self.get_declaracao("nome")
+
     def set_nome(self, nome):
         self.set_declaracao("nome", nome)
+
     def get_contribuinte(self, attr):
         if attr == "nome":
             return self.get_nome()
         return self._get_attr(self.contribuinte, attr)
+
     def set_contribuinte(self, attr, val):
         if attr == "nome":
             self.set_nome(val)
index 380ffa7..7687985 100644 (file)
@@ -21,6 +21,7 @@ class Municipios:
         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():
@@ -29,11 +30,13 @@ class Municipios:
                         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]
index 5f5ec17..4c95fc9 100644 (file)
@@ -23,6 +23,7 @@ class Ocupacoes:
         self.g = {}
         self._list()
         self._group()
+
     def _list(self):
         for i in self.xml.childNodes[0].childNodes:
             if "COL4" in i.attributes.keys():
@@ -32,13 +33,16 @@ class Ocupacoes:
                         i.attributes["COL4"].nodeValue))
                 def list(self):
                     return self.l
+
     def _group(self):
         for i in self.l:
             if i[1] not in self.g:
                 self.g[i[1]] = []
             self.g[i[1]].append(i)
+
     def groups(self):
         return self.g
+
     def get_ocupacao(self, code):
         for i in self.l:
             if i[0] == code: