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 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'),
)

5
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):

3
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')

10
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

3
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

3
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

18
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'),

3
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}

3
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}

3
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'

12
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):

Loading…
Cancel
Save