def conv (str):
def replace (match):
- return '\\key %s;' % string.lower (match.group (1))
+ return '\\key %s;' % match.group (1).lower ()
str = re.sub ("\\\\key ([^;]+);", replace, str)
return str
elif x not in string.letters:
x = 'x'
elif x in string.lowercase and lastx == '_':
- x = string.upper (x)
+ x = x.upper ()
s = s + x
lastx = x
return s
'set-point-and-click!'
]
- origre = r'\b(%s)' % string.join (changed, '|')
+ origre = r'\b(%s)' % '|'.join (changed)
str = re.sub (origre, r'ly:\1',str)
str = re.sub ('set-point-and-click!', 'set-point-and-click', str)
'sfz',
]
- origstr = string.join (kws, '|')
+ origstr = '|'.join (kws)
str = re.sub (r'([^_^-])\\(%s)\b' % origstr, r'\1-\\\2', str)
return str
conversions.append (((1,7,6), conv, 'note\\script -> note-\script'))
## end of while <>
- suffix = string.join (slur_strs, '') + string.join (pslur_strs,
- '') \
- + string.join (dyns, '')
+ suffix = ''.join (slur_strs) + ''.join (pslur_strs) \
+ + ''.join (dyns)
return '@STARTCHORD@%s@ENDCHORD@%s%s' % (str , dur_str, suffix)
def conv (str):
def func(match):
- return "#'font-size = #%d" % (2*string.atoi (match.group (1)))
+ return "#'font-size = #%d" % (2*int (match.group (1)))
str =re.sub (r"#'font-relative-size\s*=\s*#\+?([0-9-]+)", func, str)
str =re.sub (r"#'font-family\s*=\s*#'ancient",
def sub_note (match):
dur = ''
- log = string.atoi (match.group (1))
- dots = string.atoi (match.group (2))
+ log = int (match.group (1))
+ dots = int (match.group (2))
if log >= 0:
dur = '%d' % (1 << log)
import getopt
import sys
import os
-import string
dsr_font_regex = re.compile ('%%DocumentSuppliedResources: font (.*)')
begin_font_regex = re.compile ('%%BeginFont: (.*)')
in_font = 0
if curr_font_name in extract_from_this:
- font_dict[curr_font_name] = string.join (curr_font, '')
+ font_dict[curr_font_name] = ''.join (curr_font)
if verbose:
sys.stderr.write (_('Extracted %s')
% curr_font_name + '\n')
if extract_from_this:
sys.stderr.write ("Failed to extract %s from %s\n"
- % (string.join (extract_from_this, ', '), filename))
+ % (', '.join (extract_from_this), filename))
def write_extracted_fonts (output_file_name, font_dict):
if verbose: