Skip to content

Commit aae5f38

Browse files
committed
Rename CommandSet.__private_cmd to CommandSet.__cmd_internal.
1 parent ad1e717 commit aae5f38

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

cmd2/command_definition.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,27 @@ def __init__(self) -> None:
9595
# Private reference to the CLI instance in which this CommandSet running.
9696
# This will be set when the CommandSet is registered and it should be
9797
# 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
9999

100100
self._settables: Dict[str, Settable] = {}
101101
self._settable_prefix = self.__class__.__name__
102102

103103
@property
104104
def _cmd(self) -> 'cmd2.Cmd':
105105
"""
106-
Property for child classes to access self.__private_cmd.
106+
Property for child classes to access self.__cmd_internal.
107107
108-
Using this property ensures that self.__private_cmd has been set
108+
Using this property ensures that self.__cmd_internal has been set
109109
and it tells type checkers that it's no longer a None type.
110110
111111
Override this property if you need to change its return type to a
112112
child class of Cmd.
113113
114114
:raises: CommandSetRegistrationError if CommandSet is not registered.
115115
"""
116-
if self.__private_cmd is None:
116+
if self.__cmd_internal is None:
117117
raise CommandSetRegistrationError('This CommandSet is not registered')
118-
return self.__private_cmd
118+
return self.__cmd_internal
119119

120120
def on_register(self, cmd: 'cmd2.Cmd') -> None:
121121
"""
@@ -126,8 +126,8 @@ def on_register(self, cmd: 'cmd2.Cmd') -> None:
126126
:param cmd: The cmd2 main application
127127
:raises: CommandSetRegistrationError if CommandSet is already registered.
128128
"""
129-
if self.__private_cmd is None:
130-
self.__private_cmd = cmd
129+
if self.__cmd_internal is None:
130+
self.__cmd_internal = cmd
131131
else:
132132
raise CommandSetRegistrationError('This CommandSet has already been registered')
133133

@@ -151,7 +151,7 @@ def on_unregistered(self) -> None:
151151
Called by ``cmd2.Cmd`` after a CommandSet has been unregistered and all its commands removed from the CLI.
152152
Subclasses can override this to perform remaining cleanup steps.
153153
"""
154-
self.__private_cmd = None
154+
self.__cmd_internal = None
155155

156156
@property
157157
def settable_prefix(self) -> str:
@@ -167,7 +167,7 @@ def add_settable(self, settable: Settable) -> None:
167167
168168
:param settable: Settable object being added
169169
"""
170-
if self.__private_cmd is not None:
170+
if self.__cmd_internal is not None:
171171
if not self._cmd.always_prefix_settables:
172172
if settable.name in self._cmd.settables.keys() and settable.name not in self._settables.keys():
173173
raise KeyError(f'Duplicate settable: {settable.name}')

0 commit comments

Comments
 (0)