{"action":"created","comment":{"url":"https://api.github.com/repos/innovia/training-exercise/pulls/comments/69461199","id":69461199,"diff_hunk":"@@ -0,0 +1,133 @@\n+# Copyright (c) 2016 Ami . All rights reserved\n+import argparse\n+import csv\n+import os\n+import sys\n+\n+def get_arguments():\n+    current_directory = os.getcwd()\n+    parser = argparse.ArgumentParser(description=\"Split CSV by every x rows\")\n+\n+    parser.add_argument(\n+        \"-i\",\n+        action=\"store\",\n+        dest=\"input_file\",\n+        help=\"CSV input file\",\n+        required=True\n+    )\n+    parser.add_argument(\n+        \"-o\",\n+        action=\"store\",\n+        dest=\"output_path\",\n+        help=\"Output path - where to store the split CSV files\",\n+        default=current_directory\n+    )\n+    parser.add_argument(\n+        \"-r\",\n+        action=\"store\",\n+        dest=\"row_limit\",\n+        help=\"split by every x lines\",\n+        type=int,\n+        required=True\n+    )\n+\n+    if len(sys.argv) == 1:\n+        parser.print_help()\n+        return None\n+    else:\n+        return parser.parse_args()\n+\n+def check_if_file_exists(file_path):\n+    if os.path.exists(file_path):\n+        return True\n+    else:\n+        print(\"File not found:\", file_path)\n+        return False\n+\n+def validate_minimum_rows(csv_file_name, csv_file_num_lines, row_limit):\n+    print(\n+        \"Validating file {file_name} has more than {row_limit} rows to split by...\".format(\n+            file_name=csv_file_name,\n+            row_limit=row_limit,\n+        ),\n+        end=\"\"\n+    )\n+\n+    if csv_file_num_lines < row_limit:\n+        print(\n+            \"Error: the file {file_name} contains {file_num_lines} lines, \"\n+            \"it is smaller than the {row_limit} rows to split by\".format(\n+                file=csv_file_name,\n+                file_num_lines=csv_file_num_lines,\n+                row_limit= row_limit,","path":"06-files-input-and-output/csv_split.py","position":62,"original_position":62,"commit_id":"5429f97b041c7402b7a5c83cf6b2890304aeab4d","original_commit_id":"5429f97b041c7402b7a5c83cf6b2890304aeab4d","user":{"login":"boarik","id":4247190,"avatar_url":"https://avatars.githubusercontent.com/u/4247190?v=3","gravatar_id":"","url":"https://api.github.com/users/boarik","html_url":"https://github.com/boarik","followers_url":"https://api.github.com/users/boarik/followers","following_url":"https://api.github.com/users/boarik/following{/other_user}","gists_url":"https://api.github.com/users/boarik/gists{/gist_id}","starred_url":"https://api.github.com/users/boarik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boarik/subscriptions","organizations_url":"https://api.github.com/users/boarik/orgs","repos_url":"https://api.github.com/users/boarik/repos","events_url":"https://api.github.com/users/boarik/events{/privacy}","received_events_url":"https://api.github.com/users/boarik/received_events","type":"User","site_admin":false},"body":"Redundant space after =.","created_at":"2016-07-04T13:56:01Z","updated_at":"2016-07-04T13:56:01Z","html_url":"https://github.com/innovia/training-exercise/pull/11#discussion_r69461199","pull_request_url":"https://api.github.com/repos/innovia/training-exercise/pulls/11","_links":{"self":{"href":"https://api.github.com/repos/innovia/training-exercise/pulls/comments/69461199"},"html":{"href":"https://github.com/innovia/training-exercise/pull/11#discussion_r69461199"},"pull_request":{"href":"https://api.github.com/repos/innovia/training-exercise/pulls/11"}}},"pull_request":{"url":"https://api.github.com/repos/innovia/training-exercise/pulls/11","id":76088312,"html_url":"https://github.com/innovia/training-exercise/pull/11","diff_url":"https://github.com/innovia/training-exercise/pull/11.diff","patch_url":"https://github.com/innovia/training-exercise/pull/11.patch","issue_url":"https://api.github.com/repos/innovia/training-exercise/issues/11","number":11,"state":"open","locked":false,"title":"[master] 06 files input and output c - split csv","user":{"login":"innovia","id":112025,"avatar_url":"https://avatars.githubusercontent.com/u/112025?v=3","gravatar_id":"","url":"https://api.github.com/users/innovia","html_url":"https://github.com/innovia","followers_url":"https://api.github.com/users/innovia/followers","following_url":"https://api.github.com/users/innovia/following{/other_user}","gists_url":"https://api.github.com/users/innovia/gists{/gist_id}","starred_url":"https://api.github.com/users/innovia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innovia/subscriptions","organizations_url":"https://api.github.com/users/innovia/orgs","repos_url":"https://api.github.com/users/innovia/repos","events_url":"https://api.github.com/users/innovia/events{/privacy}","received_events_url":"https://api.github.com/users/innovia/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-03T12:49:03Z","updated_at":"2016-07-04T13:56:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f79efa8b388fc1d08b986617ee119e01d7e52c1","assignee":{"login":"boarik","id":4247190,"avatar_url":"https://avatars.githubusercontent.com/u/4247190?v=3","gravatar_id":"","url":"https://api.github.com/users/boarik","html_url":"https://github.com/boarik","followers_url":"https://api.github.com/users/boarik/followers","following_url":"https://api.github.com/users/boarik/following{/other_user}","gists_url":"https://api.github.com/users/boarik/gists{/gist_id}","starred_url":"https://api.github.com/users/boarik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boarik/subscriptions","organizations_url":"https://api.github.com/users/boarik/orgs","repos_url":"https://api.github.com/users/boarik/repos","events_url":"https://api.github.com/users/boarik/events{/privacy}","received_events_url":"https://api.github.com/users/boarik/received_events","type":"User","site_admin":false},"assignees":[{"login":"boarik","id":4247190,"avatar_url":"https://avatars.githubusercontent.com/u/4247190?v=3","gravatar_id":"","url":"https://api.github.com/users/boarik","html_url":"https://github.com/boarik","followers_url":"https://api.github.com/users/boarik/followers","following_url":"https://api.github.com/users/boarik/following{/other_user}","gists_url":"https://api.github.com/users/boarik/gists{/gist_id}","starred_url":"https://api.github.com/users/boarik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/boarik/subscriptions","organizations_url":"https://api.github.com/users/boarik/orgs","repos_url":"https://api.github.com/users/boarik/repos","events_url":"https://api.github.com/users/boarik/events{/privacy}","received_events_url":"https://api.github.com/users/boarik/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/innovia/training-exercise/pulls/11/commits","review_comments_url":"https://api.github.com/repos/innovia/training-exercise/pulls/11/comments","review_comment_url":"https://api.github.com/repos/innovia/training-exercise/pulls/comments{/number}","comments_url":"https://api.github.com/repos/innovia/training-exercise/issues/11/comments","statuses_url":"https://api.github.com/repos/innovia/training-exercise/statuses/5429f97b041c7402b7a5c83cf6b2890304aeab4d","head":{"label":"innovia:06-files-input-and-output-c","ref":"06-files-input-and-output-c","sha":"5429f97b041c7402b7a5c83cf6b2890304aeab4d","user":{"login":"innovia","id":112025,"avatar_url":"https://avatars.githubusercontent.com/u/112025?v=3","gravatar_id":"","url":"https://api.github.com/users/innovia","html_url":"https://github.com/innovia","followers_url":"https://api.github.com/users/innovia/followers","following_url":"https://api.github.com/users/innovia/following{/other_user}","gists_url":"https://api.github.com/users/innovia/gists{/gist_id}","starred_url":"https://api.github.com/users/innovia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innovia/subscriptions","organizations_url":"https://api.github.com/users/innovia/orgs","repos_url":"https://api.github.com/users/innovia/repos","events_url":"https://api.github.com/users/innovia/events{/privacy}","received_events_url":"https://api.github.com/users/innovia/received_events","type":"User","site_admin":false},"repo":{"id":61481262,"name":"training-exercise","full_name":"innovia/training-exercise","owner":{"login":"innovia","id":112025,"avatar_url":"https://avatars.githubusercontent.com/u/112025?v=3","gravatar_id":"","url":"https://api.github.com/users/innovia","html_url":"https://github.com/innovia","followers_url":"https://api.github.com/users/innovia/followers","following_url":"https://api.github.com/users/innovia/following{/other_user}","gists_url":"https://api.github.com/users/innovia/gists{/gist_id}","starred_url":"https://api.github.com/users/innovia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innovia/subscriptions","organizations_url":"https://api.github.com/users/innovia/orgs","repos_url":"https://api.github.com/users/innovia/repos","events_url":"https://api.github.com/users/innovia/events{/privacy}","received_events_url":"https://api.github.com/users/innovia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/innovia/training-exercise","description":"","fork":false,"url":"https://api.github.com/repos/innovia/training-exercise","forks_url":"https://api.github.com/repos/innovia/training-exercise/forks","keys_url":"https://api.github.com/repos/innovia/training-exercise/keys{/key_id}","collaborators_url":"https://api.github.com/repos/innovia/training-exercise/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/innovia/training-exercise/teams","hooks_url":"https://api.github.com/repos/innovia/training-exercise/hooks","issue_events_url":"https://api.github.com/repos/innovia/training-exercise/issues/events{/number}","events_url":"https://api.github.com/repos/innovia/training-exercise/events","assignees_url":"https://api.github.com/repos/innovia/training-exercise/assignees{/user}","branches_url":"https://api.github.com/repos/innovia/training-exercise/branches{/branch}","tags_url":"https://api.github.com/repos/innovia/training-exercise/tags","blobs_url":"https://api.github.com/repos/innovia/training-exercise/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/innovia/training-exercise/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/innovia/training-exercise/git/refs{/sha}","trees_url":"https://api.github.com/repos/innovia/training-exercise/git/trees{/sha}","statuses_url":"https://api.github.com/repos/innovia/training-exercise/statuses/{sha}","languages_url":"https://api.github.com/repos/innovia/training-exercise/languages","stargazers_url":"https://api.github.com/repos/innovia/training-exercise/stargazers","contributors_url":"https://api.github.com/repos/innovia/training-exercise/contributors","subscribers_url":"https://api.github.com/repos/innovia/training-exercise/subscribers","subscription_url":"https://api.github.com/repos/innovia/training-exercise/subscription","commits_url":"https://api.github.com/repos/innovia/training-exercise/commits{/sha}","git_commits_url":"https://api.github.com/repos/innovia/training-exercise/git/commits{/sha}","comments_url":"https://api.github.com/repos/innovia/training-exercise/comments{/number}","issue_comment_url":"https://api.github.com/repos/innovia/training-exercise/issues/comments{/number}","contents_url":"https://api.github.com/repos/innovia/training-exercise/contents/{+path}","compare_url":"https://api.github.com/repos/innovia/training-exercise/compare/{base}...{head}","merges_url":"https://api.github.com/repos/innovia/training-exercise/merges","archive_url":"https://api.github.com/repos/innovia/training-exercise/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/innovia/training-exercise/downloads","issues_url":"https://api.github.com/repos/innovia/training-exercise/issues{/number}","pulls_url":"https://api.github.com/repos/innovia/training-exercise/pulls{/number}","milestones_url":"https://api.github.com/repos/innovia/training-exercise/milestones{/number}","notifications_url":"https://api.github.com/repos/innovia/training-exercise/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/innovia/training-exercise/labels{/name}","releases_url":"https://api.github.com/repos/innovia/training-exercise/releases{/id}","deployments_url":"https://api.github.com/repos/innovia/training-exercise/deployments","created_at":"2016-06-19T13:21:38Z","updated_at":"2016-06-20T12:42:49Z","pushed_at":"2016-07-04T12:39:47Z","git_url":"git://github.com/innovia/training-exercise.git","ssh_url":"git@github.com:innovia/training-exercise.git","clone_url":"https://github.com/innovia/training-exercise.git","svn_url":"https://github.com/innovia/training-exercise","homepage":null,"size":290,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"innovia:master","ref":"master","sha":"f6892ee9c1342204248fc0fab2261468cbf5d8c8","user":{"login":"innovia","id":112025,"avatar_url":"https://avatars.githubusercontent.com/u/112025?v=3","gravatar_id":"","url":"https://api.github.com/users/innovia","html_url":"https://github.com/innovia","followers_url":"https://api.github.com/users/innovia/followers","following_url":"https://api.github.com/users/innovia/following{/other_user}","gists_url":"https://api.github.com/users/innovia/gists{/gist_id}","starred_url":"https://api.github.com/users/innovia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innovia/subscriptions","organizations_url":"https://api.github.com/users/innovia/orgs","repos_url":"https://api.github.com/users/innovia/repos","events_url":"https://api.github.com/users/innovia/events{/privacy}","received_events_url":"https://api.github.com/users/innovia/received_events","type":"User","site_admin":false},"repo":{"id":61481262,"name":"training-exercise","full_name":"innovia/training-exercise","owner":{"login":"innovia","id":112025,"avatar_url":"https://avatars.githubusercontent.com/u/112025?v=3","gravatar_id":"","url":"https://api.github.com/users/innovia","html_url":"https://github.com/innovia","followers_url":"https://api.github.com/users/innovia/followers","following_url":"https://api.github.com/users/innovia/following{/other_user}","gists_url":"https://api.github.com/users/innovia/gists{/gist_id}","starred_url":"https://api.github.com/users/innovia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/innovia/subscriptions","organizations_url":"https://api.github.com/users/innovia/orgs","repos_url":"https://api.github.com/users/innovia/repos","events_url":"https://api.github.com/users/innovia/events{/privacy}","received_events_url":"https://api.github.com/users/innovia/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/innovia/training-exercise","description":"","fork":false,"url":"https://api.github.com/repos/innovia/training-exercise","forks_url":"https://api.github.com/repos/innovia/training-exercise/forks","keys_url":"https://api.github.com/repos/innovia/training-exercise/keys{/key_id}","collaborators_url":"https://api.github.com/repos/innovia/training-exercise/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/innovia/training-exercise/teams","hooks_url":"https://api.github.com/repos/innovia/training-exercise/hooks","issue_events_url":"https://api.github.com/repos/innovia/training-exercise/issues/events{/number}","events_url":"https://api.github.com/repos/innovia/training-exercise/events","assignees_url":"https://api.github.com/repos/innovia/training-exercise/assignees{/user}","branches_url":"https://api.github.com/repos/innovia/training-exercise/branches{/branch}","tags_url":"https://api.github.com/repos/innovia/training-exercise/tags","blobs_url":"https://api.github.com/repos/innovia/training-exercise/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/innovia/training-exercise/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/innovia/training-exercise/git/refs{/sha}","trees_url":"https://api.github.com/repos/innovia/training-exercise/git/trees{/sha}","statuses_url":"https://api.github.com/repos/innovia/training-exercise/statuses/{sha}","languages_url":"https://api.github.com/repos/innovia/training-exercise/languages","stargazers_url":"https://api.github.com/repos/innovia/training-exercise/stargazers","contributors_url":"https://api.github.com/repos/innovia/training-exercise/contributors","subscribers_url":"https://api.github.com/repos/innovia/training-exercise/subscribers","subscription_url":"https://api.github.com/repos/innovia/training-exercise/subscription","commits_url":"https://api.github.com/repos/innovia/training-exercise/commits{/sha}","git_commits_url":"https://api.github.com/repos/innovia/training-exercise/git/commits{/sha}","comments_url":"https://api.github.com/repos/innovia/training-exercise/comments{/number}","issue_comment_url":"https://api.github.com/repos/innovia/training-exercise/issues/comments{/number}","contents_url":"https://api.github.com/repos/innovia/training-exercise/contents/{+path}","compare_url":"https://api.github.com/repos/innovia/training-exercise/compare/{base}...{head}","merges_url":"https://api.github.com/repos/innovia/training-exercise/merges","archive_url":"https://api.github.com/repos/innovia/training-exercise/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/innovia/training-exercise/downloads","issues_url":"https://api.github.com/repos/innovia/training-exercise/issues{/number}","pulls_url":"https://api.github.com/repos/innovia/training-exercise/pulls{/number}","milestones_url":"https://api.github.com/repos/innovia/training-exercise/milestones{/number}","notifications_url":"https://api.github.com/repos/innovia/training-exercise/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/innovia/training-exercise/labels{/name}","releases_url":"https://api.github.com/repos/innovia/training-exercise/releases{/id}","deployments_url":"https://api.github.com/repos/innovia/training-exercise/deployments","created_at":"2016-06-19T13:21:38Z","updated_at":"2016-06-20T12:42:49Z","pushed_at":"2016-07-04T12:39:47Z","git_url":"git://github.com/innovia/training-exercise.git","ssh_url":"git@github.com:innovia/training-exercise.git","clone_url":"https://github.com/innovia/training-exercise.git","svn_url":"https://github.com/innovia/training-exercise","homepage":null,"size":290,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/innovia/training-exercise/pulls/11"},"html":{"href":"https://github.com/innovia/training-exercise/pull/11"},"issue":{"href":"https://api.github.com/repos/innovia/training-exercise/issues/11"},"comments":{"href":"https://api.github.com/repos/innovia/training-exercise/issues/11/comments"},"review_comments":{"href":"https://api.github.com/repos/innovia/training-exercise/pulls/11/comments"},"review_comment":{"href":"https://api.github.com/repos/innovia/training-exercise/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/innovia/training-exercise/pulls/11/commits"},"statuses":{"href":"https://api.github.com/repos/innovia/training-exercise/statuses/5429f97b041c7402b7a5c83cf6b2890304aeab4d"}}}}
{"actor":{"display_login":"boarik"}}