futurehouse-client 0.3.18.dev109__py3-none-any.whl → 0.3.18.dev110__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.
- futurehouse_client/utils/__init__.py +6 -2
- futurehouse_client/utils/context.py +38 -9
- {futurehouse_client-0.3.18.dev109.dist-info → futurehouse_client-0.3.18.dev110.dist-info}/METADATA +1 -1
- {futurehouse_client-0.3.18.dev109.dist-info → futurehouse_client-0.3.18.dev110.dist-info}/RECORD +6 -6
- {futurehouse_client-0.3.18.dev109.dist-info → futurehouse_client-0.3.18.dev110.dist-info}/WHEEL +0 -0
- {futurehouse_client-0.3.18.dev109.dist-info → futurehouse_client-0.3.18.dev110.dist-info}/top_level.txt +0 -0
@@ -1,16 +1,45 @@
|
|
1
|
-
|
2
|
-
"""A context manager for storing user information from the initial request."""
|
1
|
+
from typing import Any, ClassVar
|
3
2
|
|
4
|
-
|
3
|
+
USER_JWT_CONTEXT_KEY = "user_jwt"
|
4
|
+
JOB_ID_CONTEXT_KEY = "job_id"
|
5
|
+
|
6
|
+
|
7
|
+
class RequestContext:
|
8
|
+
"""A context manager for storing information from the initial request."""
|
9
|
+
|
10
|
+
_context: ClassVar[dict[str, Any]] = {}
|
5
11
|
|
6
12
|
@classmethod
|
7
|
-
def
|
8
|
-
|
13
|
+
def set(cls, key: str, value: Any) -> None:
|
14
|
+
"""Set a context variable.
|
15
|
+
|
16
|
+
Args:
|
17
|
+
key: The context variable name
|
18
|
+
value: The value to store
|
19
|
+
"""
|
20
|
+
cls._context[key] = value
|
9
21
|
|
10
22
|
@classmethod
|
11
|
-
def
|
12
|
-
|
23
|
+
def get(cls, key: str) -> Any:
|
24
|
+
"""Get a context variable.
|
25
|
+
|
26
|
+
Args:
|
27
|
+
key: The context variable name
|
28
|
+
default: Default value if key doesn't exist
|
29
|
+
|
30
|
+
Returns:
|
31
|
+
The stored value or default if not found
|
32
|
+
"""
|
33
|
+
return cls._context.get(key, None)
|
13
34
|
|
14
35
|
@classmethod
|
15
|
-
def
|
16
|
-
|
36
|
+
def clear(cls, key: str | None = None) -> None:
|
37
|
+
"""Clear a specific context variable or all variables.
|
38
|
+
|
39
|
+
Args:
|
40
|
+
key: Specific key to clear, or None to clear all
|
41
|
+
"""
|
42
|
+
if key is None:
|
43
|
+
cls._context.clear()
|
44
|
+
elif key in cls._context:
|
45
|
+
del cls._context[key]
|
{futurehouse_client-0.3.18.dev109.dist-info → futurehouse_client-0.3.18.dev110.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: futurehouse-client
|
3
|
-
Version: 0.3.18.
|
3
|
+
Version: 0.3.18.dev110
|
4
4
|
Summary: A client for interacting with endpoints of the FutureHouse service.
|
5
5
|
Author-email: FutureHouse technical staff <hello@futurehouse.org>
|
6
6
|
Classifier: Operating System :: OS Independent
|
{futurehouse_client-0.3.18.dev109.dist-info → futurehouse_client-0.3.18.dev110.dist-info}/RECORD
RENAMED
@@ -6,12 +6,12 @@ futurehouse_client/models/__init__.py,sha256=ta3jFLM_LsDz1rKDmx8rja8sT7WtSKoFvMg
|
|
6
6
|
futurehouse_client/models/app.py,sha256=yfZ9tyw4VATVAfYrU7aTdCNPSljLEho09_nIbh8oZDY,23174
|
7
7
|
futurehouse_client/models/client.py,sha256=n4HD0KStKLm6Ek9nL9ylP-bkK10yzAaD1uIDF83Qp_A,1828
|
8
8
|
futurehouse_client/models/rest.py,sha256=lgwkMIXz0af-49BYSkKeS7SRqvN3motqnAikDN4YGTc,789
|
9
|
-
futurehouse_client/utils/__init__.py,sha256=
|
10
|
-
futurehouse_client/utils/context.py,sha256=
|
9
|
+
futurehouse_client/utils/__init__.py,sha256=Tlz5A-h2h2R8SZo7HXtNGNwDY08zCMWtE33PnSw5jjo,169
|
10
|
+
futurehouse_client/utils/context.py,sha256=QN_-Z61IQtAUOZaBDoP5F6pqvrkMxZ7y-1t7LEuF6lI,1162
|
11
11
|
futurehouse_client/utils/general.py,sha256=A_rtTiYW30ELGEZlWCIArO7q1nEmqi8hUlmBRYkMQ_c,767
|
12
12
|
futurehouse_client/utils/module_utils.py,sha256=aFyd-X-pDARXz9GWpn8SSViUVYdSbuy9vSkrzcVIaGI,4955
|
13
13
|
futurehouse_client/utils/monitoring.py,sha256=UjRlufe67kI3VxRHOd5fLtJmlCbVA2Wqwpd4uZhXkQM,8728
|
14
|
-
futurehouse_client-0.3.18.
|
15
|
-
futurehouse_client-0.3.18.
|
16
|
-
futurehouse_client-0.3.18.
|
17
|
-
futurehouse_client-0.3.18.
|
14
|
+
futurehouse_client-0.3.18.dev110.dist-info/METADATA,sha256=DQlgzMDU6QxiO2hvu29l1K3EDgjipG2ew6vtsfFdlF8,12767
|
15
|
+
futurehouse_client-0.3.18.dev110.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
16
|
+
futurehouse_client-0.3.18.dev110.dist-info/top_level.txt,sha256=TRuLUCt_qBnggdFHCX4O_BoCu1j2X43lKfIZC-ElwWY,19
|
17
|
+
futurehouse_client-0.3.18.dev110.dist-info/RECORD,,
|
{futurehouse_client-0.3.18.dev109.dist-info → futurehouse_client-0.3.18.dev110.dist-info}/WHEEL
RENAMED
File without changes
|
File without changes
|