GitHub PullRequestReviewCommentEvent at 2014-02-12 08:51:02
Repository: astropy
Actor: astrofrog
Payload: {"comment":{"url":"https://api.github.com/repos/astropy/astropy/pulls/comments/9659881","id":9659881,"diff_hunk":"@@ -0,0 +1,204 @@\n+import time\n+import tempfile\n+\n+import numpy as np\n+\n+from ...table import Table\n+from ...nddata import NDData\n+from ...io import fits\n+\n+from . import SAMPIntegratedClient\n+from ... import __version__\n+from ...extern.six.moves.urllib.parse import urljoin\n+\n+__all__ = ['send', 'receive', 'list_clients']\n+\n+\n+def declare_metadata(client):\n+\n+    metadata = {\"samp.name\": \"astropy\",\n+                \"samp.description.text\": \"The Astropy Project\",\n+                \"samp.icon.url\": client.client._xmlrpcAddr + \"/samp/icon\",\n+                \"samp.documentation.url\": \"http://docs.astropy.org/en/stable/vo/samp\",\n+                \"author.name\": \"The Astropy Collaboration\",\n+                \"home.page\": \"http://www.astropy.org\",\n+                \"astropy.version\": __version__\n+                }\n+\n+    client.declare_metadata(metadata)\n+\n+\n+class Receiver(object):\n+    def __init__(self, client):\n+        self.client = client\n+        self.received = False\n+    def receive_call(self, private_key, sender_id, msg_id, mtype, params, extra):\n+        self.mtype = mtype\n+        self.params = params\n+        self.received = True\n+        self.client.reply(msg_id, {\"samp.status\": \"samp.ok\", \"samp.result\": {}})\n+    def receive_notification(self, private_key, sender_id, mtype, params, extra):\n+        self.mtype = mtype\n+        self.params = params\n+        self.received = True\n+\n+\n+def wait_until_received(object, timeout=None, step=0.1):\n+    start_time = time.time()\n+    while not (hasattr(object, 'received') and object.received):\n+        time.sleep(step)\n+        if timeout is not None and time.time() - start_time > timeout:\n+            raise AttributeError(\"Timeout while waiting for message to be received\")","path":"astropy/vo/samp/high_level.py","position":51,"original_position":51,"commit_id":"91ec845da706c30b81d727f8d654b02fa5ae2450","original_commit_id":"91ec845da706c30b81d727f8d654b02fa5ae2450","user":{"login":"astrofrog","id":314716,"avatar_url":"https://gravatar.com/avatar/f586e2a9879fe0a55fd1e3ea529c664f?d=https%3A%2F%2Fidenticons.github.com%2Fcd67091624d794840b328627bddbba7b.png&r=x","gravatar_id":"f586e2a9879fe0a55fd1e3ea529c664f","url":"https://api.github.com/users/astrofrog","html_url":"https://github.com/astrofrog","followers_url":"https://api.github.com/users/astrofrog/followers","following_url":"https://api.github.com/users/astrofrog/following{/other_user}","gists_url":"https://api.github.com/users/astrofrog/gists{/gist_id}","starred_url":"https://api.github.com/users/astrofrog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/astrofrog/subscriptions","organizations_url":"https://api.github.com/users/astrofrog/orgs","repos_url":"https://api.github.com/users/astrofrog/repos","events_url":"https://api.github.com/users/astrofrog/events{/privacy}","received_events_url":"https://api.github.com/users/astrofrog/received_events","type":"User","site_admin":false},"body":"Maybe a ``TimeoutError``?","created_at":"2014-02-12T08:51:02Z","updated_at":"2014-02-12T08:51:02Z","html_url":"https://github.com/astropy/astropy/pull/1920#discussion_r9659881","pull_request_url":"https://api.github.com/repos/astropy/astropy/pulls/1920","_links":{"self":{"href":"https://api.github.com/repos/astropy/astropy/pulls/comments/9659881"},"html":{"href":"https://github.com/astropy/astropy/pull/1920#discussion_r9659881"},"pull_request":{"href":"https://api.github.com/repos/astropy/astropy/pulls/1920"}}}}