本文整理汇总了Python中version.Version.get_version方法的典型用法代码示例。如果您正苦于以下问题:Python Version.get_version方法的具体用法?Python Version.get_version怎么用?Python Version.get_version使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类version.Version
的用法示例。
在下文中一共展示了Version.get_version方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_file
# 需要导入模块: from version import Version [as 别名]
# 或者: from version.Version import get_version [as 别名]
def convert_file(self, file_address, written_file_name=False):
"""
Get the txt file and convert it to the
shelx config file, returns the generated
config file name as string. suffix will be added
if a file with a same name exist.
"""
version = Version()
version_tag = version.get_version()
f = self.read_file(file_address)
if(written_file_name):
written_file = open(written_file_name, 'w')
else:
written_file = open(
self.get_file_container(f)["name"] + ".cfg", 'w')
file_name = written_file.name
written_file.write(
"#Config file generated by SatGen V. " + version_tag)
for line in list(f):
if(not re.search("Date", line)):
line = re.sub(":", "=", line)
if(re.search("Date", line)):
line = re.sub("(?<=[^0-9]):", "=", line.strip())
line = re.sub("\[ ", "[", line)
line = re.sub(" \]", "]", line)
line = line.strip()
line = line + "\n"
try:
written_file.write(line)
self.log.debug(written_file.name + " is written to the disk!")
except IOError as e:
self.log.error(
"I/O error({0}): {1}".format(e.errno, e.strerror))
raise
written_file.close()
f.close
return file_name