kalbio 0.2.2__tar.gz → 0.2.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kalbio
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Python client for kaleidoscope.bio
5
5
  License: MIT
6
6
  Author: Ahmed Elnaiem
@@ -65,7 +65,7 @@ from kalbio.entity_fields import DataFieldTypeEnum
65
65
  from kalbio.programs import Program
66
66
  from kalbio.labels import Label
67
67
  from kalbio.workspace import WorkspaceUser, WorkspaceGroup
68
- from typing import Any, BinaryIO, List, Literal, Optional, Union
68
+ from typing import Any, BinaryIO, List, Literal, Optional, TypeAlias, Union
69
69
  from typing import TYPE_CHECKING
70
70
 
71
71
  if TYPE_CHECKING:
@@ -153,7 +153,7 @@ class ActivityStatusEnum(str, Enum):
153
153
  DONE = "done"
154
154
 
155
155
 
156
- type ActivityType = Union[
156
+ ActivityType: TypeAlias = Union[
157
157
  Literal["task"],
158
158
  Literal["experiment"],
159
159
  Literal["project"],
@@ -671,7 +671,7 @@ class Activity(_KaleidoscopeBaseModel):
671
671
  setattr(self, k, v)
672
672
 
673
673
 
674
- type ActivityIdentifier = Union[Activity, str]
674
+ ActivityIdentifier: TypeAlias = Union[Activity, str]
675
675
  """Identifier class for Activity
676
676
 
677
677
  Activities are able to be identified by:
@@ -681,7 +681,7 @@ Activities are able to be identified by:
681
681
  * UUID
682
682
  """
683
683
 
684
- type DefinitionIdentifier = Union[ActivityDefinition, str]
684
+ DefinitionIdentifier: TypeAlias = Union[ActivityDefinition, str]
685
685
  """Identifier class for ActivityDefinition
686
686
 
687
687
  ActivityDefinitions are able to be identified by:
@@ -119,6 +119,7 @@ class KaleidoscopeClient:
119
119
 
120
120
  _client_id: str
121
121
  _client_secret: str
122
+ _additional_headers: dict
122
123
  _iap_client_id: Optional[str]
123
124
 
124
125
  _refresh_token: str = None
@@ -133,6 +134,7 @@ class KaleidoscopeClient:
133
134
  client_id: Optional[str] = _env_client_id,
134
135
  client_secret: Optional[str] = _env_client_secret,
135
136
  url: str = PROD_API_URL,
137
+ additional_headers: dict = {},
136
138
  iap_client_id: Optional[str] = None,
137
139
  verify_ssl: bool = True,
138
140
  ):
@@ -206,6 +208,7 @@ class KaleidoscopeClient:
206
208
 
207
209
  self._client_id = client_id
208
210
  self._client_secret = client_secret
211
+ self.additional_headers = additional_headers
209
212
  self._iap_client_id = iap_client_id
210
213
  self._verify_ssl = verify_ssl
211
214
 
@@ -258,7 +261,7 @@ class KaleidoscopeClient:
258
261
  "client_id": self._client_id,
259
262
  "client_secret": self._client_secret,
260
263
  },
261
- headers=self._get_iap_headers(),
264
+ headers={**self._get_iap_headers(), **self.additional_headers},
262
265
  timeout=TIMEOUT_MAXIMUM,
263
266
  verify=self._verify_ssl,
264
267
  )
@@ -284,7 +287,7 @@ class KaleidoscopeClient:
284
287
  "grant_type": "refresh_token",
285
288
  "refresh_token": self._refresh_token,
286
289
  },
287
- headers=self._get_iap_headers(),
290
+ headers={**self._get_iap_headers(), **self.additional_headers},
288
291
  timeout=TIMEOUT_MAXIMUM,
289
292
  verify=self._verify_ssl,
290
293
  )
@@ -327,6 +330,7 @@ class KaleidoscopeClient:
327
330
  "Content-Type": "application/json",
328
331
  "X-Kal-Authorization": f"Bearer {self._access_token}",
329
332
  **self._get_iap_headers(),
333
+ **self.additional_headers,
330
334
  }
331
335
 
332
336
  return headers
@@ -21,11 +21,11 @@ from functools import lru_cache
21
21
  from kalbio._kaleidoscope_model import _KaleidoscopeBaseModel
22
22
  from kalbio.client import KaleidoscopeClient
23
23
  from pydantic import TypeAdapter
24
- from typing import List, Literal, Union
24
+ from typing import List, Literal, TypeAlias, Union
25
25
 
26
26
  _logger = logging.getLogger(__name__)
27
27
 
28
- type DashboardType = Union[
28
+ DashboardType: TypeAlias = Union[
29
29
  Literal["decision"],
30
30
  Literal["data"],
31
31
  Literal["chart"],
@@ -41,7 +41,7 @@ from functools import lru_cache
41
41
  from kalbio._kaleidoscope_model import _KaleidoscopeBaseModel
42
42
  from kalbio.client import KaleidoscopeClient
43
43
  from pydantic import TypeAdapter
44
- from typing import List, Optional, Union
44
+ from typing import List, Optional, TypeAlias, Union
45
45
 
46
46
  _logger = logging.getLogger(__name__)
47
47
 
@@ -151,7 +151,7 @@ class EntityField(_KaleidoscopeBaseModel):
151
151
  return f"{self.field_name}"
152
152
 
153
153
 
154
- type EntityFieldIdentifier = Union[EntityField, str]
154
+ EntityFieldIdentifier: TypeAlias = Union[EntityField, str]
155
155
  """An Identifier Type for Entity Fields.
156
156
 
157
157
  An EntityField should be able to be identified by:
@@ -119,7 +119,7 @@ class ExportsService:
119
119
  url = "/records/export/csv"
120
120
  file = self._client._get_file(
121
121
  url,
122
- f"{download_path if download_path else "/tmp"}/{filename}",
122
+ f"{download_path if download_path else '/tmp'}/{filename}",
123
123
  params,
124
124
  )
125
125
 
@@ -62,6 +62,7 @@ from typing import (
62
62
  Dict,
63
63
  List,
64
64
  Optional,
65
+ TypeAlias,
65
66
  TypedDict,
66
67
  Union,
67
68
  Unpack,
@@ -631,7 +632,7 @@ class Record(_KaleidoscopeBaseModel):
631
632
  setattr(self, k, v)
632
633
 
633
634
 
634
- type RecordIdentifier = Union[Record, str, dict[EntityFieldIdentifier, str]]
635
+ RecordIdentifier: TypeAlias = Union[Record, str, dict[EntityFieldIdentifier, str]]
635
636
  """Identifier type for Record
636
637
 
637
638
  Record can be identified by:
@@ -1154,7 +1155,7 @@ class RecordsService:
1154
1155
  ]
1155
1156
  # fmt: on
1156
1157
 
1157
- resp = self._client._get(f"/records?record_ids={",".join(to_fetch)}") or []
1158
+ resp = self._client._get(f"/records?record_ids={','.join(to_fetch)}") or []
1158
1159
  self._create_record_list(resp)
1159
1160
 
1160
1161
  ordered = [
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kalbio"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "Python client for kaleidoscope.bio"
5
5
  authors = ["Ahmed Elnaiem <ahmed@kaleidoscope.bio>"]
6
6
  readme = "README.md"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes