Skip to content

Commit b21f97c

Browse files
committed
v0.9.2
1 parent bbbaf78 commit b21f97c

File tree

125 files changed

+7197
-5752
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+7197
-5752
lines changed

PKG-INFO

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Metadata-Version: 2.1
22
Name: tuneinsight
3-
Version: 0.9.0
3+
Version: 0.9.2
44
Summary: Diapason is the official Python SDK for the Tune Insight API. Version 0.6.2 targets the API v0.8.0.
55
License: Apache-2.0
66
Author: Tune Insight SA
@@ -15,7 +15,6 @@ Requires-Dist: PyYAML (>=6.0,<7.0)
1515
Requires-Dist: attrs (>=21.3.0)
1616
Requires-Dist: black (==24.2.0)
1717
Requires-Dist: certifi (>=2023.7.22,<2024.0.0)
18-
Requires-Dist: handsdown (>=2.1.0,<3.0.0)
1918
Requires-Dist: httpx (>=0.15.4,<0.24.0)
2019
Requires-Dist: matplotlib (>=3.5.0,<4.0.0)
2120
Requires-Dist: notebook (>=6.4.11,<7.0.0)

pyproject.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "tuneinsight"
3-
version = "0.9.0"
3+
version = "0.9.2"
44
description = "Diapason is the official Python SDK for the Tune Insight API. Version 0.6.2 targets the API v0.8.0."
55
authors = ["Tune Insight SA"]
66
license = "Apache-2.0"
@@ -28,14 +28,14 @@ httpx = ">=0.15.4,<0.24.0"
2828
attrs = ">=21.3.0"
2929
certifi = "^2023.7.22"
3030
black = "24.2.0"
31-
handsdown = "^2.1.0"
3231

3332
[tool.poetry.group.dev.dependencies]
3433
selenium = "^4.9.1"
3534
wheel = "^0.38.1"
3635
docker = "^6.0.1"
3736
pylint = "^2.13.2"
3837
pyvcf3 = "^1.0.3" # For GWAS .vcf file parsing
38+
pytest = "^8.1.1"
3939

4040
[build-system]
4141
requires = ["poetry-core>=1.0.0"]

