hossam 0.4.12__py3-none-any.whl → 0.4.14__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hossam/__init__.py +46 -7
- hossam/hs_cluster.py +777 -40
- hossam/hs_plot.py +322 -218
- hossam/hs_study.py +76 -0
- {hossam-0.4.12.dist-info → hossam-0.4.14.dist-info}/METADATA +1 -1
- {hossam-0.4.12.dist-info → hossam-0.4.14.dist-info}/RECORD +9 -8
- {hossam-0.4.12.dist-info → hossam-0.4.14.dist-info}/WHEEL +0 -0
- {hossam-0.4.12.dist-info → hossam-0.4.14.dist-info}/licenses/LICENSE +0 -0
- {hossam-0.4.12.dist-info → hossam-0.4.14.dist-info}/top_level.txt +0 -0
hossam/hs_study.py
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import ast
|
|
2
|
+
import os
|
|
3
|
+
import pandas as pd
|
|
4
|
+
from pathlib import Path
|
|
5
|
+
from IPython.display import Markdown, display
|
|
6
|
+
from .hs_util import pretty_table
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def module_list():
|
|
10
|
+
"""
|
|
11
|
+
현재 패키지(hossam) 내의 모든 모듈(파이썬 파일) 이름을 데이터프레임으로 반환함.
|
|
12
|
+
- .py 확장자만 대상, __init__.py는 제외
|
|
13
|
+
- 컬럼명: 'module'
|
|
14
|
+
"""
|
|
15
|
+
pkg_dir = os.path.dirname(__file__)
|
|
16
|
+
files = [f for f in os.listdir(pkg_dir) if f.endswith(".py") and f != "__init__.py"]
|
|
17
|
+
modules = [os.path.splitext(f)[0] for f in files]
|
|
18
|
+
df = pd.DataFrame({"module": modules})
|
|
19
|
+
df.sort_values(by='module', inplace=True)
|
|
20
|
+
df.reset_index(drop=True, inplace=True)
|
|
21
|
+
pretty_table(df)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def function_list(module_name: str, keyword: str | None = None):
|
|
25
|
+
"""
|
|
26
|
+
지정한 모듈 내의 모든 함수 이름과 간단한 설명을 데이터프레임으로 반환함.
|
|
27
|
+
|
|
28
|
+
- module_name: 모듈 이름 (예: 'hs_cluster')
|
|
29
|
+
- keyword: 함수 이름 또는 설명에 포함된 키워드로 필터링 (선택 사항)
|
|
30
|
+
"""
|
|
31
|
+
pkg_dir = os.path.dirname(__file__)
|
|
32
|
+
py_path = os.path.join(pkg_dir, module_name + ".py")
|
|
33
|
+
if not os.path.exists(py_path):
|
|
34
|
+
raise FileNotFoundError(f"{py_path} 파일이 존재하지 않음")
|
|
35
|
+
|
|
36
|
+
with open(py_path, encoding="utf-8") as f:
|
|
37
|
+
src = f.read()
|
|
38
|
+
tree = ast.parse(src)
|
|
39
|
+
rows = []
|
|
40
|
+
for node in tree.body:
|
|
41
|
+
if isinstance(node, ast.FunctionDef):
|
|
42
|
+
func_name = node.name
|
|
43
|
+
doc = ast.get_docstring(node) or ''
|
|
44
|
+
# # 파라미터 추출
|
|
45
|
+
# params = []
|
|
46
|
+
# for arg in node.args.args:
|
|
47
|
+
# if arg.arg != 'self':
|
|
48
|
+
# params.append(arg.arg)
|
|
49
|
+
# # 리턴 타입
|
|
50
|
+
# returns = ''
|
|
51
|
+
# if node.returns:
|
|
52
|
+
# try:
|
|
53
|
+
# returns = ast.unparse(node.returns)
|
|
54
|
+
# except Exception:
|
|
55
|
+
# returns = str(node.returns)
|
|
56
|
+
rows.append({
|
|
57
|
+
'function': func_name,
|
|
58
|
+
'description': doc.split('\n')[0] if doc else '',
|
|
59
|
+
# 'parameters': ', '.join(params),
|
|
60
|
+
# 'returns': returns
|
|
61
|
+
'reference': f"https://py.hossam.kr/api/{module_name}/#{module_name}.{func_name}"
|
|
62
|
+
})
|
|
63
|
+
df = pd.DataFrame(rows)
|
|
64
|
+
df.sort_values(by='function', inplace=True)
|
|
65
|
+
df.reset_index(drop=True, inplace=True)
|
|
66
|
+
|
|
67
|
+
# df.style.format(
|
|
68
|
+
# {"reference": lambda x: f"<a href='{x}' target='_blank'>view</a>"},
|
|
69
|
+
# escape=False # type: ignore
|
|
70
|
+
# )
|
|
71
|
+
|
|
72
|
+
if keyword:
|
|
73
|
+
mask = df['function'].str.contains(keyword, case=False) | df['description'].str.contains(keyword, case=False)
|
|
74
|
+
df = df[mask].reset_index(drop=True)
|
|
75
|
+
|
|
76
|
+
pretty_table(df)
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
hossam/NotoSansKR-Regular.ttf,sha256=0SCufUQwcVWrWTu75j4Lt_V2bgBJIBXl1p8iAJJYkVY,6185516
|
|
2
|
-
hossam/__init__.py,sha256=
|
|
2
|
+
hossam/__init__.py,sha256=lJ-_g2HAmFnixOmKjCv7_cMSdiYwbM6SNlHEtptUlUI,4045
|
|
3
3
|
hossam/hs_classroom.py,sha256=Sb1thy49LKn2zU90aiOVwHWhyWSMHLZbZX7eXmQlquc,27523
|
|
4
|
-
hossam/hs_cluster.py,sha256=
|
|
4
|
+
hossam/hs_cluster.py,sha256=umgJRRr9vXkaFVIs6V_K3SrOo6Q5AEqVYmQSMaGj7rY,31945
|
|
5
5
|
hossam/hs_gis.py,sha256=DVmndBK-_7GMK3J1_on3ieEQk1S0MfUZ8_wlX-cDdZQ,11581
|
|
6
|
-
hossam/hs_plot.py,sha256=
|
|
6
|
+
hossam/hs_plot.py,sha256=zq1tP5mEoDe85ljLT8poTgeY4httjOTdpNWsXEO6IEU,94919
|
|
7
7
|
hossam/hs_prep.py,sha256=ypuX97mCxpo7CLoI_S79bUw7th0ok5LCZjt4vzRaGiI,38326
|
|
8
8
|
hossam/hs_stats.py,sha256=MDS3rvaXDP8aYwcE36JTetWiZgE4fkXnNo0vwlXu-pA,119890
|
|
9
|
+
hossam/hs_study.py,sha256=ZzL76_V0IHnk_YUTbWncIIBruOj2Sz3xs91snS6cpu0,2776
|
|
9
10
|
hossam/hs_timeserise.py,sha256=NzGV4bJmVQr3qUFySOP25qENItmloYjgh3VgwSbSmXc,43163
|
|
10
11
|
hossam/hs_util.py,sha256=ptl-2W7-0Ad_BemZMR8cFnDt6-SHCRRCk1Gh7giFjSs,16149
|
|
11
12
|
hossam/leekh.png,sha256=1PB5NQ24SDoHA5KMiBBsWpSa3iniFcwFTuGwuOsTHfI,6395
|
|
12
|
-
hossam-0.4.
|
|
13
|
-
hossam-0.4.
|
|
14
|
-
hossam-0.4.
|
|
15
|
-
hossam-0.4.
|
|
16
|
-
hossam-0.4.
|
|
13
|
+
hossam-0.4.14.dist-info/licenses/LICENSE,sha256=nIqzhlcFY_2D6QtFsYjwU7BWkafo-rUJOQpDZ-DsauI,941
|
|
14
|
+
hossam-0.4.14.dist-info/METADATA,sha256=7ImpA00AlStHil2PdLPHNwA3aU23zFLfbbaA6zE6pqM,3803
|
|
15
|
+
hossam-0.4.14.dist-info/WHEEL,sha256=qELbo2s1Yzl39ZmrAibXA2jjPLUYfnVhUNTlyF1rq0Y,92
|
|
16
|
+
hossam-0.4.14.dist-info/top_level.txt,sha256=_-7bwjhthHplWhywEaHIJX2yL11CQCaLjCNSBlk6wiQ,7
|
|
17
|
+
hossam-0.4.14.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|