Skip to content

Commit 0770c5c

Browse files
committed
[FIX] Fix for python 3.5
1 parent 58ace07 commit 0770c5c

File tree

6 files changed

+24
-15
lines changed

6 files changed

+24
-15
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: python
22
python:
3+
- '3.5'
34
- '3.6'
45
install:
56
- pip install six

sped/blocos.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ def __init__(self, nome=''):
99
self._registros = []
1010

1111
def __repr__(self):
12-
return f'<{self.__class__.__module__}.{self.__class__.__name__}({self._nome})>'
12+
return '<%s.%s(%s)>' % (self.__class__.__module__,
13+
self.__class__.__name__, self._nome)
1314

1415
@property
1516
def abertura(self):

sped/campos.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def __init__(self, indice, nome, obrigatorio=False):
3232
self._obrigatorio = obrigatorio
3333

3434
def __repr__(self):
35-
return f'<{self.__class__.__module__}.{self.__class__.__name__}({self._indice}, {self._nome})>'
35+
return '<%s.%s(%s, %s)>' % (self.__class__.__module__,
36+
self.__class__.__name__,
37+
self._indice, self._nome)
3638

3739
@property
3840
def indice(self):
@@ -207,8 +209,8 @@ def set(self, registro, valor):
207209
else:
208210
raise FormatoInvalidoError(registro, str(self))
209211

210-
def __repr__(self):
211-
return f'{self.__class__.__name__}({self.indice}, {self.nome}, {self._obrigatorio}, {self._regex})'
212+
# def __repr__(self):
213+
# return '' f'{self.__class__.__name__}({self.indice}, {self.nome}, {self._obrigatorio}, {self._regex})'
212214

213215

214216
class CampoCNPJ(Campo):

sped/escrituracao.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,10 @@ def __init__(self, tipo: str, ano_calendario: int):
8484
self._add_registro(self._registro_escrituracao)
8585

8686
sped_path = Path(__file__).parent
87-
leiaute_ecd = Path(sped_path / 'leiautes' / f'{self._tipo}_{self._ano_calendario}.json')
87+
88+
leiaute_path = '%s/leiautes/%s_%s.json' % (sped_path, self._tipo,
89+
self._ano_calendario)
90+
leiaute_ecd = Path(leiaute_path)
8891

8992
with leiaute_ecd.open(encoding='utf-8', newline='\n') as f:
9093
p = json.load(f)
@@ -226,19 +229,21 @@ def prepare(self):
226229
self.registro_encerramento[2] = reg_count
227230

228231
def write_to(self, buff):
229-
buff.write(f'{self.registro_abertura}\r\n')
232+
buff.write('%s\r\n' % self.registro_abertura)
230233
reg_count = 2
231234
for bloco in self._blocos.values():
232235
reg_count += len(bloco.registros)
233236
for registro in bloco.registros:
234-
buff.write(f'{registro}\r\n')
237+
buff.write('%s\r\n' % registro)
235238

236239
self.registro_encerramento[2] = reg_count
237240

238-
buff.write(f'{self.registro_encerramento}\r\n')
241+
buff.write('%s\r\n' % self.registro_encerramento)
239242

240243
def add(self, registro: Registro):
241244
pass
242245

243246
def __repr__(self):
244-
return f'<{self.__class__.__module__}.{self.__class__.__name__}({self._tipo}, {self._ano_calendario})>'
247+
return '<%s.%s(%s, %s)>' % (self.__class__.__module__,
248+
self.__class__.__name__,
249+
self._tipo, self._ano_calendario)

sped/leiaute.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, nome, descricao):
4444
self.descricao = descricao
4545

4646
def __repr__(self):
47-
return f'<Bloco({self.nome}, {self.descricao})>'
47+
return '<Bloco(%s, %s)>' % (self.nome, self.descricao)
4848

4949

5050
class Registro(object):
@@ -58,7 +58,7 @@ def __init__(self, codigo, nome, regras, nivel, ocorrencia, campos_chave):
5858
self.campos = []
5959

6060
def __repr__(self):
61-
return f'<Registro({self.codigo}, {self.nome})>'
61+
return '<Registro(%s, %s)>' % (self.codigo, self.nome)
6262

6363

6464
class Campo(object):
@@ -70,12 +70,12 @@ def __init__(self, indice, nome, descricao, tipo, tamanho, decimal, valores, obr
7070
self.nome = nome
7171
self.descricao = descricao
7272
self.tipo = tipo
73-
73+
7474
try:
7575
self.tamanho = int(tamanho)
7676
except:
7777
self.tamanho = None
78-
78+
7979
try:
8080
self.decimal = int(decimal)
8181
except:
@@ -86,4 +86,4 @@ def __init__(self, indice, nome, descricao, tipo, tamanho, decimal, valores, obr
8686
self.regras = regras
8787

8888
def __repr__(self):
89-
return f'<Campo({self.indice}, {self.nome})>'
89+
return '<Campo(%s, %s)>' % (self.indice, self.nome)

sped/registros.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def __str__(self):
120120
return '|'.join(self._valores)
121121

122122
def __repr__(self):
123-
return f'<{self.__class__.__module__}.{self.__class__.__name__}>'
123+
return '<%s.%s>' % (self.__class__.__module__, self.__class__.__name__)
124124

125125

126126
class RegistroIndefinido(Registro):

0 commit comments

Comments
 (0)