From 6817248badbf0d3162eb9788acf5aca26c14ed7d Mon Sep 17 00:00:00 2001 From: Marcio Mazza Date: Mon, 27 Jul 2015 17:28:51 -0300 Subject: [PATCH] Sort all imports using isort isort -rc . --- base/admin.py | 1 - base/migrations/0001_initial.py | 2 +- comissoes/admin.py | 1 - comissoes/migrations/0001_initial.py | 2 +- comissoes/urls.py | 5 ++-- comissoes/views.py | 2 +- conftest.py | 1 - legacy/migration.py | 1 - legacy/migrations/0001_initial.py | 2 +- legacy/scripts/scrap_original_forms.py | 6 ++--- legacy/scripts/study.py | 1 - legacy/test_renames.py | 2 +- lexml/admin.py | 1 - lexml/migrations/0001_initial.py | 2 +- lexml/views.py | 3 ++- materia/admin.py | 1 - materia/migrations/0001_initial.py | 2 +- materia/views.py | 11 ++++---- norma/admin.py | 1 - norma/migrations/0001_initial.py | 2 +- norma/views.py | 5 ++-- parlamentares/admin.py | 1 - parlamentares/migrations/0001_initial.py | 2 +- parlamentares/views.py | 11 ++++---- protocoloadm/admin.py | 1 - protocoloadm/migrations/0001_initial.py | 2 +- protocoloadm/views.py | 6 ++--- sapl/crud.py | 7 +++--- sapl/layout.py | 4 +-- sapl/settings.py | 1 - sapl/test_crud.py | 4 +-- sapl/test_general.py | 1 - sapl/test_utils.py | 1 + sapl/teststubs/urls_for_list_test.py | 2 +- sapl/urls.py | 32 ++++++++++++------------ sapl/utils.py | 1 - sessao/admin.py | 1 - sessao/migrations/0001_initial.py | 2 +- sessao/models.py | 4 +-- sessao/urls.py | 5 ++-- sessao/views.py | 13 +++++----- 41 files changed, 69 insertions(+), 86 deletions(-) diff --git a/base/admin.py b/base/admin.py index 483f7357b..5c02ebd40 100644 --- a/base/admin.py +++ b/base/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/base/migrations/0001_initial.py b/base/migrations/0001_initial.py index 7db684a28..f173f9f90 100644 --- a/base/migrations/0001_initial.py +++ b/base/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/comissoes/admin.py b/comissoes/admin.py index 483f7357b..5c02ebd40 100644 --- a/comissoes/admin.py +++ b/comissoes/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/comissoes/migrations/0001_initial.py b/comissoes/migrations/0001_initial.py index d4d2951d4..cd9502b26 100644 --- a/comissoes/migrations/0001_initial.py +++ b/comissoes/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/comissoes/urls.py b/comissoes/urls.py index dea39fedb..490baf6f2 100644 --- a/comissoes/urls.py +++ b/comissoes/urls.py @@ -1,8 +1,7 @@ from django.conf.urls import url -from comissoes.views import ( - comissao_crud, ComposicaoView, MateriasView, ReunioesView) - +from comissoes.views import (ComposicaoView, MateriasView, ReunioesView, + comissao_crud) urlpatterns = comissao_crud.urlpatterns + [ url(r'^(?P\d+)/composicao$', diff --git a/comissoes/views.py b/comissoes/views.py index e29b92748..da165fdbd 100644 --- a/comissoes/views.py +++ b/comissoes/views.py @@ -1,8 +1,8 @@ from django.utils.translation import ugettext_lazy as _ -from .models import (TipoComissao, Comissao, Periodo, CargoComissao) from sapl.crud import build_crud +from .models import CargoComissao, Comissao, Periodo, TipoComissao cargo_crud = build_crud( CargoComissao, diff --git a/conftest.py b/conftest.py index 78f021a9c..17bacd6d8 100644 --- a/conftest.py +++ b/conftest.py @@ -1,7 +1,6 @@ import pytest from django_webtest import DjangoTestApp, WebTestMixin - DEFAULT_MARK = object() diff --git a/legacy/migration.py b/legacy/migration.py index 602f2ddd5..dff68018b 100644 --- a/legacy/migration.py +++ b/legacy/migration.py @@ -13,7 +13,6 @@ from comissoes.models import Composicao, Participacao from parlamentares.models import Parlamentar from sapl.utils import appconfs - # BASE ###################################################################### name_sets = [set(m.__name__ for m in ac.get_models()) for ac in appconfs] diff --git a/legacy/migrations/0001_initial.py b/legacy/migrations/0001_initial.py index dd6aa4398..975b10678 100644 --- a/legacy/migrations/0001_initial.py +++ b/legacy/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/legacy/scripts/scrap_original_forms.py b/legacy/scripts/scrap_original_forms.py index 2b32a5941..f1a47c87f 100644 --- a/legacy/scripts/scrap_original_forms.py +++ b/legacy/scripts/scrap_original_forms.py @@ -1,5 +1,5 @@ -import pprint import os +import pprint import re import string @@ -7,12 +7,10 @@ import pkg_resources import yaml from bs4 import BeautifulSoup from bs4.element import NavigableString, Tag - from django.apps.config import AppConfig from legacy.migration import appconfs, get_renames -from legacy.scripts.utils import listify, getsourcelines - +from legacy.scripts.utils import getsourcelines, listify # to prevent removal by automatic organize imports on this file assert appconfs diff --git a/legacy/scripts/study.py b/legacy/scripts/study.py index 8ac2abe4d..f7c6f446c 100644 --- a/legacy/scripts/study.py +++ b/legacy/scripts/study.py @@ -2,7 +2,6 @@ from django.apps import apps from .migration_base import legacy_app - for model in apps.get_app_config('legacy').get_models(): if 'ind_excluido' in [f.name for f in model._meta.fields]: print(model, model.objects.values_list( diff --git a/legacy/test_renames.py b/legacy/test_renames.py index 5416d6eb4..5abdc18c3 100644 --- a/legacy/test_renames.py +++ b/legacy/test_renames.py @@ -1,7 +1,7 @@ import comissoes import materia -from .migration import appconfs, get_renames, legacy_app +from .migration import appconfs, get_renames, legacy_app RENAMING_IGNORED_MODELS = [ comissoes.models.Composicao, diff --git a/lexml/admin.py b/lexml/admin.py index 483f7357b..5c02ebd40 100644 --- a/lexml/admin.py +++ b/lexml/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/lexml/migrations/0001_initial.py b/lexml/migrations/0001_initial.py index 8f1b169f9..d6527b5d5 100644 --- a/lexml/migrations/0001_initial.py +++ b/lexml/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/lexml/views.py b/lexml/views.py index 543d18570..dafff5ef9 100644 --- a/lexml/views.py +++ b/lexml/views.py @@ -1,7 +1,8 @@ from django.utils.translation import ugettext_lazy as _ from sapl.crud import build_crud -from .models import (LexmlProvedor, LexmlPublicador) + +from .models import LexmlProvedor, LexmlPublicador lexml_provedor_crud = build_crud( LexmlProvedor, diff --git a/materia/admin.py b/materia/admin.py index 483f7357b..5c02ebd40 100644 --- a/materia/admin.py +++ b/materia/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/materia/migrations/0001_initial.py b/materia/migrations/0001_initial.py index abe0598c1..74cd0462d 100644 --- a/materia/migrations/0001_initial.py +++ b/materia/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/materia/views.py b/materia/views.py index 2431204a2..6f585cdec 100644 --- a/materia/views.py +++ b/materia/views.py @@ -1,11 +1,12 @@ from django.utils.translation import ugettext_lazy as _ from sapl.crud import build_crud -from .models import (Origem, TipoMateriaLegislativa, RegimeTramitacao, - TipoDocumento, TipoFimRelatoria, MateriaLegislativa, - Anexada, TipoAutor, Autor, Autoria, DocumentoAcessorio, - Numeracao, Orgao, Relatoria, TipoProposicao, Proposicao, - StatusTramitacao, UnidadeTramitacao, Tramitacao) + +from .models import (Anexada, Autor, Autoria, DocumentoAcessorio, + MateriaLegislativa, Numeracao, Orgao, Origem, Proposicao, + RegimeTramitacao, Relatoria, StatusTramitacao, TipoAutor, + TipoDocumento, TipoFimRelatoria, TipoMateriaLegislativa, + TipoProposicao, Tramitacao, UnidadeTramitacao) origem_crud = build_crud( Origem, diff --git a/norma/admin.py b/norma/admin.py index 483f7357b..5c02ebd40 100644 --- a/norma/admin.py +++ b/norma/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/norma/migrations/0001_initial.py b/norma/migrations/0001_initial.py index 9476083ed..de1f80b31 100644 --- a/norma/migrations/0001_initial.py +++ b/norma/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/norma/views.py b/norma/views.py index e32365767..b36b29be7 100644 --- a/norma/views.py +++ b/norma/views.py @@ -1,8 +1,9 @@ from django.utils.translation import ugettext_lazy as _ from sapl.crud import build_crud -from .models import (AssuntoNorma, TipoNormaJuridica, - NormaJuridica, LegislacaoCitada) + +from .models import (AssuntoNorma, LegislacaoCitada, NormaJuridica, + TipoNormaJuridica) assunto_norma_crud = build_crud( AssuntoNorma, diff --git a/parlamentares/admin.py b/parlamentares/admin.py index 483f7357b..5c02ebd40 100644 --- a/parlamentares/admin.py +++ b/parlamentares/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/parlamentares/migrations/0001_initial.py b/parlamentares/migrations/0001_initial.py index a61c7b8a2..4ba503a8c 100644 --- a/parlamentares/migrations/0001_initial.py +++ b/parlamentares/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/parlamentares/views.py b/parlamentares/views.py index 764c1a4c9..d3502f896 100644 --- a/parlamentares/views.py +++ b/parlamentares/views.py @@ -1,12 +1,11 @@ from django.utils.translation import ugettext_lazy as _ from sapl.crud import build_crud -from .models import (Legislatura, Coligacao, Partido, - Dependente, SessaoLegislativa, - Parlamentar, Filiacao, Mandato, - TipoDependente, NivelInstrucao, - TipoAfastamento, SituacaoMilitar, - CargoMesa) + +from .models import (CargoMesa, Coligacao, Dependente, Filiacao, Legislatura, + Mandato, NivelInstrucao, Parlamentar, Partido, + SessaoLegislativa, SituacaoMilitar, TipoAfastamento, + TipoDependente) cargo_mesa_crud = build_crud( CargoMesa, diff --git a/protocoloadm/admin.py b/protocoloadm/admin.py index 483f7357b..5c02ebd40 100644 --- a/protocoloadm/admin.py +++ b/protocoloadm/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/protocoloadm/migrations/0001_initial.py b/protocoloadm/migrations/0001_initial.py index c7e4080e7..f18b98c32 100644 --- a/protocoloadm/migrations/0001_initial.py +++ b/protocoloadm/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/protocoloadm/views.py b/protocoloadm/views.py index 86776bf22..9e33031ba 100644 --- a/protocoloadm/views.py +++ b/protocoloadm/views.py @@ -1,10 +1,10 @@ from django.utils.translation import ugettext_lazy as _ from sapl.crud import build_crud -from .models import (TipoDocumentoAdministrativo, DocumentoAdministrativo, + +from .models import (DocumentoAcessorioAdministrativo, DocumentoAdministrativo, Protocolo, StatusTramitacaoAdministrativo, - TramitacaoAdministrativo, - DocumentoAcessorioAdministrativo) + TipoDocumentoAdministrativo, TramitacaoAdministrativo) tipo_documento_administrativo_crud = build_crud( TipoDocumentoAdministrativo, diff --git a/sapl/crud.py b/sapl/crud.py index a90b69dd9..a515f310e 100644 --- a/sapl/crud.py +++ b/sapl/crud.py @@ -3,13 +3,12 @@ from crispy_forms.helper import FormHelper from django import forms from django.conf.urls import url from django.core.urlresolvers import reverse, reverse_lazy +from django.utils.functional import cached_property from django.utils.translation import ugettext_lazy as _ -from django.views.generic import ( - CreateView, DeleteView, ListView, UpdateView, DetailView) +from django.views.generic import (CreateView, DeleteView, DetailView, ListView, + UpdateView) from sapl.layout import SaplFormLayout -from django.utils.functional import cached_property - NO_ENTRIES_MSG = _('Não existem registros') diff --git a/sapl/layout.py b/sapl/layout.py index 8b0ee0c95..cb08db49b 100644 --- a/sapl/layout.py +++ b/sapl/layout.py @@ -1,5 +1,5 @@ -from crispy_forms_foundation.layout import ( - Div, Layout, Fieldset, Row, Column, Submit, HTML) +from crispy_forms_foundation.layout import (HTML, Column, Div, Fieldset, + Layout, Row, Submit) from django.utils.translation import ugettext as _ diff --git a/sapl/settings.py b/sapl/settings.py index b0f1d140f..2c3d0efb6 100644 --- a/sapl/settings.py +++ b/sapl/settings.py @@ -13,7 +13,6 @@ https://docs.djangoproject.com/en/1.8/ref/settings/ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os - BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) diff --git a/sapl/test_crud.py b/sapl/test_crud.py index 2bdbb2c05..a194236cf 100644 --- a/sapl/test_crud.py +++ b/sapl/test_crud.py @@ -2,10 +2,10 @@ import pytest from django.core.urlresolvers import reverse from model_mommy import mommy -from .crud import (get_field_display, build_crud, make_pagination, from_to, - NO_ENTRIES_MSG) from comissoes.models import Comissao, TipoComissao +from .crud import (NO_ENTRIES_MSG, build_crud, from_to, get_field_display, + make_pagination) pytestmark = pytest.mark.django_db diff --git a/sapl/test_general.py b/sapl/test_general.py index 82492cfcc..92e1f8c22 100644 --- a/sapl/test_general.py +++ b/sapl/test_general.py @@ -3,7 +3,6 @@ from model_mommy import mommy from .utils import appconfs - pytestmark = pytest.mark.django_db diff --git a/sapl/test_utils.py b/sapl/test_utils.py index af97a910e..5e4e59b81 100644 --- a/sapl/test_utils.py +++ b/sapl/test_utils.py @@ -1,4 +1,5 @@ from pytest import mark + from .utils import make_choices diff --git a/sapl/teststubs/urls_for_list_test.py b/sapl/teststubs/urls_for_list_test.py index f8364a721..05ce72baf 100644 --- a/sapl/teststubs/urls_for_list_test.py +++ b/sapl/teststubs/urls_for_list_test.py @@ -1,8 +1,8 @@ from django.conf.urls import include, url -from sapl.crud import build_crud from comissoes.models import Comissao from comissoes.urls import comissoes_urls +from sapl.crud import build_crud crud = build_crud( Comissao, diff --git a/sapl/urls.py b/sapl/urls.py index 4f9acb38f..f3c7cf3c9 100644 --- a/sapl/urls.py +++ b/sapl/urls.py @@ -17,23 +17,23 @@ from django.conf.urls import include, url from django.contrib import admin from django.views.generic.base import TemplateView -from comissoes.views import ( - tipo_comissao_crud, periodo_composicao_crud, cargo_crud) -from parlamentares.views import (legislatura_crud, coligacao_crud, - partido_crud, tipo_dependente_crud, - nivel_instrucao_crud, tipo_afastamento_crud, - tipo_militar_crud, sessao_legislativa_crud, - cargo_mesa_crud) -from materia.views import (tipo_materia_crud, regime_tramitacao_crud, - tipo_autor_crud, tipo_documento_crud, - tipo_fim_relatoria_crud, unidade_tramitacao_crud, - origem_crud, autor_crud, status_tramitacao_crud, - orgao_crud, tipo_proposicao_crud) -from lexml.views import (lexml_provedor_crud, lexml_publicador_crud) -from norma.views import (tipo_norma_crud, assunto_norma_crud) -from sessao.views import (tipo_sessao_crud, tipo_resultado_votacao_crud, - tipo_expediente_crud) from comissoes.urls import comissoes_urls +from comissoes.views import (cargo_crud, periodo_composicao_crud, + tipo_comissao_crud) +from lexml.views import lexml_provedor_crud, lexml_publicador_crud +from materia.views import (autor_crud, orgao_crud, origem_crud, + regime_tramitacao_crud, status_tramitacao_crud, + tipo_autor_crud, tipo_documento_crud, + tipo_fim_relatoria_crud, tipo_materia_crud, + tipo_proposicao_crud, unidade_tramitacao_crud) +from norma.views import assunto_norma_crud, tipo_norma_crud +from parlamentares.views import (cargo_mesa_crud, coligacao_crud, + legislatura_crud, nivel_instrucao_crud, + partido_crud, sessao_legislativa_crud, + tipo_afastamento_crud, tipo_dependente_crud, + tipo_militar_crud) +from sessao.views import (tipo_expediente_crud, tipo_resultado_votacao_crud, + tipo_sessao_crud) urlpatterns = [ url(r'^$', TemplateView.as_view(template_name='index.html')), diff --git a/sapl/utils.py b/sapl/utils.py index 60a93f64f..ef1a896e8 100644 --- a/sapl/utils.py +++ b/sapl/utils.py @@ -1,7 +1,6 @@ from django.apps import apps from django.contrib import admin - # SAPL business apps # This is a dependency order: each entry depends only on previous ones # The order is important for migration code diff --git a/sessao/admin.py b/sessao/admin.py index 483f7357b..5c02ebd40 100644 --- a/sessao/admin.py +++ b/sessao/admin.py @@ -1,4 +1,3 @@ from sapl.utils import register_all_models_in_admin - register_all_models_in_admin(__name__) diff --git a/sessao/migrations/0001_initial.py b/sessao/migrations/0001_initial.py index ef025ec5c..d36c2175e 100644 --- a/sessao/migrations/0001_initial.py +++ b/sessao/migrations/0001_initial.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- from __future__ import unicode_literals -from django.db import models, migrations +from django.db import migrations, models class Migration(migrations.Migration): diff --git a/sessao/models.py b/sessao/models.py index 79354a2b1..ae77793aa 100644 --- a/sessao/models.py +++ b/sessao/models.py @@ -2,8 +2,8 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ from materia.models import MateriaLegislativa -from parlamentares.models import (CargoMesa, Parlamentar, SessaoLegislativa, - Legislatura) +from parlamentares.models import (CargoMesa, Legislatura, Parlamentar, + SessaoLegislativa) from sapl.utils import make_choices diff --git a/sessao/urls.py b/sessao/urls.py index bb96c74c7..10dc9c8d2 100644 --- a/sessao/urls.py +++ b/sessao/urls.py @@ -1,8 +1,7 @@ from django.conf.urls import patterns, url -from sessao.views import (SessaoPlenariaListView, SessaoPlenariaDetailView, - SessaoPlenariaCreateView, SessaoPlenariaUpdateView) - +from sessao.views import (SessaoPlenariaCreateView, SessaoPlenariaDetailView, + SessaoPlenariaListView, SessaoPlenariaUpdateView) urlpatterns = patterns( 'sessao.views', diff --git a/sessao/views.py b/sessao/views.py index e87a03a2e..bd14f57c5 100644 --- a/sessao/views.py +++ b/sessao/views.py @@ -1,15 +1,14 @@ -from django.utils.translation import ugettext_lazy as _ - from braces.views import FormMessagesMixin from django.core.urlresolvers import reverse_lazy -from django.views.generic import ( - CreateView, DeleteView, ListView, UpdateView, DetailView) +from django.utils.translation import ugettext_lazy as _ +from django.views.generic import (CreateView, DeleteView, DetailView, ListView, + UpdateView) from sapl.crud import build_crud -from .models import (TipoSessaoPlenaria, SessaoPlenaria, - ExpedienteMateria, OrdemDia, TipoResultadoVotacao, - RegistroVotacao, TipoExpediente) +from .models import (ExpedienteMateria, OrdemDia, RegistroVotacao, + SessaoPlenaria, TipoExpediente, TipoResultadoVotacao, + TipoSessaoPlenaria) tipo_sessao_crud = build_crud( TipoSessaoPlenaria,