The source code and dockerfile for the GSW2024 AI Lab.
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

38 lines
1.1 KiB

2 months ago
  1. from __future__ import annotations
  2. import re
  3. # stolen from python docs
  4. def trim(docstring):
  5. if not docstring:
  6. return ""
  7. # Convert tabs to spaces (following the normal Python rules)
  8. # and split into a list of lines:
  9. lines = docstring.expandtabs().splitlines()
  10. # Determine minimum indentation (first line doesn't count):
  11. indent = 232323
  12. for line in lines[1:]:
  13. stripped = line.lstrip()
  14. if stripped:
  15. indent = min(indent, len(line) - len(stripped))
  16. # Remove indentation (first line is special):
  17. trimmed = [lines[0].strip()]
  18. if indent < 232323:
  19. for line in lines[1:]:
  20. trimmed.append(line[indent:].rstrip())
  21. # Strip off trailing and leading blank lines:
  22. while trimmed and not trimmed[-1]:
  23. trimmed.pop()
  24. while trimmed and not trimmed[0]:
  25. trimmed.pop(0)
  26. # Return a single string:
  27. return "\n".join(trimmed)
  28. def env_name_format(str):
  29. # KeyCorridorEnv
  30. split = re.findall(r"[A-Z](?:[a-z]+|[A-Z]*(?=[A-Z]|$))", str)
  31. # ['Key', 'Corridor', 'Env']
  32. split = filter(lambda x: x.upper() != "ENV", split)
  33. return " ".join(split)