Browse Source

Adjust final pep8 issues by hand

Verified with
pep8 --exclude=ipython_log.py* --exclude=migrations .
pull/6/head
Marcio Mazza 10 years ago
parent
commit
e6ad69e753
  1. 5
      comissoes/urls.py
  2. 5
      comissoes/views.py
  3. 3
      legacy/migration.py
  4. 10
      legacy/models.py
  5. 3
      legacy/router.py
  6. 3
      legacy/test_renames.py
  7. 18
      materia/models.py
  8. 3
      norma/models.py
  9. 3
      parlamentares/models.py
  10. 3
      sapl/settings.py
  11. 12
      sessao/models.py

5
comissoes/urls.py

@ -1,10 +1,9 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
from comissoes.views import (ListaComissoes, from comissoes.views import ListaComissoes
CriarComissao)
urlpatterns = patterns( urlpatterns = patterns(
'comissoes.views', 'comissoes.views',
url(r'^$', ListaComissoes.as_view(), name='ListaComissoes'), url(r'^$', ListaComissoes.as_view(), name='ListaComissoes'),
#url(r'^incluir$', CriarComissao.as_view(), name='CriarComissao'),
) )

5
comissoes/views.py

@ -1,6 +1,5 @@
from vanilla import CreateView, DeleteView, ListView, UpdateView
from django.core.urlresolvers import reverse_lazy 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 from comissoes.models import Comissao
@ -14,8 +13,6 @@ class ListaComissoes(ListView):
class CriarComissao(CreateView): class CriarComissao(CreateView):
model = Comissao model = Comissao
success_url = reverse_lazy('ListaComissoes') success_url = reverse_lazy('ListaComissoes')
#template_name = 'comissoes/criar_comissao.html'
#fields = ['']
class DetalheComissao(ListView): class DetalheComissao(ListView):

3
legacy/migration.py

@ -139,7 +139,8 @@ def build_special_field_migration(field, get_old_field_value):
def none_to_false(obj): def none_to_false(obj):
value = get_old_field_value(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 # => transform None to False
if value is None: if value is None:
warn('null converted to False') warn('null converted to False')

10
legacy/models.py

@ -1,13 +1,5 @@
# This is an auto-generated Django model module. # This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up: # DO NOT EDIT THIS FILE !!!
# * 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.
from django.db import models from django.db import models

3
legacy/router.py

@ -11,7 +11,8 @@ class LegacyRouter(object):
return None return None
def allow_relation(self, obj1, obj2, **hints): 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 True
return None return None

3
legacy/test_renames.py

@ -34,7 +34,8 @@ def test_get_renames():
# ignored fields are explicitly listed # ignored fields are explicitly listed
missing_in_renames = field_names - renamed missing_in_renames = field_names - renamed
if missing_in_renames: 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' 'Field(s) missing in renames but not explicitly listed'
# all old names correspond to a legacy field # all old names correspond to a legacy field

18
materia/models.py

@ -145,7 +145,8 @@ class Anexada(models.Model):
verbose_name_plural = _('Anexadas') verbose_name_plural = _('Anexadas')
def __str__(self): 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_principal': self.materia_principal,
'materia_anexada': self.materia_anexada} 'materia_anexada': self.materia_anexada}
@ -196,8 +197,8 @@ class Autor(models.Model):
return str(self.partido) return str(self.partido)
else: else:
if str(self.cargo): if str(self.cargo):
return _( return _('%(nome)s - %(cargo)s') % {
'%(nome)s - %(cargo)s') % {'nome': self.nome, 'cargo': self.cargo} 'nome': self.nome, 'cargo': self.cargo}
else: else:
return str(self.nome) return str(self.nome)
@ -212,8 +213,8 @@ class Autoria(models.Model):
verbose_name_plural = _('Autorias') verbose_name_plural = _('Autorias')
def __str__(self): def __str__(self):
return _( return _('%(autor)s - %(materia)s') % {
'%(autor)s - %(materia)s') % {'autor': self.autor, 'materia': self.materia} 'autor': self.autor, 'materia': self.materia}
class DespachoInicial(models.Model): class DespachoInicial(models.Model):
@ -277,8 +278,8 @@ class MateriaAssunto(models.Model):
verbose_name_plural = _('Relações Matéria - Assunto') verbose_name_plural = _('Relações Matéria - Assunto')
def __str__(self): def __str__(self):
return _( return _('%(materia)s - %(assunto)s') % {
'%(materia)s - %(assunto)s') % {'materia': self.materia, 'assunto': self.assunto} 'materia': self.materia, 'assunto': self.assunto}
class Numeracao(models.Model): class Numeracao(models.Model):
@ -490,7 +491,8 @@ class UnidadeTramitacao(models.Model):
class Tramitacao(models.Model): class Tramitacao(models.Model):
TURNO_CHOICES, \ TURNO_CHOICES, \
PRIMEIRO, SEGUNDO, UNICO, SUPLEMENTAR, FINAL, \ 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'), 'P', _('Primeiro'),
'S', _('Segundo'), 'S', _('Segundo'),
'Ú', _('Único'), 'Ú', _('Único'),

3
norma/models.py

@ -159,7 +159,8 @@ class VinculoNormaJuridica(models.Model):
verbose_name_plural = _('Vínculos entre Normas Jurídicas') verbose_name_plural = _('Vínculos entre Normas Jurídicas')
def __str__(self): 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, 'referente': self.norma_referente,
'referida': self.norma_referida, 'referida': self.norma_referida,
'vinculo': self.tipo_vinculo} 'vinculo': self.tipo_vinculo}

3
parlamentares/models.py

@ -15,7 +15,8 @@ class Legislatura(models.Model):
verbose_name_plural = _('Legislaturas') verbose_name_plural = _('Legislaturas')
def __str__(self): 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, 'eleicao': self.data_eleicao,
'inicio': self.data_inicio, 'inicio': self.data_inicio,
'fim': self.data_fim} 'fim': self.data_fim}

3
sapl/settings.py

@ -127,4 +127,5 @@ USE_TZ = True
STATIC_URL = '/static/' STATIC_URL = '/static/'
DAB_FIELD_RENDERER = 'django_admin_bootstrapped.renderers.BootstrapFieldRenderer' DAB_FIELD_RENDERER = \
'django_admin_bootstrapped.renderers.BootstrapFieldRenderer'

12
sessao/models.py

@ -3,7 +3,8 @@ from django.db import models
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from materia.models import MateriaLegislativa 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 from sapl.utils import make_choices
@ -21,7 +22,8 @@ class TipoSessaoPlenaria(models.Model):
class SessaoPlenaria(models.Model): class SessaoPlenaria(models.Model):
# TODO trash??? Seems to have been a FK in the past. Would be: # 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 ! # TODO analyze querying all hosted databases !
cod_andamento_sessao = models.IntegerField(blank=True, null=True) cod_andamento_sessao = models.IntegerField(blank=True, null=True)
@ -51,11 +53,13 @@ class SessaoPlenaria(models.Model):
verbose_name_plural = _('Sessões Plenárias') verbose_name_plural = _('Sessões Plenárias')
def __str__(self): 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.numero,
self.tipo.nome, self.tipo.nome,
self.sessao_legislativa.numero, 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): class AbstractOrdemDia(models.Model):

Loading…
Cancel
Save