def emo_lexicon():
    f = open('data/EmoticonSentimentLexicon.txt', 'r', encoding='utf-8')
    output_dict = {}
    for line in f:
        emoti = trim(line[:(len(line) - 3)])
        pol = trim(line[len(line)-3:])
        output_dict.update({emoti: sent[pol]})
    return output_dict
def emo_lexicon():
    dirname = os.path.dirname(__file__)
    filename = os.path.join(dirname, '../data/EmoticonSentimentLexicon.txt')
    f = open(filename, 'r', encoding='utf-8')

    output_dict = {}
    for line in f:
        emoti = trim(line[:(len(line) - 3)])
        pol = trim(line[len(line) - 3:])
        output_dict.update({emoti: sent[pol]})
    return output_dict
Example #3
0
def render_css_link(context, path, media=''):
    context.caller_stack._push_frame()
    try:
        context._push_buffer()
        self = context.get('self', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 2
        __M_writer(u'\n')
        # SOURCE LINE 3
        if path not in self.seen_css:
            # SOURCE LINE 4
            __M_writer(
                u'        <link rel="stylesheet" type="text/css" href="')
            __M_writer(filters.html_escape(unicode(path)))
            __M_writer(u'" media="')
            __M_writer(unicode(media))
            __M_writer(u'">\n')
            pass
        # SOURCE LINE 6
        __M_writer(u'    ')
        self.seen_css.add(path)

        __M_writer(u'\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #4
0
def render_css_link(context,path,media=''):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        self = context.get('self', UNDEFINED)
        __M_writer = context.writer()
        # SOURCE LINE 2
        __M_writer(u'\n')
        # SOURCE LINE 3
        if path not in self.seen_css:
            # SOURCE LINE 4
            __M_writer(u'        <link rel="stylesheet" type="text/css" href="')
            __M_writer(filters.html_escape(unicode(path)))
            __M_writer(u'" media="')
            __M_writer(unicode(media))
            __M_writer(u'">\n')
        # SOURCE LINE 6
        __M_writer(u'    ')
        self.seen_css.add(path) 
        
        __M_writer(u'\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #5
0
def render_pre(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        __M_writer = context.writer()
        __M_writer(u'\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #6
0
def render_post(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        __M_writer = context.writer()
        __M_writer(u'\n<div>\n    <div class="footer">\n        <p>&#169; Copyright 2014 Ume&#229; Universitet &nbsp;</p>\n    </div>\n</div>\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #7
0
def render_post(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        __M_writer = context.writer()
        __M_writer(u'\n<div>\n    <div class="footer">\n        <p>&#169; Copyright 2014 Ume&#229; Universitet &nbsp;</p>\n    </div>\n</div>\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #8
0
def render_post(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        __M_writer = context.writer()
        __M_writer('\n<div>\n    <div class="footer">\n    </div>\n</div>\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #9
0
def render_pre(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        __M_writer = context.writer()
        __M_writer(u'\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #10
0
def render_pre(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        __M_writer = context.writer()
        __M_writer(u'\n    <div class="header">\n        <h1><a href="/">Login</a></h1>\n    </div>\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #11
0
def render_pre(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        __M_writer = context.writer()
        __M_writer(
            u'\n    <div class="header">\n        <h1><a href="/">Login</a></h1>\n    </div>\n'
        )
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #12
0
def getDespesaTipo(nome,cursor=None):
    print "Nome Antes" + nome
    if nome[0:6] == 'ASSINATURA'[0:6]:
        nome='ASSINATURA DE PUBLICACOES'
        
    if nome[0:6] == 'COMBUSTIVEIS E LUBRIFICANTES'[0:6]:
        nome='COMBUSTIVEIS E LUBRIFICANTES'    

    if nome[0:6] == 'CONSULTORIAS'[0:6]:
        nome='CONSULTORIAS'             
         
    if trim(nome)[8:12] == 'SERVICOS POSTAIS'[7:11]:
        nome='SERVICOS POSTAIS' 
    if nome[0:5].upper() == 'EMISSAO BILHETE AEREO'[0:5]:
        nome='EMISSAO BILHETE AEREO'      
    
    if nome[0:6] == 'DIVULGACAO'[0:6]:
        nome='DIVULGACAO DA ATIVIDADE PARLAMENTAR'            
  
    if nome[0:6] == 'MANUTENCAO DE ESCRITORIO DE APOIO A ATIVIDADE'[0:6]:
        nome='MANUTENCAO DE ESCRITORIO DE APOIO A ATIVIDADE'        
    
    if nome[0:6] == 'FORNECIMENTO DE ALIMENTACAO DO PARLAMENTAR'[0:6]:
        nome='FORNECIMENTO DE ALIMENTACAO DO PARLAMENTAR'         
    
    if nome[0:4] == 'LOCACAO DE VEICULOS AUTOMOTORES OU FRETAMENTO'[0:4]:
        nome='LOCACAO DE VEICULOS AUTOMOTORES OU FRETAMENTO' 
         
    if nome[0:6] == 'PASSAGENS AEREAS E FRETAMENTO DE AERONAVES'[0:6]:
        nome='PASSAGENS AEREAS E FRETAMENTO DE AERONAVES' 
 
    if nome[22:27] == 'SERVICO DE SEGURANCA PRESTADO POR EMPRESA ESPECIALIZADA'[20:25]:
        nome='SERVICO DE SEGURANCA PRESTADO POR EMPRESA ESPECIALIZADA' 
    if nome[30:44]=="ESTACIONAMENTO":   
        nome='SERVICO DE TAXI, PEDAGIO E ESTACIONAMENTO'
    
    #nome = applyCoding(nome,depara)
    print "Nome Depois" + nome
    
    query="select * from despesatipo where nome_despesatipo = '"+str(nome)+ "'"
    print query
    cursor.execute(query )
    rows = cursor.fetchall()
    for row in rows:
        return row    
    
    query="insert into despesatipo (nome_despesatipo) values ('"+str(nome)+"');"
    print "Inserido DESPESAS "  +query   
    cursor.execute(query)
    
    return getDespesaTipo(nome,cursor=cursor)
Example #13
0
def render_css(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        def css_link(path,media=''):
            return render_css_link(context,path,media)
        __M_writer = context.writer()
        __M_writer(u'\n    ')
        __M_writer(unicode(css_link('/css/main.css', 'screen')))
        __M_writer(u'\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #14
0
def render_css(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        def css_link(path,media=''):
            return render_css_link(context,path,media)
        __M_writer = context.writer()
        __M_writer(u'\n    ')
        __M_writer(unicode(css_link('/css/main.css', 'screen')))
        __M_writer(u'\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #15
0
def render_css(context):
    __M_caller = context.caller_stack._push_frame()
    try:
        context._push_buffer()
        def css_link(path,media=''):
            return render_css_link(context,path,media)
        __M_writer = context.writer()
        __M_writer('\n    ')
        __M_writer(str(css_link('/static/bootstrap/css/bootstrap.min.css', 'screen')))
        __M_writer('\n    ')
        __M_writer(str(css_link('/static/bootstrap/css/style.css', 'screen')))
        __M_writer('\n')
    finally:
        __M_buf, __M_writer = context._pop_buffer_and_writer()
        context.caller_stack._pop_frame()
    __M_writer(filters.trim(__M_buf.getvalue()))
    return ''
Example #16
0
def runDespesas(cursor=None,anoFilter=None, semanaFilter=None):         
    csv_reader = utils.openCSV('data/ExpDespesas.csv')
    despesasSQL=""
    max=100
    i=0
    for line in csv_reader:
        i=i+1
        
        Despesas_semanaInicio  = line[2]  
        ano=  trim(Despesas_semanaInicio[-4:])
          #print semanaFilter
        if (line[1] and len(line)>=5 and ((anoFilter is None or anoFilter==ano) and (semanaFilter is None or semanaFilter==Despesas_semana))):  
            #if i > max:
            #    break
            
            Despesas_semana  = line[1]   
            Despesas_semanaFim    = line[3]    
          
            #addRodada(semana=Despesas_semana,ano=ano,inicio=Despesas_semanaInicio,fim=Despesas_semanaFim)
            rodadaRetorno=rodada.addRodada(semana=Despesas_semana,ano=ano,cursor=cursor) 
     
            if isinstance(rodadaRetorno, tuple):
                rodadaRetorno=int(rodadaRetorno[0])
  
            ideCadastro  = line[0] 
            politicoRetorno = politico.getCandidatura(id_original=ideCadastro,cursor=cursor)
            
            Despesas_txtDescricao  = line[4]  
            Despesas_txtDescricao=getDespesaTipo(Despesas_txtDescricao,cursor=cursor)
            #Despesas_txtDescricao = Despesas_txtDescricao.decode("utf-8")
            Despesas_vlrLiquido= line[5]
            Despesas_vlrLiquido = Despesas_vlrLiquido.replace(",",".")

            if politicoRetorno is not None:
                despesasSQL=addDespesas(candidatura=politicoRetorno,categoria=Despesas_txtDescricao,  
                            valor=Despesas_vlrLiquido,rodada=rodadaRetorno,despesasSQL=despesasSQL,cursor=cursor)
Example #17
0
def propostaVinculada(sigla):
    sigla = trim(sigla)
    siglas = sigla.split("=>")
    for sig in siglas:
        sigla=trim(sig)
    return sigla   
Example #18
0
                  help="define o ano que deseja processar, descartando dados dos demais ", metavar="ANO")

parser.add_option("-s", "--semana", dest="semana",
                  help="define a semana que deseja processar, descartando dados dos demais ", metavar="SEMANA")


(options, args) = parser.parse_args()


opcao=None
rodadaOption=None
ambiente=None
ano="2014"
semana=None
if options.opcao is not None:    
    opcao=trim(options.opcao)
if options.rodada is not None:    
    rodadaOption=trim(options.rodada)
if options.ambiente is not None:    
    ambiente=trim(options.ambiente)
if options.ano is not None:    
    ano=trim(options.ano)
if options.semana is not None:    
    ambiente=trim(options.semana)

''' Connect to DB '''
cursor = utils.getCursorConnection(ambiente)

depara=utils.runCoding()
logflag=True
Example #19
0
def separaSiglaNumeroAnoProposicao(entrada):
    #PL 6025/2005
    entrada=trim(entrada)