-
Notifications
You must be signed in to change notification settings - Fork 115
/
datasets.py
39 lines (29 loc) · 1.07 KB
/
datasets.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# -*- coding:utf-8 -*-
# !/usr/bin/env python
"""
Date: 2022/5/9 18:08
Desc: 导入文件工具,可以正确处理路径问题
"""
import pathlib
from importlib import resources
def get_pyscript_html(file: str = "akscript.html") -> pathlib.Path:
"""Get path to data "ths.js" text file."""
with resources.path("aktools.assets.html", file) as f:
data_file_path = f
return data_file_path
def get_template_path():
with resources.path("aktools.assets.html", "akscript.html") as f:
data_file_path = f
return data_file_path.parent
def get_homepage_html(file: str = "homepage.html") -> pathlib.Path:
"""Get path to data "ths.js" text file."""
with resources.path("aktools.assets.html", file) as f:
data_file_path = f
return data_file_path
def get_favicon_path(file: str = "favicon.ico"):
with resources.path("aktools.assets.images", file) as f:
data_file_path = f
return data_file_path
if __name__ == "__main__":
get_pyscript_html_path = get_pyscript_html(file="akscript.html")
print(get_pyscript_html_path)