Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(727)

Side by Side Diff: tools/dom/scripts/dartmetadata.py

Issue 444743002: Use Blink IDL parser for dart libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: cleanup Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality to provide Dart metadata for 6 """This module provides shared functionality to provide Dart metadata for
7 DOM APIs. 7 DOM APIs.
8 """ 8 """
9 9
10 import copy 10 import copy
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 "@SupportedBrowser(SupportedBrowser.CHROME)", 569 "@SupportedBrowser(SupportedBrowser.CHROME)",
570 "@SupportedBrowser(SupportedBrowser.FIREFOX)", 570 "@SupportedBrowser(SupportedBrowser.FIREFOX)",
571 "@SupportedBrowser(SupportedBrowser.SAFARI)", 571 "@SupportedBrowser(SupportedBrowser.SAFARI)",
572 ], 572 ],
573 }) 573 })
574 574
575 # TODO(blois): minimize noise and enable by default. 575 # TODO(blois): minimize noise and enable by default.
576 _monitor_type_metadata = False 576 _monitor_type_metadata = False
577 577
578 class DartMetadata(object): 578 class DartMetadata(object):
579 def __init__(self, api_status_path, doc_comments_path): 579 def __init__(self, api_status_path, doc_comments_path,
580 logging_level=logging.WARNING):
581 _logger.setLevel(logging_level)
580 self._api_status_path = api_status_path 582 self._api_status_path = api_status_path
581 status_file = open(self._api_status_path, 'r+') 583 status_file = open(self._api_status_path, 'r+')
582 self._types = json.load(status_file) 584 self._types = json.load(status_file)
583 status_file.close() 585 status_file.close()
584 586
585 comments_file = open(doc_comments_path, 'r+') 587 comments_file = open(doc_comments_path, 'r+')
586 self._doc_comments = json.load(comments_file) 588 self._doc_comments = json.load(comments_file)
587 comments_file.close() 589 comments_file.close()
588 590
589 if _monitor_type_metadata: 591 if _monitor_type_metadata:
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 pass 821 pass
820 else: 822 else:
821 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) 823 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id))
822 824
823 return annotations 825 return annotations
824 826
825 def Flush(self): 827 def Flush(self):
826 json_file = open(self._api_status_path, 'w+') 828 json_file = open(self._api_status_path, 'w+')
827 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key s=True) 829 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key s=True)
828 json_file.close() 830 json_file.close()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698