|
1 | 1 | import datetime # noqa: F401 |
2 | 2 | import warnings |
3 | | -from typing import Callable, Dict, List, Optional, Tuple # noqa: F401 |
| 3 | +from typing import Callable, Dict, Optional, Any # noqa: F401 |
4 | 4 |
|
5 | 5 | from posthog.client import Client |
6 | 6 | from posthog.scopes import ( |
7 | | - new_context, |
8 | | - scoped, |
9 | | - tag, |
10 | | - set_context_session, |
11 | | - identify_context, |
| 7 | + new_context as inner_new_context, |
| 8 | + scoped as inner_scoped, |
| 9 | + tag as inner_tag, |
| 10 | + set_context_session as inner_set_context_session, |
| 11 | + identify_context as inner_identify_context, |
12 | 12 | ) |
13 | 13 | from posthog.types import FeatureFlag, FlagsAndPayloads |
14 | 14 | from posthog.version import VERSION |
15 | 15 |
|
16 | 16 | __version__ = VERSION |
17 | 17 |
|
18 | 18 | """Context management.""" |
19 | | -new_context = new_context |
20 | | -tag = tag |
21 | | -scoped = scoped |
22 | | -identify_context = identify_context |
23 | | -set_context_session = set_context_session |
| 19 | + |
| 20 | + |
| 21 | +def new_context(fresh=False, capture_exceptions=True): |
| 22 | + return inner_new_context(fresh=fresh, capture_exceptions=capture_exceptions) |
| 23 | + |
| 24 | + |
| 25 | +def scoped(fresh=False, capture_exceptions=True): |
| 26 | + return inner_scoped(fresh=fresh, capture_exceptions=capture_exceptions) |
| 27 | + |
| 28 | + |
| 29 | +def set_context_session(session_id: str): |
| 30 | + return inner_set_context_session(session_id) |
| 31 | + |
| 32 | + |
| 33 | +def identify_context(distinct_id: str): |
| 34 | + return inner_identify_context(distinct_id) |
| 35 | + |
| 36 | + |
| 37 | +def tag(name: str, value: Any): |
| 38 | + return inner_tag(name, value) |
24 | 39 |
|
25 | 40 |
|
26 | 41 | """Settings.""" |
|
0 commit comments