From e6ad69e7538c7187e175c5f5ef99e8228af46269 Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Wed, 15 Jul 2015 14:54:06 -0300 Subject: [PATCH] Adjust final pep8 issues by hand Verified with pep8 --exclude=ipython_log.py* --exclude=migrations . --- comissoes/urls.py | 5 ++--- comissoes/views.py | 5 +---- legacy/migration.py | 3 ++- legacy/models.py | 10 +--------- legacy/router.py | 3 ++- legacy/test_renames.py | 3 ++- materia/models.py | 18 ++++++++++-------- norma/models.py | 3 ++- parlamentares/models.py | 3 ++- sapl/settings.py | 3 ++- sessao/models.py | 12 ++++++++---- 11 files changed, 34 insertions(+), 34 deletions(-) diff --git a/comissoes/urls.py b/comissoes/urls.py index 2327f9d70..cd27dabf5 100644 --- a/comissoes/urls.py +++ b/comissoes/urls.py @@ -1,10 +1,9 @@ from django.conf.urls import patterns, url -from comissoes.views import (ListaComissoes, - CriarComissao) +from comissoes.views import ListaComissoes + urlpatterns = patterns( 'comissoes.views', url(r'^$', ListaComissoes.as_view(), name='ListaComissoes'), - #url(r'^incluir$', CriarComissao.as_view(), name='CriarComissao'), ) diff --git a/comissoes/views.py b/comissoes/views.py index af68363f1..d2dfd2cdc 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -1,6 +1,5 @@ -from vanilla import CreateView, DeleteView, ListView, UpdateView from django.core.urlresolvers import reverse_lazy -from django.shortcuts import render, get_object_or_404 +from vanilla import CreateView, ListView from comissoes.models import Comissao @@ -14,8 +13,6 @@ class ListaComissoes(ListView): class CriarComissao(CreateView): model = Comissao success_url = reverse_lazy('ListaComissoes') - #template_name = 'comissoes/criar_comissao.html' - #fields = [''] class DetalheComissao(ListView): diff --git a/legacy/migration.py b/legacy/migration.py index 44de1dab3..83a43b7c4 100644 --- a/legacy/migration.py +++ b/legacy/migration.py @@ -139,7 +139,8 @@ def build_special_field_migration(field, get_old_field_value): def none_to_false(obj): value = get_old_field_value(obj) - # Field is defined as not null in legacy db, but data includes null values + # Field is defined as not null in legacy db, + # but data includes null values # => transform None to False if value is None: warn('null converted to False') diff --git a/legacy/models.py b/legacy/models.py index e283dd0ab..343f22feb 100644 --- a/legacy/models.py +++ b/legacy/models.py @@ -1,13 +1,5 @@ # This is an auto-generated Django model module. -# You'll have to do the following manually to clean this up: -# * Rearrange models' order -# * Make sure each model has one field with primary_key=True -# * Remove `managed = False` lines if you wish to allow Django to create, modify, and delete the table -# Feel free to rename the models, but don't rename db_table values or field names. -# -# Also note: You'll have to insert the output of 'django-admin sqlcustom [app_label]' -# into your database. - +# DO NOT EDIT THIS FILE !!! from django.db import models diff --git a/legacy/router.py b/legacy/router.py index bf747bb91..1e3c92135 100644 --- a/legacy/router.py +++ b/legacy/router.py @@ -11,7 +11,8 @@ class LegacyRouter(object): return None def allow_relation(self, obj1, obj2, **hints): - if obj1._meta.app_label == 'legacy' and obj2._meta.app_label == 'legacy': + if obj1._meta.app_label == 'legacy' \ + and obj2._meta.app_label == 'legacy': return True return None diff --git a/legacy/test_renames.py b/legacy/test_renames.py index 006691788..5416d6eb4 100644 --- a/legacy/test_renames.py +++ b/legacy/test_renames.py @@ -34,7 +34,8 @@ def test_get_renames(): # ignored fields are explicitly listed missing_in_renames = field_names - renamed if missing_in_renames: - assert (model, missing_in_renames) in RENAMING_IGNORED_FIELDS, \ + assert (model, missing_in_renames) in \ + RENAMING_IGNORED_FIELDS, \ 'Field(s) missing in renames but not explicitly listed' # all old names correspond to a legacy field diff --git a/materia/models.py b/materia/models.py index 9a0fbd92c..3db0db4d8 100644 --- a/materia/models.py +++ b/materia/models.py @@ -145,7 +145,8 @@ class Anexada(models.Model): verbose_name_plural = _('Anexadas') def __str__(self): - return _('Principal: %(materia_principal)s - Anexada: %(materia_anexada)s') % { + return _('Principal: %(materia_principal)s' + ' - Anexada: %(materia_anexada)s') % { 'materia_principal': self.materia_principal, 'materia_anexada': self.materia_anexada} @@ -196,8 +197,8 @@ class Autor(models.Model): return str(self.partido) else: if str(self.cargo): - return _( - '%(nome)s - %(cargo)s') % {'nome': self.nome, 'cargo': self.cargo} + return _('%(nome)s - %(cargo)s') % { + 'nome': self.nome, 'cargo': self.cargo} else: return str(self.nome) @@ -212,8 +213,8 @@ class Autoria(models.Model): verbose_name_plural = _('Autorias') def __str__(self): - return _( - '%(autor)s - %(materia)s') % {'autor': self.autor, 'materia': self.materia} + return _('%(autor)s - %(materia)s') % { + 'autor': self.autor, 'materia': self.materia} class DespachoInicial(models.Model): @@ -277,8 +278,8 @@ class MateriaAssunto(models.Model): verbose_name_plural = _('Relações Matéria - Assunto') def __str__(self): - return _( - '%(materia)s - %(assunto)s') % {'materia': self.materia, 'assunto': self.assunto} + return _('%(materia)s - %(assunto)s') % { + 'materia': self.materia, 'assunto': self.assunto} class Numeracao(models.Model): @@ -490,7 +491,8 @@ class UnidadeTramitacao(models.Model): class Tramitacao(models.Model): TURNO_CHOICES, \ PRIMEIRO, SEGUNDO, UNICO, SUPLEMENTAR, FINAL, \ - VOTACAO_UNICA, PRIMEIRA_VOTACAO, SEGUNDA_TERCEIRA_VOTACAO = make_choices( + VOTACAO_UNICA, PRIMEIRA_VOTACAO, \ + SEGUNDA_TERCEIRA_VOTACAO = make_choices( 'P', _('Primeiro'), 'S', _('Segundo'), 'Ú', _('Único'), diff --git a/norma/models.py b/norma/models.py index 7c4bdc25a..f2bd942a9 100644 --- a/norma/models.py +++ b/norma/models.py @@ -159,7 +159,8 @@ class VinculoNormaJuridica(models.Model): verbose_name_plural = _('Vínculos entre Normas Jurídicas') def __str__(self): - return _(u'Referente: %(referente)s \nReferida: %(referida)s \nVínculo: %(vinculo)s') % { + return _(u'Referente: %(referente)s \n' + 'Referida: %(referida)s \nVínculo: %(vinculo)s') % { 'referente': self.norma_referente, 'referida': self.norma_referida, 'vinculo': self.tipo_vinculo} diff --git a/parlamentares/models.py b/parlamentares/models.py index b964abc1a..697395cab 100644 --- a/parlamentares/models.py +++ b/parlamentares/models.py @@ -15,7 +15,8 @@ class Legislatura(models.Model): verbose_name_plural = _('Legislaturas') def __str__(self): - return _(u'Eleição: %(eleicao)s - Início: %(inicio)s | Fim: %(fim)s') % { + return _(u'Eleição: %(eleicao)s' + ' - Início: %(inicio)s | Fim: %(fim)s') % { 'eleicao': self.data_eleicao, 'inicio': self.data_inicio, 'fim': self.data_fim} diff --git a/sapl/settings.py b/sapl/settings.py index 045f5c449..148131121 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -127,4 +127,5 @@ USE_TZ = True STATIC_URL = '/static/' -DAB_FIELD_RENDERER = 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer' +DAB_FIELD_RENDERER = \ + 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer' diff --git a/sessao/models.py b/sessao/models.py index 702bbd971..95f2142af 100644 --- a/sessao/models.py +++ b/sessao/models.py @@ -3,7 +3,8 @@ from django.db import models from django.utils.translation import ugettext as _ from materia.models import MateriaLegislativa -from parlamentares.models import CargoMesa, Parlamentar, SessaoLegislativa, Legislatura +from parlamentares.models import (CargoMesa, Parlamentar, SessaoLegislativa, + Legislatura) from sapl.utils import make_choices @@ -21,7 +22,8 @@ class TipoSessaoPlenaria(models.Model): class SessaoPlenaria(models.Model): # TODO trash??? Seems to have been a FK in the past. Would be: - # andamento_sessao = models.ForeignKey(AndamentoSessao, blank=True, null=True) + # andamento_sessao = models.ForeignKey( + # AndamentoSessao, blank=True, null=True) # TODO analyze querying all hosted databases ! cod_andamento_sessao = models.IntegerField(blank=True, null=True) @@ -51,11 +53,13 @@ class SessaoPlenaria(models.Model): verbose_name_plural = _('Sessões Plenárias') def __str__(self): - return _('%sª Sessão %s da %sª Sessão Legislativa da %sª Legislatura') % ( + return _('%sª Sessão %s da %sª Sessão Legislativa' + ' da %sª Legislatura') % ( self.numero, self.tipo.nome, self.sessao_legislativa.numero, - self.legislatura.id) # XXX check if it shouldn't be legislatura.numero + # XXX check if it shouldn't be legislatura.numero + self.legislatura.id) class AbstractOrdemDia(models.Model):