apsniper0673-util 0.1.4__tar.gz
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.
- apsniper0673_util-0.1.4/PKG-INFO +6 -0
- apsniper0673_util-0.1.4/README.md +1 -0
- apsniper0673_util-0.1.4/pyproject.toml +19 -0
- apsniper0673_util-0.1.4/setup.cfg +4 -0
- apsniper0673_util-0.1.4/src/apsniper0673_util.egg-info/PKG-INFO +6 -0
- apsniper0673_util-0.1.4/src/apsniper0673_util.egg-info/SOURCES.txt +9 -0
- apsniper0673_util-0.1.4/src/apsniper0673_util.egg-info/dependency_links.txt +1 -0
- apsniper0673_util-0.1.4/src/apsniper0673_util.egg-info/top_level.txt +1 -0
- apsniper0673_util-0.1.4/src/myutil/__init__.py +1 -0
- apsniper0673_util-0.1.4/src/myutil/path/__init__.py +1 -0
- apsniper0673_util-0.1.4/src/myutil/path/path.py +31 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# util
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "apsniper0673_util"
|
|
3
|
+
version = "0.1.4"
|
|
4
|
+
description = "My util for APSniper0673"
|
|
5
|
+
authors = [
|
|
6
|
+
{ name = "apsniper0673" }
|
|
7
|
+
]
|
|
8
|
+
requires-python = ">=3.8"
|
|
9
|
+
dependencies = [
|
|
10
|
+
# "pandas",
|
|
11
|
+
# "numpy",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
[build-system]
|
|
15
|
+
requires = ["setuptools>=64", "wheel"]
|
|
16
|
+
build-backend = "setuptools.build_meta"
|
|
17
|
+
|
|
18
|
+
[tool.setuptools.packages.find]
|
|
19
|
+
where = ["src"]
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
README.md
|
|
2
|
+
pyproject.toml
|
|
3
|
+
src/apsniper0673_util.egg-info/PKG-INFO
|
|
4
|
+
src/apsniper0673_util.egg-info/SOURCES.txt
|
|
5
|
+
src/apsniper0673_util.egg-info/dependency_links.txt
|
|
6
|
+
src/apsniper0673_util.egg-info/top_level.txt
|
|
7
|
+
src/myutil/__init__.py
|
|
8
|
+
src/myutil/path/__init__.py
|
|
9
|
+
src/myutil/path/path.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
myutil
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .path import get_target_path
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .path import get_target_path
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from pathlib import Path
|
|
2
|
+
|
|
3
|
+
def get_target_path(target_dir_name: str, caller_path=None) -> Path:
|
|
4
|
+
"""
|
|
5
|
+
현재 파일 기준으로 상위 디렉토리를 탐색하여 target_dir_name 폴더를 찾고,
|
|
6
|
+
해당 폴더의 경로를 반환합니다.
|
|
7
|
+
|
|
8
|
+
Args:
|
|
9
|
+
target_dir_name (str): 찾으려는 대상 디렉토리 이름
|
|
10
|
+
caller_path (Path or str, optional): 탐색을 시작할 경로 (기본: 현재 작업 디렉토리)
|
|
11
|
+
|
|
12
|
+
Returns:
|
|
13
|
+
Path: 발견한 target_dir_name 디렉토리의 경로
|
|
14
|
+
|
|
15
|
+
Raises:
|
|
16
|
+
FileNotFoundError: target_dir_name 디렉토리를 찾지 못한 경우
|
|
17
|
+
"""
|
|
18
|
+
# 시작 경로 설정
|
|
19
|
+
if caller_path is None:
|
|
20
|
+
current = Path.cwd()
|
|
21
|
+
else:
|
|
22
|
+
current = Path(caller_path).resolve()
|
|
23
|
+
|
|
24
|
+
# 루트까지 상위 디렉토리를 탐색
|
|
25
|
+
while current != current.parent:
|
|
26
|
+
target_path = current / target_dir_name
|
|
27
|
+
if target_path.exists() and target_path.is_dir():
|
|
28
|
+
return target_path
|
|
29
|
+
current = current.parent
|
|
30
|
+
|
|
31
|
+
raise FileNotFoundError(f"상위 디렉토리에 '{target_dir_name}' 폴더를 찾을 수 없습니다.")
|