本文整理汇总了Python中ntpath.splitext方法的典型用法代码示例。如果您正苦于以下问题:Python ntpath.splitext方法的具体用法?Python ntpath.splitext怎么用?Python ntpath.splitext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ntpath
的用法示例。
在下文中一共展示了ntpath.splitext方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: FetchPDBFile
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def FetchPDBFile(self):
# Ensure the pdb filename has the correct extension.
pdb_filename = self.plugin_args.pdb_filename
guid = self.plugin_args.guid
if not pdb_filename.endswith(".pdb"):
pdb_filename += ".pdb"
for url in self.SYM_URLS:
basename = ntpath.splitext(pdb_filename)[0]
try:
return self.DownloadUncompressedPDBFile(
url, pdb_filename, guid, basename)
except urllib.error.HTTPError:
return self.DownloadCompressedPDBFile(
url, pdb_filename, guid, basename)
示例2: runIndexedSearch
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def runIndexedSearch(dbfilenameFullPath, search_space, options):
# todo: Handle duplicate hit supression
logger.info("Performing indexed search")
DB = appDB.DBClass(dbfilenameFullPath, True, settings.__version__)
DB.appInitDB()
DB.appConnectDB()
searchTerm = options.searchLiteral[0]
numHits = 0
# Run actual indexed query
data = DB.Query("SELECT RowID FROM Entries_FilePaths WHERE %s == '%s';" % (search_space, searchTerm))
if data:
# results = []
# results.append(('cyan', "FileName,HitCount".split(',')))
with open(options.outputFile, "w") as text_file:
with open(os.path.join(ntpath.dirname(options.outputFile), ntpath.splitext(options.outputFile)[0] + ".mmd"), "w") as markdown_file:
for row in data:
# results.append(('white', row))
record = retrieveSearchData(row[0], DB, search_space)
saveSearchData(record, None, None, text_file, markdown_file)
numHits += 1
# outputcolum(results)
return (numHits, 0, [])
else: return(0, 0, [])
示例3: out
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def out(self):
""" Output instruction in textform. """
buf = idaapi.init_output_buffer(1024)
if self.cmd.auxpref & self.FLo_PluginCall:
lib,_ = self.get_string(self.cmd[0].addr)
fn,_ = self.get_string(self.cmd[1].addr)
lib = ntpath.splitext(ntpath.basename(lib))[0]
out_line('{}::{}'.format(lib, fn), COLOR_INSN)
OutChar(' ')
out_one_operand(2)
else:
OutMnem(12)
for i, op in ((i, self.cmd[i]) for i in range(6)):
if op.type == o_void:
break
if i > 0:
out_symbol(',')
OutChar(' ')
out_one_operand(i)
term_output_buffer()
cvar.gl_comm = 1
MakeLine(buf)
示例4: filepathParser
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def filepathParser(path):
return ntpath.split(ntpath.splitext(path)[0])
示例5: changeToPyImportType
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def changeToPyImportType(path):
"""
>>> changeToPyImportType('/path/to/module.py')
'path.to.module'
>>> changeToPyImportType('path/to/module.py')
'path.to.module'
>>> changeToPyImportType('path/to')
'path.to'
"""
return ntpath.splitext(path)[0].strip("/").replace("/", ".")
示例6: choosePocType
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def choosePocType(filepath):
"""
@function choose '.py' or '.json' extension to load the poc file
"""
return ntpath.splitext(filepath)[1][1:]
示例7: __init__
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def __init__(self, *args, **kwargs):
self.metadata = kwargs.pop("metadata", {})
super(ParsePDB, self).__init__(*args, **kwargs)
profile_class = self.metadata.get(
"ProfileClass", self.plugin_args.profile_class)
# By default select the class with the same name as the pdb file.
if profile_class is None:
profile_class = os.path.splitext(
os.path.basename(self.plugin_args.pdb_filename))[0].capitalize()
if profile_class not in obj.Profile.classes:
profile_class = "BasicPEProfile"
self.plugin_args.profile_class = profile_class
versions = []
if self.plugin_args.windows_version is not None:
versions = self.plugin_args.windows_version.split(".", 2)
for i, metadata in enumerate(["major", "minor", "rev"]):
try:
self.metadata[metadata] = versions[i]
except IndexError:
break
self.tpi = PDBParser(self.plugin_args.pdb_filename, self.session)
示例8: test_splitext
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def test_splitext(self):
tester('ntpath.splitext("foo.ext")', ('foo', '.ext'))
tester('ntpath.splitext("/foo/foo.ext")', ('/foo/foo', '.ext'))
tester('ntpath.splitext(".ext")', ('.ext', ''))
tester('ntpath.splitext("\\foo.ext\\foo")', ('\\foo.ext\\foo', ''))
tester('ntpath.splitext("foo.ext\\")', ('foo.ext\\', ''))
tester('ntpath.splitext("")', ('', ''))
tester('ntpath.splitext("foo.bar.ext")', ('foo.bar', '.ext'))
tester('ntpath.splitext("xx/foo.bar.ext")', ('xx/foo.bar', '.ext'))
tester('ntpath.splitext("xx\\foo.bar.ext")', ('xx\\foo.bar', '.ext'))
tester('ntpath.splitext("c:a/b\\c.d")', ('c:a/b\\c', '.d'))
示例9: KnownBadRegexCount
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def KnownBadRegexCount(file_full_path):
file_path = ntpath.dirname(file_full_path)
file_name, file_extension = os.path.splitext(file_full_path)
# Load base file
total_regex_count = KnownBadRegexCountFile(file_full_path)
# Load extra files
for filename in glob.iglob(file_name + '-*' + file_extension):
total_regex_count += KnownBadRegexCountFile(filename)
return total_regex_count
示例10: test_path_splitext
# 需要导入模块: import ntpath [as 别名]
# 或者: from ntpath import splitext [as 别名]
def test_path_splitext(self):
self.assertPathEqual(self.path.splitext)