Return ``(username, email)`` previously saved, or ``(None, None)``.
()
| 385 | |
| 386 | @staticmethod |
| 387 | def get_user_info() -> Tuple[Optional[str], Optional[str]]: |
| 388 | """Return ``(username, email)`` previously saved, or ``(None, None)``.""" |
| 389 | path = get_default_config().credentials_dir / ModelScopeConfig.USER_INFO_FILE_NAME |
| 390 | try: |
| 391 | info = path.read_text(encoding='utf-8') |
| 392 | except (FileNotFoundError, OSError): |
| 393 | return None, None |
| 394 | parts = info.split(':', 1) |
| 395 | if len(parts) == 2: |
| 396 | return parts[0], parts[1] |
| 397 | return None, None |
| 398 | |
| 399 | @staticmethod |
| 400 | def get_git_token() -> Optional[str]: |