JAEN 0.0.2__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.
- JAEN-0.0.2/JAEN.egg-info/PKG-INFO +16 -0
- JAEN-0.0.2/JAEN.egg-info/SOURCES.txt +8 -0
- JAEN-0.0.2/JAEN.egg-info/dependency_links.txt +1 -0
- JAEN-0.0.2/JAEN.egg-info/requires.txt +3 -0
- JAEN-0.0.2/JAEN.egg-info/top_level.txt +1 -0
- JAEN-0.0.2/PKG-INFO +16 -0
- JAEN-0.0.2/jaen/__init__.py +22 -0
- JAEN-0.0.2/jaen/jaen.py +205 -0
- JAEN-0.0.2/setup.cfg +4 -0
- JAEN-0.0.2/setup.py +22 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: JAEN
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: 차별화된 실무중심 교육
|
|
5
|
+
Home-page: https://www.jaen.kr/
|
|
6
|
+
Author: baem1n
|
|
7
|
+
Author-email: baemin.dev@gmail.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.6
|
|
14
|
+
|
|
15
|
+
UNKNOWN
|
|
16
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
jaen
|
JAEN-0.0.2/PKG-INFO
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: JAEN
|
|
3
|
+
Version: 0.0.2
|
|
4
|
+
Summary: 차별화된 실무중심 교육
|
|
5
|
+
Home-page: https://www.jaen.kr/
|
|
6
|
+
Author: baem1n
|
|
7
|
+
Author-email: baemin.dev@gmail.com
|
|
8
|
+
License: UNKNOWN
|
|
9
|
+
Platform: UNKNOWN
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Requires-Python: >=3.6
|
|
14
|
+
|
|
15
|
+
UNKNOWN
|
|
16
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='JAEN',
|
|
5
|
+
version='0.0.2',
|
|
6
|
+
description='차별화된 실무중심 교육',
|
|
7
|
+
author='baem1n',
|
|
8
|
+
author_email='baemin.dev@gmail.com',
|
|
9
|
+
url='https://www.jaen.kr/',
|
|
10
|
+
packages=find_packages(),
|
|
11
|
+
install_requires=[
|
|
12
|
+
'requests',
|
|
13
|
+
'pandas',
|
|
14
|
+
'IPython'
|
|
15
|
+
],
|
|
16
|
+
classifiers=[
|
|
17
|
+
'Programming Language :: Python :: 3',
|
|
18
|
+
'License :: OSI Approved :: MIT License',
|
|
19
|
+
'Operating System :: OS Independent',
|
|
20
|
+
],
|
|
21
|
+
python_requires='>=3.6',
|
|
22
|
+
)
|
JAEN-0.0.2/jaen/jaen.py
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# coding: utf-8
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
URL = 'https://manage.jaen.kr'
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
import requests
|
|
10
|
+
import json
|
|
11
|
+
import datetime
|
|
12
|
+
import os
|
|
13
|
+
import pandas as pd
|
|
14
|
+
from requests.auth import HTTPBasicAuth
|
|
15
|
+
from IPython.display import display
|
|
16
|
+
|
|
17
|
+
class Dataset:
|
|
18
|
+
|
|
19
|
+
def __init__(self, data_dir='data'):
|
|
20
|
+
self.data_dir = data_dir
|
|
21
|
+
# data 폴더 생성
|
|
22
|
+
if not os.path.exists(data_dir):
|
|
23
|
+
os.makedirs(data_dir)
|
|
24
|
+
try:
|
|
25
|
+
res = requests.get(URL+'/api/project/list_data')
|
|
26
|
+
|
|
27
|
+
except requests.exceptions.Timeout as errd:
|
|
28
|
+
print("Timeout Error : ", errd)
|
|
29
|
+
|
|
30
|
+
except requests.exceptions.ConnectionError as errc:
|
|
31
|
+
print("Error Connecting : ", errc)
|
|
32
|
+
|
|
33
|
+
except requests.exceptions.HTTPError as errb:
|
|
34
|
+
print("Http Error : ", errb)
|
|
35
|
+
|
|
36
|
+
# Any Error except upper exception
|
|
37
|
+
except requests.exceptions.RequestException as erra:
|
|
38
|
+
print("AnyException : ", erra)
|
|
39
|
+
|
|
40
|
+
if res.status_code == 200:
|
|
41
|
+
project_data = json.loads(res.text)
|
|
42
|
+
# project_data 변수로부터 데이터를 처리
|
|
43
|
+
else:
|
|
44
|
+
print("API에서 데이터를 가져오지 못했습니다. 상태 코드:", res.status_code)
|
|
45
|
+
print("요청된 값:", json.loads(res.text))
|
|
46
|
+
|
|
47
|
+
ids = []
|
|
48
|
+
titles = []
|
|
49
|
+
filenames = list(project_data['data_file'].values())
|
|
50
|
+
infos = list(project_data['data_info'].values())
|
|
51
|
+
datas = []
|
|
52
|
+
for e in range(len(list(project_data['data_info'].keys()))):
|
|
53
|
+
id_val = list(project_data['data_info'].keys())[e].split('_')[0]
|
|
54
|
+
ids.append(id_val)
|
|
55
|
+
titles.append((list(project_data['data_info'].keys())[e].split('_')[1]))
|
|
56
|
+
if len(filenames[e])==1:
|
|
57
|
+
datas.append(URL + f'/api/project/dataSingleDownload?pro_id={id_val}&fileName={str(filenames[e])[2:-2]}')
|
|
58
|
+
else:
|
|
59
|
+
temp = []
|
|
60
|
+
for i in range(len(filenames[e])):
|
|
61
|
+
temp.append(URL + f'/api/project/dataSingleDownload?pro_id={id_val}&fileName={str(filenames[e][i])}')
|
|
62
|
+
datas.append(temp)
|
|
63
|
+
|
|
64
|
+
self.dataset = pd.DataFrame({
|
|
65
|
+
'pro_id': ids,
|
|
66
|
+
'name': titles,
|
|
67
|
+
'info': infos,
|
|
68
|
+
'data': datas,
|
|
69
|
+
'filename': filenames,
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
def info(self):
|
|
74
|
+
display(self.dataset[['pro_id', 'name', 'info', 'filename']])
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def load(self, dataset_names):
|
|
78
|
+
global datasets
|
|
79
|
+
username = 'mysuni'
|
|
80
|
+
password = 'mysuni1!'
|
|
81
|
+
|
|
82
|
+
if type(dataset_names) == str:
|
|
83
|
+
df = self.dataset.loc[self.dataset['name'] == dataset_names]
|
|
84
|
+
if df.shape[0] > 0:
|
|
85
|
+
fileurl = df['data']
|
|
86
|
+
filename = df['filename']
|
|
87
|
+
if type(fileurl.iloc[0]) == str:
|
|
88
|
+
fileurl.iloc[0] = pd.Series(fileurl.iloc[0])
|
|
89
|
+
for f_name, f_url in zip(filename.iloc[0], fileurl.iloc[0]):
|
|
90
|
+
r = requests.get(f_url, auth=HTTPBasicAuth(username, password))
|
|
91
|
+
filepath = os.path.join(self.data_dir, f_name)
|
|
92
|
+
open(filepath, 'wb').write(r.content)
|
|
93
|
+
print(f'파일 다운로드 완료\n====================\n\n데이터셋: {dataset_names}\n파일경로: {filepath}\n\n====================')
|
|
94
|
+
return
|
|
95
|
+
else:
|
|
96
|
+
raise Exception('데이터셋 정보가 없습니다.')
|
|
97
|
+
|
|
98
|
+
elif type(dataset_names) == list or type(dataset_names) == tuple:
|
|
99
|
+
for dataset_name in dataset_names:
|
|
100
|
+
df = self.dataset.loc[self.dataset['name'] == dataset_name]
|
|
101
|
+
if df.shape[0] > 0:
|
|
102
|
+
fileurls = df['data'].iloc[0]
|
|
103
|
+
filenames = df['filename'].iloc[0]
|
|
104
|
+
if type(fileurls) == str:
|
|
105
|
+
fileurls = pd.Series(fileurls)
|
|
106
|
+
for fileurl, filename in zip(fileurls, filenames):
|
|
107
|
+
r = requests.get(fileurl, auth=HTTPBasicAuth(username, password))
|
|
108
|
+
filepath = os.path.join(self.data_dir, filename)
|
|
109
|
+
open(filepath, 'wb').write(r.content)
|
|
110
|
+
print(f'파일 다운로드 완료\n====================\n\n데이터셋: {dataset_name}\n파일경로: {filepath}\n\n====================')
|
|
111
|
+
else:
|
|
112
|
+
raise Exception('데이터셋 정보가 없습니다.')
|
|
113
|
+
return
|
|
114
|
+
else:
|
|
115
|
+
raise Exception('잘못된 정보입니다.')
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
dataset = Dataset()
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def list_data():
|
|
122
|
+
global dataset
|
|
123
|
+
dataset.info()
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
def download_data(dataset_name):
|
|
127
|
+
global dataset
|
|
128
|
+
return dataset.load(dataset_name)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class Project:
|
|
135
|
+
def __init__(self, project_name, class_info, email, server='manage'):
|
|
136
|
+
self.project_name = project_name
|
|
137
|
+
self.edu_name = class_info['edu_name']
|
|
138
|
+
self.edu_rnd = class_info['edu_rnd']
|
|
139
|
+
self.edu_class = class_info['edu_class']
|
|
140
|
+
self.email = email
|
|
141
|
+
self.server = server
|
|
142
|
+
|
|
143
|
+
def __make_submission(self, submission):
|
|
144
|
+
timestring = datetime.datetime.now().strftime('%H-%M-%S')
|
|
145
|
+
filename = 'submission-{}.csv'.format(timestring)
|
|
146
|
+
submission.to_csv(filename, index=False)
|
|
147
|
+
print('파일을 저장하였습니다. 파일명: {}'.format(filename))
|
|
148
|
+
return filename
|
|
149
|
+
|
|
150
|
+
def __project_submission(self, file_name):
|
|
151
|
+
file_path = './'
|
|
152
|
+
url = URL + f'/api/studentProject/apiScoring?edu_name={self.edu_name}&edu_rnd={self.edu_rnd}&edu_class={self.edu_class}&mail={self.email}&project_name={self.project_name}&file_name={file_name}'
|
|
153
|
+
files = {'file': (file_name, open(file_path + file_name, 'rb'), 'text/csv')}
|
|
154
|
+
r = requests.post(url, files=files)
|
|
155
|
+
r.encoding = 'utf-8'
|
|
156
|
+
message = ''
|
|
157
|
+
try:
|
|
158
|
+
data = json.loads(r.text) # json 변환 실패시 원본 메세지 사용
|
|
159
|
+
if 'trial' in data.keys():
|
|
160
|
+
message = '제출 여부 :{}\n오늘 제출 횟수 : {}\n제출 결과:{}'.format(data['msg'], data['trial'], data['score'])
|
|
161
|
+
else:
|
|
162
|
+
message = '제출 실패 : {}'.format(data['msg'])
|
|
163
|
+
except:
|
|
164
|
+
message = '변환 에러 발생 : {}'.format(r.text)
|
|
165
|
+
return message
|
|
166
|
+
|
|
167
|
+
def submit_ipynb(self, ipynb_file_path=None):
|
|
168
|
+
if ipynb_file_path is None:
|
|
169
|
+
raise Exception('노트북(ipynb) 파일의 경로를 입력해 주세요.')
|
|
170
|
+
url = URL + '/api/studentProject/ipynbUploadFromMod'
|
|
171
|
+
upload = {'upload_file': open(ipynb_file_path, 'rb')}
|
|
172
|
+
upload['filename'] = upload['upload_file'].name[2:]
|
|
173
|
+
res = requests.post(url, data = upload, params = self.info(), verify = False)
|
|
174
|
+
print(res.text)
|
|
175
|
+
|
|
176
|
+
def submit(self, submission):
|
|
177
|
+
filename = self.__make_submission(submission)
|
|
178
|
+
print(self.__project_submission(filename))
|
|
179
|
+
|
|
180
|
+
def info(self):
|
|
181
|
+
return {'edu_name': self.edu_name,
|
|
182
|
+
'edu_rnd': self.edu_rnd,
|
|
183
|
+
'edu_class': self.edu_class,
|
|
184
|
+
'email': self.email,
|
|
185
|
+
'project_name': self.project_name}
|
|
186
|
+
|
|
187
|
+
def submit(submission_file):
|
|
188
|
+
global project
|
|
189
|
+
project.submit(submission_file)
|
|
190
|
+
|
|
191
|
+
def submit_ipynb(ipynb_file_path):
|
|
192
|
+
global project
|
|
193
|
+
project.submit_ipynb(ipynb_file_path)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def update_project(project_name=None, class_info=None, email=None):
|
|
197
|
+
global project
|
|
198
|
+
if project_name:
|
|
199
|
+
project.project_name = project_name
|
|
200
|
+
if project.class_info:
|
|
201
|
+
project.class_info = class_info
|
|
202
|
+
if project.email:
|
|
203
|
+
project.email = email
|
|
204
|
+
print('정보 업데이트 완료')
|
|
205
|
+
|
JAEN-0.0.2/setup.cfg
ADDED
JAEN-0.0.2/setup.py
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='JAEN',
|
|
5
|
+
version='0.0.2',
|
|
6
|
+
description='차별화된 실무중심 교육',
|
|
7
|
+
author='baem1n',
|
|
8
|
+
author_email='baemin.dev@gmail.com',
|
|
9
|
+
url='https://www.jaen.kr/',
|
|
10
|
+
packages=find_packages(),
|
|
11
|
+
install_requires=[
|
|
12
|
+
'requests',
|
|
13
|
+
'pandas',
|
|
14
|
+
'IPython'
|
|
15
|
+
],
|
|
16
|
+
classifiers=[
|
|
17
|
+
'Programming Language :: Python :: 3',
|
|
18
|
+
'License :: OSI Approved :: MIT License',
|
|
19
|
+
'Operating System :: OS Independent',
|
|
20
|
+
],
|
|
21
|
+
python_requires='>=3.6',
|
|
22
|
+
)
|