| 26 | |
| 27 | |
| 28 | class SessionNameValidator: |
| 29 | |
| 30 | def __init__(self, error_message: str): |
| 31 | self.error_message = error_message |
| 32 | |
| 33 | def __call__(self, value: str) -> str: |
| 34 | # Session name can be a path or just a name. |
| 35 | if (os.path.sep not in value |
| 36 | and not VALID_SESSION_NAME_PATTERN.search(value)): |
| 37 | raise argparse.ArgumentError(None, self.error_message) |
| 38 | return value |
| 39 | |
| 40 | |
| 41 | class Escaped(str): |