{"action":"created","comment":{"url":"https://api.github.com/repos/mapsme/omim/pulls/comments/45718501","id":45718501,"diff_hunk":"@@ -0,0 +1,73 @@\n+# Tool shows following information about classes\n+#  - zooms range, for classes with a style\n+#  - classes without a style\n+\n+import sys\n+import csv\n+import drules_struct_pb2\n+\n+def GetAllClasses(mapping_path):\n+    class_order = []\n+    for row in csv.reader(open(mapping_path), delimiter=';'):\n+        cl = row[0].replace(\"|\", \"-\")\n+        if row[2] != \"x\":\n+            class_order.append(cl)\n+    class_order.sort()\n+    return class_order\n+\n+def GetClassesZoomRange(drules_path):\n+    drules = drules_struct_pb2.ContainerProto()\n+    drules.ParseFromString(open(drules_path).read())\n+    result = {}\n+    for rule in drules.cont:\n+        name = str(rule.name)\n+        zooms = [-1, -1]\n+        for elem in rule.element:\n+            if elem.scale >= 0:\n+                if zooms[0] == -1 or elem.scale < zooms[0]:\n+                    zooms[0] = elem.scale\n+                if zooms[1] == -1 or elem.scale > zooms[1]:\n+                    zooms[1] = elem.scale\n+        if zooms[0] != -1:\n+            if name in result:\n+                if result[name][0].scale < zooms[0]:\n+                    zooms[0] = result[name][0].scale\n+                if result[name][1].scale > zooms[1]:\n+                    zooms[1] = result[name][1].scale\n+            result[name] = zooms\n+    return result\n+\n+def ShowZoomInfo(mapping_path, drules_path):\n+    classes_order = GetAllClasses(mapping_path)\n+    classes_zooms = GetClassesZoomRange(drules_path)\n+\n+    classes_with_style = []\n+    classes_without_style = []\n+\n+    for c in classes_order:\n+        if c in classes_zooms:\n+            classes_with_style.append(c)\n+        else:\n+            classes_without_style.append(c)\n+\n+    classes_with_style.sort()\n+    classes_without_style.sort()\n+\n+    print \"Classes with a style: (%s)\" % (str(len(classes_with_style)))","path":"tools/python/stylesheet/drules_info.py","position":56,"original_position":56,"commit_id":"d2d9447e077b3e105500642ca565b8bdf7f57030","original_commit_id":"d2d9447e077b3e105500642ca565b8bdf7f57030","user":{"login":"Zverik","id":766031,"avatar_url":"https://avatars.githubusercontent.com/u/766031?v=3","gravatar_id":"","url":"https://api.github.com/users/Zverik","html_url":"https://github.com/Zverik","followers_url":"https://api.github.com/users/Zverik/followers","following_url":"https://api.github.com/users/Zverik/following{/other_user}","gists_url":"https://api.github.com/users/Zverik/gists{/gist_id}","starred_url":"https://api.github.com/users/Zverik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zverik/subscriptions","organizations_url":"https://api.github.com/users/Zverik/orgs","repos_url":"https://api.github.com/users/Zverik/repos","events_url":"https://api.github.com/users/Zverik/events{/privacy}","received_events_url":"https://api.github.com/users/Zverik/received_events","type":"User","site_admin":false},"body":"Зачем печатать классы со стилями? Этого нет в ТЗ, а две трети кода, кажется, решают только эту задачу.","created_at":"2015-11-24T10:32:10Z","updated_at":"2015-11-24T10:32:10Z","html_url":"https://github.com/mapsme/omim/pull/688#discussion_r45718501","pull_request_url":"https://api.github.com/repos/mapsme/omim/pulls/688","_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments/45718501"},"html":{"href":"https://github.com/mapsme/omim/pull/688#discussion_r45718501"},"pull_request":{"href":"https://api.github.com/repos/mapsme/omim/pulls/688"}}},"pull_request":{"url":"https://api.github.com/repos/mapsme/omim/pulls/688","id":51640969,"html_url":"https://github.com/mapsme/omim/pull/688","diff_url":"https://github.com/mapsme/omim/pull/688.diff","patch_url":"https://github.com/mapsme/omim/pull/688.patch","issue_url":"https://api.github.com/repos/mapsme/omim/issues/688","number":688,"state":"open","locked":false,"title":"Added tool which shows classes without a style","user":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"body":"Cherry-pick from The Master","created_at":"2015-11-24T10:27:08Z","updated_at":"2015-11-24T10:32:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bc336b118370fad606eeadb8cb91cfdce1011e6b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mapsme/omim/pulls/688/commits","review_comments_url":"https://api.github.com/repos/mapsme/omim/pulls/688/comments","review_comment_url":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mapsme/omim/issues/688/comments","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/d2d9447e077b3e105500642ca565b8bdf7f57030","head":{"label":"kshalnev:drape-2.0_drules_info","ref":"drape-2.0_drules_info","sha":"d2d9447e077b3e105500642ca565b8bdf7f57030","user":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"repo":{"id":43427584,"name":"omim","full_name":"kshalnev/omim","owner":{"login":"kshalnev","id":8023141,"avatar_url":"https://avatars.githubusercontent.com/u/8023141?v=3","gravatar_id":"","url":"https://api.github.com/users/kshalnev","html_url":"https://github.com/kshalnev","followers_url":"https://api.github.com/users/kshalnev/followers","following_url":"https://api.github.com/users/kshalnev/following{/other_user}","gists_url":"https://api.github.com/users/kshalnev/gists{/gist_id}","starred_url":"https://api.github.com/users/kshalnev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kshalnev/subscriptions","organizations_url":"https://api.github.com/users/kshalnev/orgs","repos_url":"https://api.github.com/users/kshalnev/repos","events_url":"https://api.github.com/users/kshalnev/events{/privacy}","received_events_url":"https://api.github.com/users/kshalnev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kshalnev/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":true,"url":"https://api.github.com/repos/kshalnev/omim","forks_url":"https://api.github.com/repos/kshalnev/omim/forks","keys_url":"https://api.github.com/repos/kshalnev/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kshalnev/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kshalnev/omim/teams","hooks_url":"https://api.github.com/repos/kshalnev/omim/hooks","issue_events_url":"https://api.github.com/repos/kshalnev/omim/issues/events{/number}","events_url":"https://api.github.com/repos/kshalnev/omim/events","assignees_url":"https://api.github.com/repos/kshalnev/omim/assignees{/user}","branches_url":"https://api.github.com/repos/kshalnev/omim/branches{/branch}","tags_url":"https://api.github.com/repos/kshalnev/omim/tags","blobs_url":"https://api.github.com/repos/kshalnev/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kshalnev/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kshalnev/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/kshalnev/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kshalnev/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/kshalnev/omim/languages","stargazers_url":"https://api.github.com/repos/kshalnev/omim/stargazers","contributors_url":"https://api.github.com/repos/kshalnev/omim/contributors","subscribers_url":"https://api.github.com/repos/kshalnev/omim/subscribers","subscription_url":"https://api.github.com/repos/kshalnev/omim/subscription","commits_url":"https://api.github.com/repos/kshalnev/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/kshalnev/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/kshalnev/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/kshalnev/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/kshalnev/omim/contents/{+path}","compare_url":"https://api.github.com/repos/kshalnev/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kshalnev/omim/merges","archive_url":"https://api.github.com/repos/kshalnev/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kshalnev/omim/downloads","issues_url":"https://api.github.com/repos/kshalnev/omim/issues{/number}","pulls_url":"https://api.github.com/repos/kshalnev/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/kshalnev/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/kshalnev/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kshalnev/omim/labels{/name}","releases_url":"https://api.github.com/repos/kshalnev/omim/releases{/id}","created_at":"2015-09-30T10:46:32Z","updated_at":"2015-09-30T10:49:20Z","pushed_at":"2015-11-24T10:25:09Z","git_url":"git://github.com/kshalnev/omim.git","ssh_url":"git@github.com:kshalnev/omim.git","clone_url":"https://github.com/kshalnev/omim.git","svn_url":"https://github.com/kshalnev/omim","homepage":null,"size":1886684,"stargazers_count":0,"watchers_count":0,"language":"C++","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":"mapsme:drape-2.0","ref":"drape-2.0","sha":"897f697cd71477c2365a9b72d0b1bad1ddfa0e65","user":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"repo":{"id":42798033,"name":"omim","full_name":"mapsme/omim","owner":{"login":"mapsme","id":14185141,"avatar_url":"https://avatars.githubusercontent.com/u/14185141?v=3","gravatar_id":"","url":"https://api.github.com/users/mapsme","html_url":"https://github.com/mapsme","followers_url":"https://api.github.com/users/mapsme/followers","following_url":"https://api.github.com/users/mapsme/following{/other_user}","gists_url":"https://api.github.com/users/mapsme/gists{/gist_id}","starred_url":"https://api.github.com/users/mapsme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mapsme/subscriptions","organizations_url":"https://api.github.com/users/mapsme/orgs","repos_url":"https://api.github.com/users/mapsme/repos","events_url":"https://api.github.com/users/mapsme/events{/privacy}","received_events_url":"https://api.github.com/users/mapsme/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mapsme/omim","description":"MAPS.ME - Offline OpenStreetMap maps for iOS/Android/Mac/Linux/Windows","fork":false,"url":"https://api.github.com/repos/mapsme/omim","forks_url":"https://api.github.com/repos/mapsme/omim/forks","keys_url":"https://api.github.com/repos/mapsme/omim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mapsme/omim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mapsme/omim/teams","hooks_url":"https://api.github.com/repos/mapsme/omim/hooks","issue_events_url":"https://api.github.com/repos/mapsme/omim/issues/events{/number}","events_url":"https://api.github.com/repos/mapsme/omim/events","assignees_url":"https://api.github.com/repos/mapsme/omim/assignees{/user}","branches_url":"https://api.github.com/repos/mapsme/omim/branches{/branch}","tags_url":"https://api.github.com/repos/mapsme/omim/tags","blobs_url":"https://api.github.com/repos/mapsme/omim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mapsme/omim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mapsme/omim/git/refs{/sha}","trees_url":"https://api.github.com/repos/mapsme/omim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mapsme/omim/statuses/{sha}","languages_url":"https://api.github.com/repos/mapsme/omim/languages","stargazers_url":"https://api.github.com/repos/mapsme/omim/stargazers","contributors_url":"https://api.github.com/repos/mapsme/omim/contributors","subscribers_url":"https://api.github.com/repos/mapsme/omim/subscribers","subscription_url":"https://api.github.com/repos/mapsme/omim/subscription","commits_url":"https://api.github.com/repos/mapsme/omim/commits{/sha}","git_commits_url":"https://api.github.com/repos/mapsme/omim/git/commits{/sha}","comments_url":"https://api.github.com/repos/mapsme/omim/comments{/number}","issue_comment_url":"https://api.github.com/repos/mapsme/omim/issues/comments{/number}","contents_url":"https://api.github.com/repos/mapsme/omim/contents/{+path}","compare_url":"https://api.github.com/repos/mapsme/omim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mapsme/omim/merges","archive_url":"https://api.github.com/repos/mapsme/omim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mapsme/omim/downloads","issues_url":"https://api.github.com/repos/mapsme/omim/issues{/number}","pulls_url":"https://api.github.com/repos/mapsme/omim/pulls{/number}","milestones_url":"https://api.github.com/repos/mapsme/omim/milestones{/number}","notifications_url":"https://api.github.com/repos/mapsme/omim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mapsme/omim/labels{/name}","releases_url":"https://api.github.com/repos/mapsme/omim/releases{/id}","created_at":"2015-09-20T02:57:13Z","updated_at":"2015-11-24T07:04:16Z","pushed_at":"2015-11-24T10:27:08Z","git_url":"git://github.com/mapsme/omim.git","ssh_url":"git@github.com:mapsme/omim.git","clone_url":"https://github.com/mapsme/omim.git","svn_url":"https://github.com/mapsme/omim","homepage":null,"size":1899334,"stargazers_count":1492,"watchers_count":1492,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":176,"mirror_url":null,"open_issues_count":64,"forks":176,"open_issues":64,"watchers":1492,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mapsme/omim/pulls/688"},"html":{"href":"https://github.com/mapsme/omim/pull/688"},"issue":{"href":"https://api.github.com/repos/mapsme/omim/issues/688"},"comments":{"href":"https://api.github.com/repos/mapsme/omim/issues/688/comments"},"review_comments":{"href":"https://api.github.com/repos/mapsme/omim/pulls/688/comments"},"review_comment":{"href":"https://api.github.com/repos/mapsme/omim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mapsme/omim/pulls/688/commits"},"statuses":{"href":"https://api.github.com/repos/mapsme/omim/statuses/d2d9447e077b3e105500642ca565b8bdf7f57030"}}}}