From a5d2ef28a3d68631c99d7853b2e8d6ee3857309e Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Fri, 24 Jul 2015 15:33:51 -0300 Subject: [PATCH] Use flake8 in qa checks --- base/views.py | 3 --- legacy/admin.py | 3 --- legacy/scripts/scrap_original_forms.py | 12 ++++++------ legacy/views.py | 3 --- lexml/views.py | 3 --- materia/views.py | 3 --- norma/models.py | 4 ++-- norma/views.py | 3 --- parlamentares/models.py | 14 +++++++------- parlamentares/views.py | 3 --- protocoloadm/models.py | 4 ++-- protocoloadm/views.py | 3 --- qa_check.sh | 2 +- requirements/dev-requirements.txt | 1 + sapl/layout.py | 2 +- sapl/legacy_migration_settings.py | 2 +- 16 files changed, 21 insertions(+), 44 deletions(-) diff --git a/base/views.py b/base/views.py index 91ea44a21..e69de29bb 100644 --- a/base/views.py +++ b/base/views.py @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/legacy/admin.py b/legacy/admin.py index 8c38f3f3d..e69de29bb 100644 --- a/legacy/admin.py +++ b/legacy/admin.py @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/legacy/scripts/scrap_original_forms.py b/legacy/scripts/scrap_original_forms.py index 1fc7456cf..2b32a5941 100644 --- a/legacy/scripts/scrap_original_forms.py +++ b/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 diff --git a/legacy/views.py b/legacy/views.py index 91ea44a21..e69de29bb 100644 --- a/legacy/views.py +++ b/legacy/views.py @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/lexml/views.py b/lexml/views.py index 91ea44a21..e69de29bb 100644 --- a/lexml/views.py +++ b/lexml/views.py @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/materia/views.py b/materia/views.py index 91ea44a21..e69de29bb 100644 --- a/materia/views.py +++ b/materia/views.py @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/norma/models.py b/norma/models.py index b692cddd9..64a4d7e96 100644 --- a/norma/models.py +++ b/norma/models.py @@ -96,7 +96,7 @@ class NormaJuridica(models.Model): verbose_name_plural = _('Normas Jurídicas') def __str__(self): - return _(u'%(tipo)s nº %(numero)s - %(materia)s - %(ano)s') % { + return _('%(tipo)s nº %(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, diff --git a/norma/views.py b/norma/views.py index 91ea44a21..e69de29bb 100644 --- a/norma/views.py +++ b/norma/views.py @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/parlamentares/models.py b/parlamentares/models.py index 76c0d742b..33f08e592 100644 --- a/parlamentares/models.py +++ b/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 } diff --git a/parlamentares/views.py b/parlamentares/views.py index 91ea44a21..e69de29bb 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/protocoloadm/models.py b/protocoloadm/models.py index 03b2a185d..b1be64d65 100644 --- a/protocoloadm/models.py +++ b/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 } diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 91ea44a21..e69de29bb 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -1,3 +0,0 @@ -from django.shortcuts import render - -# Create your views here. diff --git a/qa_check.sh b/qa_check.sh index 1c267df41..908e4accd 100755 --- a/qa_check.sh +++ b/qa_check.sh @@ -4,4 +4,4 @@ ./manage.py check py.test -pep8 --exclude='ipython_log.py*,migrations' . +flake8 --exclude='ipython_log.py*,migrations' . diff --git a/requirements/dev-requirements.txt b/requirements/dev-requirements.txt index a2bca981a..352899576 100644 --- a/requirements/dev-requirements.txt +++ b/requirements/dev-requirements.txt @@ -2,6 +2,7 @@ beautifulsoup4 django-debug-toolbar django-extensions +flake8 ipdb pygraphviz==1.3rc2 pytest-ipdb==0.1-prerelease2 diff --git a/sapl/layout.py b/sapl/layout.py index 573e2d904..8b0ee0c95 100644 --- a/sapl/layout.py +++ b/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 _ diff --git a/sapl/legacy_migration_settings.py b/sapl/legacy_migration_settings.py index f90da1f9e..433cc2329 100644 --- a/sapl/legacy_migration_settings.py +++ b/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