Skip to content

Commit 1c8d8f3

Browse files
committed
Changed some function signatures.
1 parent d678856 commit 1c8d8f3

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

cmd2/cmd2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,7 +1367,7 @@ def _create_base_printing_console(
13671367
# Check if we should use or update a cached console
13681368
if file is self.stdout:
13691369
cached = self._console_cache.stdout
1370-
if cached is not None and cached.matches_config(file, **kwargs):
1370+
if cached is not None and cached.matches_config(file=file, **kwargs):
13711371
return cached
13721372

13731373
# Create new console and update cache
@@ -1376,7 +1376,7 @@ def _create_base_printing_console(
13761376

13771377
if file is sys.stderr:
13781378
cached = self._console_cache.stderr
1379-
if cached is not None and cached.matches_config(file, **kwargs):
1379+
if cached is not None and cached.matches_config(file=file, **kwargs):
13801380
return cached
13811381

13821382
# Create new console and update cache

cmd2/rich_utils.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def __init__(
161161
)
162162

163163
# Store the configuration used to create this console for caching purposes.
164-
self._config_key = self._generate_config_key(file, kwargs)
164+
self._config_key = self._generate_config_key(file=file, **kwargs)
165165

166166
force_terminal: bool | None = None
167167
force_interactive: bool | None = None
@@ -185,13 +185,17 @@ def __init__(
185185

186186
@staticmethod
187187
def _generate_config_key(
188+
*,
188189
file: IO[str] | None,
189-
kwargs: dict[str, Any],
190+
**kwargs: Any,
190191
) -> tuple[Any, ...]:
191192
"""Generate a key representing the settings used to initialize a console.
192193
193194
This key includes the file identity, global settings (ALLOW_STYLE, APP_THEME),
194195
and any other settings passed in via kwargs.
196+
197+
:param file: file stream being checked
198+
:param kwargs: other console settings
195199
"""
196200
return (
197201
id(file),
@@ -202,16 +206,17 @@ def _generate_config_key(
202206

203207
def matches_config(
204208
self,
209+
*,
205210
file: IO[str] | None,
206211
**kwargs: Any,
207212
) -> bool:
208-
"""Check if this console instance is compatible with the given settings.
213+
"""Check if this console instance was initialized with the specified settings.
209214
210215
:param file: file stream being checked
211-
:param kwargs: formatting settings being checked
216+
:param kwargs: other console settings being checked
212217
:return: True if the settings match this console's configuration
213218
"""
214-
return self._config_key == self._generate_config_key(file, kwargs)
219+
return self._config_key == self._generate_config_key(file=file, **kwargs)
215220

216221
def on_broken_pipe(self) -> None:
217222
"""Override which raises BrokenPipeError instead of SystemExit."""

0 commit comments

Comments
 (0)