{"action":"created","comment":{"url":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments/72427306","id":72427306,"diff_hunk":"@@ -0,0 +1,63 @@\n+#!/usr/bin/env python\n+import sys\n+import traceback\n+import os\n+from os.path import join\n+import importlib\n+from contextlib import contextmanager\n+from ast import literal_eval\n+# local imports\n+from code_evaluator import CodeEvaluator\n+from StringIO import StringIO\n+\n+\n+@contextmanager\n+def redirect_stdout():\n+    new_target = StringIO()\n+\n+    old_target, sys.stdout = sys.stdout, new_target  # replace sys.stdout\n+    try:\n+        yield new_target  # run some code with the replaced stdout\n+    finally:\n+        sys.stdout = old_target  # restore to the previous value\n+\n+\n+class PythonStdioEvaluator(CodeEvaluator):\n+    \"\"\"Tests the Python code obtained from Code Server\"\"\"\n+\n+    def compile_code(self, user_answer, expected_input, expected_output):\n+        submitted = compile(user_answer, '<string>', mode='exec')\n+        if expected_input:\n+            input_buffer = StringIO()\n+            input_buffer.write(expected_input)\n+            input_buffer.seek(0)\n+            sys.stdin = input_buffer\n+\n+        with redirect_stdout() as output_buffer:\n+            exec_scope = {}\n+            exec submitted in exec_scope\n+        self.output_value = output_buffer.getvalue().rstrip(\"\\n\")\n+        return self.output_value\n+\n+    def check_code(self, user_answer, expected_input, expected_output):\n+        success = False\n+\n+        tb = None\n+        if expected_output in user_answer:","path":"yaksh/python_stdio_evaluator.py","position":46,"original_position":46,"commit_id":"4b6b3c7fa59381fa780d8f8856ad724045f94614","original_commit_id":"4b6b3c7fa59381fa780d8f8856ad724045f94614","user":{"login":"prathamesh920","id":3014000,"avatar_url":"https://avatars.githubusercontent.com/u/3014000?v=3","gravatar_id":"","url":"https://api.github.com/users/prathamesh920","html_url":"https://github.com/prathamesh920","followers_url":"https://api.github.com/users/prathamesh920/followers","following_url":"https://api.github.com/users/prathamesh920/following{/other_user}","gists_url":"https://api.github.com/users/prathamesh920/gists{/gist_id}","starred_url":"https://api.github.com/users/prathamesh920/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/prathamesh920/subscriptions","organizations_url":"https://api.github.com/users/prathamesh920/orgs","repos_url":"https://api.github.com/users/prathamesh920/repos","events_url":"https://api.github.com/users/prathamesh920/events{/privacy}","received_events_url":"https://api.github.com/users/prathamesh920/received_events","type":"User","site_admin":false},"body":"checking this expected_output in user_answer may give unexpected results.\r\nBetter to remove it because even though my answer code is correct but will still get incorrect, only because I have expected_output some where in my code.\r\nTo check whether user is simply printing, we have multiple testcases to take care of this situation for now. ","created_at":"2016-07-27T12:07:35Z","updated_at":"2016-07-27T12:07:35Z","html_url":"https://github.com/FOSSEE/online_test/pull/105#discussion_r72427306","pull_request_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/105","_links":{"self":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments/72427306"},"html":{"href":"https://github.com/FOSSEE/online_test/pull/105#discussion_r72427306"},"pull_request":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/105"}}},"pull_request":{"url":"https://api.github.com/repos/FOSSEE/online_test/pulls/105","id":72333787,"html_url":"https://github.com/FOSSEE/online_test/pull/105","diff_url":"https://github.com/FOSSEE/online_test/pull/105.diff","patch_url":"https://github.com/FOSSEE/online_test/pull/105.patch","issue_url":"https://api.github.com/repos/FOSSEE/online_test/issues/105","number":105,"state":"open","locked":false,"title":"Stdin stdout evaluators","user":{"login":"adityacp","id":15092744,"avatar_url":"https://avatars.githubusercontent.com/u/15092744?v=3","gravatar_id":"","url":"https://api.github.com/users/adityacp","html_url":"https://github.com/adityacp","followers_url":"https://api.github.com/users/adityacp/followers","following_url":"https://api.github.com/users/adityacp/following{/other_user}","gists_url":"https://api.github.com/users/adityacp/gists{/gist_id}","starred_url":"https://api.github.com/users/adityacp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adityacp/subscriptions","organizations_url":"https://api.github.com/users/adityacp/orgs","repos_url":"https://api.github.com/users/adityacp/repos","events_url":"https://api.github.com/users/adityacp/events{/privacy}","received_events_url":"https://api.github.com/users/adityacp/received_events","type":"User","site_admin":false},"body":"Created Stdio based evaluators for C, Cpp, Java, Python and bash.\r\nEvaluators takes the expected input and expected output provided by moderator\r\nCompares expected output with user output \r\nAdded test cases for evaluators","created_at":"2016-06-02T11:58:12Z","updated_at":"2016-07-27T12:07:35Z","closed_at":null,"merged_at":null,"merge_commit_sha":"622fb9d3435e7cb2a6e8627361cc8a1cba549951","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/105/commits","review_comments_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/105/comments","review_comment_url":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments{/number}","comments_url":"https://api.github.com/repos/FOSSEE/online_test/issues/105/comments","statuses_url":"https://api.github.com/repos/FOSSEE/online_test/statuses/4b6b3c7fa59381fa780d8f8856ad724045f94614","head":{"label":"adityacp:stdin_stdout_evaluator","ref":"stdin_stdout_evaluator","sha":"4b6b3c7fa59381fa780d8f8856ad724045f94614","user":{"login":"adityacp","id":15092744,"avatar_url":"https://avatars.githubusercontent.com/u/15092744?v=3","gravatar_id":"","url":"https://api.github.com/users/adityacp","html_url":"https://github.com/adityacp","followers_url":"https://api.github.com/users/adityacp/followers","following_url":"https://api.github.com/users/adityacp/following{/other_user}","gists_url":"https://api.github.com/users/adityacp/gists{/gist_id}","starred_url":"https://api.github.com/users/adityacp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adityacp/subscriptions","organizations_url":"https://api.github.com/users/adityacp/orgs","repos_url":"https://api.github.com/users/adityacp/repos","events_url":"https://api.github.com/users/adityacp/events{/privacy}","received_events_url":"https://api.github.com/users/adityacp/received_events","type":"User","site_admin":false},"repo":{"id":58149021,"name":"online_test","full_name":"adityacp/online_test","owner":{"login":"adityacp","id":15092744,"avatar_url":"https://avatars.githubusercontent.com/u/15092744?v=3","gravatar_id":"","url":"https://api.github.com/users/adityacp","html_url":"https://github.com/adityacp","followers_url":"https://api.github.com/users/adityacp/followers","following_url":"https://api.github.com/users/adityacp/following{/other_user}","gists_url":"https://api.github.com/users/adityacp/gists{/gist_id}","starred_url":"https://api.github.com/users/adityacp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adityacp/subscriptions","organizations_url":"https://api.github.com/users/adityacp/orgs","repos_url":"https://api.github.com/users/adityacp/repos","events_url":"https://api.github.com/users/adityacp/events{/privacy}","received_events_url":"https://api.github.com/users/adityacp/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/adityacp/online_test","description":"Online quiz/exam taking application. ","fork":true,"url":"https://api.github.com/repos/adityacp/online_test","forks_url":"https://api.github.com/repos/adityacp/online_test/forks","keys_url":"https://api.github.com/repos/adityacp/online_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/adityacp/online_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/adityacp/online_test/teams","hooks_url":"https://api.github.com/repos/adityacp/online_test/hooks","issue_events_url":"https://api.github.com/repos/adityacp/online_test/issues/events{/number}","events_url":"https://api.github.com/repos/adityacp/online_test/events","assignees_url":"https://api.github.com/repos/adityacp/online_test/assignees{/user}","branches_url":"https://api.github.com/repos/adityacp/online_test/branches{/branch}","tags_url":"https://api.github.com/repos/adityacp/online_test/tags","blobs_url":"https://api.github.com/repos/adityacp/online_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/adityacp/online_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/adityacp/online_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/adityacp/online_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/adityacp/online_test/statuses/{sha}","languages_url":"https://api.github.com/repos/adityacp/online_test/languages","stargazers_url":"https://api.github.com/repos/adityacp/online_test/stargazers","contributors_url":"https://api.github.com/repos/adityacp/online_test/contributors","subscribers_url":"https://api.github.com/repos/adityacp/online_test/subscribers","subscription_url":"https://api.github.com/repos/adityacp/online_test/subscription","commits_url":"https://api.github.com/repos/adityacp/online_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/adityacp/online_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/adityacp/online_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/adityacp/online_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/adityacp/online_test/contents/{+path}","compare_url":"https://api.github.com/repos/adityacp/online_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/adityacp/online_test/merges","archive_url":"https://api.github.com/repos/adityacp/online_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/adityacp/online_test/downloads","issues_url":"https://api.github.com/repos/adityacp/online_test/issues{/number}","pulls_url":"https://api.github.com/repos/adityacp/online_test/pulls{/number}","milestones_url":"https://api.github.com/repos/adityacp/online_test/milestones{/number}","notifications_url":"https://api.github.com/repos/adityacp/online_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/adityacp/online_test/labels{/name}","releases_url":"https://api.github.com/repos/adityacp/online_test/releases{/id}","deployments_url":"https://api.github.com/repos/adityacp/online_test/deployments","created_at":"2016-05-05T17:36:03Z","updated_at":"2016-05-05T17:36:04Z","pushed_at":"2016-07-22T06:34:54Z","git_url":"git://github.com/adityacp/online_test.git","ssh_url":"git@github.com:adityacp/online_test.git","clone_url":"https://github.com/adityacp/online_test.git","svn_url":"https://github.com/adityacp/online_test","homepage":"http://fossee.in","size":4942,"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":"FOSSEE:master","ref":"master","sha":"660a8b4f8b21a1e5836536a9db755fcf840ecd63","user":{"login":"FOSSEE","id":703487,"avatar_url":"https://avatars.githubusercontent.com/u/703487?v=3","gravatar_id":"","url":"https://api.github.com/users/FOSSEE","html_url":"https://github.com/FOSSEE","followers_url":"https://api.github.com/users/FOSSEE/followers","following_url":"https://api.github.com/users/FOSSEE/following{/other_user}","gists_url":"https://api.github.com/users/FOSSEE/gists{/gist_id}","starred_url":"https://api.github.com/users/FOSSEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FOSSEE/subscriptions","organizations_url":"https://api.github.com/users/FOSSEE/orgs","repos_url":"https://api.github.com/users/FOSSEE/repos","events_url":"https://api.github.com/users/FOSSEE/events{/privacy}","received_events_url":"https://api.github.com/users/FOSSEE/received_events","type":"Organization","site_admin":false},"repo":{"id":2734092,"name":"online_test","full_name":"FOSSEE/online_test","owner":{"login":"FOSSEE","id":703487,"avatar_url":"https://avatars.githubusercontent.com/u/703487?v=3","gravatar_id":"","url":"https://api.github.com/users/FOSSEE","html_url":"https://github.com/FOSSEE","followers_url":"https://api.github.com/users/FOSSEE/followers","following_url":"https://api.github.com/users/FOSSEE/following{/other_user}","gists_url":"https://api.github.com/users/FOSSEE/gists{/gist_id}","starred_url":"https://api.github.com/users/FOSSEE/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FOSSEE/subscriptions","organizations_url":"https://api.github.com/users/FOSSEE/orgs","repos_url":"https://api.github.com/users/FOSSEE/repos","events_url":"https://api.github.com/users/FOSSEE/events{/privacy}","received_events_url":"https://api.github.com/users/FOSSEE/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/FOSSEE/online_test","description":"Online quiz/exam taking application. ","fork":false,"url":"https://api.github.com/repos/FOSSEE/online_test","forks_url":"https://api.github.com/repos/FOSSEE/online_test/forks","keys_url":"https://api.github.com/repos/FOSSEE/online_test/keys{/key_id}","collaborators_url":"https://api.github.com/repos/FOSSEE/online_test/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/FOSSEE/online_test/teams","hooks_url":"https://api.github.com/repos/FOSSEE/online_test/hooks","issue_events_url":"https://api.github.com/repos/FOSSEE/online_test/issues/events{/number}","events_url":"https://api.github.com/repos/FOSSEE/online_test/events","assignees_url":"https://api.github.com/repos/FOSSEE/online_test/assignees{/user}","branches_url":"https://api.github.com/repos/FOSSEE/online_test/branches{/branch}","tags_url":"https://api.github.com/repos/FOSSEE/online_test/tags","blobs_url":"https://api.github.com/repos/FOSSEE/online_test/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/FOSSEE/online_test/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/FOSSEE/online_test/git/refs{/sha}","trees_url":"https://api.github.com/repos/FOSSEE/online_test/git/trees{/sha}","statuses_url":"https://api.github.com/repos/FOSSEE/online_test/statuses/{sha}","languages_url":"https://api.github.com/repos/FOSSEE/online_test/languages","stargazers_url":"https://api.github.com/repos/FOSSEE/online_test/stargazers","contributors_url":"https://api.github.com/repos/FOSSEE/online_test/contributors","subscribers_url":"https://api.github.com/repos/FOSSEE/online_test/subscribers","subscription_url":"https://api.github.com/repos/FOSSEE/online_test/subscription","commits_url":"https://api.github.com/repos/FOSSEE/online_test/commits{/sha}","git_commits_url":"https://api.github.com/repos/FOSSEE/online_test/git/commits{/sha}","comments_url":"https://api.github.com/repos/FOSSEE/online_test/comments{/number}","issue_comment_url":"https://api.github.com/repos/FOSSEE/online_test/issues/comments{/number}","contents_url":"https://api.github.com/repos/FOSSEE/online_test/contents/{+path}","compare_url":"https://api.github.com/repos/FOSSEE/online_test/compare/{base}...{head}","merges_url":"https://api.github.com/repos/FOSSEE/online_test/merges","archive_url":"https://api.github.com/repos/FOSSEE/online_test/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/FOSSEE/online_test/downloads","issues_url":"https://api.github.com/repos/FOSSEE/online_test/issues{/number}","pulls_url":"https://api.github.com/repos/FOSSEE/online_test/pulls{/number}","milestones_url":"https://api.github.com/repos/FOSSEE/online_test/milestones{/number}","notifications_url":"https://api.github.com/repos/FOSSEE/online_test/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/FOSSEE/online_test/labels{/name}","releases_url":"https://api.github.com/repos/FOSSEE/online_test/releases{/id}","deployments_url":"https://api.github.com/repos/FOSSEE/online_test/deployments","created_at":"2011-11-08T14:02:17Z","updated_at":"2016-07-14T03:41:27Z","pushed_at":"2016-07-27T06:24:12Z","git_url":"git://github.com/FOSSEE/online_test.git","ssh_url":"git@github.com:FOSSEE/online_test.git","clone_url":"https://github.com/FOSSEE/online_test.git","svn_url":"https://github.com/FOSSEE/online_test","homepage":"http://fossee.in","size":5230,"stargazers_count":26,"watchers_count":26,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":28,"mirror_url":null,"open_issues_count":12,"forks":28,"open_issues":12,"watchers":26,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/105"},"html":{"href":"https://github.com/FOSSEE/online_test/pull/105"},"issue":{"href":"https://api.github.com/repos/FOSSEE/online_test/issues/105"},"comments":{"href":"https://api.github.com/repos/FOSSEE/online_test/issues/105/comments"},"review_comments":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/105/comments"},"review_comment":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/FOSSEE/online_test/pulls/105/commits"},"statuses":{"href":"https://api.github.com/repos/FOSSEE/online_test/statuses/4b6b3c7fa59381fa780d8f8856ad724045f94614"}}}}
{"actor":{"display_login":"prathamesh920"}}