@@ -95,27 +95,27 @@ def __init__(self) -> None:
95
95
# Private reference to the CLI instance in which this CommandSet running.
96
96
# This will be set when the CommandSet is registered and it should be
97
97
# accessed by child classes using the self._cmd property.
98
- self .__private_cmd : Optional [cmd2 .Cmd ] = None
98
+ self .__cmd_internal : Optional [cmd2 .Cmd ] = None
99
99
100
100
self ._settables : Dict [str , Settable ] = {}
101
101
self ._settable_prefix = self .__class__ .__name__
102
102
103
103
@property
104
104
def _cmd (self ) -> 'cmd2.Cmd' :
105
105
"""
106
- Property for child classes to access self.__private_cmd .
106
+ Property for child classes to access self.__cmd_internal .
107
107
108
- Using this property ensures that self.__private_cmd has been set
108
+ Using this property ensures that self.__cmd_internal has been set
109
109
and it tells type checkers that it's no longer a None type.
110
110
111
111
Override this property if you need to change its return type to a
112
112
child class of Cmd.
113
113
114
114
:raises: CommandSetRegistrationError if CommandSet is not registered.
115
115
"""
116
- if self .__private_cmd is None :
116
+ if self .__cmd_internal is None :
117
117
raise CommandSetRegistrationError ('This CommandSet is not registered' )
118
- return self .__private_cmd
118
+ return self .__cmd_internal
119
119
120
120
def on_register (self , cmd : 'cmd2.Cmd' ) -> None :
121
121
"""
@@ -126,8 +126,8 @@ def on_register(self, cmd: 'cmd2.Cmd') -> None:
126
126
:param cmd: The cmd2 main application
127
127
:raises: CommandSetRegistrationError if CommandSet is already registered.
128
128
"""
129
- if self .__private_cmd is None :
130
- self .__private_cmd = cmd
129
+ if self .__cmd_internal is None :
130
+ self .__cmd_internal = cmd
131
131
else :
132
132
raise CommandSetRegistrationError ('This CommandSet has already been registered' )
133
133
@@ -151,7 +151,7 @@ def on_unregistered(self) -> None:
151
151
Called by ``cmd2.Cmd`` after a CommandSet has been unregistered and all its commands removed from the CLI.
152
152
Subclasses can override this to perform remaining cleanup steps.
153
153
"""
154
- self .__private_cmd = None
154
+ self .__cmd_internal = None
155
155
156
156
@property
157
157
def settable_prefix (self ) -> str :
@@ -167,7 +167,7 @@ def add_settable(self, settable: Settable) -> None:
167
167
168
168
:param settable: Settable object being added
169
169
"""
170
- if self .__private_cmd is not None :
170
+ if self .__cmd_internal is not None :
171
171
if not self ._cmd .always_prefix_settables :
172
172
if settable .name in self ._cmd .settables .keys () and settable .name not in self ._settables .keys ():
173
173
raise KeyError (f'Duplicate settable: { settable .name } ' )
0 commit comments