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. 15
      sigi/apps/mdl/models.py
  12. 4
      sigi/apps/metas/urls.py
  13. 1
      sigi/apps/ocorrencias/admin.py
  14. 3
      sigi/apps/parlamentares/reports.py
  15. 3
      sigi/apps/parlamentares/urls.py
  16. 1
      sigi/apps/saberes/admin.py
  17. 13
      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. 4
      sigi/context_processors.py
  26. 2
      sigi/settings/base.py
  27. 7
      sigi/urls.py

2
moodlerouter.py

@ -1,6 +1,8 @@
# -*- coding: utf-8 -*-
class MoodleRouter(object):
def db_for_read(self, model, **hints):
if model._meta.app_label == 'mdl':
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

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:
"""
A CSV writer which will write rows to CSV file "f",
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:
"""
A CSV writer which will write rows to CSV file "f",
which is encoded in the given encoding.

1
scripts/csv_writer.py

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

1
scripts/setgerentes/dados_gerentes.py

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

1
sigi/apps/casas/admin.py

@ -164,6 +164,7 @@ class OcorrenciaInline(admin.TabularInline):
class GerentesContasFilter(admin.filters.RelatedFieldListFilter):
def __init__(self, *args, **kwargs):
super(GerentesContasFilter, self).__init__(*args, **kwargs)
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
urlpatterns = patterns('sigi.apps.casas.views',
urlpatterns = patterns(
'sigi.apps.casas.views',
# Informacoes de uma casa legislativa
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
urlpatterns = patterns('sigi.apps.convenios.views',
urlpatterns = patterns(
'sigi.apps.convenios.views',
url(r'^reports/$', 'report', name='convenios-report'),
url(r'^carrinho/$', 'visualizar_carrinho', name='visualizar-carrinho'),
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'
urlpatterns = patterns('sigi.apps.diagnosticos.views',
urlpatterns = patterns(
'sigi.apps.diagnosticos.views',
# Lista de Diagnósticos
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
url(r'^mobile/login/$', 'login', {'template_name':
'diagnosticos/diagnosticos_login.html'}, name='login'),

15
sigi/apps/mdl/models.py

@ -3,6 +3,7 @@
from __future__ import unicode_literals
from django.db import models
class CourseStats(models.Model):
# databaseview: (postgresql dialect):
# -- View: sigi_course_stats
@ -51,6 +52,7 @@ class CourseStats(models.Model):
def __unicode__(self):
return '%s - %s: %s' % (self.category.name, self.course.fullname, self.usercount)
class Cohort(models.Model):
id = models.BigIntegerField(primary_key=True)
context = models.ForeignKey('Context', db_column='contextid')
@ -72,6 +74,7 @@ class Cohort(models.Model):
def __unicode__(self):
return self.name
class CohortMembers(models.Model):
id = models.BigIntegerField(primary_key=True)
cohort = models.ForeignKey('Cohort', db_column='cohortid')
@ -82,6 +85,7 @@ class CohortMembers(models.Model):
managed = False
db_table = 'mdl_cohort_members'
class Context(models.Model):
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
@ -105,6 +109,7 @@ class Context(models.Model):
def __unicode__(self):
return self.path
class Course(models.Model):
id = models.BigIntegerField(primary_key=True)
category = models.ForeignKey('CourseCategories', db_column='category', related_name='courses')
@ -141,7 +146,7 @@ class Course(models.Model):
class Meta:
managed = False
db_table = 'mdl_course'
ordering = ['sortorder',]
ordering = ['sortorder', ]
def __unicode__(self):
return self.fullname
@ -158,6 +163,7 @@ class Course(models.Model):
q = q | e.user_enrolments.all()
return q
class CourseCategories(models.Model):
id = models.BigIntegerField(primary_key=True)
name = models.CharField(max_length=255)
@ -177,7 +183,7 @@ class CourseCategories(models.Model):
class Meta:
managed = False
db_table = 'mdl_course_categories'
ordering = ['sortorder',]
ordering = ['sortorder', ]
def __unicode__(self):
return self.name
@ -212,6 +218,7 @@ class CourseCategories(models.Model):
q = q | c.get_all_courses(only_visible=only_visible)
return q
class CourseCompletions(models.Model):
id = models.BigIntegerField(primary_key=True)
user = models.ForeignKey('User', db_column='userid')
@ -225,6 +232,7 @@ class CourseCompletions(models.Model):
managed = False
db_table = 'mdl_course_completions'
class Enrol(models.Model):
id = models.BigIntegerField(primary_key=True)
enrol = models.CharField(max_length=20)
@ -265,13 +273,14 @@ class Enrol(models.Model):
class Meta:
managed = False
db_table = 'mdl_enrol'
ordering = ['sortorder',]
ordering = ['sortorder', ]
def __unicode__(self):
if not self.name:
return self.enrol
return self.name
class User(models.Model):
id = models.BigIntegerField(primary_key=True)
auth = models.CharField(max_length=20)

4
sigi/apps/metas/urls.py

@ -2,7 +2,9 @@
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'^mapa/$', 'mapa', name='metas-mapa'), # tagerror
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)
return qs
class OcorrenciaAdmin(BaseModelAdmin):
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', )

3
sigi/apps/parlamentares/reports.py

@ -10,7 +10,6 @@ from reportlab.lib.units import cm
from sigi.apps.relatorios.reports import ReportDefault
def string_to_cm(texto):
tamanho = 0
minEspeciais = {
@ -120,7 +119,7 @@ class ParlamentaresLabels(Report):
cep_parlamentar(instance)
),
]
self.band_detail = DetailBand(width=(self.largura_etiqueta) * cm, height=(self.altura_etiqueta) * cm, margin_left = 0, margin_top = 0, margin_bottom=0.0 * cm, margin_right = 0, elements=my_elements, display_inline=True, default_style={'fontName': 'Helvetica', 'fontSize': self.tamanho_fonte})
self.band_detail = DetailBand(width=(self.largura_etiqueta) * cm, height=(self.altura_etiqueta) * cm, margin_left=0, margin_top=0, margin_bottom=0.0 * cm, margin_right=0, elements=my_elements, display_inline=True, default_style={'fontName': 'Helvetica', 'fontSize': self.tamanho_fonte})
def logradouro_parlamentar(instance):

3
sigi/apps/parlamentares/urls.py

@ -1,7 +1,8 @@
# coding: utf-8
from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.parlamentares.views',
urlpatterns = patterns(
'sigi.apps.parlamentares.views',
# Reports labels parlamentares
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 sigi.apps.saberes.models import CategoriasInteresse
class CategoriasInteresseAdmin(admin.ModelAdmin):
list_display = ('prefixo', 'descricao', 'count_categorias',)

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

@ -36,15 +36,15 @@ class Command(BaseCommand):
areas = []
numeros = [
{'descricao': _(u'Total de usuários cadastrados'), 'valor': User.objects.count()},
{'descricao': _(u'Novos usuários cadastrados') , 'valor': User.objects.filter(firstaccess__gte=1392326052).count()}
{'descricao': _(u'Novos usuários cadastrados'), 'valor': User.objects.filter(firstaccess__gte=1392326052).count()}
]
for ci in CategoriasInteresse.objects.all():
if ci.coorte:
total_matriculas = ci.total_alunos_coorte()
elif ci.apurar_conclusao:
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'))}
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'))}
total_matriculas = sum(x['total_users'] for k, x in data.items())
else:
total_matriculas = CourseStats.objects.filter(category__in=ci.categorias(subcategorias=True)). \
@ -68,10 +68,10 @@ class Command(BaseCommand):
if 'C' in data:
dados.append({'descricao': _(u'Alunos em curso'), 'valor': data['C']['total_users'],
'percentual': 100.0 * data['C']['total_users'] / total_alunos })
'percentual': 100.0 * data['C']['total_users'] / total_alunos})
if 'L' in data:
dados.append({'descricao': _(u'Alunos que abandonaram o curso'), 'valor': data['L']['total_users'],
'percentual': 100.0 * data['L']['total_users'] / total_alunos })
'percentual': 100.0 * data['L']['total_users'] / total_alunos})
if 'R' in data:
dados.append({'descricao': _(u'Alunos reprovados'), 'valor': data['R']['total_users'],
'percentual': 100.0 * data['R']['total_users'] / total_alunos})
@ -98,6 +98,5 @@ class Command(BaseCommand):
for p in paineis:
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)

