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) |
589 self._api_status_path = api_status_path | 591 self._api_status_path = api_status_path |
590 status_file = open(self._api_status_path, 'r+') | 592 status_file = open(self._api_status_path, 'r+') |
591 self._types = json.load(status_file) | 593 self._types = json.load(status_file) |
592 status_file.close() | 594 status_file.close() |
593 | 595 |
594 comments_file = open(doc_comments_path, 'r+') | 596 comments_file = open(doc_comments_path, 'r+') |
595 self._doc_comments = json.load(comments_file) | 597 self._doc_comments = json.load(comments_file) |
596 comments_file.close() | 598 comments_file.close() |
597 | 599 |
598 if _monitor_type_metadata: | 600 if _monitor_type_metadata: |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 pass | 832 pass |
831 else: | 833 else: |
832 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) | 834 _logger.warn('Unknown support_level - %s:%s' % (interface_id, member_id)) |
833 | 835 |
834 return annotations | 836 return annotations |
835 | 837 |
836 def Flush(self): | 838 def Flush(self): |
837 json_file = open(self._api_status_path, 'w+') | 839 json_file = open(self._api_status_path, 'w+') |
838 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) | 840 json.dump(self._types, json_file, indent=2, separators=(',', ': '), sort_key
s=True) |
839 json_file.close() | 841 json_file.close() |
OLD | NEW |