<commit_before>##
## Copyright (C) 2012 Aldebaran Robotics
##

""" Python service providing the famous 'reply::s(s)' function
"""

import sys
import qi

class ServiceTest:
    def __init__(self):
        self.onFoo = qi.Signal("i")
        self.onBar = qi.Signal("i")

    def reply(self, plaf):
        print "iciiii"
        print "v:", plaf
        return plaf + "bim"

    def rep(self):
        self.onFoo(32)
        print "rep"

    def totot(self, pif, paf):
        print "laaaa"
        pass

def get_servicedirectory_address():
    """ Parse command line arguments

    Print usage is service directory address is not set.
    """
    if len(sys.argv) != 2:
        print 'Usage : %s qi-service.py directory-address' % sys.argv[0]
        print 'Assuming service directory address is tcp://127.0.0.1:9559'
        return "tcp://127.0.0.1:9559"

    return sys.argv[1]

def main():
    """ Entry point of qiservice
    """
    #0 Declare app
    app = qi.Application()

    #1 Check if user give us service directory address.
    sd_addr = get_servicedirectory_address()

    s = qi.Session()

    s.connect(sd_addr)
    m = ServiceTest()
    s.register_service("serviceTest", m)

    #5 Call Application.run() to join event loop.
    app.run()

    #6 Clean
    s.close()
    app.stop()
    #main : Done.

if __name__ == "__main__":
    main()<commit_msg>qiservice.py: publish events<commit_after>##
## Copyright (C) 2012 Aldebaran Robotics
##

""" Python service providing the famous 'reply::s(s)' function
"""

import sys
import time
import qi

class ServiceTest:
    def __init__(self):
        self.onFoo = qi.Signal("i")
        self.onBar = qi.Signal("i")
        self.testEvent = qi.Signal("(s)")


    def reply(self, plaf):
        print "iciiii"
        print "v:", plaf
        return plaf + "bim"

    def rep(self):
        self.onFoo(32)
        print "rep"

    def totot(self, pif, paf):
        print "laaaa"
        pass

def get_servicedirectory_address():
    """ Parse command line arguments

    Print usage is service directory address is not set.
    """
    if len(sys.argv) != 2:
        print 'Usage : %s qi-service.py directory-address' % sys.argv[0]
        print 'Assuming service directory address is tcp://127.0.0.1:9559'
        return "tcp://127.0.0.1:9559"

    return sys.argv[1]

def main():
    """ Entry point of qiservice
    """
    #0 Declare app
    app = qi.Application()

    #1 Check if user give us service directory address.
    sd_addr = get_servicedirectory_address()

    s = qi.Session()

    s.connect(sd_addr)
    m = ServiceTest()
    s.register_service("serviceTest", m)

    #5 Call Application.run() to join event loop.
    i = 0
    while True:
      mystr = "bim" + str(i)
      print "posting:", mystr
      m.testEvent(mystr)
      time.sleep(1);
      i += 1

    #6 Clean
    s.close()
    app.stop()
    #main : Done.

if __name__ == "__main__":
    main()
{'fraction_non_alphanumeric': 0.13062755798090042, 'fraction_numerical': 0.02353342428376535, 'mean_word_length': 2.379032258064516, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1181056', 'n_tokens_mistral': 1041, 'n_tokens_neox': 978, 'n_words': 278}