7
sigi/apps/saberes/models.py

@ -6,15 +6,16 @@ from django.db import models
from django.db.models import Q
from sigi.apps.mdl.models import Course, CourseCategories, CourseCompletions, UserEnrolments
class CategoriasInteresse(models.Model):
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"))
descricao = models.CharField(_(u"Descrição"), max_length=100)
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"))
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"))
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"))
class Meta:
@ -60,6 +61,8 @@ class CategoriasInteresse(models.Model):
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)
class PainelItem(models.Model):
painel = models.CharField(max_length=255)
descricao = models.CharField(max_length=255)

4
sigi/apps/saberes/urls.py

@ -1,7 +1,9 @@
# coding: utf-8
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/(?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.saberes.models import CategoriasInteresse, PainelItem
def dashboard(request):
paineis = OrderedDict()
@ -26,6 +27,7 @@ def dashboard(request):
return render_to_response('saberes/dashboard.html', extra_context, context_instance=RequestContext(request))
def detail(request, 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}
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
urlpatterns = patterns('sigi.apps.servicos.views',
urlpatterns = patterns(
'sigi.apps.servicos.views',
url(r'^manifesta/$', 'casa_manifesta_view', name="casa-manifesta-view"),
url(r'^munatenjson/(?P<servico>\w+)/$', 'municipios_atendidos', name="municipios-atendidos"),
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(_(
u"A data de início deve ser menor que a data final. Verifique novamente"))
class FeriasForm(forms.ModelForm):
class Meta:

4
sigi/apps/servidores/urls.py

@ -2,7 +2,9 @@
from django.conf.urls import patterns, url
urlpatterns = patterns('sigi.apps.servidores.views',
urlpatterns = patterns(
'sigi.apps.servidores.views',
# Reports servidores
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'),

1
sigi/apps/utils/__init__.py

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

4
sigi/context_processors.py

@ -168,8 +168,8 @@ def busca_informacoes_seit():
for tipo_servico in TipoServico.objects.all():
por_mes = []
for mes in range(1,13):
por_mes.append({'mes': '%02d/%s' % (mes,datetime.date.today().year),
for mes in range(1, 13):
por_mes.append({'mes': '%02d/%s' % (mes, datetime.date.today().year),
'total': tipo_servico.servico_set.filter(data_desativacao=None, data_ativacao__year=mes_atual.year, data_ativacao__month=mes).count()})
result.append(

2
sigi/settings/base.py

@ -40,7 +40,7 @@ TEMPLATE_LOADERS = ('django.template.loaders.filesystem.Loader',
)
# Database routers
DATABASE_ROUTERS = ['moodlerouter.MoodleRouter',]
DATABASE_ROUTERS = ['moodlerouter.MoodleRouter', ]
# Application definition
INSTALLED_APPS = (

7
sigi/urls.py

@ -8,7 +8,8 @@ from django.contrib import admin
admin.site.index_template = 'index.html'
admin.autodiscover()
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^parlamentares/parlamentar/', include('sigi.apps.parlamentares.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)
if settings.DEBUG:
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^404/$', TemplateView.as_view(template_name='404.html')),
url(r'^500/$', TemplateView.as_view(template_name='500.html')),
url(r'^503/$', TemplateView.as_view(template_name='503.html')),

Loading…
Cancel
Save