当前位置: 首页>>代码示例>>Python>>正文


Python StringUtils.getFileNameFromURL方法代码示例

本文整理汇总了Python中StringUtils.StringUtils.getFileNameFromURL方法的典型用法代码示例。如果您正苦于以下问题:Python StringUtils.getFileNameFromURL方法的具体用法?Python StringUtils.getFileNameFromURL怎么用?Python StringUtils.getFileNameFromURL使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在StringUtils.StringUtils的用法示例。


在下文中一共展示了StringUtils.getFileNameFromURL方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: readChecksum

# 需要导入模块: from StringUtils import StringUtils [as 别名]
# 或者: from StringUtils.StringUtils import getFileNameFromURL [as 别名]
 def readChecksum(self,line,pkg):
     strUtils = StringUtils()
     line=pkg.decodeContents(line)
     data = line.strip();
     words=data.split(" ")
     nrWords = len(words)
     if (nrWords != 3):
         print "Error: Unable to parse line: "+line
         return False
     value=words[2].split("=")
     if (len(value) != 2):
         print "Error: Unable to parse line: "+line
         return False
     matchedSources=[]
     for source in pkg.sources:
         sourceName=strUtils.getFileNameFromURL(source)
         if (sourceName.startswith(value[0])):
             matchedSources.append(sourceName)
     if (len(matchedSources) == 0):
         print "Error: Can not find match for sha1 "+value[0]
         return False
     if (len(matchedSources) > 1):
         print "Error: Too many matches in sources: "+matchedSources+" for sha1 "+value[0]
         return False
     pkg.checksums[sourceName] = value[1]
     return True;
开发者ID:DheerajSShetty,项目名称:photon,代码行数:28,代码来源:SpecParser.py

示例2: _readChecksum

# 需要导入模块: from StringUtils import StringUtils [as 别名]
# 或者: from StringUtils.StringUtils import getFileNameFromURL [as 别名]
 def _readChecksum(self, line, pkg):
     strUtils = StringUtils()
     line = self._replaceMacros(line)
     data = line.strip()
     words = data.split()
     nrWords = len(words)
     if nrWords != 3:
         print("Error: Unable to parse line: " + line)
         return False
     value = words[2].split("=")
     if len(value) != 2:
         print("Error: Unable to parse line: "+line)
         return False
     matchedSources = []
     for source in pkg.sources:
         sourceName = strUtils.getFileNameFromURL(source)
         if sourceName.startswith(value[0]):
             matchedSources.append(sourceName)
     if not matchedSources:
         print("Error: Can not find match for sha1 " + value[0])
         return False
     if len(matchedSources) > 1:
         print("Error: Too many matched Sources:" +
               ' '.join(matchedSources) + " for sha1 " + value[0])
         return False
     pkg.checksums[sourceName] = value[1]
     return True
开发者ID:TiejunChina,项目名称:photon,代码行数:29,代码来源:SpecParser.py

示例3: _getPatchNames

# 需要导入模块: from StringUtils import StringUtils [as 别名]
# 或者: from StringUtils.StringUtils import getFileNameFromURL [as 别名]
 def _getPatchNames(self):
     patchNames = []
     strUtils = StringUtils()
     pkg = self.packages.get('default')
     for patch in pkg.patches:
         patchName = strUtils.getFileNameFromURL(patch)
         patchNames.append(patchName)
     return patchNames
开发者ID:frapposelli,项目名称:photon,代码行数:10,代码来源:SpecParser.py

示例4: _getSourceNames

# 需要导入模块: from StringUtils import StringUtils [as 别名]
# 或者: from StringUtils.StringUtils import getFileNameFromURL [as 别名]
 def _getSourceNames(self):
     sourceNames = []
     strUtils = StringUtils()
     pkg = self.packages.get('default')
     for source in pkg.sources:
         sourceName = strUtils.getFileNameFromURL(source)
         sourceNames.append(sourceName)
     return sourceNames
开发者ID:frapposelli,项目名称:photon,代码行数:10,代码来源:SpecParser.py

示例5: getPatchNames

# 需要导入模块: from StringUtils import StringUtils [as 别名]
# 或者: from StringUtils.StringUtils import getFileNameFromURL [as 别名]
 def getPatchNames(self):
     patchNames = []
     strUtils = StringUtils()
     pkg = self.spec.packages.get("default")
     if pkg is None:
         return None
     for patch in pkg.patches:
         patchName = strUtils.getFileNameFromURL(patch)
         patchNames.append(patchName)
     return patchNames
开发者ID:casualjim,项目名称:photon,代码行数:12,代码来源:SpecUtils.py

示例6: getSourceNames

# 需要导入模块: from StringUtils import StringUtils [as 别名]
# 或者: from StringUtils.StringUtils import getFileNameFromURL [as 别名]
 def getSourceNames(self):
     sourceNames = []
     strUtils = StringUtils()
     pkg = self.spec.packages.get("default")
     if pkg is None:
         return None
     for source in pkg.sources:
         sourceName = strUtils.getFileNameFromURL(source)
         sourceNames.append(sourceName)
     return sourceNames
开发者ID:casualjim,项目名称:photon,代码行数:12,代码来源:SpecUtils.py


注:本文中的StringUtils.StringUtils.getFileNameFromURL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。