当前位置: 首页>>代码示例>>Python>>正文


Python RappCloud.RappPlatformService类代码示例

本文整理汇总了Python中RappCloud.RappPlatformService的典型用法代码示例。如果您正苦于以下问题:Python RappPlatformService类的具体用法?Python RappPlatformService怎么用?Python RappPlatformService使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RappPlatformService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

class RappInterfaceTest:

  def __init__(self):
    self.validResults = {
        'city': 'San Francisco',
        'zip': '94107',
        'country': 'United States',
        'region': 'California',
        'country_code': 'US',
        'longtitude': -122.39330291748047,
        'latitude': 37.76969909667969,
        'timezone': 'America/Los_Angeles',
        'error': ''
    }

    self.msg = Geolocation(ipaddr='104.16.115.182')
    self.svc = RappPlatformService(self.msg)


  def execute(self):
    start_time = timeit.default_timer()
    response = self.svc.call()
    print response.serialize()
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)


  def validate(self, response):
    error = response.error

    if self.validResults == response.serialize():
        return [True, self.elapsed_time]
    else:
        return [error, self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:35,代码来源:geolocation_pass_ipaddr.py

示例2: __init__

class RappInterfaceTest:

  def __init__(self):
    self.msg = EmailFetch(
        email='[email protected]',
        password='',
        server='imap.gmail.com',
        port='',
        date_from=0,
        date_to=100000000,
        email_status='',
        num_emails=1)

    self.svc = RappPlatformService(self.msg)


  def execute(self):
    start_time = timeit.default_timer()
    response = self.svc.call()
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)


  def validate(self, response):
    error = response.error
    if error != "":
      return [error, self.elapsed_time]
    else:
        return [True, self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:30,代码来源:email_fetch.py

示例3: __init__

class RappInterfaceTest:

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    imagepath = path.join(pkgDir, 'test_data',
        'face_samples', 'klpanagi_medium_straight.jpg')

    self.msg = FaceDetection(imageFilepath=imagepath, fast=False)
    self.svc = RappPlatformService(persistent=True, msg=self.msg)

    self.valid_faces = [{
        'up_left_point': {'y': 545.0, 'x': 720.0},
        'down_right_point': {'y': 672.0, 'x': 847.0}
    }]


  def execute(self):
    start_time = timeit.default_timer()
    response = self.svc.call()
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)


  def validate(self, response):
    error = response.error
    if error != "":
      return [error, self.elapsed_time]

    faces = response.faces
    if self.valid_faces == faces:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(response), self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:35,代码来源:face_detection_test_medium_straight.py

示例4: __init__

class RappInterfaceTest:

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    imagepath = path.join(pkgDir, 'test_data',
        'face_samples', 'multi_faces_frames', 'two_faces.jpg')

    self.msg = FaceDetection(imageFilepath=imagepath, fast=False)
    self.svc = RappPlatformService(persistent=True, msg=self.msg)

    self.valid_numFaces = 2


  def execute(self):
    start_time = timeit.default_timer()
    response = self.svc.call()
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)


  def validate(self, response):
    error = response.error
    if error != "":
      return [error, self.elapsed_time]

    numFaces = len(response.faces)
    if self.valid_numFaces == numFaces:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + ' Number of faces found -> ' +\
              str(numFaces) + ', expected -> ' + str(self.valid_numFaces), \
              self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:34,代码来源:face_detection_test_two_faces_jpg.py

示例5: __init__

class RappInterfaceTest:

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    self.image = join(pkgDir, 'test_data',
        'human_detection_samples', 'NAO_picture_3.png')

    self.valid_humans = [{
        'up_left_point': {'y': 30.0, 'x': 48.0},
        'down_right_point': {'y': 399.0, 'x': 232.0}
    }]
    self.msg = HumanDetection(imageFilepath=self.image)
    self.svc = RappPlatformService(self.msg)


  def execute(self):
    start_time = timeit.default_timer()
    response = self.svc.call()

    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)


  def validate(self, response):
    error = response.error
    if error != "":
      return [error, self.elapsed_time]

    humans = response.humans
    if self.valid_humans == humans:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(response), self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:35,代码来源:human_detection_test.py

示例6: __init__

class RappInterfaceTest:

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    imagepath = path.join(pkgDir, 'test_data','qr_samples', 'hardFarQr.jpg')

    self.msg = QrDetection(imageFilepath=imagepath)
    self.svc = RappPlatformService(msg=self.msg)

    self.valid_results = {
        'qr_centers': [{'y': 580, 'x': 669}],
        'qr_messages': ['This QR will be used to check the algorithmic robustness as it is quite small'],
        'error': ''
    }


  def execute(self):
    start_time = timeit.default_timer()
    response = self.svc.call()
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)

  def validate(self, response):
    error = response.error
    if error != "":
      return [error, self.elapsed_time]

    if self.valid_results == response.serialize():
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:33,代码来源:qr_detection_test_hard_far.py

示例7: __init__

