本文整理汇总了Python中util.Util.openFile方法的典型用法代码示例。如果您正苦于以下问题:Python Util.openFile方法的具体用法?Python Util.openFile怎么用?Python Util.openFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类util.Util
的用法示例。
在下文中一共展示了Util.openFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: processImports
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import openFile [as 别名]
def processImports(self, content):
matches = re.findall(r'(@import\s{1,}(\'|\")(.*)(\2))$', content, re.MULTILINE)
for match in matches:
filename = match[2] if match[2].endswith('.mmlx') else match[2] + '.mmlx'
disk_path = os.path.join(self.import_directory, filename)
file_content = Util.openFile(disk_path)
content = content.replace(match[0], file_content)
self.logger.log('- stripping comments again', True)
content = self.stripComments(content)
if content.find('@import') > 0:
content = self.processImports(content)
return content
示例2: processFile
# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import openFile [as 别名]
def processFile(self, input, output, open_file=False):
Instrument.reset()
self.logger.log('processing file: ' + self.logger.color(input, self.logger.YELLOW), True)
content = Util.openFile(input)
whistle = WarpWhistle(content, self.logger, self.options)
whistle.import_directory = os.path.dirname(input)
while whistle.isPlaying():
open_file = open_file and whistle.first_run
song = whistle.play()
new_output = output
if song[1] is not None:
new_output = new_output.replace('.mml', '_' + song[1] + '.mml')
self.handleProcessedFile(song[0], new_output, open_file)
if self.options['separate_voices']:
self.logger.log("")