44 if self.
_mode_mode==
'D':
45 return copy.deepcopy(self.
_dirPath_dirPath)
47 return copy.deepcopy(self.
_filePath_filePath)
61 for root, dirs, files
in os.walk(rootDir, followlinks=
True):
62 files=[f
for f
in files
if f[0]!=
'.']
63 dirs=[d
for d
in dirs
if d[0]!=
'.' and d!=
'__pycache__' and d!=
'include']
64 if self.
_mode_mode==
'F':
66 self.
_filePath_filePath.append(os.path.join(root,f))
69 elif self.
_mode_mode==
'D':
71 self.
_dirPath_dirPath.append(os.path.join(root,dir))
74 elif self.
_mode_mode==
'DF':
76 if f.endswith(
'.py')
or f.endswith(
'.pyi'):
77 self.
_filePath_filePath.append(os.path.join(root, f))
78 if 'requirements.txt' in f:
The Path class definition 路径定义类
def path(self)
Return collected paths (deep copy to avoid mutation) 返回收集到的路径(深拷贝以避免被修改)
def clc(self)
Clear previously collected path data for reuse 清空之前收集的路径数据以便复用
def __init__(self, mode)
Initialize the Path object with a traversal mode 使用遍历模式初始化Path对象
def getPath(self, rootDir)
Traverse the root directory and collect file and directory paths 遍历根目录,收集文件和目录路径