{"action":"created","comment":{"url":"https://api.github.com/repos/NSLS-II/ophyd/pulls/comments/49241069","id":49241069,"diff_hunk":"@@ -233,7 +240,77 @@ def __new__(cls, name, bases, clsdict):\n         return clsobj\n \n \n-class OphydDevice(OphydObject, metaclass=ComponentMeta):\n+\n+# These stub 'Interface' classes are the apex of the mro heirarchy for\n+# their respective methods. They make it safe to use multiple inheritance\n+# with the base classes given in any order.\n+\n+\n+class BlueskyInterface:\n+    \"\"\"Classes that inherit from this can safely customize the\n+    these methods without breaking mro.\"\"\"\n+    def __init__(self, *args, **kwargs):\n+        # Subclasses can populate this with (signal, value) pairs, to be\n+        # set by stage() and restored back by unstage().\n+        self.stage_sigs = list()\n+        self._staged = False\n+        super().__init__(*args, **kwargs)\n+\n+    def trigger(self):\n+        pass\n+\n+    def read(self):\n+        return {}\n+\n+    def describe(self):\n+        return {}\n+\n+    def stage(self):\n+        \"Prepare the device to be triggered.\"\n+        # Read and stage current values, to be restored by unstage()\n+        self._original_vals = {sig: sig.get() for sig, _ in self.stage_sigs}\n+\n+        # Apply settings.\n+        self._staged = True\n+        for sig, val in self.stage_sigs:\n+            ttime.sleep(0.1)\n+            set_and_wait(sig, val)\n+\n+        # Call stage() on child devices (including, notably, plugins).\n+        for signal_name in self.signal_names:\n+            signal = getattr(self, signal_name)\n+            if hasattr(signal, 'stage'):\n+                signal.stage()\n+\n+    def unstage(self):\n+        \"\"\"\n+        Restore the device to 'standby'.\n+\n+        Multiple calls (without a new call to 'stage') have no effect.\n+        \"\"\"\n+        if not self._staged:\n+            return\n+\n+        # Restore original values.\n+        for sig, val in list(self._original_vals.items())[::-1]:","path":"ophyd/controls/device.py","position":107,"original_position":107,"commit_id":"450d8cdbbb56a7aa63188588f821df6aa320e6da","original_commit_id":"450d8cdbbb56a7aa63188588f821df6aa320e6da","user":{"login":"klauer","id":5139267,"avatar_url":"https://avatars.githubusercontent.com/u/5139267?v=3","gravatar_id":"","url":"https://api.github.com/users/klauer","html_url":"https://github.com/klauer","followers_url":"https://api.github.com/users/klauer/followers","following_url":"https://api.github.com/users/klauer/following{/other_user}","gists_url":"https://api.github.com/users/klauer/gists{/gist_id}","starred_url":"https://api.github.com/users/klauer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klauer/subscriptions","organizations_url":"https://api.github.com/users/klauer/orgs","repos_url":"https://api.github.com/users/klauer/repos","events_url":"https://api.github.com/users/klauer/events{/privacy}","received_events_url":"https://api.github.com/users/klauer/received_events","type":"User","site_admin":false},"body":"`reversed()`","created_at":"2016-01-08T21:37:26Z","updated_at":"2016-01-08T21:37:26Z","html_url":"https://github.com/NSLS-II/ophyd/pull/186#discussion_r49241069","pull_request_url":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186","_links":{"self":{"href":"https://api.github.com/repos/NSLS-II/ophyd/pulls/comments/49241069"},"html":{"href":"https://github.com/NSLS-II/ophyd/pull/186#discussion_r49241069"},"pull_request":{"href":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186"}}},"pull_request":{"url":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186","id":54113420,"html_url":"https://github.com/NSLS-II/ophyd/pull/186","diff_url":"https://github.com/NSLS-II/ophyd/pull/186.diff","patch_url":"https://github.com/NSLS-II/ophyd/pull/186.patch","issue_url":"https://api.github.com/repos/NSLS-II/ophyd/issues/186","number":186,"state":"open","locked":false,"title":"Alternate approach to AD: split out functionality that does multiple acq. per trigger","user":{"login":"danielballan","id":2279598,"avatar_url":"https://avatars.githubusercontent.com/u/2279598?v=3","gravatar_id":"","url":"https://api.github.com/users/danielballan","html_url":"https://github.com/danielballan","followers_url":"https://api.github.com/users/danielballan/followers","following_url":"https://api.github.com/users/danielballan/following{/other_user}","gists_url":"https://api.github.com/users/danielballan/gists{/gist_id}","starred_url":"https://api.github.com/users/danielballan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielballan/subscriptions","organizations_url":"https://api.github.com/users/danielballan/orgs","repos_url":"https://api.github.com/users/danielballan/repos","events_url":"https://api.github.com/users/danielballan/events{/privacy}","received_events_url":"https://api.github.com/users/danielballan/received_events","type":"User","site_admin":false},"body":"This is an alternate to #185.\r\n\r\nThere are two tricky problems that the original area detector implementation solved:\r\n1. Monitoring the acquisition signal for an acquisition to be complete\r\n2. Initiating multiple acquisitions per trigger.\r\n\r\nIn this PR, `DetectorBase` handles (1) and `MultiAcqDetectorBase` handles (2).\r\n\r\nAlso, the universal logic of `stage` and `unstage` in now in `OphydDevice`. It looks for a dict `_staged_sigs`, mapping signals to values, which can be populated by subclasses.","created_at":"2015-12-18T15:17:57Z","updated_at":"2016-01-08T21:37:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c601a22e24fd491b3a5a72e6b66914e7626e93f8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186/commits","review_comments_url":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186/comments","review_comment_url":"https://api.github.com/repos/NSLS-II/ophyd/pulls/comments{/number}","comments_url":"https://api.github.com/repos/NSLS-II/ophyd/issues/186/comments","statuses_url":"https://api.github.com/repos/NSLS-II/ophyd/statuses/450d8cdbbb56a7aa63188588f821df6aa320e6da","head":{"label":"danielballan:ad-alt","ref":"ad-alt","sha":"450d8cdbbb56a7aa63188588f821df6aa320e6da","user":{"login":"danielballan","id":2279598,"avatar_url":"https://avatars.githubusercontent.com/u/2279598?v=3","gravatar_id":"","url":"https://api.github.com/users/danielballan","html_url":"https://github.com/danielballan","followers_url":"https://api.github.com/users/danielballan/followers","following_url":"https://api.github.com/users/danielballan/following{/other_user}","gists_url":"https://api.github.com/users/danielballan/gists{/gist_id}","starred_url":"https://api.github.com/users/danielballan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielballan/subscriptions","organizations_url":"https://api.github.com/users/danielballan/orgs","repos_url":"https://api.github.com/users/danielballan/repos","events_url":"https://api.github.com/users/danielballan/events{/privacy}","received_events_url":"https://api.github.com/users/danielballan/received_events","type":"User","site_admin":false},"repo":{"id":33561494,"name":"ophyd","full_name":"danielballan/ophyd","owner":{"login":"danielballan","id":2279598,"avatar_url":"https://avatars.githubusercontent.com/u/2279598?v=3","gravatar_id":"","url":"https://api.github.com/users/danielballan","html_url":"https://github.com/danielballan","followers_url":"https://api.github.com/users/danielballan/followers","following_url":"https://api.github.com/users/danielballan/following{/other_user}","gists_url":"https://api.github.com/users/danielballan/gists{/gist_id}","starred_url":"https://api.github.com/users/danielballan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielballan/subscriptions","organizations_url":"https://api.github.com/users/danielballan/orgs","repos_url":"https://api.github.com/users/danielballan/repos","events_url":"https://api.github.com/users/danielballan/events{/privacy}","received_events_url":"https://api.github.com/users/danielballan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/danielballan/ophyd","description":"Python/EPICS based data collection for NSLS-II","fork":true,"url":"https://api.github.com/repos/danielballan/ophyd","forks_url":"https://api.github.com/repos/danielballan/ophyd/forks","keys_url":"https://api.github.com/repos/danielballan/ophyd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/danielballan/ophyd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/danielballan/ophyd/teams","hooks_url":"https://api.github.com/repos/danielballan/ophyd/hooks","issue_events_url":"https://api.github.com/repos/danielballan/ophyd/issues/events{/number}","events_url":"https://api.github.com/repos/danielballan/ophyd/events","assignees_url":"https://api.github.com/repos/danielballan/ophyd/assignees{/user}","branches_url":"https://api.github.com/repos/danielballan/ophyd/branches{/branch}","tags_url":"https://api.github.com/repos/danielballan/ophyd/tags","blobs_url":"https://api.github.com/repos/danielballan/ophyd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/danielballan/ophyd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/danielballan/ophyd/git/refs{/sha}","trees_url":"https://api.github.com/repos/danielballan/ophyd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/danielballan/ophyd/statuses/{sha}","languages_url":"https://api.github.com/repos/danielballan/ophyd/languages","stargazers_url":"https://api.github.com/repos/danielballan/ophyd/stargazers","contributors_url":"https://api.github.com/repos/danielballan/ophyd/contributors","subscribers_url":"https://api.github.com/repos/danielballan/ophyd/subscribers","subscription_url":"https://api.github.com/repos/danielballan/ophyd/subscription","commits_url":"https://api.github.com/repos/danielballan/ophyd/commits{/sha}","git_commits_url":"https://api.github.com/repos/danielballan/ophyd/git/commits{/sha}","comments_url":"https://api.github.com/repos/danielballan/ophyd/comments{/number}","issue_comment_url":"https://api.github.com/repos/danielballan/ophyd/issues/comments{/number}","contents_url":"https://api.github.com/repos/danielballan/ophyd/contents/{+path}","compare_url":"https://api.github.com/repos/danielballan/ophyd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/danielballan/ophyd/merges","archive_url":"https://api.github.com/repos/danielballan/ophyd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/danielballan/ophyd/downloads","issues_url":"https://api.github.com/repos/danielballan/ophyd/issues{/number}","pulls_url":"https://api.github.com/repos/danielballan/ophyd/pulls{/number}","milestones_url":"https://api.github.com/repos/danielballan/ophyd/milestones{/number}","notifications_url":"https://api.github.com/repos/danielballan/ophyd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/danielballan/ophyd/labels{/name}","releases_url":"https://api.github.com/repos/danielballan/ophyd/releases{/id}","created_at":"2015-04-07T18:43:53Z","updated_at":"2015-04-07T20:48:43Z","pushed_at":"2016-01-08T20:48:09Z","git_url":"git://github.com/danielballan/ophyd.git","ssh_url":"git@github.com:danielballan/ophyd.git","clone_url":"https://github.com/danielballan/ophyd.git","svn_url":"https://github.com/danielballan/ophyd","homepage":"http://nsls-ii.github.io/","size":1665,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"NSLS-II:master","ref":"master","sha":"7a21e6a63dc791248f79817c9495c0b797a98253","user":{"login":"NSLS-II","id":8700262,"avatar_url":"https://avatars.githubusercontent.com/u/8700262?v=3","gravatar_id":"","url":"https://api.github.com/users/NSLS-II","html_url":"https://github.com/NSLS-II","followers_url":"https://api.github.com/users/NSLS-II/followers","following_url":"https://api.github.com/users/NSLS-II/following{/other_user}","gists_url":"https://api.github.com/users/NSLS-II/gists{/gist_id}","starred_url":"https://api.github.com/users/NSLS-II/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NSLS-II/subscriptions","organizations_url":"https://api.github.com/users/NSLS-II/orgs","repos_url":"https://api.github.com/users/NSLS-II/repos","events_url":"https://api.github.com/users/NSLS-II/events{/privacy}","received_events_url":"https://api.github.com/users/NSLS-II/received_events","type":"Organization","site_admin":false},"repo":{"id":26235440,"name":"ophyd","full_name":"NSLS-II/ophyd","owner":{"login":"NSLS-II","id":8700262,"avatar_url":"https://avatars.githubusercontent.com/u/8700262?v=3","gravatar_id":"","url":"https://api.github.com/users/NSLS-II","html_url":"https://github.com/NSLS-II","followers_url":"https://api.github.com/users/NSLS-II/followers","following_url":"https://api.github.com/users/NSLS-II/following{/other_user}","gists_url":"https://api.github.com/users/NSLS-II/gists{/gist_id}","starred_url":"https://api.github.com/users/NSLS-II/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NSLS-II/subscriptions","organizations_url":"https://api.github.com/users/NSLS-II/orgs","repos_url":"https://api.github.com/users/NSLS-II/repos","events_url":"https://api.github.com/users/NSLS-II/events{/privacy}","received_events_url":"https://api.github.com/users/NSLS-II/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/NSLS-II/ophyd","description":"Python/EPICS based data collection for NSLS-II","fork":false,"url":"https://api.github.com/repos/NSLS-II/ophyd","forks_url":"https://api.github.com/repos/NSLS-II/ophyd/forks","keys_url":"https://api.github.com/repos/NSLS-II/ophyd/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NSLS-II/ophyd/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NSLS-II/ophyd/teams","hooks_url":"https://api.github.com/repos/NSLS-II/ophyd/hooks","issue_events_url":"https://api.github.com/repos/NSLS-II/ophyd/issues/events{/number}","events_url":"https://api.github.com/repos/NSLS-II/ophyd/events","assignees_url":"https://api.github.com/repos/NSLS-II/ophyd/assignees{/user}","branches_url":"https://api.github.com/repos/NSLS-II/ophyd/branches{/branch}","tags_url":"https://api.github.com/repos/NSLS-II/ophyd/tags","blobs_url":"https://api.github.com/repos/NSLS-II/ophyd/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NSLS-II/ophyd/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NSLS-II/ophyd/git/refs{/sha}","trees_url":"https://api.github.com/repos/NSLS-II/ophyd/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NSLS-II/ophyd/statuses/{sha}","languages_url":"https://api.github.com/repos/NSLS-II/ophyd/languages","stargazers_url":"https://api.github.com/repos/NSLS-II/ophyd/stargazers","contributors_url":"https://api.github.com/repos/NSLS-II/ophyd/contributors","subscribers_url":"https://api.github.com/repos/NSLS-II/ophyd/subscribers","subscription_url":"https://api.github.com/repos/NSLS-II/ophyd/subscription","commits_url":"https://api.github.com/repos/NSLS-II/ophyd/commits{/sha}","git_commits_url":"https://api.github.com/repos/NSLS-II/ophyd/git/commits{/sha}","comments_url":"https://api.github.com/repos/NSLS-II/ophyd/comments{/number}","issue_comment_url":"https://api.github.com/repos/NSLS-II/ophyd/issues/comments{/number}","contents_url":"https://api.github.com/repos/NSLS-II/ophyd/contents/{+path}","compare_url":"https://api.github.com/repos/NSLS-II/ophyd/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NSLS-II/ophyd/merges","archive_url":"https://api.github.com/repos/NSLS-II/ophyd/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NSLS-II/ophyd/downloads","issues_url":"https://api.github.com/repos/NSLS-II/ophyd/issues{/number}","pulls_url":"https://api.github.com/repos/NSLS-II/ophyd/pulls{/number}","milestones_url":"https://api.github.com/repos/NSLS-II/ophyd/milestones{/number}","notifications_url":"https://api.github.com/repos/NSLS-II/ophyd/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NSLS-II/ophyd/labels{/name}","releases_url":"https://api.github.com/repos/NSLS-II/ophyd/releases{/id}","created_at":"2014-11-05T19:20:01Z","updated_at":"2015-12-10T23:37:22Z","pushed_at":"2016-01-08T20:48:09Z","git_url":"git://github.com/NSLS-II/ophyd.git","ssh_url":"git@github.com:NSLS-II/ophyd.git","clone_url":"https://github.com/NSLS-II/ophyd.git","svn_url":"https://github.com/NSLS-II/ophyd","homepage":"http://nsls-ii.github.io/","size":4429,"stargazers_count":3,"watchers_count":3,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":10,"mirror_url":null,"open_issues_count":39,"forks":10,"open_issues":39,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186"},"html":{"href":"https://github.com/NSLS-II/ophyd/pull/186"},"issue":{"href":"https://api.github.com/repos/NSLS-II/ophyd/issues/186"},"comments":{"href":"https://api.github.com/repos/NSLS-II/ophyd/issues/186/comments"},"review_comments":{"href":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186/comments"},"review_comment":{"href":"https://api.github.com/repos/NSLS-II/ophyd/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/NSLS-II/ophyd/pulls/186/commits"},"statuses":{"href":"https://api.github.com/repos/NSLS-II/ophyd/statuses/450d8cdbbb56a7aa63188588f821df6aa320e6da"}}}}