{"action":"created","comment":{"url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/comments/111958499","pull_request_review_id":33235881,"id":111958499,"diff_hunk":"@@ -0,0 +1,148 @@\n+#!/usr/bin/env python\n+\"\"\"\n+Amitié is an interactive commandline application to help you allocate rooms to\n+Andela Employees randomly and efficiently.\n+\n+Usage:\n+    Amitié create_room <room_type> <room_name>...\n+    Amitié add_person <first_name> <last_name> <role> <accomodation>\n+    Amitié reallocate_person <full_names> <room_name>\n+    Amitié load_people <file_name>\n+    Amitié print_allocations [--file_name]\n+    Amitié unallocated [--file_name]\n+    Amitié print_room <room_name>\n+    Amitié save_state <db_name>\n+    Amitié (-i | --interactive)\n+    Amitié (-h | --help | --version)\n+\n+\n+Options:\n+    -i, --interactive  Interactive Mode\n+    -h, --help  Show this screen and exit.\n+\"\"\"\n+\n+import sys\n+import cmd\n+import time\n+\n+from docopt import docopt, DocoptExit\n+\n+from termcolor import colored, cprint\n+from pyfiglet import figlet_format, Figlet\n+\n+from cp.amity import Amity\n+\n+\n+def docopt_cmd(func):\n+\n+    def fn(self, arg):\n+        try:\n+            opt = docopt(fn.__doc__, arg)\n+\n+        except DocoptExit as e:\n+            # The DocoptExit is thrown when the args do not match.\n+            # We print a message to the user and the usage block.\n+\n+            print('Invalid Command!\\n')\n+            print(e)\n+            return\n+\n+        except SystemExit:\n+            # The SystemExit exception prints the usage for --help\n+            # We do not need to do the print here.\n+\n+            return\n+\n+        return func(self, opt)\n+\n+    fn.__name__ = func.__name__\n+    fn.__doc__ = func.__doc__\n+    fn.__dict__.update(func.__dict__)\n+    return fn\n+\n+\n+def app_header():\n+    cprint(\"=================================================\", 'blue')\n+\n+\n+class App(cmd.Cmd):\n+    intro = 'Welcome to Amitié!' + ' (Type help for a list of commands.)'\n+    custom_prompt = colored('Amitié ', 'green', attrs=[\n+        'bold']) + colored('-->', 'grey', attrs=['bold', 'blink'])\n+    prompt = custom_prompt\n+    file = None\n+\n+    @docopt_cmd\n+    def do_create_room(self, arg):\n+        \"\"\"Usage: create_room <room_type> <room_name>...\"\"\"\n+\n+        room_type = arg['<room_type>']\n+        room_name = arg['<room_name>']\n+        amity.create_room(room_type, room_name)\n+\n+    @docopt_cmd\n+    def do_add_person(self, arg):\n+        \"\"\"Usage: add_person <first_name> <last_name> <role> <accomodation>\"\"\"\n+\n+        first_name = arg['<first_name>']\n+        last_name = arg['<last_name>']\n+        role = arg['<role>']\n+        accomodation = arg['<accomodation>']\n+        amity.add_person(first_name, last_name, role, accomodation)\n+\n+    @docopt_cmd\n+    def do_reallocate_person(self, arg):\n+        \"\"\"Usage: reallocate_person <First_name> <Last_name> <room_name>\"\"\"\n+\n+        First_name = arg['<First_name>']\n+        Last_name = arg['<Last_name>']\n+        room_name = arg['<room_name>']\n+        amity.reallocate_person(First_name, Last_name, room_name)\n+\n+    @docopt_cmd\n+    def do_load_people(self, arg):\n+        \"\"\"Usage: load_people <file_name>\"\"\"\n+\n+        file_name = arg['<file_name>']\n+        amity.load_people(file_name)\n+\n+    @docopt_cmd\n+    def do_print_allocations(self, arg):\n+        \"\"\"Usage: print_allocations [--file_name]\"\"\"\n+\n+        amity.print_allocations()\n+\n+    @docopt_cmd\n+    def do_print_unallocated(self, arg):","path":"app/view.py","position":116,"original_position":116,"commit_id":"f18dbfa85807dc30c53fee49e7fe1fa933361115","original_commit_id":"f18dbfa85807dc30c53fee49e7fe1fa933361115","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars2.githubusercontent.com/u/19940114?v=3","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/assets/images/favicon.png) Issue found: [Method could be a function](https://www.codacy.com/app/ProberI/CP1-amity-allocation/pullRequest?prid=611628)","created_at":"2017-04-18T13:52:30Z","updated_at":"2017-04-18T13:52:30Z","html_url":"https://github.com/ProberI/CP1-amity-allocation/pull/4#discussion_r111958499","pull_request_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/comments/111958499"},"html":{"href":"https://github.com/ProberI/CP1-amity-allocation/pull/4#discussion_r111958499"},"pull_request":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4","id":116252807,"html_url":"https://github.com/ProberI/CP1-amity-allocation/pull/4","diff_url":"https://github.com/ProberI/CP1-amity-allocation/pull/4.diff","patch_url":"https://github.com/ProberI/CP1-amity-allocation/pull/4.patch","issue_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/4","number":4,"state":"open","locked":false,"title":"PR1-Amity-code-review-PR","user":{"login":"ProberI","id":19177880,"avatar_url":"https://avatars1.githubusercontent.com/u/19177880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProberI","html_url":"https://github.com/ProberI","followers_url":"https://api.github.com/users/ProberI/followers","following_url":"https://api.github.com/users/ProberI/following{/other_user}","gists_url":"https://api.github.com/users/ProberI/gists{/gist_id}","starred_url":"https://api.github.com/users/ProberI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProberI/subscriptions","organizations_url":"https://api.github.com/users/ProberI/orgs","repos_url":"https://api.github.com/users/ProberI/repos","events_url":"https://api.github.com/users/ProberI/events{/privacy}","received_events_url":"https://api.github.com/users/ProberI/received_events","type":"User","site_admin":false},"body":"#### What does this PR do?\r\n  * Amity room allocation CLI implementation.\r\n  * OOP implementation.\r\n  * Docopt for CLI 'front-end'.\r\n#### Description of Task to be completed:\r\n       Have 70% tests coverage.\r\n       Have functions implemented according to python best practices.\r\n#### How should this be manually tested?\r\n   * Clone the repo.\r\n   * Install project requirements in a virtual environment.\r\n   * CD into app directory.\r\n   * Run nose tests --with-coverage to check for test coverage.\r\n   * Run python view.py -i to start app in interactive mode.\r\n","created_at":"2017-04-18T05:16:03Z","updated_at":"2017-04-18T13:52:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4cefc48281fa7a951c31e723272775a0e767e513","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4/commits","review_comments_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4/comments","review_comment_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/4/comments","statuses_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/statuses/f18dbfa85807dc30c53fee49e7fe1fa933361115","head":{"label":"ProberI:develop","ref":"develop","sha":"f18dbfa85807dc30c53fee49e7fe1fa933361115","user":{"login":"ProberI","id":19177880,"avatar_url":"https://avatars1.githubusercontent.com/u/19177880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProberI","html_url":"https://github.com/ProberI","followers_url":"https://api.github.com/users/ProberI/followers","following_url":"https://api.github.com/users/ProberI/following{/other_user}","gists_url":"https://api.github.com/users/ProberI/gists{/gist_id}","starred_url":"https://api.github.com/users/ProberI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProberI/subscriptions","organizations_url":"https://api.github.com/users/ProberI/orgs","repos_url":"https://api.github.com/users/ProberI/repos","events_url":"https://api.github.com/users/ProberI/events{/privacy}","received_events_url":"https://api.github.com/users/ProberI/received_events","type":"User","site_admin":false},"repo":{"id":85191887,"name":"CP1-amity-allocation","full_name":"ProberI/CP1-amity-allocation","owner":{"login":"ProberI","id":19177880,"avatar_url":"https://avatars1.githubusercontent.com/u/19177880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProberI","html_url":"https://github.com/ProberI","followers_url":"https://api.github.com/users/ProberI/followers","following_url":"https://api.github.com/users/ProberI/following{/other_user}","gists_url":"https://api.github.com/users/ProberI/gists{/gist_id}","starred_url":"https://api.github.com/users/ProberI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProberI/subscriptions","organizations_url":"https://api.github.com/users/ProberI/orgs","repos_url":"https://api.github.com/users/ProberI/repos","events_url":"https://api.github.com/users/ProberI/events{/privacy}","received_events_url":"https://api.github.com/users/ProberI/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ProberI/CP1-amity-allocation","description":"A room allocation system for one of Andela's facility : 'Amity'","fork":false,"url":"https://api.github.com/repos/ProberI/CP1-amity-allocation","forks_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/forks","keys_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/teams","hooks_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/hooks","issue_events_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/events{/number}","events_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/events","assignees_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/assignees{/user}","branches_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/branches{/branch}","tags_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/tags","blobs_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/refs{/sha}","trees_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/statuses/{sha}","languages_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/languages","stargazers_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/stargazers","contributors_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/contributors","subscribers_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/subscribers","subscription_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/subscription","commits_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/commits{/sha}","git_commits_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/commits{/sha}","comments_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/comments{/number}","issue_comment_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/comments{/number}","contents_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/contents/{+path}","compare_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/merges","archive_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/downloads","issues_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues{/number}","pulls_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls{/number}","milestones_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/milestones{/number}","notifications_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/labels{/name}","releases_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/releases{/id}","deployments_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/deployments","created_at":"2017-03-16T12:11:18Z","updated_at":"2017-03-30T14:42:47Z","pushed_at":"2017-04-18T13:09:05Z","git_url":"git://github.com/ProberI/CP1-amity-allocation.git","ssh_url":"git@github.com:ProberI/CP1-amity-allocation.git","clone_url":"https://github.com/ProberI/CP1-amity-allocation.git","svn_url":"https://github.com/ProberI/CP1-amity-allocation","homepage":null,"size":407,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ProberI:master","ref":"master","sha":"5580ecfc92ce2bb3bc580f24dce4397a0a3dc3f6","user":{"login":"ProberI","id":19177880,"avatar_url":"https://avatars1.githubusercontent.com/u/19177880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProberI","html_url":"https://github.com/ProberI","followers_url":"https://api.github.com/users/ProberI/followers","following_url":"https://api.github.com/users/ProberI/following{/other_user}","gists_url":"https://api.github.com/users/ProberI/gists{/gist_id}","starred_url":"https://api.github.com/users/ProberI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProberI/subscriptions","organizations_url":"https://api.github.com/users/ProberI/orgs","repos_url":"https://api.github.com/users/ProberI/repos","events_url":"https://api.github.com/users/ProberI/events{/privacy}","received_events_url":"https://api.github.com/users/ProberI/received_events","type":"User","site_admin":false},"repo":{"id":85191887,"name":"CP1-amity-allocation","full_name":"ProberI/CP1-amity-allocation","owner":{"login":"ProberI","id":19177880,"avatar_url":"https://avatars1.githubusercontent.com/u/19177880?v=3","gravatar_id":"","url":"https://api.github.com/users/ProberI","html_url":"https://github.com/ProberI","followers_url":"https://api.github.com/users/ProberI/followers","following_url":"https://api.github.com/users/ProberI/following{/other_user}","gists_url":"https://api.github.com/users/ProberI/gists{/gist_id}","starred_url":"https://api.github.com/users/ProberI/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ProberI/subscriptions","organizations_url":"https://api.github.com/users/ProberI/orgs","repos_url":"https://api.github.com/users/ProberI/repos","events_url":"https://api.github.com/users/ProberI/events{/privacy}","received_events_url":"https://api.github.com/users/ProberI/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ProberI/CP1-amity-allocation","description":"A room allocation system for one of Andela's facility : 'Amity'","fork":false,"url":"https://api.github.com/repos/ProberI/CP1-amity-allocation","forks_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/forks","keys_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/teams","hooks_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/hooks","issue_events_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/events{/number}","events_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/events","assignees_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/assignees{/user}","branches_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/branches{/branch}","tags_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/tags","blobs_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/refs{/sha}","trees_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/statuses/{sha}","languages_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/languages","stargazers_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/stargazers","contributors_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/contributors","subscribers_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/subscribers","subscription_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/subscription","commits_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/commits{/sha}","git_commits_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/git/commits{/sha}","comments_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/comments{/number}","issue_comment_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/comments{/number}","contents_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/contents/{+path}","compare_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/merges","archive_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/downloads","issues_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues{/number}","pulls_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls{/number}","milestones_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/milestones{/number}","notifications_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/labels{/name}","releases_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/releases{/id}","deployments_url":"https://api.github.com/repos/ProberI/CP1-amity-allocation/deployments","created_at":"2017-03-16T12:11:18Z","updated_at":"2017-03-30T14:42:47Z","pushed_at":"2017-04-18T13:09:05Z","git_url":"git://github.com/ProberI/CP1-amity-allocation.git","ssh_url":"git@github.com:ProberI/CP1-amity-allocation.git","clone_url":"https://github.com/ProberI/CP1-amity-allocation.git","svn_url":"https://github.com/ProberI/CP1-amity-allocation","homepage":null,"size":407,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4"},"html":{"href":"https://github.com/ProberI/CP1-amity-allocation/pull/4"},"issue":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/4"},"comments":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/ProberI/CP1-amity-allocation/statuses/f18dbfa85807dc30c53fee49e7fe1fa933361115"}}}}
{"actor":{"display_login":"codacy-bot"}}