{"action":"created","comment":{"url":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/comments/27727945","id":27727945,"diff_hunk":"@@ -290,6 +290,15 @@ it. This is a mandatory method call::\n    problematic and non-deterministic. An explicit ``close()`` is now\n    recommended in all XlsxWriter programs.\n \n+It is possible to use ``with`` statement to control your workbook lifetime like this::\n+\n+    with xlsxwriter.Workbook('test.xlsx') as workbook:\n+        worksheet = workbook.add_worksheet()\n+        ...\n+\n+The workbook will automatically close when exiting ``with`` statement scope.","path":"dev/docs/source/workbook.rst","position":10,"original_position":10,"commit_id":"a0d06b5ad68c0c46d11b71ff162642a0006b16ed","original_commit_id":"a0d06b5ad68c0c46d11b71ff162642a0006b16ed","user":{"login":"jmcnamara","id":94267,"avatar_url":"https://avatars.githubusercontent.com/u/94267?v=3","gravatar_id":"","url":"https://api.github.com/users/jmcnamara","html_url":"https://github.com/jmcnamara","followers_url":"https://api.github.com/users/jmcnamara/followers","following_url":"https://api.github.com/users/jmcnamara/following{/other_user}","gists_url":"https://api.github.com/users/jmcnamara/gists{/gist_id}","starred_url":"https://api.github.com/users/jmcnamara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmcnamara/subscriptions","organizations_url":"https://api.github.com/users/jmcnamara/orgs","repos_url":"https://api.github.com/users/jmcnamara/repos","events_url":"https://api.github.com/users/jmcnamara/events{/privacy}","received_events_url":"https://api.github.com/users/jmcnamara/received_events","type":"User","site_admin":false},"body":"Change to:\r\n\r\nThe workbook will automatically close when exiting the scope of the ``with`` statement. ","created_at":"2015-04-03T12:59:26Z","updated_at":"2015-04-03T12:59:26Z","html_url":"https://github.com/jmcnamara/XlsxWriter/pull/239#discussion_r27727945","pull_request_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239","_links":{"self":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/comments/27727945"},"html":{"href":"https://github.com/jmcnamara/XlsxWriter/pull/239#discussion_r27727945"},"pull_request":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239"}}},"pull_request":{"url":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239","id":32585679,"html_url":"https://github.com/jmcnamara/XlsxWriter/pull/239","diff_url":"https://github.com/jmcnamara/XlsxWriter/pull/239.diff","patch_url":"https://github.com/jmcnamara/XlsxWriter/pull/239.patch","issue_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/239","number":239,"state":"open","locked":false,"title":"Add 'with' statement support","user":{"login":"jollyroger","id":96645,"avatar_url":"https://avatars.githubusercontent.com/u/96645?v=3","gravatar_id":"","url":"https://api.github.com/users/jollyroger","html_url":"https://github.com/jollyroger","followers_url":"https://api.github.com/users/jollyroger/followers","following_url":"https://api.github.com/users/jollyroger/following{/other_user}","gists_url":"https://api.github.com/users/jollyroger/gists{/gist_id}","starred_url":"https://api.github.com/users/jollyroger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jollyroger/subscriptions","organizations_url":"https://api.github.com/users/jollyroger/orgs","repos_url":"https://api.github.com/users/jollyroger/repos","events_url":"https://api.github.com/users/jollyroger/events{/privacy}","received_events_url":"https://api.github.com/users/jollyroger/received_events","type":"User","site_admin":false},"body":"This allows you to use 'with' statement for your workbook like this:\r\n\r\n    with xlsxwriter.Workbook('test.xlsx') as workbook:\r\n        worksheet = workbook.add_worksheet()\r\n        ...\r\n\r\nThe workbook will automatically close when exiting \"with\" statement scope.","created_at":"2015-04-03T12:19:05Z","updated_at":"2015-04-03T12:59:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8349a9ca8b9d05c9b4ddd421baf1333818a4a5c1","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239/commits","review_comments_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239/comments","review_comment_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/comments{/number}","comments_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/239/comments","statuses_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/statuses/a0d06b5ad68c0c46d11b71ff162642a0006b16ed","head":{"label":"jollyroger:enter_exit","ref":"enter_exit","sha":"a0d06b5ad68c0c46d11b71ff162642a0006b16ed","user":{"login":"jollyroger","id":96645,"avatar_url":"https://avatars.githubusercontent.com/u/96645?v=3","gravatar_id":"","url":"https://api.github.com/users/jollyroger","html_url":"https://github.com/jollyroger","followers_url":"https://api.github.com/users/jollyroger/followers","following_url":"https://api.github.com/users/jollyroger/following{/other_user}","gists_url":"https://api.github.com/users/jollyroger/gists{/gist_id}","starred_url":"https://api.github.com/users/jollyroger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jollyroger/subscriptions","organizations_url":"https://api.github.com/users/jollyroger/orgs","repos_url":"https://api.github.com/users/jollyroger/repos","events_url":"https://api.github.com/users/jollyroger/events{/privacy}","received_events_url":"https://api.github.com/users/jollyroger/received_events","type":"User","site_admin":false},"repo":{"id":33360904,"name":"XlsxWriter","full_name":"jollyroger/XlsxWriter","owner":{"login":"jollyroger","id":96645,"avatar_url":"https://avatars.githubusercontent.com/u/96645?v=3","gravatar_id":"","url":"https://api.github.com/users/jollyroger","html_url":"https://github.com/jollyroger","followers_url":"https://api.github.com/users/jollyroger/followers","following_url":"https://api.github.com/users/jollyroger/following{/other_user}","gists_url":"https://api.github.com/users/jollyroger/gists{/gist_id}","starred_url":"https://api.github.com/users/jollyroger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jollyroger/subscriptions","organizations_url":"https://api.github.com/users/jollyroger/orgs","repos_url":"https://api.github.com/users/jollyroger/repos","events_url":"https://api.github.com/users/jollyroger/events{/privacy}","received_events_url":"https://api.github.com/users/jollyroger/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jollyroger/XlsxWriter","description":"A Python module for creating Excel XLSX files.","fork":true,"url":"https://api.github.com/repos/jollyroger/XlsxWriter","forks_url":"https://api.github.com/repos/jollyroger/XlsxWriter/forks","keys_url":"https://api.github.com/repos/jollyroger/XlsxWriter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jollyroger/XlsxWriter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jollyroger/XlsxWriter/teams","hooks_url":"https://api.github.com/repos/jollyroger/XlsxWriter/hooks","issue_events_url":"https://api.github.com/repos/jollyroger/XlsxWriter/issues/events{/number}","events_url":"https://api.github.com/repos/jollyroger/XlsxWriter/events","assignees_url":"https://api.github.com/repos/jollyroger/XlsxWriter/assignees{/user}","branches_url":"https://api.github.com/repos/jollyroger/XlsxWriter/branches{/branch}","tags_url":"https://api.github.com/repos/jollyroger/XlsxWriter/tags","blobs_url":"https://api.github.com/repos/jollyroger/XlsxWriter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jollyroger/XlsxWriter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jollyroger/XlsxWriter/git/refs{/sha}","trees_url":"https://api.github.com/repos/jollyroger/XlsxWriter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jollyroger/XlsxWriter/statuses/{sha}","languages_url":"https://api.github.com/repos/jollyroger/XlsxWriter/languages","stargazers_url":"https://api.github.com/repos/jollyroger/XlsxWriter/stargazers","contributors_url":"https://api.github.com/repos/jollyroger/XlsxWriter/contributors","subscribers_url":"https://api.github.com/repos/jollyroger/XlsxWriter/subscribers","subscription_url":"https://api.github.com/repos/jollyroger/XlsxWriter/subscription","commits_url":"https://api.github.com/repos/jollyroger/XlsxWriter/commits{/sha}","git_commits_url":"https://api.github.com/repos/jollyroger/XlsxWriter/git/commits{/sha}","comments_url":"https://api.github.com/repos/jollyroger/XlsxWriter/comments{/number}","issue_comment_url":"https://api.github.com/repos/jollyroger/XlsxWriter/issues/comments{/number}","contents_url":"https://api.github.com/repos/jollyroger/XlsxWriter/contents/{+path}","compare_url":"https://api.github.com/repos/jollyroger/XlsxWriter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jollyroger/XlsxWriter/merges","archive_url":"https://api.github.com/repos/jollyroger/XlsxWriter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jollyroger/XlsxWriter/downloads","issues_url":"https://api.github.com/repos/jollyroger/XlsxWriter/issues{/number}","pulls_url":"https://api.github.com/repos/jollyroger/XlsxWriter/pulls{/number}","milestones_url":"https://api.github.com/repos/jollyroger/XlsxWriter/milestones{/number}","notifications_url":"https://api.github.com/repos/jollyroger/XlsxWriter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jollyroger/XlsxWriter/labels{/name}","releases_url":"https://api.github.com/repos/jollyroger/XlsxWriter/releases{/id}","created_at":"2015-04-03T11:46:51Z","updated_at":"2015-04-03T11:46:54Z","pushed_at":"2015-04-03T12:17:52Z","git_url":"git://github.com/jollyroger/XlsxWriter.git","ssh_url":"git@github.com:jollyroger/XlsxWriter.git","clone_url":"https://github.com/jollyroger/XlsxWriter.git","svn_url":"https://github.com/jollyroger/XlsxWriter","homepage":"https://xlsxwriter.readthedocs.org/","size":78522,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"jmcnamara:master","ref":"master","sha":"0ab9bdded4f750246c41a439f6a6cecaf9179030","user":{"login":"jmcnamara","id":94267,"avatar_url":"https://avatars.githubusercontent.com/u/94267?v=3","gravatar_id":"","url":"https://api.github.com/users/jmcnamara","html_url":"https://github.com/jmcnamara","followers_url":"https://api.github.com/users/jmcnamara/followers","following_url":"https://api.github.com/users/jmcnamara/following{/other_user}","gists_url":"https://api.github.com/users/jmcnamara/gists{/gist_id}","starred_url":"https://api.github.com/users/jmcnamara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmcnamara/subscriptions","organizations_url":"https://api.github.com/users/jmcnamara/orgs","repos_url":"https://api.github.com/users/jmcnamara/repos","events_url":"https://api.github.com/users/jmcnamara/events{/privacy}","received_events_url":"https://api.github.com/users/jmcnamara/received_events","type":"User","site_admin":false},"repo":{"id":7433211,"name":"XlsxWriter","full_name":"jmcnamara/XlsxWriter","owner":{"login":"jmcnamara","id":94267,"avatar_url":"https://avatars.githubusercontent.com/u/94267?v=3","gravatar_id":"","url":"https://api.github.com/users/jmcnamara","html_url":"https://github.com/jmcnamara","followers_url":"https://api.github.com/users/jmcnamara/followers","following_url":"https://api.github.com/users/jmcnamara/following{/other_user}","gists_url":"https://api.github.com/users/jmcnamara/gists{/gist_id}","starred_url":"https://api.github.com/users/jmcnamara/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmcnamara/subscriptions","organizations_url":"https://api.github.com/users/jmcnamara/orgs","repos_url":"https://api.github.com/users/jmcnamara/repos","events_url":"https://api.github.com/users/jmcnamara/events{/privacy}","received_events_url":"https://api.github.com/users/jmcnamara/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jmcnamara/XlsxWriter","description":"A Python module for creating Excel XLSX files.","fork":false,"url":"https://api.github.com/repos/jmcnamara/XlsxWriter","forks_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/forks","keys_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/teams","hooks_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/hooks","issue_events_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/events{/number}","events_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/events","assignees_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/assignees{/user}","branches_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/branches{/branch}","tags_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/tags","blobs_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/git/refs{/sha}","trees_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/statuses/{sha}","languages_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/languages","stargazers_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/stargazers","contributors_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/contributors","subscribers_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/subscribers","subscription_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/subscription","commits_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/commits{/sha}","git_commits_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/git/commits{/sha}","comments_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/comments{/number}","issue_comment_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/comments{/number}","contents_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/contents/{+path}","compare_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/merges","archive_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/downloads","issues_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues{/number}","pulls_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls{/number}","milestones_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/milestones{/number}","notifications_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/labels{/name}","releases_url":"https://api.github.com/repos/jmcnamara/XlsxWriter/releases{/id}","created_at":"2013-01-04T01:07:06Z","updated_at":"2015-04-03T01:01:13Z","pushed_at":"2015-04-03T12:19:07Z","git_url":"git://github.com/jmcnamara/XlsxWriter.git","ssh_url":"git@github.com:jmcnamara/XlsxWriter.git","clone_url":"https://github.com/jmcnamara/XlsxWriter.git","svn_url":"https://github.com/jmcnamara/XlsxWriter","homepage":"https://xlsxwriter.readthedocs.org/","size":78522,"stargazers_count":380,"watchers_count":380,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":93,"mirror_url":null,"open_issues_count":16,"forks":93,"open_issues":16,"watchers":380,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239"},"html":{"href":"https://github.com/jmcnamara/XlsxWriter/pull/239"},"issue":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/239"},"comments":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/issues/239/comments"},"review_comments":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239/comments"},"review_comment":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/pulls/239/commits"},"statuses":{"href":"https://api.github.com/repos/jmcnamara/XlsxWriter/statuses/a0d06b5ad68c0c46d11b71ff162642a0006b16ed"}}}}