__init__.py 455 B

123456789101112131415161718
  1. # Copyright (c) Microsoft Corporation. All rights reserved.
  2. # Licensed under the MIT License.
  3. """
  4. Short examples used in the documentation.
  5. """
  6. import os
  7. def get_example(name):
  8. """
  9. Retrieves the absolute file name of an example.
  10. """
  11. this = os.path.abspath(os.path.dirname(__file__))
  12. full = os.path.join(this, name)
  13. if not os.path.exists(full):
  14. raise FileNotFoundError(f"Unable to find example '{name}'")
  15. return full