Keyboard firmwares for Atmel AVR and Cortex-M
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

host_registry.py 1.2KB

123456789101112131415161718192021222324252627282930313233343536
  1. """
  2. mbed SDK
  3. Copyright (c) 2011-2013 ARM Limited
  4. Licensed under the Apache License, Version 2.0 (the "License");
  5. you may not use this file except in compliance with the License.
  6. You may obtain a copy of the License at
  7. http://www.apache.org/licenses/LICENSE-2.0
  8. Unless required by applicable law or agreed to in writing, software
  9. distributed under the License is distributed on an "AS IS" BASIS,
  10. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  11. See the License for the specific language governing permissions and
  12. limitations under the License.
  13. """
  14. class HostRegistry:
  15. """ Class stores registry with host tests and objects representing them
  16. """
  17. HOST_TESTS = {} # host_test_name -> host_test_ojbect
  18. def register_host_test(self, ht_name, ht_object):
  19. if ht_name not in self.HOST_TESTS:
  20. self.HOST_TESTS[ht_name] = ht_object
  21. def unregister_host_test(self):
  22. if ht_name in HOST_TESTS:
  23. self.HOST_TESTS[ht_name] = None
  24. def get_host_test(self, ht_name):
  25. return self.HOST_TESTS[ht_name] if ht_name in self.HOST_TESTS else None
  26. def is_host_test(self, ht_name):
  27. return ht_name in self.HOST_TESTS