src/tuneinsight/api/api-checksum

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b71c951f2eb600cc2a1f073151c9a0c003bd48f1210262ab7df58c9d06e05aba
1+
1543c5968e0e568095cb5eeb44a3c7ab3179d6491f270932e268ab579c8d5948
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
from http import HTTPStatus
2+
from typing import Any, Dict, Optional, Union
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import Client
8+
from ...models.error import Error
9+
from ...models.settings import Settings
10+
from ...types import Response
11+
12+
13+
def _get_kwargs(
14+
*,
15+
client: Client,
16+
) -> Dict[str, Any]:
17+
url = "{}/settings".format(client.base_url)
18+
19+
headers: Dict[str, str] = client.get_headers()
20+
cookies: Dict[str, Any] = client.get_cookies()
21+
22+
return {
23+
"method": "get",
24+
"url": url,
25+
"headers": headers,
26+
"cookies": cookies,
27+
"timeout": client.get_timeout(),
28+
}
29+
30+
31+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Error, Settings]]:
32+
if response.status_code == HTTPStatus.OK:
33+
response_200 = Settings.from_dict(response.json())
34+
35+
return response_200
36+
if response.status_code == HTTPStatus.BAD_REQUEST:
37+
response_400 = Error.from_dict(response.json())
38+
39+
return response_400
40+
if response.status_code == HTTPStatus.UNAUTHORIZED:
41+
response_401 = Error.from_dict(response.json())
42+
43+
return response_401
44+
if response.status_code == HTTPStatus.FORBIDDEN:
45+
response_403 = Error.from_dict(response.json())
46+
47+
return response_403
48+
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
49+
response_500 = Error.from_dict(response.json())
50+
51+
return response_500
52+
if client.raise_on_unexpected_status:
53+
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
54+
else:
55+
return None
56+
57+
58+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Error, Settings]]:
59+
return Response(
60+
status_code=HTTPStatus(response.status_code),
61+
content=response.content,
62+
headers=response.headers,
63+
parsed=_parse_response(client=client, response=response),
64+
)
65+
66+
67+
def sync_detailed(
68+
*,
69+
client: Client,
70+
) -> Response[Union[Error, Settings]]:
71+
"""retrieve the instance settings
72+
73+
Raises:
74+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
75+
httpx.TimeoutException: If the request takes longer than Client.timeout.
76+
77+
Returns:
78+
Response[Union[Error, Settings]]
79+
"""
80+
81+
kwargs = _get_kwargs(
82+
client=client,
83+
)
84+
85+
response = httpx.request(
86+
verify=client.verify_ssl,
87+
**kwargs,
88+
)
89+
90+
return _build_response(client=client, response=response)
91+
92+
93+
def sync(
94+
*,
95+
client: Client,
96+
) -> Optional[Union[Error, Settings]]:
97+
"""retrieve the instance settings
98+
99+
Raises:
100+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
101+
httpx.TimeoutException: If the request takes longer than Client.timeout.
102+
103+
Returns:
104+
Response[Union[Error, Settings]]
105+
"""
106+
107+
return sync_detailed(
108+
client=client,
109+
).parsed
110+
111+
112+
async def asyncio_detailed(
113+
*,
114+
client: Client,
115+
) -> Response[Union[Error, Settings]]:
116+
"""retrieve the instance settings
117+
118+
Raises:
119+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
120+
httpx.TimeoutException: If the request takes longer than Client.timeout.
121+
122+
Returns:
123+
Response[Union[Error, Settings]]
124+
"""
125+
126+
kwargs = _get_kwargs(
127+
client=client,
128+
)
129+
130+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
131+
response = await _client.request(**kwargs)
132+
133+
return _build_response(client=client, response=response)
134+
135+
136+
async def asyncio(
137+
*,
138+
client: Client,
139+
) -> Optional[Union[Error, Settings]]:
140+
"""retrieve the instance settings
141+
142+
Raises:
143+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144+
httpx.TimeoutException: If the request takes longer than Client.timeout.
145+
146+
Returns:
147+
Response[Union[Error, Settings]]
148+
"""
149+
150+
return (
151+
await asyncio_detailed(
152+
client=client,
153+
)
154+
).parsed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
from http import HTTPStatus
2+
from typing import Any, Dict, Optional, Union
3+
4+
import httpx
5+
6+
from ... import errors
7+
from ...client import Client
8+
from ...models.error import Error
9+
from ...models.settings import Settings
10+
from ...types import Response
11+
12+
13+
def _get_kwargs(
14+
*,
15+
client: Client,
16+
json_body: Settings,
17+
) -> Dict[str, Any]:
18+
url = "{}/settings".format(client.base_url)
19+
20+
headers: Dict[str, str] = client.get_headers()
21+
cookies: Dict[str, Any] = client.get_cookies()
22+
23+
json_json_body = json_body.to_dict()
24+
25+
return {
26+
"method": "patch",
27+
"url": url,
28+
"headers": headers,
29+
"cookies": cookies,
30+
"timeout": client.get_timeout(),
31+
"json": json_json_body,
32+
}
33+
34+
35+
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Error, Settings]]:
36+
if response.status_code == HTTPStatus.OK:
37+
response_200 = Settings.from_dict(response.json())
38+
39+
return response_200
40+
if response.status_code == HTTPStatus.BAD_REQUEST:
41+
response_400 = Error.from_dict(response.json())
42+
43+
return response_400
44+
if response.status_code == HTTPStatus.UNAUTHORIZED:
45+
response_401 = Error.from_dict(response.json())
46+
47+
return response_401
48+
if response.status_code == HTTPStatus.FORBIDDEN:
49+
response_403 = Error.from_dict(response.json())
50+
51+
return response_403
52+
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
53+
response_422 = Error.from_dict(response.json())
54+
55+
return response_422
56+
if response.status_code == HTTPStatus.INTERNAL_SERVER_ERROR:
57+
response_500 = Error.from_dict(response.json())
58+
59+
return response_500
60+
if client.raise_on_unexpected_status:
61+
raise errors.UnexpectedStatus(f"Unexpected status code: {response.status_code}")
62+
else:
63+
return None
64+
65+
66+
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Error, Settings]]:
67+
return Response(
68+
status_code=HTTPStatus(response.status_code),
69+
content=response.content,
70+
headers=response.headers,
71+
parsed=_parse_response(client=client, response=response),
72+
)
73+
74+
75+
def sync_detailed(
76+
*,
77+
client: Client,
78+
json_body: Settings,
79+
) -> Response[Union[Error, Settings]]:
80+
"""modify the settings
81+
82+
Args:
83+
json_body (Settings): instance settings that is configurable by the administrator.
84+
85+
Raises:
86+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
87+
httpx.TimeoutException: If the request takes longer than Client.timeout.
88+
89+
Returns:
90+
Response[Union[Error, Settings]]
91+
"""
92+
93+
kwargs = _get_kwargs(
94+
client=client,
95+
json_body=json_body,
96+
)
97+
98+
response = httpx.request(
99+
verify=client.verify_ssl,
100+
**kwargs,
101+
)
102+
103+
return _build_response(client=client, response=response)
104+
105+
106+
def sync(
107+
*,
108+
client: Client,
109+
json_body: Settings,
110+
) -> Optional[Union[Error, Settings]]:
111+
"""modify the settings
112+
113+
Args:
114+
json_body (Settings): instance settings that is configurable by the administrator.
115+
116+
Raises:
117+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
118+
httpx.TimeoutException: If the request takes longer than Client.timeout.
119+
120+
Returns:
121+
Response[Union[Error, Settings]]
122+
"""
123+
124+
return sync_detailed(
125+
client=client,
126+
json_body=json_body,
127+
).parsed
128+
129+
130+
async def asyncio_detailed(
131+
*,
132+
client: Client,
133+
json_body: Settings,
134+
) -> Response[Union[Error, Settings]]:
135+
"""modify the settings
136+
137+
Args:
138+
json_body (Settings): instance settings that is configurable by the administrator.
139+
140+
Raises:
141+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
142+
httpx.TimeoutException: If the request takes longer than Client.timeout.
143+
144+
Returns:
145+
Response[Union[Error, Settings]]
146+
"""
147+
148+
kwargs = _get_kwargs(
149+
client=client,
150+
json_body=json_body,
151+
)
152+
153+
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
154+
response = await _client.request(**kwargs)
155+
156+
return _build_response(client=client, response=response)
157+
158+
159+
async def asyncio(
160+
*,
161+
client: Client,
162+
json_body: Settings,
163+
) -> Optional[Union[Error, Settings]]:
164+
"""modify the settings
165+
166+
Args:
167+
json_body (Settings): instance settings that is configurable by the administrator.
168+
169+
Raises:
170+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
171+
httpx.TimeoutException: If the request takes longer than Client.timeout.
172+
173+
Returns:
174+
Response[Union[Error, Settings]]
175+
"""
176+
177+
return (
178+
await asyncio_detailed(
179+
client=client,
180+
json_body=json_body,
181+
)
182+
).parsed

0 commit comments

Comments
 (0)