本文整理汇总了Python中misc.Path.getCommonSuffix方法的典型用法代码示例。如果您正苦于以下问题:Python Path.getCommonSuffix方法的具体用法?Python Path.getCommonSuffix怎么用?Python Path.getCommonSuffix使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类misc.Path
的用法示例。
在下文中一共展示了Path.getCommonSuffix方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: normalizeImgUri
# 需要导入模块: from misc import Path [as 别名]
# 或者: from misc.Path import getCommonSuffix [as 别名]
def normalizeImgUri(uriFromMetafile, trueCombinedUri, combinedUriFromMetafile):
# normalize paths (esp. "./x" -> "x")
(uriFromMetafile, trueCombinedUri, combinedUriFromMetafile) = map(os.path.normpath,
(uriFromMetafile, trueCombinedUri, combinedUriFromMetafile))
# get the "wrong" left part of the combined image, as used in the .meta file (in mappedUriPrefix)
trueUriPrefix, mappedUriPrefix, _ = Path.getCommonSuffix(trueCombinedUri, combinedUriFromMetafile)
# ...and strip it from clipped image, to get a correct image id (in uriSuffix)
_, _, uriSuffix = Path.getCommonPrefix(mappedUriPrefix, uriFromMetafile)
# ...then compose the correct prefix with the correct suffix
normalUri = os.path.normpath(os.path.join(trueUriPrefix, uriSuffix))
return normalUri