Fix separator to be OS-consistent

This commit is contained in:
Nuclear03020704
2021-12-21 22:32:45 +07:00
parent f3f74afc4a
commit c180dc1a8f

View File

@@ -1,3 +1,4 @@
import os
import sys import sys
import traceback import traceback
@@ -8,7 +9,7 @@ import scipy
genList = [] genList = []
SEP = os.sep
class Generator: class Generator:
def __init__(self, title, id, func, kwargs): def __init__(self, title, id, func, kwargs):
self.title = title self.title = title
@@ -18,10 +19,10 @@ class Generator:
(filename, line_number, function_name, (filename, line_number, function_name,
text) = traceback.extract_stack()[-2] text) = traceback.extract_stack()[-2]
funcname = filename[filename.rfind('/'):].strip() funcname = filename[filename.rfind(SEP):].strip()
funcname = funcname[1:-3] funcname = funcname[1:-3]
subjectname = filename[:filename.rfind('/')].strip() subjectname = filename[:filename.rfind(SEP)].strip()
subjectname = subjectname[subjectname.rfind('/'):].strip() subjectname = subjectname[subjectname.rfind(SEP):].strip()
subjectname = subjectname[1:] subjectname = subjectname[1:]
genList.append([id, title, self, funcname, subjectname, kwargs]) genList.append([id, title, self, funcname, subjectname, kwargs])