{"action":"created","comment":{"url":"https://api.github.com/repos/gristlabs/asttokens/pulls/comments/168844201","pull_request_review_id":97284600,"id":168844201,"diff_hunk":"@@ -448,3 +448,36 @@ def g(x):\n     else:\n       self.assertEqual(m.view_nodes_at(5, 0), {'FunctionDef:@deco2(a=1)\\ndef g(x):\\n  pass'})\n     self.assertEqual(m.view_nodes_at(5, 1), {'Name:deco2', 'Call:deco2(a=1)'})\n+\n+  def test_with(self):\n+    source = \"with foo: pass\"\n+    m = self.create_mark_checker(source)\n+    self.assertEqual(m.view_node_types_at(1, 0), {\"Module\", \"With\"})\n+    self.assertEqual(m.view_nodes_at(1, 0), {\n+      \"Module:with foo: pass\",\n+      \"With:with foo: pass\",\n+    })\n+\n+    source = textwrap.dedent(\n+      '''\n+      def f(x):\n+        with A() as a:\n+          log(a)\n+          with B() as b, C() as c: log(b, c)","path":"tests/test_mark_tokens.py","position":19,"original_position":19,"commit_id":"1f99ead482974cb91fabd54594b4cac690cb2677","original_commit_id":"1f99ead482974cb91fabd54594b4cac690cb2677","user":{"login":"FuegoFro","id":463696,"avatar_url":"https://avatars2.githubusercontent.com/u/463696?v=4","gravatar_id":"","url":"https://api.github.com/users/FuegoFro","html_url":"https://github.com/FuegoFro","followers_url":"https://api.github.com/users/FuegoFro/followers","following_url":"https://api.github.com/users/FuegoFro/following{/other_user}","gists_url":"https://api.github.com/users/FuegoFro/gists{/gist_id}","starred_url":"https://api.github.com/users/FuegoFro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FuegoFro/subscriptions","organizations_url":"https://api.github.com/users/FuegoFro/orgs","repos_url":"https://api.github.com/users/FuegoFro/repos","events_url":"https://api.github.com/users/FuegoFro/events{/privacy}","received_events_url":"https://api.github.com/users/FuegoFro/received_events","type":"User","site_admin":false},"body":"Oh nice, I should have tested the multi-with case. Super interesting that it desugars it to be nested `with` nodes in Python 2, but a single `with` node with multiple items in Python 3 :)","created_at":"2018-02-16T19:07:07Z","updated_at":"2018-02-16T19:08:49Z","html_url":"https://github.com/gristlabs/asttokens/pull/15#discussion_r168844201","pull_request_url":"https://api.github.com/repos/gristlabs/asttokens/pulls/15","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/gristlabs/asttokens/pulls/comments/168844201"},"html":{"href":"https://github.com/gristlabs/asttokens/pull/15#discussion_r168844201"},"pull_request":{"href":"https://api.github.com/repos/gristlabs/asttokens/pulls/15"}}},"pull_request":{"url":"https://api.github.com/repos/gristlabs/asttokens/pulls/15","id":169683186,"html_url":"https://github.com/gristlabs/asttokens/pull/15","diff_url":"https://github.com/gristlabs/asttokens/pull/15.diff","patch_url":"https://github.com/gristlabs/asttokens/pull/15.patch","issue_url":"https://api.github.com/repos/gristlabs/asttokens/issues/15","number":15,"state":"open","locked":false,"title":"Adjust With nodes to include the \"with\" text.","user":{"login":"dsagal","id":1091143,"avatar_url":"https://avatars0.githubusercontent.com/u/1091143?v=4","gravatar_id":"","url":"https://api.github.com/users/dsagal","html_url":"https://github.com/dsagal","followers_url":"https://api.github.com/users/dsagal/followers","following_url":"https://api.github.com/users/dsagal/following{/other_user}","gists_url":"https://api.github.com/users/dsagal/gists{/gist_id}","starred_url":"https://api.github.com/users/dsagal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dsagal/subscriptions","organizations_url":"https://api.github.com/users/dsagal/orgs","repos_url":"https://api.github.com/users/dsagal/repos","events_url":"https://api.github.com/users/dsagal/events{/privacy}","received_events_url":"https://api.github.com/users/dsagal/received_events","type":"User","site_admin":false},"body":"Apparently in Python 2 the `col_offset` of `With` nodes starts after the \"with \" text, which is incorrect. It works correctly on Python 3. This PR fixes it for Python 2.\r\n\r\nBuilds on PR #14 by @FuegoFro, with a different implementation and more testing.\r\n ","created_at":"2018-02-16T17:33:54Z","updated_at":"2018-02-16T19:08:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6898a3461a671022bdd2bca29c4d88a97c9a9027","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/gristlabs/asttokens/pulls/15/commits","review_comments_url":"https://api.github.com/repos/gristlabs/asttokens/pulls/15/comments","review_comment_url":"https://api.github.com/repos/gristlabs/asttokens/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gristlabs/asttokens/issues/15/comments","statuses_url":"https://api.github.com/repos/gristlabs/asttokens/statuses/1f99ead482974cb91fabd54594b4cac690cb2677","head":{"label":"gristlabs:fix_start_of_with","ref":"fix_start_of_with","sha":"1f99ead482974cb91fabd54594b4cac690cb2677","user":{"login":"gristlabs","id":19978005,"avatar_url":"https://avatars0.githubusercontent.com/u/19978005?v=4","gravatar_id":"","url":"https://api.github.com/users/gristlabs","html_url":"https://github.com/gristlabs","followers_url":"https://api.github.com/users/gristlabs/followers","following_url":"https://api.github.com/users/gristlabs/following{/other_user}","gists_url":"https://api.github.com/users/gristlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/gristlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gristlabs/subscriptions","organizations_url":"https://api.github.com/users/gristlabs/orgs","repos_url":"https://api.github.com/users/gristlabs/repos","events_url":"https://api.github.com/users/gristlabs/events{/privacy}","received_events_url":"https://api.github.com/users/gristlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":75670732,"name":"asttokens","full_name":"gristlabs/asttokens","owner":{"login":"gristlabs","id":19978005,"avatar_url":"https://avatars0.githubusercontent.com/u/19978005?v=4","gravatar_id":"","url":"https://api.github.com/users/gristlabs","html_url":"https://github.com/gristlabs","followers_url":"https://api.github.com/users/gristlabs/followers","following_url":"https://api.github.com/users/gristlabs/following{/other_user}","gists_url":"https://api.github.com/users/gristlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/gristlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gristlabs/subscriptions","organizations_url":"https://api.github.com/users/gristlabs/orgs","repos_url":"https://api.github.com/users/gristlabs/repos","events_url":"https://api.github.com/users/gristlabs/events{/privacy}","received_events_url":"https://api.github.com/users/gristlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gristlabs/asttokens","description":"Annotate Python AST trees with source text and token information","fork":false,"url":"https://api.github.com/repos/gristlabs/asttokens","forks_url":"https://api.github.com/repos/gristlabs/asttokens/forks","keys_url":"https://api.github.com/repos/gristlabs/asttokens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gristlabs/asttokens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gristlabs/asttokens/teams","hooks_url":"https://api.github.com/repos/gristlabs/asttokens/hooks","issue_events_url":"https://api.github.com/repos/gristlabs/asttokens/issues/events{/number}","events_url":"https://api.github.com/repos/gristlabs/asttokens/events","assignees_url":"https://api.github.com/repos/gristlabs/asttokens/assignees{/user}","branches_url":"https://api.github.com/repos/gristlabs/asttokens/branches{/branch}","tags_url":"https://api.github.com/repos/gristlabs/asttokens/tags","blobs_url":"https://api.github.com/repos/gristlabs/asttokens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gristlabs/asttokens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gristlabs/asttokens/git/refs{/sha}","trees_url":"https://api.github.com/repos/gristlabs/asttokens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gristlabs/asttokens/statuses/{sha}","languages_url":"https://api.github.com/repos/gristlabs/asttokens/languages","stargazers_url":"https://api.github.com/repos/gristlabs/asttokens/stargazers","contributors_url":"https://api.github.com/repos/gristlabs/asttokens/contributors","subscribers_url":"https://api.github.com/repos/gristlabs/asttokens/subscribers","subscription_url":"https://api.github.com/repos/gristlabs/asttokens/subscription","commits_url":"https://api.github.com/repos/gristlabs/asttokens/commits{/sha}","git_commits_url":"https://api.github.com/repos/gristlabs/asttokens/git/commits{/sha}","comments_url":"https://api.github.com/repos/gristlabs/asttokens/comments{/number}","issue_comment_url":"https://api.github.com/repos/gristlabs/asttokens/issues/comments{/number}","contents_url":"https://api.github.com/repos/gristlabs/asttokens/contents/{+path}","compare_url":"https://api.github.com/repos/gristlabs/asttokens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gristlabs/asttokens/merges","archive_url":"https://api.github.com/repos/gristlabs/asttokens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gristlabs/asttokens/downloads","issues_url":"https://api.github.com/repos/gristlabs/asttokens/issues{/number}","pulls_url":"https://api.github.com/repos/gristlabs/asttokens/pulls{/number}","milestones_url":"https://api.github.com/repos/gristlabs/asttokens/milestones{/number}","notifications_url":"https://api.github.com/repos/gristlabs/asttokens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gristlabs/asttokens/labels{/name}","releases_url":"https://api.github.com/repos/gristlabs/asttokens/releases{/id}","deployments_url":"https://api.github.com/repos/gristlabs/asttokens/deployments","created_at":"2016-12-05T22:09:10Z","updated_at":"2018-02-08T18:18:54Z","pushed_at":"2018-02-16T17:33:54Z","git_url":"git://github.com/gristlabs/asttokens.git","ssh_url":"git@github.com:gristlabs/asttokens.git","clone_url":"https://github.com/gristlabs/asttokens.git","svn_url":"https://github.com/gristlabs/asttokens","homepage":null,"size":98,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1,"open_issues":4,"watchers":23,"default_branch":"master"}},"base":{"label":"gristlabs:master","ref":"master","sha":"845744c14ea00ed07597c261496456e291eb7e9d","user":{"login":"gristlabs","id":19978005,"avatar_url":"https://avatars0.githubusercontent.com/u/19978005?v=4","gravatar_id":"","url":"https://api.github.com/users/gristlabs","html_url":"https://github.com/gristlabs","followers_url":"https://api.github.com/users/gristlabs/followers","following_url":"https://api.github.com/users/gristlabs/following{/other_user}","gists_url":"https://api.github.com/users/gristlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/gristlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gristlabs/subscriptions","organizations_url":"https://api.github.com/users/gristlabs/orgs","repos_url":"https://api.github.com/users/gristlabs/repos","events_url":"https://api.github.com/users/gristlabs/events{/privacy}","received_events_url":"https://api.github.com/users/gristlabs/received_events","type":"Organization","site_admin":false},"repo":{"id":75670732,"name":"asttokens","full_name":"gristlabs/asttokens","owner":{"login":"gristlabs","id":19978005,"avatar_url":"https://avatars0.githubusercontent.com/u/19978005?v=4","gravatar_id":"","url":"https://api.github.com/users/gristlabs","html_url":"https://github.com/gristlabs","followers_url":"https://api.github.com/users/gristlabs/followers","following_url":"https://api.github.com/users/gristlabs/following{/other_user}","gists_url":"https://api.github.com/users/gristlabs/gists{/gist_id}","starred_url":"https://api.github.com/users/gristlabs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gristlabs/subscriptions","organizations_url":"https://api.github.com/users/gristlabs/orgs","repos_url":"https://api.github.com/users/gristlabs/repos","events_url":"https://api.github.com/users/gristlabs/events{/privacy}","received_events_url":"https://api.github.com/users/gristlabs/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gristlabs/asttokens","description":"Annotate Python AST trees with source text and token information","fork":false,"url":"https://api.github.com/repos/gristlabs/asttokens","forks_url":"https://api.github.com/repos/gristlabs/asttokens/forks","keys_url":"https://api.github.com/repos/gristlabs/asttokens/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gristlabs/asttokens/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gristlabs/asttokens/teams","hooks_url":"https://api.github.com/repos/gristlabs/asttokens/hooks","issue_events_url":"https://api.github.com/repos/gristlabs/asttokens/issues/events{/number}","events_url":"https://api.github.com/repos/gristlabs/asttokens/events","assignees_url":"https://api.github.com/repos/gristlabs/asttokens/assignees{/user}","branches_url":"https://api.github.com/repos/gristlabs/asttokens/branches{/branch}","tags_url":"https://api.github.com/repos/gristlabs/asttokens/tags","blobs_url":"https://api.github.com/repos/gristlabs/asttokens/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gristlabs/asttokens/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gristlabs/asttokens/git/refs{/sha}","trees_url":"https://api.github.com/repos/gristlabs/asttokens/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gristlabs/asttokens/statuses/{sha}","languages_url":"https://api.github.com/repos/gristlabs/asttokens/languages","stargazers_url":"https://api.github.com/repos/gristlabs/asttokens/stargazers","contributors_url":"https://api.github.com/repos/gristlabs/asttokens/contributors","subscribers_url":"https://api.github.com/repos/gristlabs/asttokens/subscribers","subscription_url":"https://api.github.com/repos/gristlabs/asttokens/subscription","commits_url":"https://api.github.com/repos/gristlabs/asttokens/commits{/sha}","git_commits_url":"https://api.github.com/repos/gristlabs/asttokens/git/commits{/sha}","comments_url":"https://api.github.com/repos/gristlabs/asttokens/comments{/number}","issue_comment_url":"https://api.github.com/repos/gristlabs/asttokens/issues/comments{/number}","contents_url":"https://api.github.com/repos/gristlabs/asttokens/contents/{+path}","compare_url":"https://api.github.com/repos/gristlabs/asttokens/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gristlabs/asttokens/merges","archive_url":"https://api.github.com/repos/gristlabs/asttokens/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gristlabs/asttokens/downloads","issues_url":"https://api.github.com/repos/gristlabs/asttokens/issues{/number}","pulls_url":"https://api.github.com/repos/gristlabs/asttokens/pulls{/number}","milestones_url":"https://api.github.com/repos/gristlabs/asttokens/milestones{/number}","notifications_url":"https://api.github.com/repos/gristlabs/asttokens/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gristlabs/asttokens/labels{/name}","releases_url":"https://api.github.com/repos/gristlabs/asttokens/releases{/id}","deployments_url":"https://api.github.com/repos/gristlabs/asttokens/deployments","created_at":"2016-12-05T22:09:10Z","updated_at":"2018-02-08T18:18:54Z","pushed_at":"2018-02-16T17:33:54Z","git_url":"git://github.com/gristlabs/asttokens.git","ssh_url":"git@github.com:gristlabs/asttokens.git","clone_url":"https://github.com/gristlabs/asttokens.git","svn_url":"https://github.com/gristlabs/asttokens","homepage":null,"size":98,"stargazers_count":23,"watchers_count":23,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":4,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":1,"open_issues":4,"watchers":23,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gristlabs/asttokens/pulls/15"},"html":{"href":"https://github.com/gristlabs/asttokens/pull/15"},"issue":{"href":"https://api.github.com/repos/gristlabs/asttokens/issues/15"},"comments":{"href":"https://api.github.com/repos/gristlabs/asttokens/issues/15/comments"},"review_comments":{"href":"https://api.github.com/repos/gristlabs/asttokens/pulls/15/comments"},"review_comment":{"href":"https://api.github.com/repos/gristlabs/asttokens/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gristlabs/asttokens/pulls/15/commits"},"statuses":{"href":"https://api.github.com/repos/gristlabs/asttokens/statuses/1f99ead482974cb91fabd54594b4cac690cb2677"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"FuegoFro"}}