beta_status.py 992 B

12345678910111213141516171819202122232425262728293031
  1. from docutils import nodes
  2. from docutils.parsers.rst import Directive
  3. class BetaStatus(Directive):
  4. has_content = True
  5. text = "The {api_name} is in Beta stage, and backward compatibility is not guaranteed."
  6. node = nodes.warning
  7. def run(self):
  8. text = self.text.format(api_name=" ".join(self.content))
  9. return [self.node("", nodes.paragraph("", "", nodes.Text(text)))]
  10. class V2BetaStatus(BetaStatus):
  11. text = (
  12. "The {api_name} is in Beta stage, and while we do not expect disruptive breaking changes, "
  13. "some APIs may slightly change according to user feedback. Please submit any feedback you may have "
  14. "in this issue: https://github.com/pytorch/vision/issues/6753."
  15. )
  16. node = nodes.note
  17. def setup(app):
  18. app.add_directive("betastatus", BetaStatus)
  19. app.add_directive("v2betastatus", V2BetaStatus)
  20. return {
  21. "version": "0.1",
  22. "parallel_read_safe": True,
  23. "parallel_write_safe": True,
  24. }