mycelium-ai 0.5.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.
- mycelium/__init__.py +0 -0
- mycelium/api/__init__.py +0 -0
- mycelium/api/app.py +1147 -0
- mycelium/api/client_app.py +170 -0
- mycelium/api/generated_sources/__init__.py +0 -0
- mycelium/api/generated_sources/server_schemas/__init__.py +97 -0
- mycelium/api/generated_sources/server_schemas/api/__init__.py +5 -0
- mycelium/api/generated_sources/server_schemas/api/default_api.py +2473 -0
- mycelium/api/generated_sources/server_schemas/api_client.py +766 -0
- mycelium/api/generated_sources/server_schemas/api_response.py +25 -0
- mycelium/api/generated_sources/server_schemas/configuration.py +434 -0
- mycelium/api/generated_sources/server_schemas/exceptions.py +166 -0
- mycelium/api/generated_sources/server_schemas/models/__init__.py +41 -0
- mycelium/api/generated_sources/server_schemas/models/api_section.py +71 -0
- mycelium/api/generated_sources/server_schemas/models/chroma_section.py +69 -0
- mycelium/api/generated_sources/server_schemas/models/clap_section.py +75 -0
- mycelium/api/generated_sources/server_schemas/models/compute_on_server200_response.py +79 -0
- mycelium/api/generated_sources/server_schemas/models/compute_on_server_request.py +67 -0
- mycelium/api/generated_sources/server_schemas/models/compute_text_search_request.py +69 -0
- mycelium/api/generated_sources/server_schemas/models/config_request.py +81 -0
- mycelium/api/generated_sources/server_schemas/models/config_response.py +107 -0
- mycelium/api/generated_sources/server_schemas/models/create_playlist_request.py +71 -0
- mycelium/api/generated_sources/server_schemas/models/get_similar_by_track200_response.py +143 -0
- mycelium/api/generated_sources/server_schemas/models/library_stats_response.py +77 -0
- mycelium/api/generated_sources/server_schemas/models/logging_section.py +67 -0
- mycelium/api/generated_sources/server_schemas/models/media_server_section.py +67 -0
- mycelium/api/generated_sources/server_schemas/models/playlist_response.py +73 -0
- mycelium/api/generated_sources/server_schemas/models/plex_section.py +71 -0
- mycelium/api/generated_sources/server_schemas/models/processing_response.py +90 -0
- mycelium/api/generated_sources/server_schemas/models/save_config_response.py +73 -0
- mycelium/api/generated_sources/server_schemas/models/scan_library_response.py +75 -0
- mycelium/api/generated_sources/server_schemas/models/search_result_response.py +75 -0
- mycelium/api/generated_sources/server_schemas/models/server_section.py +67 -0
- mycelium/api/generated_sources/server_schemas/models/stop_processing_response.py +71 -0
- mycelium/api/generated_sources/server_schemas/models/task_status_response.py +87 -0
- mycelium/api/generated_sources/server_schemas/models/track_database_stats.py +75 -0
- mycelium/api/generated_sources/server_schemas/models/track_response.py +77 -0
- mycelium/api/generated_sources/server_schemas/models/tracks_list_response.py +81 -0
- mycelium/api/generated_sources/server_schemas/rest.py +329 -0
- mycelium/api/generated_sources/server_schemas/test/__init__.py +0 -0
- mycelium/api/generated_sources/server_schemas/test/test_api_section.py +57 -0
- mycelium/api/generated_sources/server_schemas/test/test_chroma_section.py +55 -0
- mycelium/api/generated_sources/server_schemas/test/test_clap_section.py +60 -0
- mycelium/api/generated_sources/server_schemas/test/test_compute_on_server200_response.py +52 -0
- mycelium/api/generated_sources/server_schemas/test/test_compute_on_server_request.py +53 -0
- mycelium/api/generated_sources/server_schemas/test/test_compute_text_search_request.py +54 -0
- mycelium/api/generated_sources/server_schemas/test/test_config_request.py +66 -0
- mycelium/api/generated_sources/server_schemas/test/test_config_response.py +97 -0
- mycelium/api/generated_sources/server_schemas/test/test_create_playlist_request.py +60 -0
- mycelium/api/generated_sources/server_schemas/test/test_default_api.py +150 -0
- mycelium/api/generated_sources/server_schemas/test/test_get_similar_by_track200_response.py +61 -0
- mycelium/api/generated_sources/server_schemas/test/test_library_stats_response.py +63 -0
- mycelium/api/generated_sources/server_schemas/test/test_logging_section.py +53 -0
- mycelium/api/generated_sources/server_schemas/test/test_media_server_section.py +53 -0
- mycelium/api/generated_sources/server_schemas/test/test_playlist_response.py +58 -0
- mycelium/api/generated_sources/server_schemas/test/test_plex_section.py +56 -0
- mycelium/api/generated_sources/server_schemas/test/test_processing_response.py +61 -0
- mycelium/api/generated_sources/server_schemas/test/test_save_config_response.py +58 -0
- mycelium/api/generated_sources/server_schemas/test/test_scan_library_response.py +61 -0
- mycelium/api/generated_sources/server_schemas/test/test_search_result_response.py +69 -0
- mycelium/api/generated_sources/server_schemas/test/test_server_section.py +53 -0
- mycelium/api/generated_sources/server_schemas/test/test_stop_processing_response.py +55 -0
- mycelium/api/generated_sources/server_schemas/test/test_task_status_response.py +71 -0
- mycelium/api/generated_sources/server_schemas/test/test_track_database_stats.py +60 -0
- mycelium/api/generated_sources/server_schemas/test/test_track_response.py +63 -0
- mycelium/api/generated_sources/server_schemas/test/test_tracks_list_response.py +75 -0
- mycelium/api/generated_sources/worker_schemas/__init__.py +61 -0
- mycelium/api/generated_sources/worker_schemas/api/__init__.py +5 -0
- mycelium/api/generated_sources/worker_schemas/api/default_api.py +318 -0
- mycelium/api/generated_sources/worker_schemas/api_client.py +766 -0
- mycelium/api/generated_sources/worker_schemas/api_response.py +25 -0
- mycelium/api/generated_sources/worker_schemas/configuration.py +434 -0
- mycelium/api/generated_sources/worker_schemas/exceptions.py +166 -0
- mycelium/api/generated_sources/worker_schemas/models/__init__.py +23 -0
- mycelium/api/generated_sources/worker_schemas/models/save_config_response.py +73 -0
- mycelium/api/generated_sources/worker_schemas/models/worker_clap_section.py +75 -0
- mycelium/api/generated_sources/worker_schemas/models/worker_client_api_section.py +69 -0
- mycelium/api/generated_sources/worker_schemas/models/worker_client_section.py +79 -0
- mycelium/api/generated_sources/worker_schemas/models/worker_config_request.py +73 -0
- mycelium/api/generated_sources/worker_schemas/models/worker_config_response.py +89 -0
- mycelium/api/generated_sources/worker_schemas/models/worker_logging_section.py +67 -0
- mycelium/api/generated_sources/worker_schemas/rest.py +329 -0
- mycelium/api/generated_sources/worker_schemas/test/__init__.py +0 -0
- mycelium/api/generated_sources/worker_schemas/test/test_default_api.py +45 -0
- mycelium/api/generated_sources/worker_schemas/test/test_save_config_response.py +58 -0
- mycelium/api/generated_sources/worker_schemas/test/test_worker_clap_section.py +60 -0
- mycelium/api/generated_sources/worker_schemas/test/test_worker_client_api_section.py +55 -0
- mycelium/api/generated_sources/worker_schemas/test/test_worker_client_section.py +65 -0
- mycelium/api/generated_sources/worker_schemas/test/test_worker_config_request.py +59 -0
- mycelium/api/generated_sources/worker_schemas/test/test_worker_config_response.py +89 -0
- mycelium/api/generated_sources/worker_schemas/test/test_worker_logging_section.py +53 -0
- mycelium/api/worker_models.py +99 -0
- mycelium/application/__init__.py +11 -0
- mycelium/application/job_queue.py +323 -0
- mycelium/application/library_management_use_cases.py +292 -0
- mycelium/application/search_use_cases.py +96 -0
- mycelium/application/services.py +340 -0
- mycelium/client.py +554 -0
- mycelium/client_config.py +251 -0
- mycelium/client_frontend_dist/404.html +1 -0
- mycelium/client_frontend_dist/_next/static/a4iyRdfsvkjdyMAK9cE9Y/_buildManifest.js +1 -0
- mycelium/client_frontend_dist/_next/static/a4iyRdfsvkjdyMAK9cE9Y/_ssgManifest.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/4bd1b696-cf72ae8a39fa05aa.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/964-830f77d7ce1c2463.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/app/_not-found/page-d25eede5a9099bd3.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/app/layout-9b3d32f96dfe13b6.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/app/page-cc6bad295789134e.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/framework-7c95b8e5103c9e90.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/main-6b37be50736577a2.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/main-app-4153d115599d3126.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/pages/_app-0a0020ddd67f79cf.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/pages/_error-03529f2c21436739.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- mycelium/client_frontend_dist/_next/static/chunks/webpack-c81e624915b2ea70.js +1 -0
- mycelium/client_frontend_dist/_next/static/css/1eb7f0e2c78e0734.css +1 -0
- mycelium/client_frontend_dist/favicon.ico +0 -0
- mycelium/client_frontend_dist/file.svg +1 -0
- mycelium/client_frontend_dist/globe.svg +1 -0
- mycelium/client_frontend_dist/index.html +1 -0
- mycelium/client_frontend_dist/index.txt +20 -0
- mycelium/client_frontend_dist/next.svg +1 -0
- mycelium/client_frontend_dist/vercel.svg +1 -0
- mycelium/client_frontend_dist/window.svg +1 -0
- mycelium/config.py +346 -0
- mycelium/domain/__init__.py +13 -0
- mycelium/domain/models.py +71 -0
- mycelium/domain/repositories.py +98 -0
- mycelium/domain/worker.py +77 -0
- mycelium/frontend_dist/404.html +1 -0
- mycelium/frontend_dist/_next/static/chunks/4bd1b696-cf72ae8a39fa05aa.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/964-830f77d7ce1c2463.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/app/_not-found/page-d25eede5a9099bd3.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/app/layout-9b3d32f96dfe13b6.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/app/page-a761463485e0540b.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/framework-7c95b8e5103c9e90.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/main-6b37be50736577a2.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/main-app-4153d115599d3126.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/pages/_app-0a0020ddd67f79cf.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/pages/_error-03529f2c21436739.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/polyfills-42372ed130431b0a.js +1 -0
- mycelium/frontend_dist/_next/static/chunks/webpack-c81e624915b2ea70.js +1 -0
- mycelium/frontend_dist/_next/static/css/1eb7f0e2c78e0734.css +1 -0
- mycelium/frontend_dist/_next/static/glVJ0yJSL0zWN7anTTG3_/_buildManifest.js +1 -0
- mycelium/frontend_dist/_next/static/glVJ0yJSL0zWN7anTTG3_/_ssgManifest.js +1 -0
- mycelium/frontend_dist/favicon.ico +0 -0
- mycelium/frontend_dist/file.svg +1 -0
- mycelium/frontend_dist/globe.svg +1 -0
- mycelium/frontend_dist/index.html +10 -0
- mycelium/frontend_dist/index.txt +20 -0
- mycelium/frontend_dist/next.svg +1 -0
- mycelium/frontend_dist/vercel.svg +1 -0
- mycelium/frontend_dist/window.svg +1 -0
- mycelium/infrastructure/__init__.py +17 -0
- mycelium/infrastructure/chroma_adapter.py +232 -0
- mycelium/infrastructure/clap_adapter.py +280 -0
- mycelium/infrastructure/plex_adapter.py +145 -0
- mycelium/infrastructure/track_database.py +467 -0
- mycelium/main.py +183 -0
- mycelium_ai-0.5.0.dist-info/METADATA +312 -0
- mycelium_ai-0.5.0.dist-info/RECORD +164 -0
- mycelium_ai-0.5.0.dist-info/WHEEL +5 -0
- mycelium_ai-0.5.0.dist-info/entry_points.txt +2 -0
- mycelium_ai-0.5.0.dist-info/licenses/LICENSE +21 -0
- mycelium_ai-0.5.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,329 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Mycelium Worker (Client) API
|
5
|
+
|
6
|
+
Configuration API for Mycelium client workers
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
import io
|
16
|
+
import json
|
17
|
+
import logging
|
18
|
+
import re
|
19
|
+
import ssl
|
20
|
+
|
21
|
+
from urllib.parse import urlencode, quote_plus
|
22
|
+
import urllib3
|
23
|
+
|
24
|
+
from mycelium.api.generated_sources.worker_schemas.exceptions import ApiException, UnauthorizedException, ForbiddenException, NotFoundException, ServiceException, ApiValueError, BadRequestException
|
25
|
+
|
26
|
+
|
27
|
+
logger = logging.getLogger(__name__)
|
28
|
+
|
29
|
+
SUPPORTED_SOCKS_PROXIES = {"socks5", "socks5h", "socks4", "socks4a"}
|
30
|
+
|
31
|
+
|
32
|
+
def is_socks_proxy_url(url):
|
33
|
+
if url is None:
|
34
|
+
return False
|
35
|
+
split_section = url.split("://")
|
36
|
+
if len(split_section) < 2:
|
37
|
+
return False
|
38
|
+
else:
|
39
|
+
return split_section[0].lower() in SUPPORTED_SOCKS_PROXIES
|
40
|
+
|
41
|
+
|
42
|
+
class RESTResponse(io.IOBase):
|
43
|
+
|
44
|
+
def __init__(self, resp) -> None:
|
45
|
+
self.urllib3_response = resp
|
46
|
+
self.status = resp.status
|
47
|
+
self.reason = resp.reason
|
48
|
+
self.data = resp.data
|
49
|
+
|
50
|
+
def getheaders(self):
|
51
|
+
"""Returns a dictionary of the response headers."""
|
52
|
+
return self.urllib3_response.headers
|
53
|
+
|
54
|
+
def getheader(self, name, default=None):
|
55
|
+
"""Returns a given response header."""
|
56
|
+
return self.urllib3_response.headers.get(name, default)
|
57
|
+
|
58
|
+
|
59
|
+
class RESTClientObject:
|
60
|
+
|
61
|
+
def __init__(self, configuration, pools_size=4, maxsize=None) -> None:
|
62
|
+
# urllib3.PoolManager will pass all kw parameters to connectionpool
|
63
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/poolmanager.py#L75 # noqa: E501
|
64
|
+
# https://github.com/shazow/urllib3/blob/f9409436f83aeb79fbaf090181cd81b784f1b8ce/urllib3/connectionpool.py#L680 # noqa: E501
|
65
|
+
# maxsize is the number of requests to host that are allowed in parallel # noqa: E501
|
66
|
+
# Custom SSL certificates and client certificates: http://urllib3.readthedocs.io/en/latest/advanced-usage.html # noqa: E501
|
67
|
+
|
68
|
+
# cert_reqs
|
69
|
+
if configuration.verify_ssl:
|
70
|
+
cert_reqs = ssl.CERT_REQUIRED
|
71
|
+
else:
|
72
|
+
cert_reqs = ssl.CERT_NONE
|
73
|
+
|
74
|
+
addition_pool_args = {}
|
75
|
+
if configuration.assert_hostname is not None:
|
76
|
+
addition_pool_args['assert_hostname'] = configuration.assert_hostname # noqa: E501
|
77
|
+
|
78
|
+
if configuration.retries is not None:
|
79
|
+
addition_pool_args['retries'] = configuration.retries
|
80
|
+
|
81
|
+
if configuration.tls_server_name:
|
82
|
+
addition_pool_args['server_hostname'] = configuration.tls_server_name
|
83
|
+
|
84
|
+
|
85
|
+
if configuration.socket_options is not None:
|
86
|
+
addition_pool_args['socket_options'] = configuration.socket_options
|
87
|
+
|
88
|
+
if maxsize is None:
|
89
|
+
if configuration.connection_pool_maxsize is not None:
|
90
|
+
maxsize = configuration.connection_pool_maxsize
|
91
|
+
else:
|
92
|
+
maxsize = 4
|
93
|
+
|
94
|
+
# https pool manager
|
95
|
+
if configuration.proxy:
|
96
|
+
if is_socks_proxy_url(configuration.proxy):
|
97
|
+
from urllib3.contrib.socks import SOCKSProxyManager
|
98
|
+
self.pool_manager = SOCKSProxyManager(
|
99
|
+
cert_reqs=cert_reqs,
|
100
|
+
ca_certs=configuration.ssl_ca_cert,
|
101
|
+
cert_file=configuration.cert_file,
|
102
|
+
key_file=configuration.key_file,
|
103
|
+
proxy_url=configuration.proxy,
|
104
|
+
headers=configuration.proxy_headers,
|
105
|
+
**addition_pool_args
|
106
|
+
)
|
107
|
+
else:
|
108
|
+
self.pool_manager = urllib3.ProxyManager(
|
109
|
+
num_pools=pools_size,
|
110
|
+
maxsize=maxsize,
|
111
|
+
cert_reqs=cert_reqs,
|
112
|
+
ca_certs=configuration.ssl_ca_cert,
|
113
|
+
cert_file=configuration.cert_file,
|
114
|
+
key_file=configuration.key_file,
|
115
|
+
proxy_url=configuration.proxy,
|
116
|
+
proxy_headers=configuration.proxy_headers,
|
117
|
+
**addition_pool_args
|
118
|
+
)
|
119
|
+
else:
|
120
|
+
self.pool_manager = urllib3.PoolManager(
|
121
|
+
num_pools=pools_size,
|
122
|
+
maxsize=maxsize,
|
123
|
+
cert_reqs=cert_reqs,
|
124
|
+
ca_certs=configuration.ssl_ca_cert,
|
125
|
+
cert_file=configuration.cert_file,
|
126
|
+
key_file=configuration.key_file,
|
127
|
+
**addition_pool_args
|
128
|
+
)
|
129
|
+
|
130
|
+
def request(self, method, url, query_params=None, headers=None,
|
131
|
+
body=None, post_params=None, _preload_content=True,
|
132
|
+
_request_timeout=None):
|
133
|
+
"""Perform requests.
|
134
|
+
|
135
|
+
:param method: http request method
|
136
|
+
:param url: http request url
|
137
|
+
:param query_params: query parameters in the url
|
138
|
+
:param headers: http request headers
|
139
|
+
:param body: request json body, for `application/json`
|
140
|
+
:param post_params: request post parameters,
|
141
|
+
`application/x-www-form-urlencoded`
|
142
|
+
and `multipart/form-data`
|
143
|
+
:param _preload_content: if False, the urllib3.HTTPResponse object will
|
144
|
+
be returned without reading/decoding response
|
145
|
+
data. Default is True.
|
146
|
+
:param _request_timeout: timeout setting for this request. If one
|
147
|
+
number provided, it will be total request
|
148
|
+
timeout. It can also be a pair (tuple) of
|
149
|
+
(connection, read) timeouts.
|
150
|
+
"""
|
151
|
+
method = method.upper()
|
152
|
+
assert method in ['GET', 'HEAD', 'DELETE', 'POST', 'PUT',
|
153
|
+
'PATCH', 'OPTIONS']
|
154
|
+
|
155
|
+
if post_params and body:
|
156
|
+
raise ApiValueError(
|
157
|
+
"body parameter cannot be used with post_params parameter."
|
158
|
+
)
|
159
|
+
|
160
|
+
post_params = post_params or {}
|
161
|
+
headers = headers or {}
|
162
|
+
# url already contains the URL query string
|
163
|
+
# so reset query_params to empty dict
|
164
|
+
query_params = {}
|
165
|
+
|
166
|
+
timeout = None
|
167
|
+
if _request_timeout:
|
168
|
+
if isinstance(_request_timeout, (int,float)): # noqa: E501,F821
|
169
|
+
timeout = urllib3.Timeout(total=_request_timeout)
|
170
|
+
elif (isinstance(_request_timeout, tuple) and
|
171
|
+
len(_request_timeout) == 2):
|
172
|
+
timeout = urllib3.Timeout(
|
173
|
+
connect=_request_timeout[0], read=_request_timeout[1])
|
174
|
+
|
175
|
+
try:
|
176
|
+
# For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE`
|
177
|
+
if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
|
178
|
+
|
179
|
+
# no content type provided or payload is json
|
180
|
+
if not headers.get('Content-Type') or re.search('json', headers['Content-Type'], re.IGNORECASE):
|
181
|
+
request_body = None
|
182
|
+
if body is not None:
|
183
|
+
request_body = json.dumps(body)
|
184
|
+
r = self.pool_manager.request(
|
185
|
+
method, url,
|
186
|
+
body=request_body,
|
187
|
+
preload_content=_preload_content,
|
188
|
+
timeout=timeout,
|
189
|
+
headers=headers)
|
190
|
+
elif headers['Content-Type'] == 'application/x-www-form-urlencoded': # noqa: E501
|
191
|
+
r = self.pool_manager.request(
|
192
|
+
method, url,
|
193
|
+
fields=post_params,
|
194
|
+
encode_multipart=False,
|
195
|
+
preload_content=_preload_content,
|
196
|
+
timeout=timeout,
|
197
|
+
headers=headers)
|
198
|
+
elif headers['Content-Type'] == 'multipart/form-data':
|
199
|
+
# must del headers['Content-Type'], or the correct
|
200
|
+
# Content-Type which generated by urllib3 will be
|
201
|
+
# overwritten.
|
202
|
+
del headers['Content-Type']
|
203
|
+
# Ensures that dict objects are serialized
|
204
|
+
post_params = [(a, json.dumps(b)) if isinstance(b, dict) else (a,b) for a, b in post_params]
|
205
|
+
r = self.pool_manager.request(
|
206
|
+
method, url,
|
207
|
+
fields=post_params,
|
208
|
+
encode_multipart=True,
|
209
|
+
preload_content=_preload_content,
|
210
|
+
timeout=timeout,
|
211
|
+
headers=headers)
|
212
|
+
# Pass a `string` parameter directly in the body to support
|
213
|
+
# other content types than Json when `body` argument is
|
214
|
+
# provided in serialized form
|
215
|
+
elif isinstance(body, str) or isinstance(body, bytes):
|
216
|
+
request_body = body
|
217
|
+
r = self.pool_manager.request(
|
218
|
+
method, url,
|
219
|
+
body=request_body,
|
220
|
+
preload_content=_preload_content,
|
221
|
+
timeout=timeout,
|
222
|
+
headers=headers)
|
223
|
+
else:
|
224
|
+
# Cannot generate the request from given parameters
|
225
|
+
msg = """Cannot prepare a request message for provided
|
226
|
+
arguments. Please check that your arguments match
|
227
|
+
declared content type."""
|
228
|
+
raise ApiException(status=0, reason=msg)
|
229
|
+
# For `GET`, `HEAD`
|
230
|
+
else:
|
231
|
+
r = self.pool_manager.request(method, url,
|
232
|
+
fields={},
|
233
|
+
preload_content=_preload_content,
|
234
|
+
timeout=timeout,
|
235
|
+
headers=headers)
|
236
|
+
except urllib3.exceptions.SSLError as e:
|
237
|
+
msg = "{0}\n{1}".format(type(e).__name__, str(e))
|
238
|
+
raise ApiException(status=0, reason=msg)
|
239
|
+
|
240
|
+
if _preload_content:
|
241
|
+
r = RESTResponse(r)
|
242
|
+
|
243
|
+
# log response body
|
244
|
+
logger.debug("response body: %s", r.data)
|
245
|
+
|
246
|
+
if not 200 <= r.status <= 299:
|
247
|
+
if r.status == 400:
|
248
|
+
raise BadRequestException(http_resp=r)
|
249
|
+
|
250
|
+
if r.status == 401:
|
251
|
+
raise UnauthorizedException(http_resp=r)
|
252
|
+
|
253
|
+
if r.status == 403:
|
254
|
+
raise ForbiddenException(http_resp=r)
|
255
|
+
|
256
|
+
if r.status == 404:
|
257
|
+
raise NotFoundException(http_resp=r)
|
258
|
+
|
259
|
+
if 500 <= r.status <= 599:
|
260
|
+
raise ServiceException(http_resp=r)
|
261
|
+
|
262
|
+
raise ApiException(http_resp=r)
|
263
|
+
|
264
|
+
return r
|
265
|
+
|
266
|
+
def get_request(self, url, headers=None, query_params=None, _preload_content=True,
|
267
|
+
_request_timeout=None):
|
268
|
+
return self.request("GET", url,
|
269
|
+
headers=headers,
|
270
|
+
_preload_content=_preload_content,
|
271
|
+
_request_timeout=_request_timeout,
|
272
|
+
query_params=query_params)
|
273
|
+
|
274
|
+
def head_request(self, url, headers=None, query_params=None, _preload_content=True,
|
275
|
+
_request_timeout=None):
|
276
|
+
return self.request("HEAD", url,
|
277
|
+
headers=headers,
|
278
|
+
_preload_content=_preload_content,
|
279
|
+
_request_timeout=_request_timeout,
|
280
|
+
query_params=query_params)
|
281
|
+
|
282
|
+
def options_request(self, url, headers=None, query_params=None, post_params=None,
|
283
|
+
body=None, _preload_content=True, _request_timeout=None):
|
284
|
+
return self.request("OPTIONS", url,
|
285
|
+
headers=headers,
|
286
|
+
query_params=query_params,
|
287
|
+
post_params=post_params,
|
288
|
+
_preload_content=_preload_content,
|
289
|
+
_request_timeout=_request_timeout,
|
290
|
+
body=body)
|
291
|
+
|
292
|
+
def delete_request(self, url, headers=None, query_params=None, body=None,
|
293
|
+
_preload_content=True, _request_timeout=None):
|
294
|
+
return self.request("DELETE", url,
|
295
|
+
headers=headers,
|
296
|
+
query_params=query_params,
|
297
|
+
_preload_content=_preload_content,
|
298
|
+
_request_timeout=_request_timeout,
|
299
|
+
body=body)
|
300
|
+
|
301
|
+
def post_request(self, url, headers=None, query_params=None, post_params=None,
|
302
|
+
body=None, _preload_content=True, _request_timeout=None):
|
303
|
+
return self.request("POST", url,
|
304
|
+
headers=headers,
|
305
|
+
query_params=query_params,
|
306
|
+
post_params=post_params,
|
307
|
+
_preload_content=_preload_content,
|
308
|
+
_request_timeout=_request_timeout,
|
309
|
+
body=body)
|
310
|
+
|
311
|
+
def put_request(self, url, headers=None, query_params=None, post_params=None,
|
312
|
+
body=None, _preload_content=True, _request_timeout=None):
|
313
|
+
return self.request("PUT", url,
|
314
|
+
headers=headers,
|
315
|
+
query_params=query_params,
|
316
|
+
post_params=post_params,
|
317
|
+
_preload_content=_preload_content,
|
318
|
+
_request_timeout=_request_timeout,
|
319
|
+
body=body)
|
320
|
+
|
321
|
+
def patch_request(self, url, headers=None, query_params=None, post_params=None,
|
322
|
+
body=None, _preload_content=True, _request_timeout=None):
|
323
|
+
return self.request("PATCH", url,
|
324
|
+
headers=headers,
|
325
|
+
query_params=query_params,
|
326
|
+
post_params=post_params,
|
327
|
+
_preload_content=_preload_content,
|
328
|
+
_request_timeout=_request_timeout,
|
329
|
+
body=body)
|
File without changes
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Mycelium Worker (Client) API
|
5
|
+
|
6
|
+
Configuration API for Mycelium client workers
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
import unittest
|
16
|
+
|
17
|
+
from mycelium.api.generated_sources.worker_schemas.api.default_api import DefaultApi # noqa: E501
|
18
|
+
|
19
|
+
|
20
|
+
class TestDefaultApi(unittest.TestCase):
|
21
|
+
"""DefaultApi unit test stubs"""
|
22
|
+
|
23
|
+
def setUp(self) -> None:
|
24
|
+
self.api = DefaultApi()
|
25
|
+
|
26
|
+
def tearDown(self) -> None:
|
27
|
+
self.api.api_client.close()
|
28
|
+
|
29
|
+
def test_get_worker_config(self) -> None:
|
30
|
+
"""Test case for get_worker_config
|
31
|
+
|
32
|
+
Get current worker configuration # noqa: E501
|
33
|
+
"""
|
34
|
+
pass
|
35
|
+
|
36
|
+
def test_save_worker_config(self) -> None:
|
37
|
+
"""Test case for save_worker_config
|
38
|
+
|
39
|
+
Save worker configuration # noqa: E501
|
40
|
+
"""
|
41
|
+
pass
|
42
|
+
|
43
|
+
|
44
|
+
if __name__ == '__main__':
|
45
|
+
unittest.main()
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Mycelium Worker (Client) API
|
5
|
+
|
6
|
+
Configuration API for Mycelium client workers
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
import unittest
|
16
|
+
import datetime
|
17
|
+
|
18
|
+
from mycelium.api.generated_sources.worker_schemas.models.save_config_response import SaveConfigResponse # noqa: E501
|
19
|
+
|
20
|
+
class TestSaveConfigResponse(unittest.TestCase):
|
21
|
+
"""SaveConfigResponse unit test stubs"""
|
22
|
+
|
23
|
+
def setUp(self):
|
24
|
+
pass
|
25
|
+
|
26
|
+
def tearDown(self):
|
27
|
+
pass
|
28
|
+
|
29
|
+
def make_instance(self, include_optional) -> SaveConfigResponse:
|
30
|
+
"""Test SaveConfigResponse
|
31
|
+
include_option is a boolean, when False only required
|
32
|
+
params are included, when True both required and
|
33
|
+
optional params are included """
|
34
|
+
# uncomment below to create an instance of `SaveConfigResponse`
|
35
|
+
"""
|
36
|
+
model = SaveConfigResponse() # noqa: E501
|
37
|
+
if include_optional:
|
38
|
+
return SaveConfigResponse(
|
39
|
+
message = '',
|
40
|
+
status = '',
|
41
|
+
reloaded = True,
|
42
|
+
reload_error = ''
|
43
|
+
)
|
44
|
+
else:
|
45
|
+
return SaveConfigResponse(
|
46
|
+
message = '',
|
47
|
+
status = '',
|
48
|
+
reloaded = True,
|
49
|
+
)
|
50
|
+
"""
|
51
|
+
|
52
|
+
def testSaveConfigResponse(self):
|
53
|
+
"""Test SaveConfigResponse"""
|
54
|
+
# inst_req_only = self.make_instance(include_optional=False)
|
55
|
+
# inst_req_and_optional = self.make_instance(include_optional=True)
|
56
|
+
|
57
|
+
if __name__ == '__main__':
|
58
|
+
unittest.main()
|
@@ -0,0 +1,60 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Mycelium Worker (Client) API
|
5
|
+
|
6
|
+
Configuration API for Mycelium client workers
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
import unittest
|
16
|
+
import datetime
|
17
|
+
|
18
|
+
from mycelium.api.generated_sources.worker_schemas.models.worker_clap_section import WorkerClapSection # noqa: E501
|
19
|
+
|
20
|
+
class TestWorkerClapSection(unittest.TestCase):
|
21
|
+
"""WorkerClapSection unit test stubs"""
|
22
|
+
|
23
|
+
def setUp(self):
|
24
|
+
pass
|
25
|
+
|
26
|
+
def tearDown(self):
|
27
|
+
pass
|
28
|
+
|
29
|
+
def make_instance(self, include_optional) -> WorkerClapSection:
|
30
|
+
"""Test WorkerClapSection
|
31
|
+
include_option is a boolean, when False only required
|
32
|
+
params are included, when True both required and
|
33
|
+
optional params are included """
|
34
|
+
# uncomment below to create an instance of `WorkerClapSection`
|
35
|
+
"""
|
36
|
+
model = WorkerClapSection() # noqa: E501
|
37
|
+
if include_optional:
|
38
|
+
return WorkerClapSection(
|
39
|
+
model_id = '',
|
40
|
+
target_sr = 56,
|
41
|
+
chunk_duration_s = 56,
|
42
|
+
num_chunks = 56,
|
43
|
+
max_load_duration_s = 56
|
44
|
+
)
|
45
|
+
else:
|
46
|
+
return WorkerClapSection(
|
47
|
+
model_id = '',
|
48
|
+
target_sr = 56,
|
49
|
+
chunk_duration_s = 56,
|
50
|
+
num_chunks = 56,
|
51
|
+
)
|
52
|
+
"""
|
53
|
+
|
54
|
+
def testWorkerClapSection(self):
|
55
|
+
"""Test WorkerClapSection"""
|
56
|
+
# inst_req_only = self.make_instance(include_optional=False)
|
57
|
+
# inst_req_and_optional = self.make_instance(include_optional=True)
|
58
|
+
|
59
|
+
if __name__ == '__main__':
|
60
|
+
unittest.main()
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Mycelium Worker (Client) API
|
5
|
+
|
6
|
+
Configuration API for Mycelium client workers
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
import unittest
|
16
|
+
import datetime
|
17
|
+
|
18
|
+
from mycelium.api.generated_sources.worker_schemas.models.worker_client_api_section import WorkerClientAPISection # noqa: E501
|
19
|
+
|
20
|
+
class TestWorkerClientAPISection(unittest.TestCase):
|
21
|
+
"""WorkerClientAPISection unit test stubs"""
|
22
|
+
|
23
|
+
def setUp(self):
|
24
|
+
pass
|
25
|
+
|
26
|
+
def tearDown(self):
|
27
|
+
pass
|
28
|
+
|
29
|
+
def make_instance(self, include_optional) -> WorkerClientAPISection:
|
30
|
+
"""Test WorkerClientAPISection
|
31
|
+
include_option is a boolean, when False only required
|
32
|
+
params are included, when True both required and
|
33
|
+
optional params are included """
|
34
|
+
# uncomment below to create an instance of `WorkerClientAPISection`
|
35
|
+
"""
|
36
|
+
model = WorkerClientAPISection() # noqa: E501
|
37
|
+
if include_optional:
|
38
|
+
return WorkerClientAPISection(
|
39
|
+
host = '',
|
40
|
+
port = 56
|
41
|
+
)
|
42
|
+
else:
|
43
|
+
return WorkerClientAPISection(
|
44
|
+
host = '',
|
45
|
+
port = 56,
|
46
|
+
)
|
47
|
+
"""
|
48
|
+
|
49
|
+
def testWorkerClientAPISection(self):
|
50
|
+
"""Test WorkerClientAPISection"""
|
51
|
+
# inst_req_only = self.make_instance(include_optional=False)
|
52
|
+
# inst_req_and_optional = self.make_instance(include_optional=True)
|
53
|
+
|
54
|
+
if __name__ == '__main__':
|
55
|
+
unittest.main()
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Mycelium Worker (Client) API
|
5
|
+
|
6
|
+
Configuration API for Mycelium client workers
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
import unittest
|
16
|
+
import datetime
|
17
|
+
|
18
|
+
from mycelium.api.generated_sources.worker_schemas.models.worker_client_section import WorkerClientSection # noqa: E501
|
19
|
+
|
20
|
+
class TestWorkerClientSection(unittest.TestCase):
|
21
|
+
"""WorkerClientSection unit test stubs"""
|
22
|
+
|
23
|
+
def setUp(self):
|
24
|
+
pass
|
25
|
+
|
26
|
+
def tearDown(self):
|
27
|
+
pass
|
28
|
+
|
29
|
+
def make_instance(self, include_optional) -> WorkerClientSection:
|
30
|
+
"""Test WorkerClientSection
|
31
|
+
include_option is a boolean, when False only required
|
32
|
+
params are included, when True both required and
|
33
|
+
optional params are included """
|
34
|
+
# uncomment below to create an instance of `WorkerClientSection`
|
35
|
+
"""
|
36
|
+
model = WorkerClientSection() # noqa: E501
|
37
|
+
if include_optional:
|
38
|
+
return WorkerClientSection(
|
39
|
+
server_host = '',
|
40
|
+
server_port = 56,
|
41
|
+
download_queue_size = 56,
|
42
|
+
job_queue_size = 56,
|
43
|
+
poll_interval = 1.337,
|
44
|
+
download_workers = 56,
|
45
|
+
gpu_batch_size = 56
|
46
|
+
)
|
47
|
+
else:
|
48
|
+
return WorkerClientSection(
|
49
|
+
server_host = '',
|
50
|
+
server_port = 56,
|
51
|
+
download_queue_size = 56,
|
52
|
+
job_queue_size = 56,
|
53
|
+
poll_interval = 1.337,
|
54
|
+
download_workers = 56,
|
55
|
+
gpu_batch_size = 56,
|
56
|
+
)
|
57
|
+
"""
|
58
|
+
|
59
|
+
def testWorkerClientSection(self):
|
60
|
+
"""Test WorkerClientSection"""
|
61
|
+
# inst_req_only = self.make_instance(include_optional=False)
|
62
|
+
# inst_req_and_optional = self.make_instance(include_optional=True)
|
63
|
+
|
64
|
+
if __name__ == '__main__':
|
65
|
+
unittest.main()
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
Mycelium Worker (Client) API
|
5
|
+
|
6
|
+
Configuration API for Mycelium client workers
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
import unittest
|
16
|
+
import datetime
|
17
|
+
|
18
|
+
from mycelium.api.generated_sources.worker_schemas.models.worker_config_request import WorkerConfigRequest # noqa: E501
|
19
|
+
|
20
|
+
class TestWorkerConfigRequest(unittest.TestCase):
|
21
|
+
"""WorkerConfigRequest unit test stubs"""
|
22
|
+
|
23
|
+
def setUp(self):
|
24
|
+
pass
|
25
|
+
|
26
|
+
def tearDown(self):
|
27
|
+
pass
|
28
|
+
|
29
|
+
def make_instance(self, include_optional) -> WorkerConfigRequest:
|
30
|
+
"""Test WorkerConfigRequest
|
31
|
+
include_option is a boolean, when False only required
|
32
|
+
params are included, when True both required and
|
33
|
+
optional params are included """
|
34
|
+
# uncomment below to create an instance of `WorkerConfigRequest`
|
35
|
+
"""
|
36
|
+
model = WorkerConfigRequest() # noqa: E501
|
37
|
+
if include_optional:
|
38
|
+
return WorkerConfigRequest(
|
39
|
+
client = { },
|
40
|
+
client_api = { },
|
41
|
+
clap = { },
|
42
|
+
logging = { }
|
43
|
+
)
|
44
|
+
else:
|
45
|
+
return WorkerConfigRequest(
|
46
|
+
client = { },
|
47
|
+
client_api = { },
|
48
|
+
clap = { },
|
49
|
+
logging = { },
|
50
|
+
)
|
51
|
+
"""
|
52
|
+
|
53
|
+
def testWorkerConfigRequest(self):
|
54
|
+
"""Test WorkerConfigRequest"""
|
55
|
+
# inst_req_only = self.make_instance(include_optional=False)
|
56
|
+
# inst_req_and_optional = self.make_instance(include_optional=True)
|
57
|
+
|
58
|
+
if __name__ == '__main__':
|
59
|
+
unittest.main()
|