{"action":"created","comment":{"url":"https://api.github.com/repos/CityOfZion/neo-python/pulls/comments/239382384","pull_request_review_id":182149729,"id":239382384,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzOTM4MjM4NA==","diff_hunk":"@@ -0,0 +1,159 @@\n+import os\n+import psutil\n+import datetime\n+from neo.Prompt.CommandBase import CommandBase, CommandDesc, ParameterDesc\n+from neo.Prompt.PromptData import PromptData\n+from neo.Prompt.Utils import get_arg\n+from neo.Core.Blockchain import Blockchain\n+from neocore.UInt256 import UInt256\n+from neo.IO.MemoryStream import StreamManager\n+from neo.Network.NodeLeader import NodeLeader\n+from neo.Implementations.Notifications.LevelDB.NotificationDB import NotificationDB\n+from neo.logging import log_manager\n+import json\n+\n+\n+logger = log_manager.getLogger()\n+\n+\n+class CommandShow(CommandBase):\n+    def __init__(self):\n+        super().__init__()\n+\n+        self.register_sub_command(CommandShowBlock())\n+        self.register_sub_command(CommandShowHeader())\n+        self.register_sub_command(CommandShowTx())\n+        self.register_sub_command(CommandShowMem())\n+        self.register_sub_command(CommandShowNodes(), ['node'])\n+\n+    def command_desc(self):\n+        return CommandDesc('show', 'show data from the blockchain')\n+\n+    def execute(self, arguments):\n+        item = get_arg(arguments)\n+\n+        if not item:\n+            print(\"run `%s help` to see supported queries\" % CommandShow().command_desc().command)\n+            return\n+\n+        try:\n+            return self.execute_sub_command(item, arguments[1:])\n+        except KeyError:\n+            print(f\"{item} is an invalid parameter\")\n+            return\n+\n+\n+class CommandShowBlock(CommandBase):\n+    def __init__(self):\n+        super().__init__()\n+\n+    def execute(self, arguments):\n+        item = get_arg(arguments)\n+        txarg = get_arg(arguments, 1)\n+\n+        block = Blockchain.Default().GetBlock(item)\n+\n+        if block is not None:\n+            block.LoadTransactions()\n+\n+            if txarg and 'tx' in txarg:\n+                txs = []\n+                for tx in block.FullTransactions:\n+                    print(json.dumps(tx.ToJson(), indent=4))\n+                    txs.append(tx.ToJson())\n+                return txs\n+\n+            print(json.dumps(block.ToJson(), indent=4))\n+            return block.ToJson()\n+\n+        else:\n+            print(\"Could not locate block %s\" % item)\n+            return\n+\n+    def command_desc(self):\n+        p1 = ParameterDesc('index/hash', 'the index or scripthash of the block')\n+        p2 = ParameterDesc('tx', 'arg to only show block transactions', optional=True)\n+        return CommandDesc('block', 'show a specified block', [p1, p2])\n+\n+\n+class CommandShowHeader(CommandBase):\n+    def __init__(self):\n+        super().__init__()\n+\n+    def execute(self, arguments):\n+        item = get_arg(arguments)\n+\n+        header = Blockchain.Default().GetHeaderBy(item)\n+        if header is not None:\n+            print(json.dumps(header.ToJson(), indent=4))\n+            return header.ToJson()\n+        else:\n+            print(\"Could not locate header %s\\n\" % item)\n+            return\n+\n+    def command_desc(self):\n+        p1 = ParameterDesc('index/hash', 'the index or scripthash of the block header')\n+        return CommandDesc('header', 'show the header of a specified block', [p1])\n+\n+\n+class CommandShowTx(CommandBase):\n+    def __init__(self):\n+        super().__init__()\n+\n+    def execute(self, arguments):","path":"neo/Prompt/Commands/Show.py","position":109,"original_position":103,"commit_id":"18eb43883b65bf8fcbcca4dd0b35869cf4884f00","original_commit_id":"202f64d8b1aaa5dc78956dcbba19b0d5284c2fed","user":{"login":"jseagrave21","id":40873301,"node_id":"MDQ6VXNlcjQwODczMzAx","avatar_url":"https://avatars0.githubusercontent.com/u/40873301?v=4","gravatar_id":"","url":"https://api.github.com/users/jseagrave21","html_url":"https://github.com/jseagrave21","followers_url":"https://api.github.com/users/jseagrave21/followers","following_url":"https://api.github.com/users/jseagrave21/following{/other_user}","gists_url":"https://api.github.com/users/jseagrave21/gists{/gist_id}","starred_url":"https://api.github.com/users/jseagrave21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jseagrave21/subscriptions","organizations_url":"https://api.github.com/users/jseagrave21/orgs","repos_url":"https://api.github.com/users/jseagrave21/repos","events_url":"https://api.github.com/users/jseagrave21/events{/privacy}","received_events_url":"https://api.github.com/users/jseagrave21/received_events","type":"User","site_admin":false},"body":"How about now? (I just removed the exception)","created_at":"2018-12-06T09:36:18Z","updated_at":"2018-12-06T09:36:18Z","html_url":"https://github.com/CityOfZion/neo-python/pull/738#discussion_r239382384","pull_request_url":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/CityOfZion/neo-python/pulls/comments/239382384"},"html":{"href":"https://github.com/CityOfZion/neo-python/pull/738#discussion_r239382384"},"pull_request":{"href":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738"}},"in_reply_to_id":239366579},"pull_request":{"url":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738","id":236207681,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM2MjA3Njgx","html_url":"https://github.com/CityOfZion/neo-python/pull/738","diff_url":"https://github.com/CityOfZion/neo-python/pull/738.diff","patch_url":"https://github.com/CityOfZion/neo-python/pull/738.patch","issue_url":"https://api.github.com/repos/CityOfZion/neo-python/issues/738","number":738,"state":"open","locked":false,"title":"[refactor prompt] Add support for show method group (pt 1)","user":{"login":"jseagrave21","id":40873301,"node_id":"MDQ6VXNlcjQwODczMzAx","avatar_url":"https://avatars0.githubusercontent.com/u/40873301?v=4","gravatar_id":"","url":"https://api.github.com/users/jseagrave21","html_url":"https://github.com/jseagrave21","followers_url":"https://api.github.com/users/jseagrave21/followers","following_url":"https://api.github.com/users/jseagrave21/following{/other_user}","gists_url":"https://api.github.com/users/jseagrave21/gists{/gist_id}","starred_url":"https://api.github.com/users/jseagrave21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jseagrave21/subscriptions","organizations_url":"https://api.github.com/users/jseagrave21/orgs","repos_url":"https://api.github.com/users/jseagrave21/repos","events_url":"https://api.github.com/users/jseagrave21/events{/privacy}","received_events_url":"https://api.github.com/users/jseagrave21/received_events","type":"User","site_admin":false},"body":"**What current issue(s) does this address, or what feature is it adding?**\r\n- Reference https://github.com/CityOfZion/neo-python/pull/737\r\n\r\n- This PR supports the first five methods from the `show` method group (see https://github.com/CityOfZion/neo-python/issues/623#issue-362278030)\r\n\r\n**How did you solve this problem?**\r\nTrial and Error\r\n\r\n**How did you make sure your solution works?**\r\nUnittest\r\n\r\n**Are there any special changes in the code that we should be aware of?**\r\nNo\r\n\r\n**Please check the following, if applicable:**\r\n\r\n- [x] Did you add any tests?\r\n- [x] Did you run `make lint`?\r\n- [x] Did you run `make test`?\r\n- [x] Are you making a PR to a feature branch or development rather than master?\r\n- [ ] Did you add an entry to `CHANGELOG.rst`? (if not, please do)\r\n","created_at":"2018-12-05T15:06:11Z","updated_at":"2018-12-06T09:36:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8a0123e7605a83523b8f770cc76a31f7a32aa064","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738/commits","review_comments_url":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738/comments","review_comment_url":"https://api.github.com/repos/CityOfZion/neo-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CityOfZion/neo-python/issues/738/comments","statuses_url":"https://api.github.com/repos/CityOfZion/neo-python/statuses/18eb43883b65bf8fcbcca4dd0b35869cf4884f00","head":{"label":"jseagrave21:refactor-CommandShow-pt1","ref":"refactor-CommandShow-pt1","sha":"18eb43883b65bf8fcbcca4dd0b35869cf4884f00","user":{"login":"jseagrave21","id":40873301,"node_id":"MDQ6VXNlcjQwODczMzAx","avatar_url":"https://avatars0.githubusercontent.com/u/40873301?v=4","gravatar_id":"","url":"https://api.github.com/users/jseagrave21","html_url":"https://github.com/jseagrave21","followers_url":"https://api.github.com/users/jseagrave21/followers","following_url":"https://api.github.com/users/jseagrave21/following{/other_user}","gists_url":"https://api.github.com/users/jseagrave21/gists{/gist_id}","starred_url":"https://api.github.com/users/jseagrave21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jseagrave21/subscriptions","organizations_url":"https://api.github.com/users/jseagrave21/orgs","repos_url":"https://api.github.com/users/jseagrave21/repos","events_url":"https://api.github.com/users/jseagrave21/events{/privacy}","received_events_url":"https://api.github.com/users/jseagrave21/received_events","type":"User","site_admin":false},"repo":{"id":139907465,"node_id":"MDEwOlJlcG9zaXRvcnkxMzk5MDc0NjU=","name":"neo-python","full_name":"jseagrave21/neo-python","private":false,"owner":{"login":"jseagrave21","id":40873301,"node_id":"MDQ6VXNlcjQwODczMzAx","avatar_url":"https://avatars0.githubusercontent.com/u/40873301?v=4","gravatar_id":"","url":"https://api.github.com/users/jseagrave21","html_url":"https://github.com/jseagrave21","followers_url":"https://api.github.com/users/jseagrave21/followers","following_url":"https://api.github.com/users/jseagrave21/following{/other_user}","gists_url":"https://api.github.com/users/jseagrave21/gists{/gist_id}","starred_url":"https://api.github.com/users/jseagrave21/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jseagrave21/subscriptions","organizations_url":"https://api.github.com/users/jseagrave21/orgs","repos_url":"https://api.github.com/users/jseagrave21/repos","events_url":"https://api.github.com/users/jseagrave21/events{/privacy}","received_events_url":"https://api.github.com/users/jseagrave21/received_events","type":"User","site_admin":false},"html_url":"https://github.com/jseagrave21/neo-python","description":"Python Node and SDK for the NEO blockchain","fork":true,"url":"https://api.github.com/repos/jseagrave21/neo-python","forks_url":"https://api.github.com/repos/jseagrave21/neo-python/forks","keys_url":"https://api.github.com/repos/jseagrave21/neo-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jseagrave21/neo-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jseagrave21/neo-python/teams","hooks_url":"https://api.github.com/repos/jseagrave21/neo-python/hooks","issue_events_url":"https://api.github.com/repos/jseagrave21/neo-python/issues/events{/number}","events_url":"https://api.github.com/repos/jseagrave21/neo-python/events","assignees_url":"https://api.github.com/repos/jseagrave21/neo-python/assignees{/user}","branches_url":"https://api.github.com/repos/jseagrave21/neo-python/branches{/branch}","tags_url":"https://api.github.com/repos/jseagrave21/neo-python/tags","blobs_url":"https://api.github.com/repos/jseagrave21/neo-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jseagrave21/neo-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jseagrave21/neo-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/jseagrave21/neo-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jseagrave21/neo-python/statuses/{sha}","languages_url":"https://api.github.com/repos/jseagrave21/neo-python/languages","stargazers_url":"https://api.github.com/repos/jseagrave21/neo-python/stargazers","contributors_url":"https://api.github.com/repos/jseagrave21/neo-python/contributors","subscribers_url":"https://api.github.com/repos/jseagrave21/neo-python/subscribers","subscription_url":"https://api.github.com/repos/jseagrave21/neo-python/subscription","commits_url":"https://api.github.com/repos/jseagrave21/neo-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/jseagrave21/neo-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/jseagrave21/neo-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/jseagrave21/neo-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/jseagrave21/neo-python/contents/{+path}","compare_url":"https://api.github.com/repos/jseagrave21/neo-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jseagrave21/neo-python/merges","archive_url":"https://api.github.com/repos/jseagrave21/neo-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jseagrave21/neo-python/downloads","issues_url":"https://api.github.com/repos/jseagrave21/neo-python/issues{/number}","pulls_url":"https://api.github.com/repos/jseagrave21/neo-python/pulls{/number}","milestones_url":"https://api.github.com/repos/jseagrave21/neo-python/milestones{/number}","notifications_url":"https://api.github.com/repos/jseagrave21/neo-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jseagrave21/neo-python/labels{/name}","releases_url":"https://api.github.com/repos/jseagrave21/neo-python/releases{/id}","deployments_url":"https://api.github.com/repos/jseagrave21/neo-python/deployments","created_at":"2018-07-05T22:40:49Z","updated_at":"2018-11-20T22:19:52Z","pushed_at":"2018-12-06T09:35:00Z","git_url":"git://github.com/jseagrave21/neo-python.git","ssh_url":"git@github.com:jseagrave21/neo-python.git","clone_url":"https://github.com/jseagrave21/neo-python.git","svn_url":"https://github.com/jseagrave21/neo-python","homepage":"https://neo-python.readthedocs.io/en/latest/","size":121158,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"development"}},"base":{"label":"CityOfZion:refactor-prompt","ref":"refactor-prompt","sha":"f19db75b3a98e556c909c329476f93915c5686b0","user":{"login":"CityOfZion","id":29782569,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzgyNTY5","avatar_url":"https://avatars1.githubusercontent.com/u/29782569?v=4","gravatar_id":"","url":"https://api.github.com/users/CityOfZion","html_url":"https://github.com/CityOfZion","followers_url":"https://api.github.com/users/CityOfZion/followers","following_url":"https://api.github.com/users/CityOfZion/following{/other_user}","gists_url":"https://api.github.com/users/CityOfZion/gists{/gist_id}","starred_url":"https://api.github.com/users/CityOfZion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CityOfZion/subscriptions","organizations_url":"https://api.github.com/users/CityOfZion/orgs","repos_url":"https://api.github.com/users/CityOfZion/repos","events_url":"https://api.github.com/users/CityOfZion/events{/privacy}","received_events_url":"https://api.github.com/users/CityOfZion/received_events","type":"Organization","site_admin":false},"repo":{"id":97416422,"node_id":"MDEwOlJlcG9zaXRvcnk5NzQxNjQyMg==","name":"neo-python","full_name":"CityOfZion/neo-python","private":false,"owner":{"login":"CityOfZion","id":29782569,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzgyNTY5","avatar_url":"https://avatars1.githubusercontent.com/u/29782569?v=4","gravatar_id":"","url":"https://api.github.com/users/CityOfZion","html_url":"https://github.com/CityOfZion","followers_url":"https://api.github.com/users/CityOfZion/followers","following_url":"https://api.github.com/users/CityOfZion/following{/other_user}","gists_url":"https://api.github.com/users/CityOfZion/gists{/gist_id}","starred_url":"https://api.github.com/users/CityOfZion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CityOfZion/subscriptions","organizations_url":"https://api.github.com/users/CityOfZion/orgs","repos_url":"https://api.github.com/users/CityOfZion/repos","events_url":"https://api.github.com/users/CityOfZion/events{/privacy}","received_events_url":"https://api.github.com/users/CityOfZion/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/CityOfZion/neo-python","description":"Python Node and SDK for the NEO blockchain","fork":false,"url":"https://api.github.com/repos/CityOfZion/neo-python","forks_url":"https://api.github.com/repos/CityOfZion/neo-python/forks","keys_url":"https://api.github.com/repos/CityOfZion/neo-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CityOfZion/neo-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CityOfZion/neo-python/teams","hooks_url":"https://api.github.com/repos/CityOfZion/neo-python/hooks","issue_events_url":"https://api.github.com/repos/CityOfZion/neo-python/issues/events{/number}","events_url":"https://api.github.com/repos/CityOfZion/neo-python/events","assignees_url":"https://api.github.com/repos/CityOfZion/neo-python/assignees{/user}","branches_url":"https://api.github.com/repos/CityOfZion/neo-python/branches{/branch}","tags_url":"https://api.github.com/repos/CityOfZion/neo-python/tags","blobs_url":"https://api.github.com/repos/CityOfZion/neo-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CityOfZion/neo-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CityOfZion/neo-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/CityOfZion/neo-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CityOfZion/neo-python/statuses/{sha}","languages_url":"https://api.github.com/repos/CityOfZion/neo-python/languages","stargazers_url":"https://api.github.com/repos/CityOfZion/neo-python/stargazers","contributors_url":"https://api.github.com/repos/CityOfZion/neo-python/contributors","subscribers_url":"https://api.github.com/repos/CityOfZion/neo-python/subscribers","subscription_url":"https://api.github.com/repos/CityOfZion/neo-python/subscription","commits_url":"https://api.github.com/repos/CityOfZion/neo-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/CityOfZion/neo-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/CityOfZion/neo-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/CityOfZion/neo-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/CityOfZion/neo-python/contents/{+path}","compare_url":"https://api.github.com/repos/CityOfZion/neo-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CityOfZion/neo-python/merges","archive_url":"https://api.github.com/repos/CityOfZion/neo-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CityOfZion/neo-python/downloads","issues_url":"https://api.github.com/repos/CityOfZion/neo-python/issues{/number}","pulls_url":"https://api.github.com/repos/CityOfZion/neo-python/pulls{/number}","milestones_url":"https://api.github.com/repos/CityOfZion/neo-python/milestones{/number}","notifications_url":"https://api.github.com/repos/CityOfZion/neo-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CityOfZion/neo-python/labels{/name}","releases_url":"https://api.github.com/repos/CityOfZion/neo-python/releases{/id}","deployments_url":"https://api.github.com/repos/CityOfZion/neo-python/deployments","created_at":"2017-07-16T23:05:32Z","updated_at":"2018-12-06T07:49:30Z","pushed_at":"2018-12-06T09:35:01Z","git_url":"git://github.com/CityOfZion/neo-python.git","ssh_url":"git@github.com:CityOfZion/neo-python.git","clone_url":"https://github.com/CityOfZion/neo-python.git","svn_url":"https://github.com/CityOfZion/neo-python","homepage":"https://neo-python.readthedocs.io/en/latest/","size":120724,"stargazers_count":282,"watchers_count":282,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":194,"mirror_url":null,"archived":false,"open_issues_count":42,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":194,"open_issues":42,"watchers":282,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738"},"html":{"href":"https://github.com/CityOfZion/neo-python/pull/738"},"issue":{"href":"https://api.github.com/repos/CityOfZion/neo-python/issues/738"},"comments":{"href":"https://api.github.com/repos/CityOfZion/neo-python/issues/738/comments"},"review_comments":{"href":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738/comments"},"review_comment":{"href":"https://api.github.com/repos/CityOfZion/neo-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CityOfZion/neo-python/pulls/738/commits"},"statuses":{"href":"https://api.github.com/repos/CityOfZion/neo-python/statuses/18eb43883b65bf8fcbcca4dd0b35869cf4884f00"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"jseagrave21"}}