mirror of
https://github.com/MLSysBook/TinyTorch.git
synced 2026-04-30 09:50:22 -05:00
Fix module reset command: use getattr for optional args
- Fix AttributeError when calling reset without --all flag - Use getattr() with defaults for 'all' and 'list_backups' attributes
This commit is contained in:
@@ -23,7 +23,7 @@ from rich.panel import Panel
|
|||||||
from rich.table import Table
|
from rich.table import Table
|
||||||
from rich.text import Text
|
from rich.text import Text
|
||||||
|
|
||||||
from .base import BaseCommand
|
from ..base import BaseCommand
|
||||||
|
|
||||||
|
|
||||||
class ModuleResetCommand(BaseCommand):
|
class ModuleResetCommand(BaseCommand):
|
||||||
@@ -694,11 +694,11 @@ class ModuleResetCommand(BaseCommand):
|
|||||||
console = self.console
|
console = self.console
|
||||||
|
|
||||||
# Handle --all (reset all modules)
|
# Handle --all (reset all modules)
|
||||||
if args.all:
|
if getattr(args, 'all', False):
|
||||||
return self._reset_all_modules(args)
|
return self._reset_all_modules(args)
|
||||||
|
|
||||||
# Handle --list-backups
|
# Handle --list-backups
|
||||||
if args.list_backups:
|
if getattr(args, 'list_backups', False):
|
||||||
if not args.module_number:
|
if not args.module_number:
|
||||||
console.print(
|
console.print(
|
||||||
"[red]Error: --list-backups requires a module number[/red]"
|
"[red]Error: --list-backups requires a module number[/red]"
|
||||||
Reference in New Issue
Block a user