Browse Source

Format code for PEP 8 (autopep8, E501 ignored)

Command:
  autopep8 --in-place --ignore E501 -r .
producao
Marcio Mazza 10 years ago
parent
commit
4e69005e3a
  1. 2
      moodlerouter.py
  2. 1
      scripts/casas_com_PM_e_SAPL.py
  3. 1
      scripts/casas_que_usam_LEGBR_ou_PM.py
  4. 1
      scripts/contatos_de_casas_que_usam_portalmodelo.py
  5. 1
      scripts/csv_writer.py
  6. 1
      scripts/setgerentes/dados_gerentes.py
  7. 1
      sigi/apps/casas/admin.py
  8. 3
      sigi/apps/casas/urls.py
  9. 4
      sigi/apps/convenios/urls.py
  10. 8
      sigi/apps/diagnosticos/urls.py
  11. 9
      sigi/apps/mdl/models.py
  12. 4
      sigi/apps/metas/urls.py
  13. 1
      sigi/apps/ocorrencias/admin.py
  14. 1
      sigi/apps/parlamentares/reports.py
  15. 3
      sigi/apps/parlamentares/urls.py
  16. 1
      sigi/apps/saberes/admin.py
  17. 3
      sigi/apps/saberes/management/commands/get_moodle_stats.py
  18. 7
      sigi/apps/saberes/models.py
  19. 4
      sigi/apps/saberes/urls.py
  20. 3
      sigi/apps/saberes/views.py
  21. 4
      sigi/apps/servicos/urls.py
  22. 1
      sigi/apps/servidores/forms.py
  23. 4
      sigi/apps/servidores/urls.py
  24. 1
      sigi/apps/utils/__init__.py
  25. 7
      sigi/urls.py

2
moodlerouter.py

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
class MoodleRouter(object): class MoodleRouter(object):
def db_for_read(self, model, **hints): def db_for_read(self, model, **hints):
if model._meta.app_label == 'mdl': if model._meta.app_label == 'mdl':
return 'moodle' return 'moodle'

1
scripts/casas_com_PM_e_SAPL.py

@ -32,4 +32,3 @@ escrever_casas(casas, '/tmp/casas_que_usam_PM_ou_SAPL.csv')
casas_algum_inativo = casas_todas casas_algum_inativo = casas_todas

1
scripts/casas_que_usam_LEGBR_ou_PM.py

@ -15,6 +15,7 @@ ARQUIVO_CSV = '/tmp/casas_que_usam_LEGBR_ou_PM.csv'
class UnicodeWriter: class UnicodeWriter:
""" """
A CSV writer which will write rows to CSV file "f", A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding. which is encoded in the given encoding.

1
scripts/contatos_de_casas_que_usam_portalmodelo.py

@ -16,6 +16,7 @@ ARQUIVO_CSV = '/tmp/contatos_casas_pm.csv'
class UnicodeWriter: class UnicodeWriter:
""" """
A CSV writer which will write rows to CSV file "f", A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding. which is encoded in the given encoding.

1
scripts/csv_writer.py

@ -4,6 +4,7 @@ import csv
class CsvWriter: class CsvWriter:
""" """
A CSV writer which will write rows to CSV file "f", A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding. which is encoded in the given encoding.

1
scripts/setgerentes/dados_gerentes.py

@ -5590,4 +5590,3 @@ atrib = [
(5222203, 'RAFAHLS'), (5222203, 'RAFAHLS'),
(5222302, 'RAFAHLS'), (5222302, 'RAFAHLS'),
] ]

1
sigi/apps/casas/admin.py

@ -164,6 +164,7 @@ class OcorrenciaInline(admin.TabularInline):
class GerentesContasFilter(admin.filters.RelatedFieldListFilter): class GerentesContasFilter(admin.filters.RelatedFieldListFilter):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(GerentesContasFilter, self).__init__(*args, **kwargs) super(GerentesContasFilter, self).__init__(*args, **kwargs)
gerentes = Servidor.objects.filter(casas_que_gerencia__isnull=False).order_by('nome_completo').distinct() gerentes = Servidor.objects.filter(casas_que_gerencia__isnull=False).order_by('nome_completo').distinct()

