def get_node_id(self, ent=None, ent_attrs: dict=None):
if ent and ent.kindname() == 'file':
node_id = str(Path(ent.longname()).relative_to(
self.root_path))
elif ent:
node_id = ent.uniquename()
elif ent_attrs and ent_attrs['kindname'] == 'file':
try:
node_id = str(Path(ent_attrs['longname']).relative_to(
self.root_path))
except ValueError:
node_id = ent_attrs['longname']
elif ent_attrs:
node_id = ent_attrs['uniquename']
else:
node_id = None
return node_id
评论列表
文章目录