MCPcopy Index your code
hub / github.com/python/cpython / copy_with

Method copy_with

Lib/_colorize.py:386–410  ·  view source on GitHub ↗

Return a new Theme based on this instance with some sections replaced. Themes are immutable to protect against accidental modifications that could lead to invalid terminal states.

(
        self,
        *,
        argparse: Argparse | None = None,
        difflib: Difflib | None = None,
        fancycompleter: FancyCompleter | None = None,
        live_profiler: LiveProfiler | None = None,
        syntax: Syntax | None = None,
        traceback: Traceback | None = None,
        unittest: Unittest | None = None,
    )

Source from the content-addressed store, hash-verified

384 unittest: Unittest = field(default_factory=Unittest)
385
386 def copy_with(
387 self,
388 *,
389 argparse: Argparse | None = None,
390 difflib: Difflib | None = None,
391 fancycompleter: FancyCompleter | None = None,
392 live_profiler: LiveProfiler | None = None,
393 syntax: Syntax | None = None,
394 traceback: Traceback | None = None,
395 unittest: Unittest | None = None,
396 ) -> Self:
397 """Return a new Theme based on this instance with some sections replaced.
398
399 Themes are immutable to protect against accidental modifications that
400 could lead to invalid terminal states.
401 """
402 return type(self)(
403 argparse=argparse or self.argparse,
404 difflib=difflib or self.difflib,
405 fancycompleter=fancycompleter or self.fancycompleter,
406 live_profiler=live_profiler or self.live_profiler,
407 syntax=syntax or self.syntax,
408 traceback=traceback or self.traceback,
409 unittest=unittest or self.unittest,
410 )
411
412 @classmethod
413 def no_colors(cls) -> Self:

Callers 2

test_copy_withMethod · 0.95
_colorize.pyFile · 0.45

Calls

no outgoing calls

Tested by 1

test_copy_withMethod · 0.76