提交 7f688a39 编写于 作者: J James Troup

remove unused functions, add prefix_multi_line_str

上级 6b55f904
# Utility functions # Utility functions
# Copyright (C) 2000, 2001 James Troup <james@nocrew.org> # Copyright (C) 2000, 2001 James Troup <james@nocrew.org>
# $Id: utils.py,v 1.40 2002-03-14 14:12:04 ajt Exp $ # $Id: utils.py,v 1.41 2002-04-21 15:39:06 troup Exp $
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
...@@ -57,10 +57,6 @@ def open_file(filename, mode='r'): ...@@ -57,10 +57,6 @@ def open_file(filename, mode='r'):
raise cant_open_exc, filename raise cant_open_exc, filename
return f return f
def touch_file(filename):
fd = os.open(filename, os.O_RDONLY | os.O_CREAT);
os.close(fd);
###################################################################################### ######################################################################################
def our_raw_input(prompt=""): def our_raw_input(prompt=""):
...@@ -494,11 +490,18 @@ def result_join (original, sep = '\t'): ...@@ -494,11 +490,18 @@ def result_join (original, sep = '\t'):
list.append(original[i]); list.append(original[i]);
return string.join(list, sep); return string.join(list, sep);
def plural (x): ################################################################################
if x > 1:
return "s"; def prefix_multi_line_string(str, prefix):
else: out = "";
return ""; for line in string.split(str, '\n'):
line = string.strip(line);
if line:
out = out + "%s%s\n" % (prefix, line);
# Strip trailing new line
if out:
out = out[:-1];
return out;
################################################################################ ################################################################################
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册