Browse Source

Use flake8 in qa checks

pull/6/head
Marcio Mazza 10 years ago
parent
commit
a5d2ef28a3
  1. 3
      base/views.py
  2. 3
      legacy/admin.py
  3. 12
      legacy/scripts/scrap_original_forms.py
  4. 3
      legacy/views.py
  5. 3
      lexml/views.py
  6. 3
      materia/views.py
  7. 4
      norma/models.py
  8. 3
      norma/views.py
  9. 14
      parlamentares/models.py
  10. 3
      parlamentares/views.py
  11. 4
      protocoloadm/models.py
  12. 3
      protocoloadm/views.py
  13. 2
      qa_check.sh
  14. 1
      requirements/dev-requirements.txt
  15. 2
      sapl/layout.py
  16. 2
      sapl/legacy_migration_settings.py

3
base/views.py

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

3
legacy/admin.py

@ -1,3 +0,0 @@
from django.contrib import admin
# Register your models here.

12
legacy/scripts/scrap_original_forms.py

@ -38,8 +38,8 @@ def extract_title_and_fieldsets(model):
filename = os.path.join(os.path.dirname(__file__),
'original_forms/%s.html' % model.__name__)
try:
with open(filename, 'r') as f:
html_doc = f.read()
with open(filename, 'r') as file:
html_doc = file.read()
except IOError:
return None, []
@ -116,7 +116,7 @@ def source_with_verbose_names(model):
name, path, args, legacy_name = split(match.groups())
if name in labels and 'verbose_name' not in args:
args = [args] if args.strip() else []
args.append("verbose_name=_(u'%s')" % labels[name])
args.append("verbose_name=_('%s')" % labels[name])
args = ', '.join(args)
new_lines.append(
(' %s = %s(%s)' % (name, path, args), legacy_name))
@ -167,8 +167,8 @@ def source_with_verbose_names(model):
yield """
class Meta:
verbose_name = _(u'%s')
verbose_name_plural = _(u'%s')""" % (title_singular, title_plural)
verbose_name = _('%s')
verbose_name_plural = _('%s')""" % (title_singular, title_plural)
def print_app_with_verbose_names(app):
@ -231,7 +231,7 @@ def extract_fieldsets_for_current(model):
rows = [
colsplit(
[reverse_field_renames.get(name, '%s_FIXME' % name)
for name, __ in line])
for name, ___ in line])
for line in fieldset['lines'] if line
]
yield [fieldset['legend']] + rows

3
legacy/views.py

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

3
lexml/views.py

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

3
materia/views.py

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

4
norma/models.py

@ -96,7 +96,7 @@ class NormaJuridica(models.Model):
verbose_name_plural = _('Normas Jurídicas')
def __str__(self):
return _(u'%(tipo)s%(numero)s - %(materia)s - %(ano)s') % {
return _('%(tipo)s%(numero)s - %(materia)s - %(ano)s') % {
'tipo': self.tipo,
'numero': self.numero,
'materia': self.materia,
@ -158,7 +158,7 @@ class VinculoNormaJuridica(models.Model):
verbose_name_plural = _('Vínculos entre Normas Jurídicas')
def __str__(self):
return _(u'Referente: %(referente)s \n'
return _('Referente: %(referente)s \n'
'Referida: %(referida)s \nVínculo: %(vinculo)s') % {
'referente': self.norma_referente,
'referida': self.norma_referida,

3
norma/views.py

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

14
parlamentares/models.py

@ -14,7 +14,7 @@ class Legislatura(models.Model):
verbose_name_plural = _('Legislaturas')
def __str__(self):
return _(u'Eleição: %(eleicao)s'
return _('Eleição: %(eleicao)s'
' - Início: %(inicio)s | Fim: %(fim)s') % {
'eleicao': self.data_eleicao,
'inicio': self.data_inicio,
@ -73,7 +73,7 @@ class Partido(models.Model):
verbose_name_plural = _('Partidos')
def __str__(self):
return _(u'%(sigla)s - %(nome)s') % {
return _('%(sigla)s - %(nome)s') % {
'sigla': self.sigla, 'nome': self.nome
}
@ -88,7 +88,7 @@ class ComposicaoColigacao(models.Model):
verbose_name_plural = ('Composição Coligações')
def __str__(self):
return _(u'%(partido)s - %(coligacao)s') % {
return _('%(partido)s - %(coligacao)s') % {
'partido': self.partido, 'coligacao': self.coligacao
}
@ -147,7 +147,7 @@ class Municipio(models.Model): # Localidade
verbose_name_plural = _('Municípios')
def __str__(self):
return _(u'%(nome)s - %(uf)s (%(regiao)s)') % {
return _('%(nome)s - %(uf)s (%(regiao)s)') % {
'nome': self.nome, 'uf': self.uf, 'regiao': self.regiao
}
@ -319,7 +319,7 @@ class Filiacao(models.Model):
verbose_name_plural = _('Filiações')
def __str__(self):
return _(u'%(parlamentar)s - %(partido)s') % {
return _('%(parlamentar)s - %(partido)s') % {
'parlamentar': self.parlamentar, 'partido': self.partido
}
@ -362,7 +362,7 @@ class Mandato(models.Model):
verbose_name_plural = _('Mandatos')
def __str__(self):
return _(u'%(parlamentar)s %(legislatura)s') % {
return _('%(parlamentar)s %(legislatura)s') % {
'parlamentar': self.parlamentar, 'legislatura': self.legislatura
}
@ -392,6 +392,6 @@ class ComposicaoMesa(models.Model):
verbose_name_plural = _('Ocupações de cargo na Mesa')
def __str__(self):
return _(u'%(parlamentar)s - %(cargo)s') % {
return _('%(parlamentar)s - %(cargo)s') % {
'parlamentar': self.parlamentar, 'cargo': self.cargo
}

3
parlamentares/views.py

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

4
protocoloadm/models.py

@ -42,7 +42,7 @@ class DocumentoAdministrativo(models.Model):
verbose_name_plural = _('Documentos Administrativos')
def __str__(self):
return _(u'%(tipo)s - %(assunto)s') % {
return _('%(tipo)s - %(assunto)s') % {
'tipo': self.tipo, 'assunto': self.assunto
}
@ -163,6 +163,6 @@ class TramitacaoAdministrativo(models.Model):
verbose_name_plural = _('Tramitações de Documento Administrativo')
def __str__(self):
return _(u'%(documento)s - %(status)s') % {
return _('%(documento)s - %(status)s') % {
'documento': self.documento, 'status': self.status
}

3
protocoloadm/views.py

@ -1,3 +0,0 @@
from django.shortcuts import render
# Create your views here.

2
qa_check.sh

@ -4,4 +4,4 @@
./manage.py check
py.test
pep8 --exclude='ipython_log.py*,migrations' .
flake8 --exclude='ipython_log.py*,migrations' .

1
requirements/dev-requirements.txt

@ -2,6 +2,7 @@
beautifulsoup4
django-debug-toolbar
django-extensions
flake8
ipdb
pygraphviz==1.3rc2
pytest-ipdb==0.1-prerelease2

2
sapl/layout.py

@ -1,5 +1,5 @@
from crispy_forms_foundation.layout import (
Div, Layout, Fieldset, Row, Column, Button, Submit, HTML)
Div, Layout, Fieldset, Row, Column, Submit, HTML)
from django.utils.translation import ugettext as _

2
sapl/legacy_migration_settings.py

@ -1,6 +1,6 @@
# Settings for data migration from mysql legacy to new postgres database
from .settings import *
from .settings import * # flake8: noqa
INSTALLED_APPS += (
'legacy', # legacy reversed model definitions

Loading…
Cancel
Save