From 56a58f35b40122b09b4876ce525f047159fc4eb9 Mon Sep 17 00:00:00 2001 From: Michael Ardron Date: Fri, 6 Oct 2023 21:16:30 -0700 Subject: [PATCH 1/7] disableColoring and Enable Coloring methods for IceCreamDebugger --- icecream/icecream.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/icecream/icecream.py b/icecream/icecream.py index 435518f..adad418 100644 --- a/icecream/icecream.py +++ b/icecream/icecream.py @@ -369,6 +369,20 @@ def configureOutput(self, prefix=_absent, outputFunction=_absent, if contextAbsPath is not _absent: self.contextAbsPath = contextAbsPath + + def disableColoring(self): + """Disable color output by rerouting outputFunction to sys.stderr""" + + self.color_outputFunction = self.outputFunction + self.outputFunction = stderrPrint + + def enableColoring(self): + """Renable color output by restoring original output function""" + + # Check if color_outputFunction has been set already. + # If not then coloring hasn't been disabled so do nothing + if hasattr(self, "color_outputFunction"): + self.outputFunction = self.color_outputFunction ic = IceCreamDebugger() From b275568a09a15cbc7d303fb11ae8954ff6d5cb06 Mon Sep 17 00:00:00 2001 From: Michael Ardron Date: Fri, 6 Oct 2023 21:17:10 -0700 Subject: [PATCH 2/7] .vscode added to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 5a8edc0..264d4d7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ build/ *.pyo *.egg *.egg-info +.vscode From 0e0042d76eec64c48cc96014c84f4a3ad6cb294e Mon Sep 17 00:00:00 2001 From: Michael Ardron Date: Fri, 6 Oct 2023 21:22:44 -0700 Subject: [PATCH 3/7] disable and enable coloring documented in readme --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index 778e044..1b29c40 100644 --- a/README.md +++ b/README.md @@ -184,6 +184,15 @@ ic| 3: 3 `ic()` continues to return its arguments when disabled, of course; no existing code with `ic()` breaks. +Finally, by default `ic()` will produce an output with coloring. Colored output can be disabled and enabled. + +``` +ic.disableColoring() + +ic.enableColoring() + +``` + ### Import Tricks From 8b3be6b33b1d4fbf9e2537a02ad23797b378ca5e Mon Sep 17 00:00:00 2001 From: fanoway <86997883+fanoway@users.noreply.github.com> Date: Fri, 6 Oct 2023 21:23:54 -0700 Subject: [PATCH 4/7] Update ci.yml to remove filter on branch name --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dd8db2..79cd70b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,8 @@ name: CI on: push: - branches: - - master + # branches: + # - master pull_request: branches: - master From 2f2028a03c1eb6d2423183e51894b971efffc60c Mon Sep 17 00:00:00 2001 From: Michael Ardron Date: Fri, 6 Oct 2023 21:25:03 -0700 Subject: [PATCH 5/7] ci.yml updated to remove filter on branch --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9dd8db2..79cd70b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,8 +2,8 @@ name: CI on: push: - branches: - - master + # branches: + # - master pull_request: branches: - master From 6f59396b311092fc8cfcbcb5645232137e1e00ba Mon Sep 17 00:00:00 2001 From: Michael Ardron Date: Fri, 6 Oct 2023 21:26:54 -0700 Subject: [PATCH 6/7] py27 removed as support is dropped in github --- .github/workflows/ci.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79cd70b..a4a2f7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,6 @@ jobs: strategy: matrix: include: - - python-version: 2.7 - toxenv: py27 - python-version: 3.5 toxenv: py35 - python-version: 3.6 From b1bb4adb805be0648a7759cb100a5db1568de10f Mon Sep 17 00:00:00 2001 From: Michael Ardron Date: Fri, 6 Oct 2023 21:29:44 -0700 Subject: [PATCH 7/7] py27 and pypy27 dropped --- .github/workflows/ci.yml | 2 -- tox.ini | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a4a2f7b..9ee5dee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,6 @@ jobs: toxenv: py38 - python-version: 3.9 toxenv: py39 - - python-version: pypy-2.7 - toxenv: pypy - python-version: pypy-3.7 toxenv: pypy3 diff --git a/tox.ini b/tox.ini index 0652468..5224f3f 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py27, py35, py36, py37, py38, py39, pypy, pypy3 +envlist = py35, py36, py37, py38, py39, pypy, pypy3 [testenv] deps =