3
sigi/apps/casas/urls.py

@ -2,7 +2,8 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.casas.views', urlpatterns = patterns(
'sigi.apps.casas.views',
# Informacoes de uma casa legislativa # Informacoes de uma casa legislativa
url(r'^report_complete/$', 'report_complete', name='report-complete-all'), url(r'^report_complete/$', 'report_complete', name='report-complete-all'),

4
sigi/apps/convenios/urls.py

@ -2,7 +2,9 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.convenios.views', urlpatterns = patterns(
'sigi.apps.convenios.views',
url(r'^reports/$', 'report', name='convenios-report'), url(r'^reports/$', 'report', name='convenios-report'),
url(r'^carrinho/$', 'visualizar_carrinho', name='visualizar-carrinho'), url(r'^carrinho/$', 'visualizar_carrinho', name='visualizar-carrinho'),
url(r'^carrinho/excluir_carrinho/$', 'excluir_carrinho', name='excluir-carrinho'), # tagerror url(r'^carrinho/excluir_carrinho/$', 'excluir_carrinho', name='excluir-carrinho'), # tagerror

8
sigi/apps/diagnosticos/urls.py

@ -5,7 +5,9 @@ from django.views.generic import TemplateView
LOGIN_REDIRECT_URL = '/diagnosticos/mobile/login' LOGIN_REDIRECT_URL = '/diagnosticos/mobile/login'
urlpatterns = patterns('sigi.apps.diagnosticos.views', urlpatterns = patterns(
'sigi.apps.diagnosticos.views',
# Lista de Diagnósticos # Lista de Diagnósticos
url(r'^mobile/$', 'lista', name='lista_diagnosticos'), url(r'^mobile/$', 'lista', name='lista_diagnosticos'),
@ -37,7 +39,9 @@ urlpatterns = patterns('sigi.apps.diagnosticos.views',
) )
urlpatterns += patterns('django.contrib.auth.views', urlpatterns += patterns(
'django.contrib.auth.views',
# Login do Diagnóstico # Login do Diagnóstico
url(r'^mobile/login/$', 'login', {'template_name': url(r'^mobile/login/$', 'login', {'template_name':
'diagnosticos/diagnosticos_login.html'}, name='login'), 'diagnosticos/diagnosticos_login.html'}, name='login'),

9
sigi/apps/mdl/models.py

@ -3,6 +3,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models from django.db import models
class CourseStats(models.Model): class CourseStats(models.Model):
# databaseview: (postgresql dialect): # databaseview: (postgresql dialect):
# -- View: sigi_course_stats # -- View: sigi_course_stats
@ -51,6 +52,7 @@ class CourseStats(models.Model):
def __unicode__(self): def __unicode__(self):
return '%s - %s: %s' % (self.category.name, self.course.fullname, self.usercount) return '%s - %s: %s' % (self.category.name, self.course.fullname, self.usercount)
class Cohort(models.Model): class Cohort(models.Model):
id = models.BigIntegerField(primary_key=True) id = models.BigIntegerField(primary_key=True)
context = models.ForeignKey('Context', db_column='contextid') context = models.ForeignKey('Context', db_column='contextid')
@ -72,6 +74,7 @@ class Cohort(models.Model):
def __unicode__(self): def __unicode__(self):
return self.name return self.name
class CohortMembers(models.Model): class CohortMembers(models.Model):
id = models.BigIntegerField(primary_key=True) id = models.BigIntegerField(primary_key=True)
cohort = models.ForeignKey('Cohort', db_column='cohortid') cohort = models.ForeignKey('Cohort', db_column='cohortid')
@ -82,6 +85,7 @@ class CohortMembers(models.Model):
managed = False managed = False
db_table = 'mdl_cohort_members' db_table = 'mdl_cohort_members'
class Context(models.Model): class Context(models.Model):
CONTEXT_SYSTEM = 10 # System context level - only one instance in every system CONTEXT_SYSTEM = 10 # System context level - only one instance in every system
CONTEXT_USER = 30 # User context level - one instance for each user describing what others can do to user CONTEXT_USER = 30 # User context level - one instance for each user describing what others can do to user
@ -105,6 +109,7 @@ class Context(models.Model):
def __unicode__(self): def __unicode__(self):
return self.path return self.path
class Course(models.Model): class Course(models.Model):
id = models.BigIntegerField(primary_key=True) id = models.BigIntegerField(primary_key=True)
category = models.ForeignKey('CourseCategories', db_column='category', related_name='courses') category = models.ForeignKey('CourseCategories', db_column='category', related_name='courses')
@ -158,6 +163,7 @@ class Course(models.Model):
q = q | e.user_enrolments.all() q = q | e.user_enrolments.all()
return q return q
class CourseCategories(models.Model): class CourseCategories(models.Model):
id = models.BigIntegerField(primary_key=True) id = models.BigIntegerField(primary_key=True)
name = models.CharField(max_length=255) name = models.CharField(max_length=255)
@ -212,6 +218,7 @@ class CourseCategories(models.Model):
q = q | c.get_all_courses(only_visible=only_visible) q = q | c.get_all_courses(only_visible=only_visible)
return q return q
class CourseCompletions(models.Model): class CourseCompletions(models.Model):
id = models.BigIntegerField(primary_key=True) id = models.BigIntegerField(primary_key=True)
user = models.ForeignKey('User', db_column='userid') user = models.ForeignKey('User', db_column='userid')
@ -225,6 +232,7 @@ class CourseCompletions(models.Model):
managed = False managed = False
db_table = 'mdl_course_completions' db_table = 'mdl_course_completions'
class Enrol(models.Model): class Enrol(models.Model):
id = models.BigIntegerField(primary_key=True) id = models.BigIntegerField(primary_key=True)
enrol = models.CharField(max_length=20) enrol = models.CharField(max_length=20)
@ -272,6 +280,7 @@ class Enrol(models.Model):
return self.enrol return self.enrol
return self.name return self.name
class User(models.Model): class User(models.Model):
id = models.BigIntegerField(primary_key=True) id = models.BigIntegerField(primary_key=True)
auth = models.CharField(max_length=20) auth = models.CharField(max_length=20)

4
sigi/apps/metas/urls.py

@ -2,7 +2,9 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.metas.views', urlpatterns = patterns(
'sigi.apps.metas.views',
url(r'^$', 'dashboard', name='metas-dashboardsss'), # tagerror url(r'^$', 'dashboard', name='metas-dashboardsss'), # tagerror
url(r'^mapa/$', 'mapa', name='metas-mapa'), # tagerror url(r'^mapa/$', 'mapa', name='metas-mapa'), # tagerror
url(r'^mapdata/$', 'map_data', name='metas-map_data'), url(r'^mapdata/$', 'map_data', name='metas-map_data'),

1
sigi/apps/ocorrencias/admin.py

@ -61,6 +61,7 @@ class OcorrenciaChangeList(ChangeList):
qs = qs.filter(servidor_registro=servidor) qs = qs.filter(servidor_registro=servidor)
return qs return qs
class OcorrenciaAdmin(BaseModelAdmin): class OcorrenciaAdmin(BaseModelAdmin):
list_display = ('data_criacao', 'casa_legislativa', 'get_municipio', 'get_uf', 'assunto', 'prioridade', 'status', 'data_modificacao', 'setor_responsavel',) list_display = ('data_criacao', 'casa_legislativa', 'get_municipio', 'get_uf', 'assunto', 'prioridade', 'status', 'data_modificacao', 'setor_responsavel',)
list_filter = (OcorrenciaListFilter, 'status', 'prioridade', 'categoria__nome', 'setor_responsavel__nome', ) list_filter = (OcorrenciaListFilter, 'status', 'prioridade', 'categoria__nome', 'setor_responsavel__nome', )

1
sigi/apps/parlamentares/reports.py

@ -10,7 +10,6 @@ from reportlab.lib.units import cm
from sigi.apps.relatorios.reports import ReportDefault from sigi.apps.relatorios.reports import ReportDefault
def string_to_cm(texto): def string_to_cm(texto):
tamanho = 0 tamanho = 0
minEspeciais = { minEspeciais = {

3
sigi/apps/parlamentares/urls.py

@ -1,7 +1,8 @@
# coding: utf-8 # coding: utf-8
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.parlamentares.views', urlpatterns = patterns(
'sigi.apps.parlamentares.views',
# Reports labels parlamentares # Reports labels parlamentares
url(r'^labels/$', 'labels_report', name='labels-report-all'), url(r'^labels/$', 'labels_report', name='labels-report-all'),

1
sigi/apps/saberes/admin.py

@ -3,6 +3,7 @@ from django.utils.translation import ugettext as _
from django.contrib import admin from django.contrib import admin
from sigi.apps.saberes.models import CategoriasInteresse from sigi.apps.saberes.models import CategoriasInteresse
class CategoriasInteresseAdmin(admin.ModelAdmin): class CategoriasInteresseAdmin(admin.ModelAdmin):
list_display = ('prefixo', 'descricao', 'count_categorias',) list_display = ('prefixo', 'descricao', 'count_categorias',)

3
sigi/apps/saberes/management/commands/get_moodle_stats.py

@ -43,7 +43,7 @@ class Command(BaseCommand):
if ci.coorte: if ci.coorte:
total_matriculas = ci.total_alunos_coorte() total_matriculas = ci.total_alunos_coorte()
elif ci.apurar_conclusao: elif ci.apurar_conclusao:
data = {x['completionstatus']: x for x in CourseStats.objects.filter(category__in=ci.categorias(subcategorias=True)). \ data = {x['completionstatus']: x for x in CourseStats.objects.filter(category__in=ci.categorias(subcategorias=True)).
values('completionstatus').annotate(total_users=Sum('usercount'), grade_average=Avg('gradeaverage'))} values('completionstatus').annotate(total_users=Sum('usercount'), grade_average=Avg('gradeaverage'))}
total_matriculas = sum(x['total_users'] for k, x in data.items()) total_matriculas = sum(x['total_users'] for k, x in data.items())
else: else:
@ -100,4 +100,3 @@ class Command(BaseCommand):
for d in p['dados']: for d in p['dados']:
PainelItem.objects.create(painel=p['titulo'], descricao=d['descricao'], help_text=d['help_text'] if 'help_text' in PainelItem.objects.create(painel=p['titulo'], descricao=d['descricao'], help_text=d['help_text'] if 'help_text' in
d else '', valor=d['valor'], percentual=d['percentual'] if 'percentual' in d else None) d else '', valor=d['valor'], percentual=d['percentual'] if 'percentual' in d else None)

7
sigi/apps/saberes/models.py

@ -6,15 +6,16 @@ from django.db import models
from django.db.models import Q from django.db.models import Q
from sigi.apps.mdl.models import Course, CourseCategories, CourseCompletions, UserEnrolments from sigi.apps.mdl.models import Course, CourseCategories, CourseCompletions, UserEnrolments
class CategoriasInteresse(models.Model): class CategoriasInteresse(models.Model):
prefixo = models.CharField(_(u"Prefixo das categorias no Moodle"), max_length=100, prefixo = models.CharField(_(u"Prefixo das categorias no Moodle"), max_length=100,
help_text=_(u"Identifica as categorias no Moodle (campo idnumber) relacionadas a este interesse")) help_text=_(u"Identifica as categorias no Moodle (campo idnumber) relacionadas a este interesse"))
descricao = models.CharField(_(u"Descrição"), max_length=100) descricao = models.CharField(_(u"Descrição"), max_length=100)
sigla = models.CharField(_(u"Sigla"), max_length=20) sigla = models.CharField(_(u"Sigla"), max_length=20)
coorte = models.BooleanField(_(u"Usa Cohorte"), default=False, help_text=_(u"Usa cohorte para calcular o número de matrículas/alunos")) coorte = models.BooleanField(_(u"Usa Cohorte"), default=False, help_text=_(u"Usa cohorte para calcular o número de matrículas/alunos"))
apurar_alunos = models.BooleanField(_(u"Apurar alunos"), default=False, help_text=_(u"Indica que deve-se verificar o perfil da"\ apurar_alunos = models.BooleanField(_(u"Apurar alunos"), default=False, help_text=_(u"Indica que deve-se verificar o perfil da"
+ " inscrição para saber se é um aluno ou se a matrícula foi rejeitada")) + " inscrição para saber se é um aluno ou se a matrícula foi rejeitada"))
apurar_conclusao = models.BooleanField(_(u"Apurar conclusão"), default=False, help_text=_(u"Indica se o dashboard mostrará o "\ apurar_conclusao = models.BooleanField(_(u"Apurar conclusão"), default=False, help_text=_(u"Indica se o dashboard mostrará o "
+ "número de alunos aprovados, reprovados e desistentes")) + "número de alunos aprovados, reprovados e desistentes"))
class Meta: class Meta:
@ -60,6 +61,8 @@ class CategoriasInteresse(models.Model):
return sum(c.total_alunos_cohort() for c in self.categorias()) return sum(c.total_alunos_cohort() for c in self.categorias())
# A temporary model to store Moodle processed data by management command (called from CRON) # A temporary model to store Moodle processed data by management command (called from CRON)
class PainelItem(models.Model): class PainelItem(models.Model):
painel = models.CharField(max_length=255) painel = models.CharField(max_length=255)
descricao = models.CharField(max_length=255) descricao = models.CharField(max_length=255)

4
sigi/apps/saberes/urls.py

@ -1,7 +1,9 @@
# coding: utf-8 # coding: utf-8
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.saberes.views', urlpatterns = patterns(
'sigi.apps.saberes.views',
url(r'^dashboard/$', 'dashboard', name="saberes-dashboard-view"), url(r'^dashboard/$', 'dashboard', name="saberes-dashboard-view"),
url(r'^dashboard/(?P<area>\w+)/$', 'detail', name="saberes-dashboard-detail"), url(r'^dashboard/(?P<area>\w+)/$', 'detail', name="saberes-dashboard-detail"),
) )

3
sigi/apps/saberes/views.py

@ -8,6 +8,7 @@ from django.template import RequestContext
from sigi.apps.mdl.models import User, CourseStats from sigi.apps.mdl.models import User, CourseStats
from sigi.apps.saberes.models import CategoriasInteresse, PainelItem from sigi.apps.saberes.models import CategoriasInteresse, PainelItem
def dashboard(request): def dashboard(request):
paineis = OrderedDict() paineis = OrderedDict()
@ -26,6 +27,7 @@ def dashboard(request):
return render_to_response('saberes/dashboard.html', extra_context, context_instance=RequestContext(request)) return render_to_response('saberes/dashboard.html', extra_context, context_instance=RequestContext(request))
def detail(request, area): def detail(request, area):
ci = get_object_or_404(CategoriasInteresse, pk=area) ci = get_object_or_404(CategoriasInteresse, pk=area)
@ -73,4 +75,3 @@ def detail(request, area):
extra_context = {'area': ci, 'table_head': table_head, 'table_data': table_data, 'flags': head_flags} extra_context = {'area': ci, 'table_head': table_head, 'table_data': table_data, 'flags': head_flags}
return render_to_response('saberes/detail.html', extra_context, context_instance=RequestContext(request)) return render_to_response('saberes/detail.html', extra_context, context_instance=RequestContext(request))

4
sigi/apps/servicos/urls.py

@ -5,7 +5,9 @@ from django.views.generic.base import TemplateView
from .views import MapaView from .views import MapaView
urlpatterns = patterns('sigi.apps.servicos.views', urlpatterns = patterns(
'sigi.apps.servicos.views',
url(r'^manifesta/$', 'casa_manifesta_view', name="casa-manifesta-view"), url(r'^manifesta/$', 'casa_manifesta_view', name="casa-manifesta-view"),
url(r'^munatenjson/(?P<servico>\w+)/$', 'municipios_atendidos', name="municipios-atendidos"), url(r'^munatenjson/(?P<servico>\w+)/$', 'municipios_atendidos', name="municipios-atendidos"),
url(r'^mapa/(?P<servico>\w+)/$', MapaView.as_view(), name="servicos-mapa"), url(r'^mapa/(?P<servico>\w+)/$', MapaView.as_view(), name="servicos-mapa"),

1
sigi/apps/servidores/forms.py

@ -12,6 +12,7 @@ def valida_data_inicial_menor_que_final(data, chave_ini, chave_fim):
raise forms.ValidationError(_( raise forms.ValidationError(_(
u"A data de início deve ser menor que a data final. Verifique novamente")) u"A data de início deve ser menor que a data final. Verifique novamente"))
class FeriasForm(forms.ModelForm): class FeriasForm(forms.ModelForm):
class Meta: class Meta:

4
sigi/apps/servidores/urls.py

@ -2,7 +2,9 @@
from django.conf.urls import patterns, url from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.servidores.views', urlpatterns = patterns(
'sigi.apps.servidores.views',
# Reports servidores # Reports servidores
url(r'^servidores_por_funcao.pdf$', 'servidores_por_funcao', name='servidores-funcao-pdf'), url(r'^servidores_por_funcao.pdf$', 'servidores_por_funcao', name='servidores-funcao-pdf'),
url(r'^servidores_por_cargo.pdf$', 'servidores_por_cargo', name='servidores-cargo-pdf'), url(r'^servidores_por_cargo.pdf$', 'servidores_por_cargo', name='servidores-cargo-pdf'),

1
sigi/apps/utils/__init__.py

@ -26,6 +26,7 @@ class SearchField(models.TextField):
kwargs['field_names'] = self.field_names kwargs['field_names'] = self.field_names
return name, path, args, kwargs return name, path, args, kwargs
def to_ascii(txt, codif='utf-8'): def to_ascii(txt, codif='utf-8'):
if not isinstance(txt, basestring): if not isinstance(txt, basestring):
txt = unicode(txt) txt = unicode(txt)

7
sigi/urls.py

@ -8,7 +8,8 @@ from django.contrib import admin
admin.site.index_template = 'index.html' admin.site.index_template = 'index.html'
admin.autodiscover() admin.autodiscover()
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^parlamentares/parlamentar/', include('sigi.apps.parlamentares.urls')), url(r'^parlamentares/parlamentar/', include('sigi.apps.parlamentares.urls')),
url(r'^casas/casalegislativa/', include('sigi.apps.casas.urls')), url(r'^casas/casalegislativa/', include('sigi.apps.casas.urls')),
@ -28,7 +29,9 @@ urlpatterns = patterns('',
) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) ) + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
if settings.DEBUG: if settings.DEBUG:
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^404/$', TemplateView.as_view(template_name='404.html')), url(r'^404/$', TemplateView.as_view(template_name='404.html')),
url(r'^500/$', TemplateView.as_view(template_name='500.html')), url(r'^500/$', TemplateView.as_view(template_name='500.html')),
url(r'^503/$', TemplateView.as_view(template_name='503.html')), url(r'^503/$', TemplateView.as_view(template_name='503.html')),

Loading…
Cancel
Save