chinus-tools 1.0.10__py3-none-any.whl → 1.1.0__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.
- chinus_tools/__init__.py +3 -13
- chinus_tools/inputs/inputs.py +6 -0
- chinus_tools/prints/prints.py +3 -0
- chinus_tools/rand/__init__.py +0 -0
- chinus_tools/rand/gauss.py +32 -0
- {chinus_tools-1.0.10.dist-info → chinus_tools-1.1.0.dist-info}/METADATA +3 -3
- chinus_tools-1.1.0.dist-info/RECORD +13 -0
- chinus_tools/paths/get/absolute_path.py +0 -8
- chinus_tools/paths/get/project_root.py +0 -30
- chinus_tools/print_input_utils/multi_line_io.py +0 -10
- chinus_tools-1.0.10.dist-info/RECORD +0 -12
- /chinus_tools/{paths → inputs}/__init__.py +0 -0
- /chinus_tools/{paths/get → jsons}/__init__.py +0 -0
- /chinus_tools/{jsons.py → jsons/jsons.py} +0 -0
- /chinus_tools/{print_input_utils → prints}/__init__.py +0 -0
- {chinus_tools-1.0.10.dist-info → chinus_tools-1.1.0.dist-info}/WHEEL +0 -0
- {chinus_tools-1.0.10.dist-info → chinus_tools-1.1.0.dist-info}/top_level.txt +0 -0
chinus_tools/__init__.py
CHANGED
@@ -1,13 +1,3 @@
|
|
1
|
-
from chinus_tools.jsons import dump_json, load_json
|
2
|
-
from chinus_tools.
|
3
|
-
from chinus_tools.
|
4
|
-
from chinus_tools.print_input_utils.multi_line_io import br_print, br_input
|
5
|
-
|
6
|
-
__all__ = [
|
7
|
-
'dump_json',
|
8
|
-
'load_json',
|
9
|
-
'get_absolute_path',
|
10
|
-
'get_project_root',
|
11
|
-
'br_print',
|
12
|
-
'br_input',
|
13
|
-
]
|
1
|
+
from chinus_tools.jsons.jsons import dump_json, load_json
|
2
|
+
from chinus_tools.inputs.inputs import br_input, br_print
|
3
|
+
from chinus_tools.rand.gauss import rand_gauss
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import random
|
2
|
+
import math
|
3
|
+
|
4
|
+
|
5
|
+
def rand_gauss(
|
6
|
+
data: list | set | tuple,
|
7
|
+
center_index: int = None,
|
8
|
+
) -> any:
|
9
|
+
"""
|
10
|
+
선택한 인덱스를 중심으로 정규분포에 기반한 랜덤 요소를 리턴하는 함수
|
11
|
+
|
12
|
+
:param data: 랜덤값 뽑을 리스트
|
13
|
+
:param center_index: 정규분포 평균 인덱스 (중심)
|
14
|
+
|
15
|
+
:raise ValueError: center_index가 data의 index 범위에서 벗어났을 때
|
16
|
+
"""
|
17
|
+
|
18
|
+
if center_index is None:
|
19
|
+
center_index = len(data) // 2
|
20
|
+
elif not 0 <= center_index < len(data):
|
21
|
+
raise ValueError(f'center_index {center_index} is out of range')
|
22
|
+
|
23
|
+
sigma = len(data) / 6
|
24
|
+
|
25
|
+
# 정규분포 기반 가중치 계산
|
26
|
+
weights = [
|
27
|
+
math.exp(-0.5 * ((i - center_index) / sigma) ** 2) # 가우스 공식
|
28
|
+
for i in range(len(data))
|
29
|
+
]
|
30
|
+
|
31
|
+
# 가중치를 사용해 선택
|
32
|
+
return random.choices(data, weights=weights, k=1)[0]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: chinus_tools
|
3
|
-
Version: 1.0
|
3
|
+
Version: 1.1.0
|
4
4
|
Summary: This is a chinus Python package.
|
5
5
|
Author-email: Chinu9653 <juyoung9653@gmail.com>
|
6
6
|
License: MIT
|
@@ -20,7 +20,7 @@ This is a sample Python package created by Chinu9653.
|
|
20
20
|
- Feature 2
|
21
21
|
|
22
22
|
## Installation
|
23
|
-
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `chinus`.
|
23
|
+
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install `chinus-tools`.
|
24
24
|
|
25
25
|
```bash
|
26
|
-
pip install chinus
|
26
|
+
pip install chinus-tools
|
@@ -0,0 +1,13 @@
|
|
1
|
+
chinus_tools/__init__.py,sha256=pKBcWQGcdnwJGGFdw232P-XFrZ-YZGkcgnkNT40tWm8,164
|
2
|
+
chinus_tools/inputs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
|
+
chinus_tools/inputs/inputs.py,sha256=FAhi7a2cliTj3ISADgiqfgyHBb4k2rMGX5FSkiCPdto,137
|
4
|
+
chinus_tools/jsons/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
+
chinus_tools/jsons/jsons.py,sha256=ULkOD-2gZxIYc8VDiCTGsSHovw2-tkE7-iZXTqESZPk,460
|
6
|
+
chinus_tools/prints/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
chinus_tools/prints/prints.py,sha256=k_K2T-lSqxoFTPcpJPQY9E-d7gw5WCATJn3er35RdEA,68
|
8
|
+
chinus_tools/rand/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
|
+
chinus_tools/rand/gauss.py,sha256=31zLV-HCnlfYMn0dZ1_Ei9Xa4JES_1NafvSGNz9sGec,955
|
10
|
+
chinus_tools-1.1.0.dist-info/METADATA,sha256=Tc9DvjEivpaxD1zdUQQFj2A2tTwCyznTKHFLuC3qoHk,684
|
11
|
+
chinus_tools-1.1.0.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
12
|
+
chinus_tools-1.1.0.dist-info/top_level.txt,sha256=6U_IGf0KxJr6X8UUe-ttqvfqr80YuxwB4hhtinXzO_w,13
|
13
|
+
chinus_tools-1.1.0.dist-info/RECORD,,
|
@@ -1,8 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
from chinus_tools.paths.get.project_root import get_project_root
|
4
|
-
from pathlib import Path
|
5
|
-
|
6
|
-
|
7
|
-
def get_absolute_path(project_relative_path: str, root_identifiers: set = None) -> str:
|
8
|
-
return str(Path(os.path.join(get_project_root(root_identifiers), project_relative_path)))
|
@@ -1,30 +0,0 @@
|
|
1
|
-
import os
|
2
|
-
|
3
|
-
|
4
|
-
def get_project_root(root_identifiers: set = None, start_path: str = os.getcwd()) -> str:
|
5
|
-
"""프로젝트 루트 경로를 자동으로 추출하는 함수.
|
6
|
-
|
7
|
-
Args:
|
8
|
-
start_path (str): 탐색을 시작할 경로. 기본값은 현재 작업 디렉토리.
|
9
|
-
|
10
|
-
Returns:
|
11
|
-
str: 프로젝트 루트 경로.
|
12
|
-
:param start_path:
|
13
|
-
:param root_identifiers:
|
14
|
-
"""
|
15
|
-
# 확인할 파일 목록: 프로젝트 루트에 있는지 확인할 파일들
|
16
|
-
root_identifiers1 = root_identifiers or {'.idea'}
|
17
|
-
|
18
|
-
# 현재 경로를 설정
|
19
|
-
current_path = start_path
|
20
|
-
|
21
|
-
# 루트 경로가 아니고 상위 디렉토리가 있는 동안 탐색
|
22
|
-
while current_path != os.path.dirname(current_path):
|
23
|
-
# 현재 디렉토리 내에 루트 식별 파일들이 있는지 확인
|
24
|
-
if any(os.path.exists(os.path.join(current_path, identifier)) for identifier in root_identifiers1):
|
25
|
-
return current_path # 루트 경로 반환
|
26
|
-
# 상위 디렉토리로 이동
|
27
|
-
current_path = os.path.dirname(current_path)
|
28
|
-
|
29
|
-
# 루트를 찾지 못한 경우 현재 작업 디렉토리 반환
|
30
|
-
return start_path
|
@@ -1,12 +0,0 @@
|
|
1
|
-
chinus_tools/__init__.py,sha256=GXcZ2XD-Tefz90MfvV0zgHQPJiS-nIpzKylMvHe6XoE,401
|
2
|
-
chinus_tools/jsons.py,sha256=ULkOD-2gZxIYc8VDiCTGsSHovw2-tkE7-iZXTqESZPk,460
|
3
|
-
chinus_tools/paths/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
4
|
-
chinus_tools/paths/get/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
chinus_tools/paths/get/absolute_path.py,sha256=zzdbBUJj0yPlY0xPD_0bV0YWQ46NvW4TyRqyIz2Y6jk,291
|
6
|
-
chinus_tools/paths/get/project_root.py,sha256=eeY4NxPem9R2dGw2d-yERuCshc7p8eSaP0aQr1JDVVk,1196
|
7
|
-
chinus_tools/print_input_utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
8
|
-
chinus_tools/print_input_utils/multi_line_io.py,sha256=MG2fIUfql3727ZjY06CSN8qGSLM01wkP5UI8wAVgp8A,158
|
9
|
-
chinus_tools-1.0.10.dist-info/METADATA,sha256=1TnbA9EPZfhxCsLC3gunJhrI_5H9K_0SaacwgiGfzSs,673
|
10
|
-
chinus_tools-1.0.10.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
|
11
|
-
chinus_tools-1.0.10.dist-info/top_level.txt,sha256=6U_IGf0KxJr6X8UUe-ttqvfqr80YuxwB4hhtinXzO_w,13
|
12
|
-
chinus_tools-1.0.10.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|