OLD | NEW |
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 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 "@SupportedBrowser(SupportedBrowser.CHROME)", | 578 "@SupportedBrowser(SupportedBrowser.CHROME)", |
579 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 579 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
580 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 580 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
581 ], | 581 ], |
582 }) | 582 }) |
583 | 583 |
584 # TODO(blois): minimize noise and enable by default. | 584 # TODO(blois): minimize noise and enable by default. |
585 _monitor_type_metadata = False | 585 _monitor_type_metadata = False |
586 | 586 |
587 class DartMetadata(object): | 587 class DartMetadata(object): |
588 def __init__(self, api_status_path, doc_comments_path, | 588 def __init__(self, api_status_path, doc_comments_path): |
589 logging_level=logging.WARNING): | |
590 _logger.setLevel(logging_level) | |
591 self._api_status_path = api_status_path | 589 self._api_status_path = api_status_path |
592 status_file = open(self._api_status_path, 'r+') | 590 status_file = open(self._api_status_path, 'r+') |
593 self._types = json.load(status_file) | 591 self._types = json.load(status_file) |
594 status_file.close() | 592 status_file.close() |
595 | 593 |
596 comments_file = open(doc_comments_path, 'r+') | 594 comments_file = open(doc_comments_path, 'r+') |
597 self._doc_comments = json.load(comments_file) | 595 self._doc_comments = json.load(comments_file) |
598 comments_file.close() | 596 comments_file.close() |
599 | 597 |
600 if _monitor_type_metadata: | 598 if _monitor_type_metadata: |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 pass | 830 pass |
833 else: | 831 else: |
834 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) | 832 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) |
835 | 833 |
836 return annotations | 834 return annotations |
837 | 835 |
838 def Flush(self): | 836 def Flush(self): |
839 json_file = open(self._api_status_path, 'w+') | 837 json_file = open(self._api_status_path, 'w+') |
840 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) | 838 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) |
841 json_file.close() | 839 json_file.close() |
OLD | NEW |