{"action":"created","comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/88306795","pull_request_review_id":8884520,"id":88306795,"diff_hunk":"@@ -2697,40 +2715,49 @@ class _StringFuncParser(object):\n     _funcs['linear'] = _FuncInfo(lambda x: x,\n                                  lambda x: x,\n                                  True)\n-    _funcs['quadratic'] = _FuncInfo(lambda x: x**2,\n-                                    lambda x: x**(1. / 2),\n+    _funcs['quadratic'] = _FuncInfo(np.square,\n+                                    np.sqrt,\n                                     True)\n     _funcs['cubic'] = _FuncInfo(lambda x: x**3,","path":"lib/matplotlib/cbook.py","position":null,"original_position":53,"commit_id":"bb042f6407cc0ab9c90fd76cb4cf1df466f81212","original_commit_id":"bb042f6407cc0ab9c90fd76cb4cf1df466f81212","user":{"login":"story645","id":1300499,"avatar_url":"https://avatars.githubusercontent.com/u/1300499?v=3","gravatar_id":"","url":"https://api.github.com/users/story645","html_url":"https://github.com/story645","followers_url":"https://api.github.com/users/story645/followers","following_url":"https://api.github.com/users/story645/following{/other_user}","gists_url":"https://api.github.com/users/story645/gists{/gist_id}","starred_url":"https://api.github.com/users/story645/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/story645/subscriptions","organizations_url":"https://api.github.com/users/story645/orgs","repos_url":"https://api.github.com/users/story645/repos","events_url":"https://api.github.com/users/story645/events{/privacy}","received_events_url":"https://api.github.com/users/story645/received_events","type":"User","site_admin":false},"body":"np.power, kwargs={x2:2}\r\nmaybe something like that?","created_at":"2016-11-16T19:04:15Z","updated_at":"2016-11-16T19:07:06Z","html_url":"https://github.com/matplotlib/matplotlib/pull/7464#discussion_r88306795","pull_request_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464","_links":{"self":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/88306795"},"html":{"href":"https://github.com/matplotlib/matplotlib/pull/7464#discussion_r88306795"},"pull_request":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464"}}},"pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464","id":93872327,"html_url":"https://github.com/matplotlib/matplotlib/pull/7464","diff_url":"https://github.com/matplotlib/matplotlib/pull/7464.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/7464.patch","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/7464","number":7464,"state":"open","locked":false,"title":"ENH: _StringFuncParser to get numerical functions callables from strings","user":{"login":"alvarosg","id":12649253,"avatar_url":"https://avatars.githubusercontent.com/u/12649253?v=3","gravatar_id":"","url":"https://api.github.com/users/alvarosg","html_url":"https://github.com/alvarosg","followers_url":"https://api.github.com/users/alvarosg/followers","following_url":"https://api.github.com/users/alvarosg/following{/other_user}","gists_url":"https://api.github.com/users/alvarosg/gists{/gist_id}","starred_url":"https://api.github.com/users/alvarosg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alvarosg/subscriptions","organizations_url":"https://api.github.com/users/alvarosg/orgs","repos_url":"https://api.github.com/users/alvarosg/repos","events_url":"https://api.github.com/users/alvarosg/events{/privacy}","received_events_url":"https://api.github.com/users/alvarosg/received_events","type":"User","site_admin":false},"body":"This PR is part of a [larger PR](https://github.com/matplotlib/matplotlib/pull/7294/commits) originally proposed to include FuncNorm and PiecewiseNorm. It was decided to split it into several PRs for easier review starting from the simpler classes.\r\n\r\nThe new functionality is inside a class _StringFuncParser in cbook, specialized on returning a _FuncInfo object with callables and other information about some predefined functions by just feeding it with a string. \r\n\r\nA typical example of use is:\r\n\r\n```python\r\n   func_info=_StringFuncParser('sqrt')\r\n   func_info.direct #Is a callable implementing the square root\r\n   func_info.inverse #Is a callable implementing the inverse of square root: the square\r\n```\r\n\r\nIt also allows parametrical functions such as:\r\n\r\n```\r\n    _StringFuncParser('root{3}(x)')  # Receives a parameter (3) to define the degree of the root\r\n```\r\n```\r\n    _StringFuncParser('log{7}(x+{4})')  # Receives a parameter (7) to define the base \r\n                                        # of the root, and a constant (4)\r\n```\r\n\r\nThe immediate use of this will be mainly related to FuncNorm and PiecewiseNorm, but in general it may come in handy for any other function taking callables. The advantage over just passing the callable, is that we have access to more information such as the inverse function, or any other property that we may want to store, without having to ask the user directly for all of those.\r\n\r\nFor now the classes are defined as hidden, so we do not have to guarantee back compatibility in case it is decided to change the way it is designed in the future. However, this still allows other matplotlib functions/classes to use it.","created_at":"2016-11-15T23:39:05Z","updated_at":"2016-11-16T19:07:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1b89f3e886072ce2f8353edd64931cbb35561458","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464/commits","review_comments_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464/comments","review_comment_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/7464/comments","statuses_url":"https://api.github.com/repos/matplotlib/matplotlib/statuses/bb042f6407cc0ab9c90fd76cb4cf1df466f81212","head":{"label":"alvarosg:string-func-parser","ref":"string-func-parser","sha":"bb042f6407cc0ab9c90fd76cb4cf1df466f81212","user":{"login":"alvarosg","id":12649253,"avatar_url":"https://avatars.githubusercontent.com/u/12649253?v=3","gravatar_id":"","url":"https://api.github.com/users/alvarosg","html_url":"https://github.com/alvarosg","followers_url":"https://api.github.com/users/alvarosg/followers","following_url":"https://api.github.com/users/alvarosg/following{/other_user}","gists_url":"https://api.github.com/users/alvarosg/gists{/gist_id}","starred_url":"https://api.github.com/users/alvarosg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alvarosg/subscriptions","organizations_url":"https://api.github.com/users/alvarosg/orgs","repos_url":"https://api.github.com/users/alvarosg/repos","events_url":"https://api.github.com/users/alvarosg/events{/privacy}","received_events_url":"https://api.github.com/users/alvarosg/received_events","type":"User","site_admin":false},"repo":{"id":71148616,"name":"matplotlib","full_name":"alvarosg/matplotlib","owner":{"login":"alvarosg","id":12649253,"avatar_url":"https://avatars.githubusercontent.com/u/12649253?v=3","gravatar_id":"","url":"https://api.github.com/users/alvarosg","html_url":"https://github.com/alvarosg","followers_url":"https://api.github.com/users/alvarosg/followers","following_url":"https://api.github.com/users/alvarosg/following{/other_user}","gists_url":"https://api.github.com/users/alvarosg/gists{/gist_id}","starred_url":"https://api.github.com/users/alvarosg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alvarosg/subscriptions","organizations_url":"https://api.github.com/users/alvarosg/orgs","repos_url":"https://api.github.com/users/alvarosg/repos","events_url":"https://api.github.com/users/alvarosg/events{/privacy}","received_events_url":"https://api.github.com/users/alvarosg/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/alvarosg/matplotlib","description":"matplotlib: plotting with Python","fork":true,"url":"https://api.github.com/repos/alvarosg/matplotlib","forks_url":"https://api.github.com/repos/alvarosg/matplotlib/forks","keys_url":"https://api.github.com/repos/alvarosg/matplotlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alvarosg/matplotlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alvarosg/matplotlib/teams","hooks_url":"https://api.github.com/repos/alvarosg/matplotlib/hooks","issue_events_url":"https://api.github.com/repos/alvarosg/matplotlib/issues/events{/number}","events_url":"https://api.github.com/repos/alvarosg/matplotlib/events","assignees_url":"https://api.github.com/repos/alvarosg/matplotlib/assignees{/user}","branches_url":"https://api.github.com/repos/alvarosg/matplotlib/branches{/branch}","tags_url":"https://api.github.com/repos/alvarosg/matplotlib/tags","blobs_url":"https://api.github.com/repos/alvarosg/matplotlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alvarosg/matplotlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alvarosg/matplotlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/alvarosg/matplotlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alvarosg/matplotlib/statuses/{sha}","languages_url":"https://api.github.com/repos/alvarosg/matplotlib/languages","stargazers_url":"https://api.github.com/repos/alvarosg/matplotlib/stargazers","contributors_url":"https://api.github.com/repos/alvarosg/matplotlib/contributors","subscribers_url":"https://api.github.com/repos/alvarosg/matplotlib/subscribers","subscription_url":"https://api.github.com/repos/alvarosg/matplotlib/subscription","commits_url":"https://api.github.com/repos/alvarosg/matplotlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/alvarosg/matplotlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/alvarosg/matplotlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/alvarosg/matplotlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/alvarosg/matplotlib/contents/{+path}","compare_url":"https://api.github.com/repos/alvarosg/matplotlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alvarosg/matplotlib/merges","archive_url":"https://api.github.com/repos/alvarosg/matplotlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alvarosg/matplotlib/downloads","issues_url":"https://api.github.com/repos/alvarosg/matplotlib/issues{/number}","pulls_url":"https://api.github.com/repos/alvarosg/matplotlib/pulls{/number}","milestones_url":"https://api.github.com/repos/alvarosg/matplotlib/milestones{/number}","notifications_url":"https://api.github.com/repos/alvarosg/matplotlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alvarosg/matplotlib/labels{/name}","releases_url":"https://api.github.com/repos/alvarosg/matplotlib/releases{/id}","deployments_url":"https://api.github.com/repos/alvarosg/matplotlib/deployments","created_at":"2016-10-17T14:43:32Z","updated_at":"2016-10-17T14:43:42Z","pushed_at":"2016-11-16T18:34:03Z","git_url":"git://github.com/alvarosg/matplotlib.git","ssh_url":"git@github.com:alvarosg/matplotlib.git","clone_url":"https://github.com/alvarosg/matplotlib.git","svn_url":"https://github.com/alvarosg/matplotlib","homepage":"http://matplotlib.org/","size":290189,"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":"matplotlib:master","ref":"master","sha":"86b32ca286f2f410186638f1b6ea87171076ae59","user":{"login":"matplotlib","id":215947,"avatar_url":"https://avatars.githubusercontent.com/u/215947?v=3","gravatar_id":"","url":"https://api.github.com/users/matplotlib","html_url":"https://github.com/matplotlib","followers_url":"https://api.github.com/users/matplotlib/followers","following_url":"https://api.github.com/users/matplotlib/following{/other_user}","gists_url":"https://api.github.com/users/matplotlib/gists{/gist_id}","starred_url":"https://api.github.com/users/matplotlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matplotlib/subscriptions","organizations_url":"https://api.github.com/users/matplotlib/orgs","repos_url":"https://api.github.com/users/matplotlib/repos","events_url":"https://api.github.com/users/matplotlib/events{/privacy}","received_events_url":"https://api.github.com/users/matplotlib/received_events","type":"Organization","site_admin":false},"repo":{"id":1385122,"name":"matplotlib","full_name":"matplotlib/matplotlib","owner":{"login":"matplotlib","id":215947,"avatar_url":"https://avatars.githubusercontent.com/u/215947?v=3","gravatar_id":"","url":"https://api.github.com/users/matplotlib","html_url":"https://github.com/matplotlib","followers_url":"https://api.github.com/users/matplotlib/followers","following_url":"https://api.github.com/users/matplotlib/following{/other_user}","gists_url":"https://api.github.com/users/matplotlib/gists{/gist_id}","starred_url":"https://api.github.com/users/matplotlib/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matplotlib/subscriptions","organizations_url":"https://api.github.com/users/matplotlib/orgs","repos_url":"https://api.github.com/users/matplotlib/repos","events_url":"https://api.github.com/users/matplotlib/events{/privacy}","received_events_url":"https://api.github.com/users/matplotlib/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/matplotlib/matplotlib","description":"matplotlib: plotting with Python","fork":false,"url":"https://api.github.com/repos/matplotlib/matplotlib","forks_url":"https://api.github.com/repos/matplotlib/matplotlib/forks","keys_url":"https://api.github.com/repos/matplotlib/matplotlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/matplotlib/matplotlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/matplotlib/matplotlib/teams","hooks_url":"https://api.github.com/repos/matplotlib/matplotlib/hooks","issue_events_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/events{/number}","events_url":"https://api.github.com/repos/matplotlib/matplotlib/events","assignees_url":"https://api.github.com/repos/matplotlib/matplotlib/assignees{/user}","branches_url":"https://api.github.com/repos/matplotlib/matplotlib/branches{/branch}","tags_url":"https://api.github.com/repos/matplotlib/matplotlib/tags","blobs_url":"https://api.github.com/repos/matplotlib/matplotlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/matplotlib/matplotlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/matplotlib/matplotlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/matplotlib/matplotlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/matplotlib/matplotlib/statuses/{sha}","languages_url":"https://api.github.com/repos/matplotlib/matplotlib/languages","stargazers_url":"https://api.github.com/repos/matplotlib/matplotlib/stargazers","contributors_url":"https://api.github.com/repos/matplotlib/matplotlib/contributors","subscribers_url":"https://api.github.com/repos/matplotlib/matplotlib/subscribers","subscription_url":"https://api.github.com/repos/matplotlib/matplotlib/subscription","commits_url":"https://api.github.com/repos/matplotlib/matplotlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/matplotlib/matplotlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/matplotlib/matplotlib/contents/{+path}","compare_url":"https://api.github.com/repos/matplotlib/matplotlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/matplotlib/matplotlib/merges","archive_url":"https://api.github.com/repos/matplotlib/matplotlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/matplotlib/matplotlib/downloads","issues_url":"https://api.github.com/repos/matplotlib/matplotlib/issues{/number}","pulls_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls{/number}","milestones_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones{/number}","notifications_url":"https://api.github.com/repos/matplotlib/matplotlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/labels{/name}","releases_url":"https://api.github.com/repos/matplotlib/matplotlib/releases{/id}","deployments_url":"https://api.github.com/repos/matplotlib/matplotlib/deployments","created_at":"2011-02-19T03:17:12Z","updated_at":"2016-11-16T16:35:46Z","pushed_at":"2016-11-16T18:34:07Z","git_url":"git://github.com/matplotlib/matplotlib.git","ssh_url":"git@github.com:matplotlib/matplotlib.git","clone_url":"https://github.com/matplotlib/matplotlib.git","svn_url":"https://github.com/matplotlib/matplotlib","homepage":"http://matplotlib.org/","size":402767,"stargazers_count":4341,"watchers_count":4341,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2136,"mirror_url":null,"open_issues_count":1034,"forks":2136,"open_issues":1034,"watchers":4341,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464"},"html":{"href":"https://github.com/matplotlib/matplotlib/pull/7464"},"issue":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/7464"},"comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/7464/comments"},"review_comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464/comments"},"review_comment":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/7464/commits"},"statuses":{"href":"https://api.github.com/repos/matplotlib/matplotlib/statuses/bb042f6407cc0ab9c90fd76cb4cf1df466f81212"}}}}
{"actor":{"display_login":"story645"}}