{"action":"created","comment":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/26729669","id":26729669,"diff_hunk":"@@ -84,6 +91,101 @@ def use(style):\n                 raise IOError(msg % style)\n \n \n+def get_parents_styles(styles):\n+    \"\"\" Returns a list of all styles with parent styles included\n+    Parameters\n+    ----------\n+    styles = list of str and/or dict\n+    Example\n+    -------\n+    Let us consider multiple stylesheet calling each other\n+    main\n+    |\n+    |- a\n+    |  |- a1\n+    |  |- a2\n+    |\n+    |- b\n+    |  |- b1\n+    |  |- b2\n+    |\n+    |- c\n+       |- c1\n+       |- c2\n+    This means that `main` calls `a`, `b`, and `c`\n+    Similar pattern for a, b and c.\n+    When calling `matplotlib.style.use(['main']), we will call all the\n+    stylesheets recursively add apply all styles. In this example, it would\n+    return the following list\n+    ['c2', 'c1', 'c', 'b2', 'b1', 'b', 'a2', 'a1', 'a', 'main']\n+    \"\"\"\n+    styles = [styles]\n+    has_parent = True\n+    full_styles = []\n+    temp_styles = styles[:]\n+\n+    while has_parent:\n+        has_parent = False\n+        for style in styles:\n+            if style in full_styles:\n+                continue\n+            full_styles.append(style)\n+\n+            if _is_dict_like(style):\n+                continue","path":"lib/matplotlib/style/core.py","position":66,"original_position":66,"commit_id":"1506abcdd932c39d5dd1200a99e475df650ecf75","original_commit_id":"1506abcdd932c39d5dd1200a99e475df650ecf75","user":{"login":"tonysyu","id":133031,"avatar_url":"https://avatars.githubusercontent.com/u/133031?v=3","gravatar_id":"","url":"https://api.github.com/users/tonysyu","html_url":"https://github.com/tonysyu","followers_url":"https://api.github.com/users/tonysyu/followers","following_url":"https://api.github.com/users/tonysyu/following{/other_user}","gists_url":"https://api.github.com/users/tonysyu/gists{/gist_id}","starred_url":"https://api.github.com/users/tonysyu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tonysyu/subscriptions","organizations_url":"https://api.github.com/users/tonysyu/orgs","repos_url":"https://api.github.com/users/tonysyu/repos","events_url":"https://api.github.com/users/tonysyu/events{/privacy}","received_events_url":"https://api.github.com/users/tonysyu/received_events","type":"User","site_admin":false},"body":"Is there any reason you decided not to support parent styles in a style-dict? I could either way.","created_at":"2015-03-19T04:49:54Z","updated_at":"2015-03-19T04:49:54Z","html_url":"https://github.com/matplotlib/matplotlib/pull/4240#discussion_r26729669","pull_request_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240","_links":{"self":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments/26729669"},"html":{"href":"https://github.com/matplotlib/matplotlib/pull/4240#discussion_r26729669"},"pull_request":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240"}}},"pull_request":{"url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240","id":31414853,"html_url":"https://github.com/matplotlib/matplotlib/pull/4240","diff_url":"https://github.com/matplotlib/matplotlib/pull/4240.diff","patch_url":"https://github.com/matplotlib/matplotlib/pull/4240.patch","issue_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4240","number":4240,"state":"open","locked":false,"title":"Style RC parameter","user":{"login":"Mrngilles","id":6099267,"avatar_url":"https://avatars.githubusercontent.com/u/6099267?v=3","gravatar_id":"","url":"https://api.github.com/users/Mrngilles","html_url":"https://github.com/Mrngilles","followers_url":"https://api.github.com/users/Mrngilles/followers","following_url":"https://api.github.com/users/Mrngilles/following{/other_user}","gists_url":"https://api.github.com/users/Mrngilles/gists{/gist_id}","starred_url":"https://api.github.com/users/Mrngilles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mrngilles/subscriptions","organizations_url":"https://api.github.com/users/Mrngilles/orgs","repos_url":"https://api.github.com/users/Mrngilles/repos","events_url":"https://api.github.com/users/Mrngilles/events{/privacy}","received_events_url":"https://api.github.com/users/Mrngilles/received_events","type":"User","site_admin":false},"body":"Added a style RC parameter to be able to import styles from stylesheet or matplotlibrc.\r\nYou can call a parent stylesheet using the following syntax in your matplotlibrc or a stylesheet: \r\n'style : chosen_style' if the style is in the library (built-in styles or a style put in your user config path\r\n'style : path/to/style' to get a style from anywhere.\r\n\r\nI also added a test to make sure we get the good rcParameters when calling parent styles. For that, I added sample stylesheets in the `sample_data parameter`, that form the same tree as the one seen in the `get_style_parameters` function. It should cover every possible override possible.\r\n\r\n*Priority order remark :* When calling styles this way, the first ones will have the highest priority.\r\n\r\nTodo:\r\n- Breakdown in smaller functions to follow the flow more easily","created_at":"2015-03-18T10:13:11Z","updated_at":"2015-03-19T04:49:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"90140b13b4cdf933ea1fa6bc12ae656d35d8e874","assignee":null,"milestone":{"url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/18","html_url":"https://github.com/matplotlib/matplotlib/milestones/next%20point%20release","labels_url":"https://api.github.com/repos/matplotlib/matplotlib/milestones/18/labels","id":970105,"number":18,"title":"next point release","description":"Next minor release.","creator":{"login":"tacaswell","id":199813,"avatar_url":"https://avatars.githubusercontent.com/u/199813?v=3","gravatar_id":"","url":"https://api.github.com/users/tacaswell","html_url":"https://github.com/tacaswell","followers_url":"https://api.github.com/users/tacaswell/followers","following_url":"https://api.github.com/users/tacaswell/following{/other_user}","gists_url":"https://api.github.com/users/tacaswell/gists{/gist_id}","starred_url":"https://api.github.com/users/tacaswell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tacaswell/subscriptions","organizations_url":"https://api.github.com/users/tacaswell/orgs","repos_url":"https://api.github.com/users/tacaswell/repos","events_url":"https://api.github.com/users/tacaswell/events{/privacy}","received_events_url":"https://api.github.com/users/tacaswell/received_events","type":"User","site_admin":false},"open_issues":170,"closed_issues":70,"state":"open","created_at":"2015-02-07T21:22:30Z","updated_at":"2015-03-18T18:05:40Z","due_on":"2015-07-06T04:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240/commits","review_comments_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240/comments","review_comment_url":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments{/number}","comments_url":"https://api.github.com/repos/matplotlib/matplotlib/issues/4240/comments","statuses_url":"https://api.github.com/repos/matplotlib/matplotlib/statuses/1506abcdd932c39d5dd1200a99e475df650ecf75","head":{"label":"Mrngilles:style_rc","ref":"style_rc","sha":"1506abcdd932c39d5dd1200a99e475df650ecf75","user":{"login":"Mrngilles","id":6099267,"avatar_url":"https://avatars.githubusercontent.com/u/6099267?v=3","gravatar_id":"","url":"https://api.github.com/users/Mrngilles","html_url":"https://github.com/Mrngilles","followers_url":"https://api.github.com/users/Mrngilles/followers","following_url":"https://api.github.com/users/Mrngilles/following{/other_user}","gists_url":"https://api.github.com/users/Mrngilles/gists{/gist_id}","starred_url":"https://api.github.com/users/Mrngilles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mrngilles/subscriptions","organizations_url":"https://api.github.com/users/Mrngilles/orgs","repos_url":"https://api.github.com/users/Mrngilles/repos","events_url":"https://api.github.com/users/Mrngilles/events{/privacy}","received_events_url":"https://api.github.com/users/Mrngilles/received_events","type":"User","site_admin":false},"repo":{"id":31761873,"name":"matplotlib","full_name":"Mrngilles/matplotlib","owner":{"login":"Mrngilles","id":6099267,"avatar_url":"https://avatars.githubusercontent.com/u/6099267?v=3","gravatar_id":"","url":"https://api.github.com/users/Mrngilles","html_url":"https://github.com/Mrngilles","followers_url":"https://api.github.com/users/Mrngilles/followers","following_url":"https://api.github.com/users/Mrngilles/following{/other_user}","gists_url":"https://api.github.com/users/Mrngilles/gists{/gist_id}","starred_url":"https://api.github.com/users/Mrngilles/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Mrngilles/subscriptions","organizations_url":"https://api.github.com/users/Mrngilles/orgs","repos_url":"https://api.github.com/users/Mrngilles/repos","events_url":"https://api.github.com/users/Mrngilles/events{/privacy}","received_events_url":"https://api.github.com/users/Mrngilles/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Mrngilles/matplotlib","description":"matplotlib: plotting with Python","fork":true,"url":"https://api.github.com/repos/Mrngilles/matplotlib","forks_url":"https://api.github.com/repos/Mrngilles/matplotlib/forks","keys_url":"https://api.github.com/repos/Mrngilles/matplotlib/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Mrngilles/matplotlib/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Mrngilles/matplotlib/teams","hooks_url":"https://api.github.com/repos/Mrngilles/matplotlib/hooks","issue_events_url":"https://api.github.com/repos/Mrngilles/matplotlib/issues/events{/number}","events_url":"https://api.github.com/repos/Mrngilles/matplotlib/events","assignees_url":"https://api.github.com/repos/Mrngilles/matplotlib/assignees{/user}","branches_url":"https://api.github.com/repos/Mrngilles/matplotlib/branches{/branch}","tags_url":"https://api.github.com/repos/Mrngilles/matplotlib/tags","blobs_url":"https://api.github.com/repos/Mrngilles/matplotlib/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Mrngilles/matplotlib/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Mrngilles/matplotlib/git/refs{/sha}","trees_url":"https://api.github.com/repos/Mrngilles/matplotlib/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Mrngilles/matplotlib/statuses/{sha}","languages_url":"https://api.github.com/repos/Mrngilles/matplotlib/languages","stargazers_url":"https://api.github.com/repos/Mrngilles/matplotlib/stargazers","contributors_url":"https://api.github.com/repos/Mrngilles/matplotlib/contributors","subscribers_url":"https://api.github.com/repos/Mrngilles/matplotlib/subscribers","subscription_url":"https://api.github.com/repos/Mrngilles/matplotlib/subscription","commits_url":"https://api.github.com/repos/Mrngilles/matplotlib/commits{/sha}","git_commits_url":"https://api.github.com/repos/Mrngilles/matplotlib/git/commits{/sha}","comments_url":"https://api.github.com/repos/Mrngilles/matplotlib/comments{/number}","issue_comment_url":"https://api.github.com/repos/Mrngilles/matplotlib/issues/comments{/number}","contents_url":"https://api.github.com/repos/Mrngilles/matplotlib/contents/{+path}","compare_url":"https://api.github.com/repos/Mrngilles/matplotlib/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Mrngilles/matplotlib/merges","archive_url":"https://api.github.com/repos/Mrngilles/matplotlib/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Mrngilles/matplotlib/downloads","issues_url":"https://api.github.com/repos/Mrngilles/matplotlib/issues{/number}","pulls_url":"https://api.github.com/repos/Mrngilles/matplotlib/pulls{/number}","milestones_url":"https://api.github.com/repos/Mrngilles/matplotlib/milestones{/number}","notifications_url":"https://api.github.com/repos/Mrngilles/matplotlib/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Mrngilles/matplotlib/labels{/name}","releases_url":"https://api.github.com/repos/Mrngilles/matplotlib/releases{/id}","created_at":"2015-03-06T09:23:02Z","updated_at":"2015-03-18T10:04:10Z","pushed_at":"2015-03-18T19:22:26Z","git_url":"git://github.com/Mrngilles/matplotlib.git","ssh_url":"git@github.com:Mrngilles/matplotlib.git","clone_url":"https://github.com/Mrngilles/matplotlib.git","svn_url":"https://github.com/Mrngilles/matplotlib","homepage":"http://matplotlib.org/","size":210884,"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":"be6a691f3826f2e7486903a2dd0b85e364936cee","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}","created_at":"2011-02-19T03:17:12Z","updated_at":"2015-03-19T03:33:01Z","pushed_at":"2015-03-18T18:05:33Z","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":261093,"stargazers_count":2344,"watchers_count":2344,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1179,"mirror_url":null,"open_issues_count":464,"forks":1179,"open_issues":464,"watchers":2344,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240"},"html":{"href":"https://github.com/matplotlib/matplotlib/pull/4240"},"issue":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/4240"},"comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/issues/4240/comments"},"review_comments":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240/comments"},"review_comment":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/matplotlib/matplotlib/pulls/4240/commits"},"statuses":{"href":"https://api.github.com/repos/matplotlib/matplotlib/statuses/1506abcdd932c39d5dd1200a99e475df650ecf75"}}}}