Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix lineWrapWidth #94

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions icecream/icecream.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,6 @@ def format_pair(prefix, arg, value):
return '\n'.join(lines)


def argumentToString(obj):
s = DEFAULT_ARG_TO_STRING_FUNCTION(obj)
s = s.replace('\\n', '\n') # Preserve string newlines in output.
return s


class IceCreamDebugger:
Expand All @@ -167,12 +163,18 @@ class IceCreamDebugger:

def __init__(self, prefix=DEFAULT_PREFIX,
outputFunction=DEFAULT_OUTPUT_FUNCTION,
argToStringFunction=argumentToString, includeContext=False):
argToStringFunction=None, includeContext=False):
self.enabled = True
self.prefix = prefix
self.includeContext = includeContext
self.outputFunction = outputFunction
self.argToStringFunction = argToStringFunction
self.argToStringFunction = self.argumentToString if argToStringFunction is None \
else argToStringFunction

def argumentToString(self, obj):
s = DEFAULT_ARG_TO_STRING_FUNCTION(obj,width=self.lineWrapWidth)
s = s.replace('\\n', '\n') # Preserve string newlines in output.
return s

def __call__(self, *args):
if self.enabled:
Expand Down