Coverage for /home/anselor/src/cmd2/cmd2/utils.py : 94%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# # coding=utf-8
"""Strip ANSI escape codes from a string.
:param text: string which may contain ANSI escape codes :return: the same string with any ANSI escape codes removed """
""" Strip outer quotes from a string.
Applies to both single and double quotes.
:param arg: string to strip outer quotes from :return: same string with potentially outer quotes stripped """
""" Convenience function for defining a namedtuple with default values
From: https://stackoverflow.com/questions/11351032/namedtuple-and-default-values-for-optional-keyword-arguments
Examples: >>> Node = namedtuple_with_defaults('Node', 'val left right') >>> Node() Node(val=None, left=None, right=None) >>> Node = namedtuple_with_defaults('Node', 'val left right', [1, 2, 3]) >>> Node() Node(val=1, left=2, right=3) >>> Node = namedtuple_with_defaults('Node', 'val left right', {'right':7}) >>> Node() Node(val=None, left=None, right=7) >>> Node(4) Node(val=4, left=None, right=7) """ prototype = T(**default_values) else:
|