From e159a651189a62e1177b9523b93cfee90ec35a04 Mon Sep 17 00:00:00 2001 From: Vijay Janapa Reddi Date: Fri, 28 Nov 2025 23:39:13 +0100 Subject: [PATCH] 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 --- tito/commands/{ => _archived}/clean.py | 0 tito/commands/{ => _archived}/help.py | 0 tito/commands/{ => _archived}/notebooks.py | 0 tito/commands/{ => _archived}/status.py | 0 tito/commands/{module_reset.py => module/reset.py} | 6 +++--- tito/commands/{module_workflow.py => module/workflow.py} | 0 tito/commands/{ => package}/nbdev.py | 0 tito/commands/{ => package}/package.py | 0 tito/commands/{ => package}/reset.py | 0 tito/commands/{ => system}/health.py | 0 tito/commands/{ => system}/info.py | 0 tito/commands/{ => system}/jupyter.py | 0 tito/commands/{ => system}/system.py | 0 13 files changed, 3 insertions(+), 3 deletions(-) rename tito/commands/{ => _archived}/clean.py (100%) rename tito/commands/{ => _archived}/help.py (100%) rename tito/commands/{ => _archived}/notebooks.py (100%) rename tito/commands/{ => _archived}/status.py (100%) rename tito/commands/{module_reset.py => module/reset.py} (99%) rename tito/commands/{module_workflow.py => module/workflow.py} (100%) rename tito/commands/{ => package}/nbdev.py (100%) rename tito/commands/{ => package}/package.py (100%) rename tito/commands/{ => package}/reset.py (100%) rename tito/commands/{ => system}/health.py (100%) rename tito/commands/{ => system}/info.py (100%) rename tito/commands/{ => system}/jupyter.py (100%) rename tito/commands/{ => system}/system.py (100%) diff --git a/tito/commands/clean.py b/tito/commands/_archived/clean.py similarity index 100% rename from tito/commands/clean.py rename to tito/commands/_archived/clean.py diff --git a/tito/commands/help.py b/tito/commands/_archived/help.py similarity index 100% rename from tito/commands/help.py rename to tito/commands/_archived/help.py diff --git a/tito/commands/notebooks.py b/tito/commands/_archived/notebooks.py similarity index 100% rename from tito/commands/notebooks.py rename to tito/commands/_archived/notebooks.py diff --git a/tito/commands/status.py b/tito/commands/_archived/status.py similarity index 100% rename from tito/commands/status.py rename to tito/commands/_archived/status.py diff --git a/tito/commands/module_reset.py b/tito/commands/module/reset.py similarity index 99% rename from tito/commands/module_reset.py rename to tito/commands/module/reset.py index 96b95bed..0297490d 100644 --- a/tito/commands/module_reset.py +++ b/tito/commands/module/reset.py @@ -23,7 +23,7 @@ from rich.panel import Panel from rich.table import Table from rich.text import Text -from .base import BaseCommand +from ..base import BaseCommand class ModuleResetCommand(BaseCommand): @@ -694,11 +694,11 @@ class ModuleResetCommand(BaseCommand): console = self.console # Handle --all (reset all modules) - if args.all: + if getattr(args, 'all', False): return self._reset_all_modules(args) # Handle --list-backups - if args.list_backups: + if getattr(args, 'list_backups', False): if not args.module_number: console.print( "[red]Error: --list-backups requires a module number[/red]" diff --git a/tito/commands/module_workflow.py b/tito/commands/module/workflow.py similarity index 100% rename from tito/commands/module_workflow.py rename to tito/commands/module/workflow.py diff --git a/tito/commands/nbdev.py b/tito/commands/package/nbdev.py similarity index 100% rename from tito/commands/nbdev.py rename to tito/commands/package/nbdev.py diff --git a/tito/commands/package.py b/tito/commands/package/package.py similarity index 100% rename from tito/commands/package.py rename to tito/commands/package/package.py diff --git a/tito/commands/reset.py b/tito/commands/package/reset.py similarity index 100% rename from tito/commands/reset.py rename to tito/commands/package/reset.py diff --git a/tito/commands/health.py b/tito/commands/system/health.py similarity index 100% rename from tito/commands/health.py rename to tito/commands/system/health.py diff --git a/tito/commands/info.py b/tito/commands/system/info.py similarity index 100% rename from tito/commands/info.py rename to tito/commands/system/info.py diff --git a/tito/commands/jupyter.py b/tito/commands/system/jupyter.py similarity index 100% rename from tito/commands/jupyter.py rename to tito/commands/system/jupyter.py diff --git a/tito/commands/system.py b/tito/commands/system/system.py similarity index 100% rename from tito/commands/system.py rename to tito/commands/system/system.py