{"action":"created","comment":{"url":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments/289333118","pull_request_review_id":244233325,"id":289333118,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI4OTMzMzExOA==","diff_hunk":"@@ -215,6 +216,39 @@ def is_ignored(filename, ignore_globs=None):\n             return True\n     return False\n \n+def ignore_patterns(exclude=None, include=None, max_file_size=None, log=None):\n+    \"\"\"\n+    A generalization of shutils.ignore_patterns that supports\n+    include globs, exclude globs, and max file size (in kb).\n+    Optionally, it logs ignored files.\n+\n+    As shutils.ignore_patterns, it returns a function taking\n+    a directory and list of file/directory names and returning the\n+    list of files/directories to be ignored.\n+\n+    A file/directory is ignored as soon as it is either excluded, or\n+    not included explicitely, or too large.\n+    \"\"\"\n+    def ignore_patterns(directory, filelist):\n+        ignored = []\n+        for filename in filelist:\n+            rationale = None\n+            fullname = os.path.join(directory, filename)\n+            if exclude and any(fnmatch.fnmatch(filename, glob) for glob in exclude):\n+                rationale = \"excluded file\"\n+            else:\n+                if os.path.isfile(fullname):\n+                    if include and not any(fnmatch.fnmatch(filename, glob) for glob in include):\n+                        rationale = \"non included\"\n+                    elif max_file_size and os.path.getsize(fullname) > 1000*max_file_size:\n+                        rationale = \"file too large\"\n+            if rationale:\n+                if log:\n+                    log.warning(\"Ignoring {} {}\".format(rationale, fullfilename))","path":"nbgrader/utils.py","position":null,"original_position":40,"commit_id":"61ec6548fb900cba1c50fb74bf3b7a1e299ae1d6","original_commit_id":"6ed181b6eda4f6bf10638a2b257b8f0b555638dd","user":{"login":"nthiery","id":545328,"node_id":"MDQ6VXNlcjU0NTMyOA==","avatar_url":"https://avatars0.githubusercontent.com/u/545328?v=4","gravatar_id":"","url":"https://api.github.com/users/nthiery","html_url":"https://github.com/nthiery","followers_url":"https://api.github.com/users/nthiery/followers","following_url":"https://api.github.com/users/nthiery/following{/other_user}","gists_url":"https://api.github.com/users/nthiery/gists{/gist_id}","starred_url":"https://api.github.com/users/nthiery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nthiery/subscriptions","organizations_url":"https://api.github.com/users/nthiery/orgs","repos_url":"https://api.github.com/users/nthiery/repos","events_url":"https://api.github.com/users/nthiery/events{/privacy}","received_events_url":"https://api.github.com/users/nthiery/received_events","type":"User","site_admin":false},"body":"Done","created_at":"2019-05-31T10:12:12Z","updated_at":"2019-05-31T10:12:12Z","html_url":"https://github.com/jupyter/nbgrader/pull/1108#discussion_r289333118","pull_request_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments/289333118"},"html":{"href":"https://github.com/jupyter/nbgrader/pull/1108#discussion_r289333118"},"pull_request":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108"}},"in_reply_to_id":289303841},"pull_request":{"url":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108","id":283849101,"node_id":"MDExOlB1bGxSZXF1ZXN0MjgzODQ5MTAx","html_url":"https://github.com/jupyter/nbgrader/pull/1108","diff_url":"https://github.com/jupyter/nbgrader/pull/1108.diff","patch_url":"https://github.com/jupyter/nbgrader/pull/1108.patch","issue_url":"https://api.github.com/repos/jupyter/nbgrader/issues/1108","number":1108,"state":"open","locked":false,"title":"Extended support for filtering files copied in the exchange","user":{"login":"nthiery","id":545328,"node_id":"MDQ6VXNlcjU0NTMyOA==","avatar_url":"https://avatars0.githubusercontent.com/u/545328?v=4","gravatar_id":"","url":"https://api.github.com/users/nthiery","html_url":"https://github.com/nthiery","followers_url":"https://api.github.com/users/nthiery/followers","following_url":"https://api.github.com/users/nthiery/following{/other_user}","gists_url":"https://api.github.com/users/nthiery/gists{/gist_id}","starred_url":"https://api.github.com/users/nthiery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nthiery/subscriptions","organizations_url":"https://api.github.com/users/nthiery/orgs","repos_url":"https://api.github.com/users/nthiery/repos","events_url":"https://api.github.com/users/nthiery/events{/privacy}","received_events_url":"https://api.github.com/users/nthiery/received_events","type":"User","site_admin":false},"body":"- ignore too large files\r\n- ignore non explicitly included files\r\n\r\nResolves #874.","created_at":"2019-05-30T23:38:42Z","updated_at":"2019-05-31T10:12:12Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f44f77d4e17c869472884a3cc4c23ff4e9d6df0","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1358563575,"node_id":"MDU6TGFiZWwxMzU4NTYzNTc1","url":"https://api.github.com/repos/jupyter/nbgrader/labels/Edinburgh-Hackathon","name":"Edinburgh-Hackathon","color":"000000","default":false},{"id":129124230,"node_id":"MDU6TGFiZWwxMjkxMjQyMzA=","url":"https://api.github.com/repos/jupyter/nbgrader/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"milestone":{"url":"https://api.github.com/repos/jupyter/nbgrader/milestones/15","html_url":"https://github.com/jupyter/nbgrader/milestone/15","labels_url":"https://api.github.com/repos/jupyter/nbgrader/milestones/15/labels","id":2551407,"node_id":"MDk6TWlsZXN0b25lMjU1MTQwNw==","number":15,"title":"0.6.0","description":"","creator":{"login":"jhamrick","id":83444,"node_id":"MDQ6VXNlcjgzNDQ0","avatar_url":"https://avatars0.githubusercontent.com/u/83444?v=4","gravatar_id":"","url":"https://api.github.com/users/jhamrick","html_url":"https://github.com/jhamrick","followers_url":"https://api.github.com/users/jhamrick/followers","following_url":"https://api.github.com/users/jhamrick/following{/other_user}","gists_url":"https://api.github.com/users/jhamrick/gists{/gist_id}","starred_url":"https://api.github.com/users/jhamrick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhamrick/subscriptions","organizations_url":"https://api.github.com/users/jhamrick/orgs","repos_url":"https://api.github.com/users/jhamrick/repos","events_url":"https://api.github.com/users/jhamrick/events{/privacy}","received_events_url":"https://api.github.com/users/jhamrick/received_events","type":"User","site_admin":false},"open_issues":34,"closed_issues":111,"state":"open","created_at":"2017-05-30T19:31:36Z","updated_at":"2019-05-31T09:24:40Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108/commits","review_comments_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108/comments","review_comment_url":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jupyter/nbgrader/issues/1108/comments","statuses_url":"https://api.github.com/repos/jupyter/nbgrader/statuses/61ec6548fb900cba1c50fb74bf3b7a1e299ae1d6","head":{"label":"nthiery:filter-file-submissions","ref":"filter-file-submissions","sha":"61ec6548fb900cba1c50fb74bf3b7a1e299ae1d6","user":{"login":"nthiery","id":545328,"node_id":"MDQ6VXNlcjU0NTMyOA==","avatar_url":"https://avatars0.githubusercontent.com/u/545328?v=4","gravatar_id":"","url":"https://api.github.com/users/nthiery","html_url":"https://github.com/nthiery","followers_url":"https://api.github.com/users/nthiery/followers","following_url":"https://api.github.com/users/nthiery/following{/other_user}","gists_url":"https://api.github.com/users/nthiery/gists{/gist_id}","starred_url":"https://api.github.com/users/nthiery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nthiery/subscriptions","organizations_url":"https://api.github.com/users/nthiery/orgs","repos_url":"https://api.github.com/users/nthiery/repos","events_url":"https://api.github.com/users/nthiery/events{/privacy}","received_events_url":"https://api.github.com/users/nthiery/received_events","type":"User","site_admin":false},"repo":{"id":189256795,"node_id":"MDEwOlJlcG9zaXRvcnkxODkyNTY3OTU=","name":"nbgrader","full_name":"nthiery/nbgrader","private":false,"owner":{"login":"nthiery","id":545328,"node_id":"MDQ6VXNlcjU0NTMyOA==","avatar_url":"https://avatars0.githubusercontent.com/u/545328?v=4","gravatar_id":"","url":"https://api.github.com/users/nthiery","html_url":"https://github.com/nthiery","followers_url":"https://api.github.com/users/nthiery/followers","following_url":"https://api.github.com/users/nthiery/following{/other_user}","gists_url":"https://api.github.com/users/nthiery/gists{/gist_id}","starred_url":"https://api.github.com/users/nthiery/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nthiery/subscriptions","organizations_url":"https://api.github.com/users/nthiery/orgs","repos_url":"https://api.github.com/users/nthiery/repos","events_url":"https://api.github.com/users/nthiery/events{/privacy}","received_events_url":"https://api.github.com/users/nthiery/received_events","type":"User","site_admin":false},"html_url":"https://github.com/nthiery/nbgrader","description":"A system for assigning and grading notebooks","fork":true,"url":"https://api.github.com/repos/nthiery/nbgrader","forks_url":"https://api.github.com/repos/nthiery/nbgrader/forks","keys_url":"https://api.github.com/repos/nthiery/nbgrader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nthiery/nbgrader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nthiery/nbgrader/teams","hooks_url":"https://api.github.com/repos/nthiery/nbgrader/hooks","issue_events_url":"https://api.github.com/repos/nthiery/nbgrader/issues/events{/number}","events_url":"https://api.github.com/repos/nthiery/nbgrader/events","assignees_url":"https://api.github.com/repos/nthiery/nbgrader/assignees{/user}","branches_url":"https://api.github.com/repos/nthiery/nbgrader/branches{/branch}","tags_url":"https://api.github.com/repos/nthiery/nbgrader/tags","blobs_url":"https://api.github.com/repos/nthiery/nbgrader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nthiery/nbgrader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nthiery/nbgrader/git/refs{/sha}","trees_url":"https://api.github.com/repos/nthiery/nbgrader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nthiery/nbgrader/statuses/{sha}","languages_url":"https://api.github.com/repos/nthiery/nbgrader/languages","stargazers_url":"https://api.github.com/repos/nthiery/nbgrader/stargazers","contributors_url":"https://api.github.com/repos/nthiery/nbgrader/contributors","subscribers_url":"https://api.github.com/repos/nthiery/nbgrader/subscribers","subscription_url":"https://api.github.com/repos/nthiery/nbgrader/subscription","commits_url":"https://api.github.com/repos/nthiery/nbgrader/commits{/sha}","git_commits_url":"https://api.github.com/repos/nthiery/nbgrader/git/commits{/sha}","comments_url":"https://api.github.com/repos/nthiery/nbgrader/comments{/number}","issue_comment_url":"https://api.github.com/repos/nthiery/nbgrader/issues/comments{/number}","contents_url":"https://api.github.com/repos/nthiery/nbgrader/contents/{+path}","compare_url":"https://api.github.com/repos/nthiery/nbgrader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nthiery/nbgrader/merges","archive_url":"https://api.github.com/repos/nthiery/nbgrader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nthiery/nbgrader/downloads","issues_url":"https://api.github.com/repos/nthiery/nbgrader/issues{/number}","pulls_url":"https://api.github.com/repos/nthiery/nbgrader/pulls{/number}","milestones_url":"https://api.github.com/repos/nthiery/nbgrader/milestones{/number}","notifications_url":"https://api.github.com/repos/nthiery/nbgrader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nthiery/nbgrader/labels{/name}","releases_url":"https://api.github.com/repos/nthiery/nbgrader/releases{/id}","deployments_url":"https://api.github.com/repos/nthiery/nbgrader/deployments","created_at":"2019-05-29T15:56:57Z","updated_at":"2019-05-29T15:57:01Z","pushed_at":"2019-05-31T10:09:15Z","git_url":"git://github.com/nthiery/nbgrader.git","ssh_url":"git@github.com:nthiery/nbgrader.git","clone_url":"https://github.com/nthiery/nbgrader.git","svn_url":"https://github.com/nthiery/nbgrader","homepage":"https://nbgrader.readthedocs.io/","size":16603,"stargazers_count":0,"watchers_count":0,"language":"HTML","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"jupyter:master","ref":"master","sha":"5df907ea4f35f8639c91ffd5f7280ce1046a8001","user":{"login":"jupyter","id":7388996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjczODg5OTY=","avatar_url":"https://avatars1.githubusercontent.com/u/7388996?v=4","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"repo":{"id":23984796,"node_id":"MDEwOlJlcG9zaXRvcnkyMzk4NDc5Ng==","name":"nbgrader","full_name":"jupyter/nbgrader","private":false,"owner":{"login":"jupyter","id":7388996,"node_id":"MDEyOk9yZ2FuaXphdGlvbjczODg5OTY=","avatar_url":"https://avatars1.githubusercontent.com/u/7388996?v=4","gravatar_id":"","url":"https://api.github.com/users/jupyter","html_url":"https://github.com/jupyter","followers_url":"https://api.github.com/users/jupyter/followers","following_url":"https://api.github.com/users/jupyter/following{/other_user}","gists_url":"https://api.github.com/users/jupyter/gists{/gist_id}","starred_url":"https://api.github.com/users/jupyter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jupyter/subscriptions","organizations_url":"https://api.github.com/users/jupyter/orgs","repos_url":"https://api.github.com/users/jupyter/repos","events_url":"https://api.github.com/users/jupyter/events{/privacy}","received_events_url":"https://api.github.com/users/jupyter/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/jupyter/nbgrader","description":"A system for assigning and grading notebooks","fork":false,"url":"https://api.github.com/repos/jupyter/nbgrader","forks_url":"https://api.github.com/repos/jupyter/nbgrader/forks","keys_url":"https://api.github.com/repos/jupyter/nbgrader/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jupyter/nbgrader/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jupyter/nbgrader/teams","hooks_url":"https://api.github.com/repos/jupyter/nbgrader/hooks","issue_events_url":"https://api.github.com/repos/jupyter/nbgrader/issues/events{/number}","events_url":"https://api.github.com/repos/jupyter/nbgrader/events","assignees_url":"https://api.github.com/repos/jupyter/nbgrader/assignees{/user}","branches_url":"https://api.github.com/repos/jupyter/nbgrader/branches{/branch}","tags_url":"https://api.github.com/repos/jupyter/nbgrader/tags","blobs_url":"https://api.github.com/repos/jupyter/nbgrader/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jupyter/nbgrader/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jupyter/nbgrader/git/refs{/sha}","trees_url":"https://api.github.com/repos/jupyter/nbgrader/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jupyter/nbgrader/statuses/{sha}","languages_url":"https://api.github.com/repos/jupyter/nbgrader/languages","stargazers_url":"https://api.github.com/repos/jupyter/nbgrader/stargazers","contributors_url":"https://api.github.com/repos/jupyter/nbgrader/contributors","subscribers_url":"https://api.github.com/repos/jupyter/nbgrader/subscribers","subscription_url":"https://api.github.com/repos/jupyter/nbgrader/subscription","commits_url":"https://api.github.com/repos/jupyter/nbgrader/commits{/sha}","git_commits_url":"https://api.github.com/repos/jupyter/nbgrader/git/commits{/sha}","comments_url":"https://api.github.com/repos/jupyter/nbgrader/comments{/number}","issue_comment_url":"https://api.github.com/repos/jupyter/nbgrader/issues/comments{/number}","contents_url":"https://api.github.com/repos/jupyter/nbgrader/contents/{+path}","compare_url":"https://api.github.com/repos/jupyter/nbgrader/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jupyter/nbgrader/merges","archive_url":"https://api.github.com/repos/jupyter/nbgrader/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jupyter/nbgrader/downloads","issues_url":"https://api.github.com/repos/jupyter/nbgrader/issues{/number}","pulls_url":"https://api.github.com/repos/jupyter/nbgrader/pulls{/number}","milestones_url":"https://api.github.com/repos/jupyter/nbgrader/milestones{/number}","notifications_url":"https://api.github.com/repos/jupyter/nbgrader/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jupyter/nbgrader/labels{/name}","releases_url":"https://api.github.com/repos/jupyter/nbgrader/releases{/id}","deployments_url":"https://api.github.com/repos/jupyter/nbgrader/deployments","created_at":"2014-09-13T03:27:36Z","updated_at":"2019-05-31T09:01:39Z","pushed_at":"2019-05-31T10:09:17Z","git_url":"git://github.com/jupyter/nbgrader.git","ssh_url":"git@github.com:jupyter/nbgrader.git","clone_url":"https://github.com/jupyter/nbgrader.git","svn_url":"https://github.com/jupyter/nbgrader","homepage":"https://nbgrader.readthedocs.io/","size":16650,"stargazers_count":724,"watchers_count":724,"language":"HTML","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":193,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":107,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":193,"open_issues":107,"watchers":724,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108"},"html":{"href":"https://github.com/jupyter/nbgrader/pull/1108"},"issue":{"href":"https://api.github.com/repos/jupyter/nbgrader/issues/1108"},"comments":{"href":"https://api.github.com/repos/jupyter/nbgrader/issues/1108/comments"},"review_comments":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108/comments"},"review_comment":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jupyter/nbgrader/pulls/1108/commits"},"statuses":{"href":"https://api.github.com/repos/jupyter/nbgrader/statuses/61ec6548fb900cba1c50fb74bf3b7a1e299ae1d6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"nthiery"}}