Skip to content

Commit 2b91dff

Browse files
committed
Remove more unused functions from utils.text
1 parent bccd9bc commit 2b91dff

1 file changed

Lines changed: 0 additions & 64 deletions

File tree

IPython/utils/text.py

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -36,18 +36,6 @@
3636
# Code
3737
#-----------------------------------------------------------------------------
3838

39-
def unquote_ends(istr):
40-
"""Remove a single pair of quotes from the endpoints of a string."""
41-
42-
if not istr:
43-
return istr
44-
if (istr[0]=="'" and istr[-1]=="'") or \
45-
(istr[0]=='"' and istr[-1]=='"'):
46-
return istr[1:-1]
47-
else:
48-
return istr
49-
50-
5139
class LSString(str):
5240
"""String derivative with a special access attributes.
5341
@@ -269,58 +257,6 @@ def sort(self,field= None, nums = False):
269257
# print_slist = result_display.when_type(SList)(print_slist)
270258

271259

272-
def esc_quotes(strng):
273-
"""Return the input string with single and double quotes escaped out"""
274-
275-
return strng.replace('"','\\"').replace("'","\\'")
276-
277-
278-
def qw(words,flat=0,sep=None,maxsplit=-1):
279-
"""Similar to Perl's qw() operator, but with some more options.
280-
281-
qw(words,flat=0,sep=' ',maxsplit=-1) -> words.split(sep,maxsplit)
282-
283-
words can also be a list itself, and with flat=1, the output will be
284-
recursively flattened.
285-
286-
Examples:
287-
288-
>>> qw('1 2')
289-
['1', '2']
290-
291-
>>> qw(['a b','1 2',['m n','p q']])
292-
[['a', 'b'], ['1', '2'], [['m', 'n'], ['p', 'q']]]
293-
294-
>>> qw(['a b','1 2',['m n','p q']],flat=1)
295-
['a', 'b', '1', '2', 'm', 'n', 'p', 'q']
296-
"""
297-
298-
if isinstance(words, basestring):
299-
return [word.strip() for word in words.split(sep,maxsplit)
300-
if word and not word.isspace() ]
301-
if flat:
302-
return flatten(map(qw,words,[1]*len(words)))
303-
return map(qw,words)
304-
305-
306-
def qwflat(words,sep=None,maxsplit=-1):
307-
"""Calls qw(words) in flat mode. It's just a convenient shorthand."""
308-
return qw(words,1,sep,maxsplit)
309-
310-
311-
def qw_lol(indata):
312-
"""qw_lol('a b') -> [['a','b']],
313-
otherwise it's just a call to qw().
314-
315-
We need this to make sure the modules_some keys *always* end up as a
316-
list of lists."""
317-
318-
if isinstance(indata, basestring):
319-
return [qw(indata)]
320-
else:
321-
return qw(indata)
322-
323-
324260
def indent(instr,nspaces=4, ntabs=0, flatten=False):
325261
"""Indent a string a given number of spaces or tabstops.
326262

0 commit comments

Comments
 (0)