Esempio n. 1
0
def normalize(S):

    normalized = ''
    i = 0

    while i < len(S):

        if isdigit(S[i]) and int(S[i]) > 0:
            num = ''
            while i != len(S) and isdigit(S[i]):
                num += str(S[i])
                i += 1
            for j in xrange(0, int(num)):
                normalized += '#'
        else:
            normalized += S[i]
            i += 1

    return normalized
Esempio n. 2
0
 def __init__(self, doc):
     seiku = doc.find('.//Stage1Seiku').text
     if isdigit(seiku):
         self.seiku = SEIKU[int(seiku)]
     else:
         self.seiku = seiku
     self.fcount = int(doc.find('.//Stage1FCount').text)
     self.lost = int(doc.find('.//Stage1FLostCount').text)
     self.ecount = int(doc.find('.//Stage1ECount').text)
     self.elost = int(doc.find('.//Stage1ELostCount').text)
def main():
    # To restrict the amount of feedback to the screen, a feedback level can be given on the command line.
    # Level 0 means show only the most urgent feedback and the higher the level, the more is shown.
    feedback_level = int(sys.argv[1]) if len(sys.argv) > 1 and isdigit(sys.argv[1]) else 10

    rospy.init_node('sm_dialog_ask_device_on_finger')
    sm_top = SMDialog('ask_device_on_finger.csv', '192.168.0.4').sm_top

    ## inserted for smach_viewer
    # Create and start the introspection server
    #sis = smach_ros.IntrospectionServer('server_name', sm_top, '/SM_ROOT')
    #sis.start()
    ## end insert
    
    # Execute SMACH plan
    outcome = sm_top.execute()
def main():
    # To restrict the amount of feedback to the screen, a feedback level can be given on the command line.
    # Level 0 means show only the most urgent feedback and the higher the level, the more is shown.
    feedback_level = int(sys.argv[1]) if len(sys.argv) > 1 and isdigit(sys.argv[1]) else 10

    rospy.init_node('sm_dialog_video_call_ended')
    sm_top = SMDialog("video_call_ended.csv", "localhost", use_getch=False).sm_top

    ## inserted for smach_viewer
    # Create and start the introspection server
    #sis = smach_ros.IntrospectionServer('server_name', sm_top, '/SM_ROOT')
    #sis.start()
    ## end insert
    
    # Execute SMACH plan
    outcome = sm_top.execute()
def main():
    # To restrict the amount of feedback to the screen, a feedback level can be given on the command line.
    # Level 0 means show only the most urgent feedback and the higher the level, the more is shown.
    feedback_level = int(sys.argv[1]) if len(sys.argv) > 1 and isdigit(sys.argv[1]) else 10

##    rospy.init_node('sm_dialog_ask_measurement')
    sm_top = SMDialog("ask_measurement.csv", 'localhost')

    ## inserted for smach_viewer
    # Create and start the introspection server
    #sis = smach_ros.IntrospectionServer('server_name', sm_top, '/SM_ROOT')
    #sis.start()
    ## end insert
    
    # Execute SMACH plan
    outcome = sm_top.Run()
    if outcome=='top_yes':
        print "Statemachine ask_measurement.csv completed successfully"
def start_dialog(feedback_level=10):

    # Get the selected filename.
    global var1
    filename = var1.get()

    sm_dialog = SMDialog(filename, 'localhost', feedback_level=feedback_level, use_getch=False) #'192.168.0.115'
    outcome = sm_dialog.Run()
    print '\n\n**************** END OF DIALOG **********************\n'

#if __name__ == '__main__':

# To restrict the amount of feedback to the screen, a feedback level can be given on the command line.
# Level 0 means show only the most urgent feedback and the higher the level, the more is shown.
feedback_level = int(sys.argv[1]) if len(sys.argv) > 1 and isdigit(sys.argv[1]) else 10

dialog_configuration_file_path = '/dialogs/'
rospath=os.getcwd() #getenv('ROS_PACKAGE_PATH')
for thepath in rospath.split(':'):
    if os.path.exists(thepath+dialog_configuration_file_path):
        dialog_configuration_files = [f for f in os.listdir(thepath+dialog_configuration_file_path) if f.endswith('.csv')]
        break

root = Tk()
root.title('Dialog tests')
root.geometry('200x85-50+200')
frame = Frame(root)
frame.pack()

var1 = StringVar()
Esempio n. 7
0
    # (i.e., multiplicados por 1 milhão). 
    lista_js = re.search(r'var coor = "(.*?)"', html).group(1)
    if not lista_js:
        _log("Aviso: linha sem pontos. URL: " + url)
        return
    lista = [float(x) / 1000000 for x in lista_js.split(r"||")]
    i = iter(lista)
    for lat in i:
        yield (lat, i.next())
#    return [(lat, i.next()) for lat in i]

def _log(string):
    print(string)
    logging.debug(string)

            

if __name__ == "__main__":
    print "Gerando linhas.csv..."
    linhas = getLinhas()
    nargs = len(sys.argv)    
    if nargs > 2 or (nargs==2 and not isdigit(sys.argv[1])):
        print "Uso: scraper.py [no. de linhas a pular no inicio]"
        sys.exit()
    if nargs == 2:
        for i in range(0, int(sys.argv[1])):
            _log("Pulando: %s" % linhas.next()["nome"])
    arquivoCsv = open("linhas.csv", "ab")
    geraCSV(linhas, arquivoCsv)
    arquivoCsv.close()