{"action":"created","comment":{"url":"https://api.github.com/repos/sympy/sympy/pulls/comments/25597153","id":25597153,"diff_hunk":"@@ -605,6 +605,124 @@ def factorial_notation(tokens, local_dict, global_dict):\n \n     return result\n \n+def _transform_equality_operator(tokens, local_dict, global_dict):\n+    \"\"\"Transforms the equality operator ``==`` to instances of Eq.\n+\n+    Works with expressions containing only one equality operator and no\n+    nesting only.\n+\n+    Examples: 1==2     to Eq(1,2)\n+              1*2==x   to Eq(1*2, x)\n+\n+    \"\"\"\n+    result = []\n+    if (OP, \"==\") in tokens:\n+        result.append((NAME, \"Eq\"))\n+        result.append((OP, \"(\"))\n+        for index, token in enumerate(tokens):\n+            if token == (OP, \"==\"):\n+                result.append((OP, \",\"))\n+                continue\n+            result.append(token)\n+        result.append((OP, \")\"))\n+    else:\n+        result = tokens\n+\n+    return result\n+\n+def convert_equality_operators(result, local_dict, global_dict):\n+    \"\"\" Transforms the equality operators ``==`` to instances of Eq.\n+\n+    Parses the equality operators in the expression and returns\n+    appropriate Eq instances.Also works with nested equality operators.\n+\n+    See also\n+    ========\n+    convert_equals_signs\n+\n+    Examples\n+    ========\n+\n+    >>> from sympy.parsing.sympy_parser import (parse_expr,\n+    ... standard_transformations, convert_equality_operators)\n+    >>> parse_expr(\"1*2==x\", transformations = (\n+    ... standard_transformations+\n+    ... (convert_equality_operators, )))\n+    Eq(2, x)\n+    >>> parse_expr(\"(1*2==x)==False\", transformations = (\n+    ... standard_transformations+\n+    ... (convert_equality_operators, )))\n+    Eq(Eq(2, x), False)\n+\n+    \"\"\"\n+    for step in (_group_parentheses(convert_equality_operators),\n+                  _apply_functions,\n+                  _transform_equality_operator):\n+        result = step(result, local_dict, global_dict)\n+\n+    result = _flatten(result)\n+    return result\n+\n+\n+def _transform_equals_sign(tokens, local_dict, global_dict):\n+    \"\"\"Transforms the equals sign ``=`` to instances of Eq.\n+\n+    Works with expressions containing one equals sign and no\n+    nesting only.\n+\n+    Examples: 1=2     to Eq(1,2)\n+              1*2=x   to Eq(1*2, x)\n+\n+    This does not deal with function arguments yet.\n+\n+    \"\"\"\n+    result = []\n+    if (OP, \"=\") in tokens:\n+        result.append((NAME, \"Eq\"))\n+        result.append((OP, \"(\"))\n+        for index, token in enumerate(tokens):\n+            if token == (OP, \"=\"):\n+                result.append((OP, \",\"))\n+                continue\n+            result.append(token)\n+        result.append((OP, \")\"))\n+    else:\n+        result = tokens\n+\n+    return result\n+","path":"sympy/parsing/sympy_parser.py","position":89,"original_position":89,"commit_id":"73df0a42af704f1469ecadde8e20965a55226435","original_commit_id":"73df0a42af704f1469ecadde8e20965a55226435","user":{"login":"debugger22","id":2821646,"avatar_url":"https://avatars.githubusercontent.com/u/2821646?v=3","gravatar_id":"","url":"https://api.github.com/users/debugger22","html_url":"https://github.com/debugger22","followers_url":"https://api.github.com/users/debugger22/followers","following_url":"https://api.github.com/users/debugger22/following{/other_user}","gists_url":"https://api.github.com/users/debugger22/gists{/gist_id}","starred_url":"https://api.github.com/users/debugger22/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/debugger22/subscriptions","organizations_url":"https://api.github.com/users/debugger22/orgs","repos_url":"https://api.github.com/users/debugger22/repos","events_url":"https://api.github.com/users/debugger22/events{/privacy}","received_events_url":"https://api.github.com/users/debugger22/received_events","type":"User","site_admin":false},"body":"Newline.","created_at":"2015-03-02T13:18:49Z","updated_at":"2015-03-02T13:18:49Z","html_url":"https://github.com/sympy/sympy/pull/9026#discussion_r25597153","pull_request_url":"https://api.github.com/repos/sympy/sympy/pulls/9026","_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments/25597153"},"html":{"href":"https://github.com/sympy/sympy/pull/9026#discussion_r25597153"},"pull_request":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9026"}}},"pull_request":{"url":"https://api.github.com/repos/sympy/sympy/pulls/9026","id":29524787,"html_url":"https://github.com/sympy/sympy/pull/9026","diff_url":"https://github.com/sympy/sympy/pull/9026.diff","patch_url":"https://github.com/sympy/sympy/pull/9026.patch","issue_url":"https://api.github.com/repos/sympy/sympy/issues/9026","number":9026,"state":"open","locked":false,"title":"parser: Added support for parsing `=` and `==` in parse_expr.","user":{"login":"paramsingh","id":1837631,"avatar_url":"https://avatars.githubusercontent.com/u/1837631?v=3","gravatar_id":"","url":"https://api.github.com/users/paramsingh","html_url":"https://github.com/paramsingh","followers_url":"https://api.github.com/users/paramsingh/followers","following_url":"https://api.github.com/users/paramsingh/following{/other_user}","gists_url":"https://api.github.com/users/paramsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/paramsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paramsingh/subscriptions","organizations_url":"https://api.github.com/users/paramsingh/orgs","repos_url":"https://api.github.com/users/paramsingh/repos","events_url":"https://api.github.com/users/paramsingh/events{/privacy}","received_events_url":"https://api.github.com/users/paramsingh/received_events","type":"User","site_admin":false},"body":"Wrote two transformer functions `convert_equals_signs` and\r\n`convert_equality_operators` which when passed to `parse_expr` as\r\ntransformations parse expressions containing `=` and `==` and\r\nreturn instances of Eq. Also wrote some tests for said\r\ntransformations.\r\n\r\nExample:\r\n```\r\n>>> from sympy.parsing.sympy_parser import (parse_expr,\r\n... standard_transformations, convert_equals_signs,\r\n... convert_equality_operators)\r\n>>> t = standard_transformations + (convert_equals_signs,\r\n... convert_equality_operators, )\r\n>>> parse_expr(\"1==x\", transformations=t)\r\nEq(1, x)\r\n>>> parse_expr(\"1=x\", transformations=t)\r\nEq(1, x)\r\n```\r\n\r\nFixes #8844.","created_at":"2015-02-18T13:27:23Z","updated_at":"2015-03-02T13:18:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0d0c979245b82a4c6b2bd5f1eb656723966953bb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sympy/sympy/pulls/9026/commits","review_comments_url":"https://api.github.com/repos/sympy/sympy/pulls/9026/comments","review_comment_url":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sympy/sympy/issues/9026/comments","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/73df0a42af704f1469ecadde8e20965a55226435","head":{"label":"paramsingh:8844_parse_equals","ref":"8844_parse_equals","sha":"73df0a42af704f1469ecadde8e20965a55226435","user":{"login":"paramsingh","id":1837631,"avatar_url":"https://avatars.githubusercontent.com/u/1837631?v=3","gravatar_id":"","url":"https://api.github.com/users/paramsingh","html_url":"https://github.com/paramsingh","followers_url":"https://api.github.com/users/paramsingh/followers","following_url":"https://api.github.com/users/paramsingh/following{/other_user}","gists_url":"https://api.github.com/users/paramsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/paramsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paramsingh/subscriptions","organizations_url":"https://api.github.com/users/paramsingh/orgs","repos_url":"https://api.github.com/users/paramsingh/repos","events_url":"https://api.github.com/users/paramsingh/events{/privacy}","received_events_url":"https://api.github.com/users/paramsingh/received_events","type":"User","site_admin":false},"repo":{"id":29932448,"name":"sympy","full_name":"paramsingh/sympy","owner":{"login":"paramsingh","id":1837631,"avatar_url":"https://avatars.githubusercontent.com/u/1837631?v=3","gravatar_id":"","url":"https://api.github.com/users/paramsingh","html_url":"https://github.com/paramsingh","followers_url":"https://api.github.com/users/paramsingh/followers","following_url":"https://api.github.com/users/paramsingh/following{/other_user}","gists_url":"https://api.github.com/users/paramsingh/gists{/gist_id}","starred_url":"https://api.github.com/users/paramsingh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paramsingh/subscriptions","organizations_url":"https://api.github.com/users/paramsingh/orgs","repos_url":"https://api.github.com/users/paramsingh/repos","events_url":"https://api.github.com/users/paramsingh/events{/privacy}","received_events_url":"https://api.github.com/users/paramsingh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/paramsingh/sympy","description":"A computer algebra system written in pure Python","fork":true,"url":"https://api.github.com/repos/paramsingh/sympy","forks_url":"https://api.github.com/repos/paramsingh/sympy/forks","keys_url":"https://api.github.com/repos/paramsingh/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paramsingh/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paramsingh/sympy/teams","hooks_url":"https://api.github.com/repos/paramsingh/sympy/hooks","issue_events_url":"https://api.github.com/repos/paramsingh/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/paramsingh/sympy/events","assignees_url":"https://api.github.com/repos/paramsingh/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/paramsingh/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/paramsingh/sympy/tags","blobs_url":"https://api.github.com/repos/paramsingh/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paramsingh/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paramsingh/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/paramsingh/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paramsingh/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/paramsingh/sympy/languages","stargazers_url":"https://api.github.com/repos/paramsingh/sympy/stargazers","contributors_url":"https://api.github.com/repos/paramsingh/sympy/contributors","subscribers_url":"https://api.github.com/repos/paramsingh/sympy/subscribers","subscription_url":"https://api.github.com/repos/paramsingh/sympy/subscription","commits_url":"https://api.github.com/repos/paramsingh/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/paramsingh/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/paramsingh/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/paramsingh/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/paramsingh/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/paramsingh/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paramsingh/sympy/merges","archive_url":"https://api.github.com/repos/paramsingh/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paramsingh/sympy/downloads","issues_url":"https://api.github.com/repos/paramsingh/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/paramsingh/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/paramsingh/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/paramsingh/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paramsingh/sympy/labels{/name}","releases_url":"https://api.github.com/repos/paramsingh/sympy/releases{/id}","created_at":"2015-01-27T20:05:08Z","updated_at":"2015-02-28T07:28:58Z","pushed_at":"2015-02-28T15:32:20Z","git_url":"git://github.com/paramsingh/sympy.git","ssh_url":"git@github.com:paramsingh/sympy.git","clone_url":"https://github.com/paramsingh/sympy.git","svn_url":"https://github.com/paramsingh/sympy","homepage":"http://sympy.org/","size":67732,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"sympy:master","ref":"master","sha":"2d3da21951c0d78eed44046e0e328174e5c77bce","user":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"repo":{"id":640534,"name":"sympy","full_name":"sympy/sympy","owner":{"login":"sympy","id":260832,"avatar_url":"https://avatars.githubusercontent.com/u/260832?v=3","gravatar_id":"","url":"https://api.github.com/users/sympy","html_url":"https://github.com/sympy","followers_url":"https://api.github.com/users/sympy/followers","following_url":"https://api.github.com/users/sympy/following{/other_user}","gists_url":"https://api.github.com/users/sympy/gists{/gist_id}","starred_url":"https://api.github.com/users/sympy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sympy/subscriptions","organizations_url":"https://api.github.com/users/sympy/orgs","repos_url":"https://api.github.com/users/sympy/repos","events_url":"https://api.github.com/users/sympy/events{/privacy}","received_events_url":"https://api.github.com/users/sympy/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sympy/sympy","description":"A computer algebra system written in pure Python","fork":false,"url":"https://api.github.com/repos/sympy/sympy","forks_url":"https://api.github.com/repos/sympy/sympy/forks","keys_url":"https://api.github.com/repos/sympy/sympy/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sympy/sympy/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sympy/sympy/teams","hooks_url":"https://api.github.com/repos/sympy/sympy/hooks","issue_events_url":"https://api.github.com/repos/sympy/sympy/issues/events{/number}","events_url":"https://api.github.com/repos/sympy/sympy/events","assignees_url":"https://api.github.com/repos/sympy/sympy/assignees{/user}","branches_url":"https://api.github.com/repos/sympy/sympy/branches{/branch}","tags_url":"https://api.github.com/repos/sympy/sympy/tags","blobs_url":"https://api.github.com/repos/sympy/sympy/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sympy/sympy/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sympy/sympy/git/refs{/sha}","trees_url":"https://api.github.com/repos/sympy/sympy/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sympy/sympy/statuses/{sha}","languages_url":"https://api.github.com/repos/sympy/sympy/languages","stargazers_url":"https://api.github.com/repos/sympy/sympy/stargazers","contributors_url":"https://api.github.com/repos/sympy/sympy/contributors","subscribers_url":"https://api.github.com/repos/sympy/sympy/subscribers","subscription_url":"https://api.github.com/repos/sympy/sympy/subscription","commits_url":"https://api.github.com/repos/sympy/sympy/commits{/sha}","git_commits_url":"https://api.github.com/repos/sympy/sympy/git/commits{/sha}","comments_url":"https://api.github.com/repos/sympy/sympy/comments{/number}","issue_comment_url":"https://api.github.com/repos/sympy/sympy/issues/comments{/number}","contents_url":"https://api.github.com/repos/sympy/sympy/contents/{+path}","compare_url":"https://api.github.com/repos/sympy/sympy/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sympy/sympy/merges","archive_url":"https://api.github.com/repos/sympy/sympy/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sympy/sympy/downloads","issues_url":"https://api.github.com/repos/sympy/sympy/issues{/number}","pulls_url":"https://api.github.com/repos/sympy/sympy/pulls{/number}","milestones_url":"https://api.github.com/repos/sympy/sympy/milestones{/number}","notifications_url":"https://api.github.com/repos/sympy/sympy/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sympy/sympy/labels{/name}","releases_url":"https://api.github.com/repos/sympy/sympy/releases{/id}","created_at":"2010-04-30T20:37:14Z","updated_at":"2015-03-02T12:05:55Z","pushed_at":"2015-03-02T12:05:55Z","git_url":"git://github.com/sympy/sympy.git","ssh_url":"git@github.com:sympy/sympy.git","clone_url":"https://github.com/sympy/sympy.git","svn_url":"https://github.com/sympy/sympy","homepage":"http://sympy.org/","size":143127,"stargazers_count":1966,"watchers_count":1966,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":960,"mirror_url":null,"open_issues_count":1836,"forks":960,"open_issues":1836,"watchers":1966,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9026"},"html":{"href":"https://github.com/sympy/sympy/pull/9026"},"issue":{"href":"https://api.github.com/repos/sympy/sympy/issues/9026"},"comments":{"href":"https://api.github.com/repos/sympy/sympy/issues/9026/comments"},"review_comments":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9026/comments"},"review_comment":{"href":"https://api.github.com/repos/sympy/sympy/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sympy/sympy/pulls/9026/commits"},"statuses":{"href":"https://api.github.com/repos/sympy/sympy/statuses/73df0a42af704f1469ecadde8e20965a55226435"}}}}