{"action":"created","comment":{"url":"https://api.github.com/repos/python-zk/kazoo/pulls/comments/24719414","id":24719414,"diff_hunk":"@@ -106,6 +120,7 @@ def acquire(self, blocking=True, timeout=None):\n         .. versionadded:: 1.1\n             The timeout option.\n         \"\"\"\n+        blocking = self.blocking if blocking else blocking","path":"kazoo/recipe/lock.py","position":57,"original_position":57,"commit_id":"83fe00116e4ad73d0800b5eaf590b30616bbfa6d","original_commit_id":"83fe00116e4ad73d0800b5eaf590b30616bbfa6d","user":{"login":"harlowja","id":970458,"avatar_url":"https://avatars.githubusercontent.com/u/970458?v=3","gravatar_id":"","url":"https://api.github.com/users/harlowja","html_url":"https://github.com/harlowja","followers_url":"https://api.github.com/users/harlowja/followers","following_url":"https://api.github.com/users/harlowja/following{/other_user}","gists_url":"https://api.github.com/users/harlowja/gists{/gist_id}","starred_url":"https://api.github.com/users/harlowja/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/harlowja/subscriptions","organizations_url":"https://api.github.com/users/harlowja/orgs","repos_url":"https://api.github.com/users/harlowja/repos","events_url":"https://api.github.com/users/harlowja/events{/privacy}","received_events_url":"https://api.github.com/users/harlowja/received_events","type":"User","site_admin":false},"body":"I agree; I'd rather have this blocking take precedence over the instance one.\r\n\r\nOtherwise it just seems confusing; maybe have ``blocking is None`` then use the instance one?","created_at":"2015-02-15T03:35:36Z","updated_at":"2015-02-15T03:35:36Z","html_url":"https://github.com/python-zk/kazoo/pull/242#discussion_r24719414","pull_request_url":"https://api.github.com/repos/python-zk/kazoo/pulls/242","_links":{"self":{"href":"https://api.github.com/repos/python-zk/kazoo/pulls/comments/24719414"},"html":{"href":"https://github.com/python-zk/kazoo/pull/242#discussion_r24719414"},"pull_request":{"href":"https://api.github.com/repos/python-zk/kazoo/pulls/242"}}},"pull_request":{"url":"https://api.github.com/repos/python-zk/kazoo/pulls/242","id":20768404,"html_url":"https://github.com/python-zk/kazoo/pull/242","diff_url":"https://github.com/python-zk/kazoo/pull/242.diff","patch_url":"https://github.com/python-zk/kazoo/pull/242.patch","issue_url":"https://api.github.com/repos/python-zk/kazoo/issues/242","number":242,"state":"open","locked":false,"title":"(#227) allow for usage of non-blocking locks inside with statements","user":{"login":"stevemer","id":6373253,"avatar_url":"https://avatars.githubusercontent.com/u/6373253?v=3","gravatar_id":"","url":"https://api.github.com/users/stevemer","html_url":"https://github.com/stevemer","followers_url":"https://api.github.com/users/stevemer/followers","following_url":"https://api.github.com/users/stevemer/following{/other_user}","gists_url":"https://api.github.com/users/stevemer/gists{/gist_id}","starred_url":"https://api.github.com/users/stevemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevemer/subscriptions","organizations_url":"https://api.github.com/users/stevemer/orgs","repos_url":"https://api.github.com/users/stevemer/repos","events_url":"https://api.github.com/users/stevemer/events{/privacy}","received_events_url":"https://api.github.com/users/stevemer/received_events","type":"User","site_admin":false},"body":" Introduce an optional argument to __init__ allowing for specification of blocking behavior at instantiation while maintaining backwards compatibility.\r\n\r\nThis allows for use of non-blocking Locks inside with statements.\r\n\r\n------------------------------------------------------\r\n```\r\nzk = KazooClient()\r\nwith zk.Lock(\"/lockpath\", \"my-identifier\", blocking=False) as lock:\r\n    if lock.is_acquired:\r\n        # do something\r\n```\r\n------------------------------------------------------\r\n","created_at":"2014-09-04T19:55:08Z","updated_at":"2015-02-15T03:35:36Z","closed_at":null,"merged_at":null,"merge_commit_sha":"40bbc9057ff6d29e11bf57fc0240dbab1ead92fc","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/python-zk/kazoo/pulls/242/commits","review_comments_url":"https://api.github.com/repos/python-zk/kazoo/pulls/242/comments","review_comment_url":"https://api.github.com/repos/python-zk/kazoo/pulls/comments/{number}","comments_url":"https://api.github.com/repos/python-zk/kazoo/issues/242/comments","statuses_url":"https://api.github.com/repos/python-zk/kazoo/statuses/83fe00116e4ad73d0800b5eaf590b30616bbfa6d","head":{"label":"stevemer:master","ref":"master","sha":"83fe00116e4ad73d0800b5eaf590b30616bbfa6d","user":{"login":"stevemer","id":6373253,"avatar_url":"https://avatars.githubusercontent.com/u/6373253?v=3","gravatar_id":"","url":"https://api.github.com/users/stevemer","html_url":"https://github.com/stevemer","followers_url":"https://api.github.com/users/stevemer/followers","following_url":"https://api.github.com/users/stevemer/following{/other_user}","gists_url":"https://api.github.com/users/stevemer/gists{/gist_id}","starred_url":"https://api.github.com/users/stevemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevemer/subscriptions","organizations_url":"https://api.github.com/users/stevemer/orgs","repos_url":"https://api.github.com/users/stevemer/repos","events_url":"https://api.github.com/users/stevemer/events{/privacy}","received_events_url":"https://api.github.com/users/stevemer/received_events","type":"User","site_admin":false},"repo":{"id":22701324,"name":"kazoo","full_name":"stevemer/kazoo","owner":{"login":"stevemer","id":6373253,"avatar_url":"https://avatars.githubusercontent.com/u/6373253?v=3","gravatar_id":"","url":"https://api.github.com/users/stevemer","html_url":"https://github.com/stevemer","followers_url":"https://api.github.com/users/stevemer/followers","following_url":"https://api.github.com/users/stevemer/following{/other_user}","gists_url":"https://api.github.com/users/stevemer/gists{/gist_id}","starred_url":"https://api.github.com/users/stevemer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevemer/subscriptions","organizations_url":"https://api.github.com/users/stevemer/orgs","repos_url":"https://api.github.com/users/stevemer/repos","events_url":"https://api.github.com/users/stevemer/events{/privacy}","received_events_url":"https://api.github.com/users/stevemer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/stevemer/kazoo","description":"Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.","fork":true,"url":"https://api.github.com/repos/stevemer/kazoo","forks_url":"https://api.github.com/repos/stevemer/kazoo/forks","keys_url":"https://api.github.com/repos/stevemer/kazoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/stevemer/kazoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/stevemer/kazoo/teams","hooks_url":"https://api.github.com/repos/stevemer/kazoo/hooks","issue_events_url":"https://api.github.com/repos/stevemer/kazoo/issues/events{/number}","events_url":"https://api.github.com/repos/stevemer/kazoo/events","assignees_url":"https://api.github.com/repos/stevemer/kazoo/assignees{/user}","branches_url":"https://api.github.com/repos/stevemer/kazoo/branches{/branch}","tags_url":"https://api.github.com/repos/stevemer/kazoo/tags","blobs_url":"https://api.github.com/repos/stevemer/kazoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/stevemer/kazoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/stevemer/kazoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/stevemer/kazoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/stevemer/kazoo/statuses/{sha}","languages_url":"https://api.github.com/repos/stevemer/kazoo/languages","stargazers_url":"https://api.github.com/repos/stevemer/kazoo/stargazers","contributors_url":"https://api.github.com/repos/stevemer/kazoo/contributors","subscribers_url":"https://api.github.com/repos/stevemer/kazoo/subscribers","subscription_url":"https://api.github.com/repos/stevemer/kazoo/subscription","commits_url":"https://api.github.com/repos/stevemer/kazoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/stevemer/kazoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/stevemer/kazoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/stevemer/kazoo/issues/comments/{number}","contents_url":"https://api.github.com/repos/stevemer/kazoo/contents/{+path}","compare_url":"https://api.github.com/repos/stevemer/kazoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/stevemer/kazoo/merges","archive_url":"https://api.github.com/repos/stevemer/kazoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/stevemer/kazoo/downloads","issues_url":"https://api.github.com/repos/stevemer/kazoo/issues{/number}","pulls_url":"https://api.github.com/repos/stevemer/kazoo/pulls{/number}","milestones_url":"https://api.github.com/repos/stevemer/kazoo/milestones{/number}","notifications_url":"https://api.github.com/repos/stevemer/kazoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/stevemer/kazoo/labels{/name}","releases_url":"https://api.github.com/repos/stevemer/kazoo/releases{/id}","created_at":"2014-08-06T23:14:34Z","updated_at":"2014-11-24T04:40:27Z","pushed_at":"2014-11-24T04:40:26Z","git_url":"git://github.com/stevemer/kazoo.git","ssh_url":"git@github.com:stevemer/kazoo.git","clone_url":"https://github.com/stevemer/kazoo.git","svn_url":"https://github.com/stevemer/kazoo","homepage":"https://kazoo.readthedocs.org","size":3485,"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":"python-zk:master","ref":"master","sha":"d14303acc1abda18756b0f35588a0e1bc1d2dea6","user":{"login":"python-zk","id":1731709,"avatar_url":"https://avatars.githubusercontent.com/u/1731709?v=3","gravatar_id":"","url":"https://api.github.com/users/python-zk","html_url":"https://github.com/python-zk","followers_url":"https://api.github.com/users/python-zk/followers","following_url":"https://api.github.com/users/python-zk/following{/other_user}","gists_url":"https://api.github.com/users/python-zk/gists{/gist_id}","starred_url":"https://api.github.com/users/python-zk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python-zk/subscriptions","organizations_url":"https://api.github.com/users/python-zk/orgs","repos_url":"https://api.github.com/users/python-zk/repos","events_url":"https://api.github.com/users/python-zk/events{/privacy}","received_events_url":"https://api.github.com/users/python-zk/received_events","type":"Organization","site_admin":false},"repo":{"id":4426689,"name":"kazoo","full_name":"python-zk/kazoo","owner":{"login":"python-zk","id":1731709,"avatar_url":"https://avatars.githubusercontent.com/u/1731709?v=3","gravatar_id":"","url":"https://api.github.com/users/python-zk","html_url":"https://github.com/python-zk","followers_url":"https://api.github.com/users/python-zk/followers","following_url":"https://api.github.com/users/python-zk/following{/other_user}","gists_url":"https://api.github.com/users/python-zk/gists{/gist_id}","starred_url":"https://api.github.com/users/python-zk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/python-zk/subscriptions","organizations_url":"https://api.github.com/users/python-zk/orgs","repos_url":"https://api.github.com/users/python-zk/repos","events_url":"https://api.github.com/users/python-zk/events{/privacy}","received_events_url":"https://api.github.com/users/python-zk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/python-zk/kazoo","description":"Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.","fork":false,"url":"https://api.github.com/repos/python-zk/kazoo","forks_url":"https://api.github.com/repos/python-zk/kazoo/forks","keys_url":"https://api.github.com/repos/python-zk/kazoo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/python-zk/kazoo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/python-zk/kazoo/teams","hooks_url":"https://api.github.com/repos/python-zk/kazoo/hooks","issue_events_url":"https://api.github.com/repos/python-zk/kazoo/issues/events{/number}","events_url":"https://api.github.com/repos/python-zk/kazoo/events","assignees_url":"https://api.github.com/repos/python-zk/kazoo/assignees{/user}","branches_url":"https://api.github.com/repos/python-zk/kazoo/branches{/branch}","tags_url":"https://api.github.com/repos/python-zk/kazoo/tags","blobs_url":"https://api.github.com/repos/python-zk/kazoo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/python-zk/kazoo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/python-zk/kazoo/git/refs{/sha}","trees_url":"https://api.github.com/repos/python-zk/kazoo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/python-zk/kazoo/statuses/{sha}","languages_url":"https://api.github.com/repos/python-zk/kazoo/languages","stargazers_url":"https://api.github.com/repos/python-zk/kazoo/stargazers","contributors_url":"https://api.github.com/repos/python-zk/kazoo/contributors","subscribers_url":"https://api.github.com/repos/python-zk/kazoo/subscribers","subscription_url":"https://api.github.com/repos/python-zk/kazoo/subscription","commits_url":"https://api.github.com/repos/python-zk/kazoo/commits{/sha}","git_commits_url":"https://api.github.com/repos/python-zk/kazoo/git/commits{/sha}","comments_url":"https://api.github.com/repos/python-zk/kazoo/comments{/number}","issue_comment_url":"https://api.github.com/repos/python-zk/kazoo/issues/comments/{number}","contents_url":"https://api.github.com/repos/python-zk/kazoo/contents/{+path}","compare_url":"https://api.github.com/repos/python-zk/kazoo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/python-zk/kazoo/merges","archive_url":"https://api.github.com/repos/python-zk/kazoo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/python-zk/kazoo/downloads","issues_url":"https://api.github.com/repos/python-zk/kazoo/issues{/number}","pulls_url":"https://api.github.com/repos/python-zk/kazoo/pulls{/number}","milestones_url":"https://api.github.com/repos/python-zk/kazoo/milestones{/number}","notifications_url":"https://api.github.com/repos/python-zk/kazoo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/python-zk/kazoo/labels{/name}","releases_url":"https://api.github.com/repos/python-zk/kazoo/releases{/id}","created_at":"2012-05-23T23:46:42Z","updated_at":"2015-02-13T22:50:23Z","pushed_at":"2015-02-13T22:50:23Z","git_url":"git://github.com/python-zk/kazoo.git","ssh_url":"git@github.com:python-zk/kazoo.git","clone_url":"https://github.com/python-zk/kazoo.git","svn_url":"https://github.com/python-zk/kazoo","homepage":"https://kazoo.readthedocs.org","size":5545,"stargazers_count":314,"watchers_count":314,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":136,"mirror_url":null,"open_issues_count":55,"forks":136,"open_issues":55,"watchers":314,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/python-zk/kazoo/pulls/242"},"html":{"href":"https://github.com/python-zk/kazoo/pull/242"},"issue":{"href":"https://api.github.com/repos/python-zk/kazoo/issues/242"},"comments":{"href":"https://api.github.com/repos/python-zk/kazoo/issues/242/comments"},"review_comments":{"href":"https://api.github.com/repos/python-zk/kazoo/pulls/242/comments"},"review_comment":{"href":"https://api.github.com/repos/python-zk/kazoo/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/python-zk/kazoo/pulls/242/commits"},"statuses":{"href":"https://api.github.com/repos/python-zk/kazoo/statuses/83fe00116e4ad73d0800b5eaf590b30616bbfa6d"}}}}