class RappInterfaceTest:

  def __init__(self):
    # Set the valid results
    self.valid_results = True;
    self.msg = OntologyIsSubsuperclass(
        parent_class='SpatialThing',
        child_class='Oven',
        recursive=True)
    self.svc = RappPlatformService(self.msg)



  def execute(self):
    start_time = timeit.default_timer()
    # Call the RappCloud service
    response = self.svc.call()
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)


  def validate(self, response):
    error = response.error
    if error != "":
      return [error, self.elapsed_time]

    # Get the returned data
    return_data = response.result
    # Check if the returned data are equal to the expected
    if self.valid_results == return_data:
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:34,代码来源:ontology_is_subsuperclass_of_SpatialThing.py

示例8: __init__

  def __init__(self):
    self.msg = WeatherReportCurrent()
    self.msg.req.city = 'Athens'
    self.msg.req.weather_reporter = ''
    self.msg.req.metric = 0

    self.svc = RappPlatformService(self.msg)
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:7,代码来源:weather_report_current_Athens.py

示例9: __init__

class RappInterfaceTest:

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    imagepath = path.join(pkgDir, 'test_data','qr_samples', 'mediumMediumQr.jpg')

    self.msg = QrDetection(imageFilepath=imagepath)
    self.svc = RappPlatformService(msg=self.msg)

    self.valid_results = {
        'qr_centers': [{'y': 535, 'x': 680}],
        'qr_messages': ['This is NAO from Greece'],
        'error': ''
    }


  def execute(self):
    start_time = timeit.default_timer()
    response = self.svc.call()
    end_time = timeit.default_timer()
    self.elapsed_time = end_time - start_time
    return self.validate(response)


  def validate(self, response):
    error = response.error
    if error != "":
      return [error, self.elapsed_time]

    if self.valid_results == response.serialize():
      return [True, self.elapsed_time]
    else:
      return ["Unexpected result : " + str(return_data), self.elapsed_time]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:34,代码来源:qr_detection_test_medium_medium.py

示例10: __init__

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    imagepath = path.join(pkgDir, 'test_data',
        'face_samples', 'etsardou_close_angle.jpg')

    self.msg = FaceDetection(imageFilepath=imagepath, fast=False)
    self.svc = RappPlatformService(persistent=True)

    self.valid_faces = [{
        'up_left_point': {'y': 275.0, 'x': 606.0},
        'down_right_point': {'y': 576.0, 'x': 907.0}
    }]
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:13,代码来源:face_detection_test_close_angle.py

示例11: __init__

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')

    self.msg = NewsExplore(
        news_engine='',
        keywords=[],
        exclude_titles=[],
        region='',
        topic='',
        num_news=5)

    self.svc = RappPlatformService(self.msg)
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:13,代码来源:news_explore_general.py

示例12: __init__

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    imagepath = path.join(pkgDir, 'test_data','qr_samples', 'easyNearQr.jpg')

    self.msg = QrDetection(imageFilepath=imagepath)
    self.svc = RappPlatformService(msg=self.msg)

    self.valid_results = {
        'qr_centers': [{'y': 510, 'x': 636}],
        'qr_messages': ['Hello there'],
        'error': ''
        }
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:13,代码来源:qr_detection_test_easy_near.py

示例13: __init__

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    audioFile = path.join(pkgDir, 'test_data',
        'speech_detection_samples', 'recording_sentence2.ogg')

    self.msg = SpeechRecognitionGoogle(
        language='en',
        audio_source='nao_ogg',
        audiofile=audioFile)

    self.svc = RappPlatformService(self.msg)

    self.valid_words_found = ['check', 'my', 'mail']
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:14,代码来源:speech_detection_google_test_ogg_sentence2.py

示例14: __init__

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    audioFile = path.join(pkgDir, 'test_data', 'thelw-voithia.wav')

    self.msg = SpeechRecognitionSphinx(
        language='el',
        audio_source='nao_wav_1_ch',
        words=[u'θέλω', u'βοήθεια'],
        sentences=[u'θέλω', u'βοήθεια'],
        grammar=[],
        audiofile=audioFile)

    self.svc = RappPlatformService(self.msg)

    self.valid_words_found = [u'θέλω', u'βοήθεια']
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:16,代码来源:speech_detection_sphinx_test_nao_wav_1_ch_thelw_voithia.py

示例15: __init__

  def __init__(self):
    rospack = rospkg.RosPack()
    pkgDir = rospack.get_path('rapp_testing_tools')
    audioFile = path.join(pkgDir, 'test_data', 'deutera.wav')

    self.msg = SpeechRecognitionSphinx(
        language='el',
        audio_source='headset',
        words=[u'Δευτέρα'],
        sentences=[u'Δευτέρα'],
        grammar=[u'Δευτέρα'],
        audiofile=audioFile)

    self.svc = RappPlatformService(self.msg)

    self.valid_words_found = [u'Δευτέρα']
开发者ID:johnjsb,项目名称:rapp-platform,代码行数:16,代码来源:speech_detection_sphinx_test_headset_deutera.py


注:本文中的RappCloud.RappPlatformService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。