sg-python-api 0.1.2__py3-none-any.whl → 0.2.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.
- {sg_python_api-0.1.2.dist-info → sg_python_api-0.2.0.dist-info}/METADATA +21 -24
- sg_python_api-0.2.0.dist-info/RECORD +58 -0
- shotgun_api3/__init__.py +4 -0
- shotgun_api3/_async_client.py +347 -281
- shotgun_api3/_async_driver.py +25 -55
- shotgun_api3/_async_httpx2.py +92 -59
- shotgun_api3/_async_transport.py +38 -3
- shotgun_api3/_capabilities.py +4 -3
- shotgun_api3/_client.py +296 -422
- shotgun_api3/_config.py +245 -120
- shotgun_api3/_connections.py +144 -0
- shotgun_api3/_crud.py +25 -250
- shotgun_api3/_driver.py +29 -54
- shotgun_api3/_execution.py +1 -3
- shotgun_api3/_files.py +193 -21
- shotgun_api3/_methods.py +59 -411
- shotgun_api3/_protocol.py +27 -53
- shotgun_api3/_transport.py +82 -407
- shotgun_api3/_version.py +7 -2
- shotgun_api3/lib/mockgun/__init__.py +20 -7
- shotgun_api3/lib/mockgun/_activity.py +510 -0
- shotgun_api3/lib/mockgun/_async_client.py +196 -0
- shotgun_api3/lib/mockgun/_dates.py +164 -0
- shotgun_api3/lib/mockgun/_errors.py +18 -0
- shotgun_api3/lib/mockgun/_events.py +1031 -0
- shotgun_api3/lib/mockgun/_follows.py +217 -0
- shotgun_api3/lib/mockgun/_handlers.py +558 -0
- shotgun_api3/lib/mockgun/_links.py +440 -0
- shotgun_api3/lib/mockgun/_new_client.py +92 -0
- shotgun_api3/lib/mockgun/_presets.py +492 -0
- shotgun_api3/lib/mockgun/_query.py +2163 -0
- shotgun_api3/lib/mockgun/_retirement.py +368 -0
- shotgun_api3/lib/mockgun/_schema.py +172 -0
- shotgun_api3/lib/mockgun/_schema_writes.py +425 -0
- shotgun_api3/lib/mockgun/_search.py +378 -0
- shotgun_api3/lib/mockgun/_server.py +169 -0
- shotgun_api3/lib/mockgun/_sessions.py +206 -0
- shotgun_api3/lib/mockgun/_site.py +150 -0
- shotgun_api3/lib/mockgun/_site_data.py +584 -0
- shotgun_api3/lib/mockgun/_storage.py +208 -0
- shotgun_api3/lib/mockgun/_store.py +1446 -0
- shotgun_api3/lib/mockgun/_summaries.py +964 -0
- shotgun_api3/lib/mockgun/_sync_client.py +190 -0
- shotgun_api3/lib/mockgun/_threads.py +226 -0
- shotgun_api3/lib/mockgun/_thumbnails.py +146 -0
- shotgun_api3/lib/mockgun/_transport.py +145 -0
- shotgun_api3/lib/mockgun/_uploads.py +417 -0
- shotgun_api3/lib/mockgun/_wire.py +120 -0
- shotgun_api3/lib/mockgun/mockgun.py +14 -0
- shotgun_api3/lib/sgtimezone.py +24 -1
- sg_python_api-0.1.2.dist-info/RECORD +0 -31
- shotgun_api3/_signatures.py +0 -53
- shotgun_api3/lib/mockgun/_async.py +0 -315
- shotgun_api3/lib/mockgun/_mockgun.py +0 -1666
- {sg_python_api-0.1.2.dist-info → sg_python_api-0.2.0.dist-info}/WHEEL +0 -0
- {sg_python_api-0.1.2.dist-info → sg_python_api-0.2.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Provide mockgun's clients under the module path Autodesk's package uses.
|
|
2
|
+
|
|
3
|
+
Code written for Autodesk's mockgun can import `Shotgun` from this module. The
|
|
4
|
+
names here are the same objects that `shotgun_api3.lib.mockgun` exports; see
|
|
5
|
+
that package for their behavior.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from ._async_client import AsyncShotgun
|
|
9
|
+
from ._errors import MockgunError
|
|
10
|
+
from ._schema import generate_schema
|
|
11
|
+
from ._site import Site
|
|
12
|
+
from ._sync_client import Shotgun
|
|
13
|
+
|
|
14
|
+
__all__ = ['AsyncShotgun', 'MockgunError', 'Shotgun', 'Site', 'generate_schema']
|
shotgun_api3/lib/sgtimezone.py
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
import datetime
|
|
4
4
|
import time
|
|
5
5
|
|
|
6
|
+
__all__ = ['UTC', 'LocalTimezone', 'SgTimezone']
|
|
7
|
+
|
|
6
8
|
_EPOCH = datetime.datetime(1970, 1, 1, tzinfo=datetime.UTC)
|
|
7
9
|
_NAIVE_EPOCH = _EPOCH.replace(tzinfo=None)
|
|
8
10
|
_ZERO = datetime.timedelta(0)
|
|
@@ -69,6 +71,11 @@ class LocalTimezone(datetime.tzinfo):
|
|
|
69
71
|
|
|
70
72
|
Returns:
|
|
71
73
|
The daylight-saving adjustment, or zero when DST is not active.
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
OSError: If the platform cannot resolve a non-pre-epoch local time.
|
|
77
|
+
OverflowError: If that local time exceeds the platform's range.
|
|
78
|
+
ValueError: If the platform rejects that local time.
|
|
72
79
|
"""
|
|
73
80
|
standard, daylight = self._offsets()
|
|
74
81
|
return daylight - standard if self._isdst(dt) else _ZERO
|
|
@@ -85,7 +92,11 @@ class LocalTimezone(datetime.tzinfo):
|
|
|
85
92
|
time.
|
|
86
93
|
|
|
87
94
|
Raises:
|
|
88
|
-
ValueError: If
|
|
95
|
+
ValueError: If the platform rejects the conversion.
|
|
96
|
+
OSError: If platform conversion fails without an applicable
|
|
97
|
+
pre-epoch fallback.
|
|
98
|
+
OverflowError: If platform conversion or local datetime arithmetic
|
|
99
|
+
exceeds its supported range.
|
|
89
100
|
"""
|
|
90
101
|
if dt.tzinfo is not self:
|
|
91
102
|
raise ValueError('fromutc() requires dt.tzinfo to be self')
|
|
@@ -130,6 +141,11 @@ class LocalTimezone(datetime.tzinfo):
|
|
|
130
141
|
|
|
131
142
|
Returns:
|
|
132
143
|
The platform's standard or daylight timezone name.
|
|
144
|
+
|
|
145
|
+
Raises:
|
|
146
|
+
OSError: If the platform cannot resolve a non-pre-epoch local time.
|
|
147
|
+
OverflowError: If that local time exceeds the platform's range.
|
|
148
|
+
ValueError: If the platform rejects that local time.
|
|
133
149
|
"""
|
|
134
150
|
return time.tzname[int(self._isdst(dt))]
|
|
135
151
|
|
|
@@ -142,6 +158,11 @@ class LocalTimezone(datetime.tzinfo):
|
|
|
142
158
|
|
|
143
159
|
Returns:
|
|
144
160
|
The current standard or daylight offset from UTC.
|
|
161
|
+
|
|
162
|
+
Raises:
|
|
163
|
+
OSError: If the platform cannot resolve a non-pre-epoch local time.
|
|
164
|
+
OverflowError: If that local time exceeds the platform's range.
|
|
165
|
+
ValueError: If the platform rejects that local time.
|
|
145
166
|
"""
|
|
146
167
|
standard, daylight = self._offsets()
|
|
147
168
|
return daylight if self._isdst(dt) else standard
|
|
@@ -193,6 +214,8 @@ class SgTimezone:
|
|
|
193
214
|
Attributes:
|
|
194
215
|
utc: UTC timezone instance.
|
|
195
216
|
local: System-local timezone instance.
|
|
217
|
+
UTC: Constructor alias for the UTC timezone class.
|
|
218
|
+
LocalTimezone: Constructor alias for the system-local timezone class.
|
|
196
219
|
"""
|
|
197
220
|
|
|
198
221
|
LocalTimezone = LocalTimezone
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
shotgun_api3/__init__.py,sha256=fviJGOi_Gb9jHi5Q9ty5tIbeIvxMtLNrKx_4HJVgemI,2011
|
|
2
|
-
shotgun_api3/_async_client.py,sha256=UYVk_IGzMcUguJ4oCV-Nof4mL2kvzYYGuiYvW4gHeMs,113167
|
|
3
|
-
shotgun_api3/_async_driver.py,sha256=NnuMmQP5KrAoANBvWIhcIUe_ljD62pK_7xSIoEIltXw,32308
|
|
4
|
-
shotgun_api3/_async_httpx2.py,sha256=3pjeFsb5racGArvlR50c3w0XtrttXuRU_6E9Y-cBU3c,24387
|
|
5
|
-
shotgun_api3/_async_transport.py,sha256=8iAcoFafEHKRBirBkqdIqMFgqLs1YTgtzgACudD0kM4,4928
|
|
6
|
-
shotgun_api3/_capabilities.py,sha256=RrStvExVC3TAADhfbY2JpYZUXmvE63vXIJy1R-nkEII,5527
|
|
7
|
-
shotgun_api3/_client.py,sha256=jtemxhdhFr1gwE7qB6K-62Sohb2C_S4dEO7uKpVh2Uo,102109
|
|
8
|
-
shotgun_api3/_config.py,sha256=fALxy5xGI3A0nECsRDyls_9A8tvjB0DNSpTu1agNEHw,54931
|
|
9
|
-
shotgun_api3/_crud.py,sha256=Ax36jA2E-lauRf2D-2rmRDj61SilOygtkjKgs5XDCUs,30319
|
|
10
|
-
shotgun_api3/_driver.py,sha256=DAtnZW044TWiqscs0G1uwTiluAFtCoR2wKTbJYJHT2g,29498
|
|
11
|
-
shotgun_api3/_errors.py,sha256=fk7v3XbmZK63M272r5wDwF_GgI-4RynPfAWv1P-J-GI,1480
|
|
12
|
-
shotgun_api3/_execution.py,sha256=Kn2Yd9sXIA975stnof7MeuA8bT3dyOuWDIqQnP65LO0,8235
|
|
13
|
-
shotgun_api3/_files.py,sha256=-eXHyG0U9mEAdYTthgVEhlzBKYUOt4g-3k9D522L3zM,33900
|
|
14
|
-
shotgun_api3/_methods.py,sha256=pYzx2pN0nus6vPWf-Gl8Zz4MgRf8R4b7kvxN8lhoXgc,37685
|
|
15
|
-
shotgun_api3/_protocol.py,sha256=0ccL65aIm3v2w6dOtNnZuFrKQncA8WO4yadtxRP55-w,42194
|
|
16
|
-
shotgun_api3/_sentinel.py,sha256=KAQzQjJVhTTZPLFY1f88-_vP7U06i2g6ZS7KJcn4vIA,116
|
|
17
|
-
shotgun_api3/_sg_timezone.py,sha256=yr7Wdln9fwfTVGMQSFsgO-eduuTHQ5EbSY5xEVQ2tYw,115
|
|
18
|
-
shotgun_api3/_signatures.py,sha256=_yhNnbkVF-0opaBfg9H6SauBN2RT4hJsHGa3ZO3Ug4s,1622
|
|
19
|
-
shotgun_api3/_transport.py,sha256=LmQ0e2VvAKwFdNy4SyfRHwgKC6GWnwkIN5Wa2fin3AM,30047
|
|
20
|
-
shotgun_api3/_version.py,sha256=0NYED9oy2nGCvTERMwWJvajshS5qzH_v4w7QUAGAivY,102
|
|
21
|
-
shotgun_api3/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
shotgun_api3/shotgun.py,sha256=X7PLlCC-gR8dJgY_uLYXw_LWN8mz5MsQsSYJldtavTk,1706
|
|
23
|
-
shotgun_api3/lib/__init__.py,sha256=4WGYod6xHcj23rapx5bTDGdjT52H1CAQNMz4BmzNmn0,55
|
|
24
|
-
shotgun_api3/lib/sgtimezone.py,sha256=nYSaCsIeq_SJh7YgL4yWN7dTVVz9lAfx-G3mzsHb8iM,7027
|
|
25
|
-
shotgun_api3/lib/mockgun/__init__.py,sha256=2mHjMJAV4mZ8JvnP8WHn6tkdMJoB7UQtNSs99YzNW30,703
|
|
26
|
-
shotgun_api3/lib/mockgun/_async.py,sha256=7bTZFdlSzeoGq9fRbPBAf-X08qDmrkzV9rxskx5AGX8,10812
|
|
27
|
-
shotgun_api3/lib/mockgun/_mockgun.py,sha256=k2cqLMCKpU5oIbUGiYulf1aIU0HLrMB6DQQ3KrCy7WQ,65093
|
|
28
|
-
sg_python_api-0.1.2.dist-info/METADATA,sha256=2Zv6g9pJZ28QttHMO6Q1yYWvyczPypCHc-QCAYbjIaQ,7587
|
|
29
|
-
sg_python_api-0.1.2.dist-info/WHEEL,sha256=W3fkpkm7-wf9vBI5Z-7s0eWkeM-spu78I8Neb98DeEg,87
|
|
30
|
-
sg_python_api-0.1.2.dist-info/licenses/LICENSE,sha256=V3moMsQxKDchTd3mtXl5J-ODaNBDvFrapOf1DK7Nx_U,1082
|
|
31
|
-
sg_python_api-0.1.2.dist-info/RECORD,,
|
shotgun_api3/_signatures.py
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"""Shared argument binding and callable reflection metadata."""
|
|
2
|
-
|
|
3
|
-
import inspect
|
|
4
|
-
from collections.abc import Callable, Mapping
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def bind_arguments(
|
|
8
|
-
signature: inspect.Signature,
|
|
9
|
-
args: tuple[object, ...],
|
|
10
|
-
kwargs: Mapping[str, object],
|
|
11
|
-
label: str,
|
|
12
|
-
) -> inspect.BoundArguments:
|
|
13
|
-
"""Bind arguments and defaults with a caller-specific error prefix.
|
|
14
|
-
|
|
15
|
-
Args:
|
|
16
|
-
signature: Public call signature to enforce.
|
|
17
|
-
args: Supplied positional arguments.
|
|
18
|
-
kwargs: Supplied keyword arguments.
|
|
19
|
-
label: Public callable label, including parentheses, for errors.
|
|
20
|
-
|
|
21
|
-
Returns:
|
|
22
|
-
Bound arguments retaining the supplied values without copying them.
|
|
23
|
-
|
|
24
|
-
Raises:
|
|
25
|
-
TypeError: If binding fails, prefixed with the callable label.
|
|
26
|
-
"""
|
|
27
|
-
try:
|
|
28
|
-
bound = signature.bind(*args, **kwargs)
|
|
29
|
-
except TypeError as exc:
|
|
30
|
-
raise TypeError(f'{label} {exc}') from None
|
|
31
|
-
bound.apply_defaults()
|
|
32
|
-
return bound
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def expose_signature(
|
|
36
|
-
function: Callable[..., object],
|
|
37
|
-
signature: inspect.Signature,
|
|
38
|
-
doc: str | None,
|
|
39
|
-
) -> Callable[..., object]:
|
|
40
|
-
"""Attach a signature and optional documentation to the same callable.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
function: Implementation receiving public reflection metadata.
|
|
44
|
-
signature: Public signature to expose.
|
|
45
|
-
doc: Replacement documentation, or `None` to preserve the docstring.
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
The same callable with its reflection metadata updated.
|
|
49
|
-
"""
|
|
50
|
-
if doc is not None:
|
|
51
|
-
object.__setattr__(function, '__doc__', doc)
|
|
52
|
-
object.__setattr__(function, '__signature__', signature)
|
|
53
|
-
return function
|
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
"""Awaitable delegation twin of the in-memory mockgun client."""
|
|
2
|
-
|
|
3
|
-
from typing import Any, ClassVar
|
|
4
|
-
|
|
5
|
-
from ._mockgun import Shotgun, expose_find_documentation, expose_find_one_documentation
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class AsyncShotgun:
|
|
9
|
-
"""Provide the mockgun surface through awaitable methods.
|
|
10
|
-
|
|
11
|
-
Each instance owns a synchronous in-memory delegate; awaitable operations
|
|
12
|
-
execute against that delegate without network I/O. Each subclass receives
|
|
13
|
-
its own delegate class, so changing its schema paths does not change those
|
|
14
|
-
of sibling subclasses.
|
|
15
|
-
|
|
16
|
-
Attributes:
|
|
17
|
-
base_url: Constructor-supplied site URL, preserved unchanged.
|
|
18
|
-
config: Mutable mock configuration.
|
|
19
|
-
finds: Number of find operations performed.
|
|
20
|
-
"""
|
|
21
|
-
|
|
22
|
-
_sync_type: ClassVar[type[Shotgun]] = Shotgun
|
|
23
|
-
finds: int
|
|
24
|
-
|
|
25
|
-
def __init__( # noqa: PLR0913, PLR0917 - compatibility requires the exact sync signature.
|
|
26
|
-
self,
|
|
27
|
-
base_url: str,
|
|
28
|
-
script_name: str | None = None,
|
|
29
|
-
api_key: str | None = None,
|
|
30
|
-
convert_datetimes_to_utc: bool = True,
|
|
31
|
-
http_proxy: str | None = None,
|
|
32
|
-
connect: bool = True,
|
|
33
|
-
ca_certs: str | None = None,
|
|
34
|
-
login: str | None = None,
|
|
35
|
-
password: str | None = None,
|
|
36
|
-
sudo_as_login: str | None = None,
|
|
37
|
-
session_token: str | None = None,
|
|
38
|
-
auth_token: str | None = None,
|
|
39
|
-
) -> None:
|
|
40
|
-
"""Initialize an asynchronous wrapper around one mock client.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
base_url: Site URL used to initialize mock configuration.
|
|
44
|
-
script_name: Accepted compatibility script name.
|
|
45
|
-
api_key: Accepted compatibility API key.
|
|
46
|
-
convert_datetimes_to_utc: Accepted datetime-conversion setting.
|
|
47
|
-
http_proxy: Accepted compatibility proxy setting.
|
|
48
|
-
connect: Accepted compatibility connection setting.
|
|
49
|
-
ca_certs: Accepted compatibility certificate path.
|
|
50
|
-
login: Accepted compatibility user login.
|
|
51
|
-
password: Accepted compatibility user password.
|
|
52
|
-
sudo_as_login: Accepted compatibility sudo login.
|
|
53
|
-
session_token: Accepted compatibility session token.
|
|
54
|
-
auth_token: Accepted compatibility two-factor token.
|
|
55
|
-
|
|
56
|
-
Raises:
|
|
57
|
-
MockgunError: If schema paths are unset or files are missing.
|
|
58
|
-
TypeError: If arguments do not match the compatibility signature.
|
|
59
|
-
ValueError: If `base_url` has an unsupported or invalid origin.
|
|
60
|
-
"""
|
|
61
|
-
self._sync = self._sync_type(
|
|
62
|
-
base_url,
|
|
63
|
-
script_name,
|
|
64
|
-
api_key,
|
|
65
|
-
convert_datetimes_to_utc,
|
|
66
|
-
http_proxy,
|
|
67
|
-
connect,
|
|
68
|
-
ca_certs,
|
|
69
|
-
login,
|
|
70
|
-
password,
|
|
71
|
-
sudo_as_login,
|
|
72
|
-
session_token,
|
|
73
|
-
auth_token,
|
|
74
|
-
)
|
|
75
|
-
self.config = self._sync.config
|
|
76
|
-
self.base_url = self._sync.base_url
|
|
77
|
-
|
|
78
|
-
def __getattr__(self, name: str) -> object:
|
|
79
|
-
"""Return the sync twin's live find counter."""
|
|
80
|
-
if name == 'finds':
|
|
81
|
-
return self._sync.finds
|
|
82
|
-
raise AttributeError(f'{type(self).__name__!s} has no attribute {name!r}')
|
|
83
|
-
|
|
84
|
-
def __init_subclass__(cls) -> None:
|
|
85
|
-
"""Give each async mock subclass its own synchronous delegate class."""
|
|
86
|
-
super().__init_subclass__()
|
|
87
|
-
cls._sync_type = type(
|
|
88
|
-
f'_{cls.__name__}SyncDelegate',
|
|
89
|
-
(cls._sync_type,),
|
|
90
|
-
{'__module__': __name__},
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
async def batch(self, requests: list[dict[str, Any]]) -> list[object]:
|
|
94
|
-
"""Execute supported requests in order and return their result values.
|
|
95
|
-
|
|
96
|
-
Requests apply sequentially. If a later request fails, earlier
|
|
97
|
-
mutations remain applied.
|
|
98
|
-
|
|
99
|
-
Args:
|
|
100
|
-
requests: Create, update, and delete request dictionaries.
|
|
101
|
-
|
|
102
|
-
Returns:
|
|
103
|
-
Per-request results in input order.
|
|
104
|
-
|
|
105
|
-
Raises:
|
|
106
|
-
ShotgunError: If a request or delegated operation is invalid.
|
|
107
|
-
"""
|
|
108
|
-
return self._sync.batch(requests)
|
|
109
|
-
|
|
110
|
-
async def create(
|
|
111
|
-
self,
|
|
112
|
-
entity_type: str,
|
|
113
|
-
data: dict[str, Any],
|
|
114
|
-
return_fields: list[str] | None = None,
|
|
115
|
-
) -> dict[str, object]:
|
|
116
|
-
"""Create and return an entity in the in-memory database.
|
|
117
|
-
|
|
118
|
-
Args:
|
|
119
|
-
entity_type: Schema entity type to create.
|
|
120
|
-
data: Field values for the new entity.
|
|
121
|
-
return_fields: Fields to return instead of the fields in `data`.
|
|
122
|
-
|
|
123
|
-
Returns:
|
|
124
|
-
Created entity identity and the selected field values.
|
|
125
|
-
|
|
126
|
-
Raises:
|
|
127
|
-
ShotgunError: If the entity, fields, or values are invalid.
|
|
128
|
-
"""
|
|
129
|
-
return self._sync.create(entity_type, data, return_fields)
|
|
130
|
-
|
|
131
|
-
async def delete(self, entity_type: str, entity_id: int) -> bool:
|
|
132
|
-
"""Retire an active entity.
|
|
133
|
-
|
|
134
|
-
Args:
|
|
135
|
-
entity_type: Schema entity type to retire.
|
|
136
|
-
entity_id: ID of the existing entity.
|
|
137
|
-
|
|
138
|
-
Returns:
|
|
139
|
-
`True` when the entity changed state, otherwise `False`.
|
|
140
|
-
|
|
141
|
-
Raises:
|
|
142
|
-
ShotgunError: If the entity type or ID is unknown.
|
|
143
|
-
"""
|
|
144
|
-
return self._sync.delete(entity_type, entity_id)
|
|
145
|
-
|
|
146
|
-
@expose_find_documentation
|
|
147
|
-
async def find( # noqa: PLR0913, PLR0917 - compatibility requires the exact sync signature.
|
|
148
|
-
self,
|
|
149
|
-
entity_type: str,
|
|
150
|
-
filters: list[Any] | tuple[Any, ...] | dict[str, Any],
|
|
151
|
-
fields: list[str] | None = None,
|
|
152
|
-
order: list[dict[str, str]] | None = None,
|
|
153
|
-
filter_operator: str | None = None,
|
|
154
|
-
limit: int = 0,
|
|
155
|
-
retired_only: bool = False,
|
|
156
|
-
page: int = 0,
|
|
157
|
-
include_archived_projects: bool = True,
|
|
158
|
-
additional_filter_presets: object = None,
|
|
159
|
-
) -> list[dict[str, object]]:
|
|
160
|
-
return self._sync.find(
|
|
161
|
-
entity_type,
|
|
162
|
-
filters,
|
|
163
|
-
fields,
|
|
164
|
-
order,
|
|
165
|
-
filter_operator,
|
|
166
|
-
limit,
|
|
167
|
-
retired_only,
|
|
168
|
-
page,
|
|
169
|
-
include_archived_projects,
|
|
170
|
-
additional_filter_presets,
|
|
171
|
-
)
|
|
172
|
-
|
|
173
|
-
@expose_find_one_documentation
|
|
174
|
-
async def find_one( # noqa: PLR0913, PLR0917 - compatibility requires the exact sync signature.
|
|
175
|
-
self,
|
|
176
|
-
entity_type: str,
|
|
177
|
-
filters: list[Any] | tuple[Any, ...] | dict[str, Any],
|
|
178
|
-
fields: list[str] | None = None,
|
|
179
|
-
order: list[dict[str, str]] | None = None,
|
|
180
|
-
filter_operator: str | None = None,
|
|
181
|
-
retired_only: bool = False,
|
|
182
|
-
include_archived_projects: bool = True,
|
|
183
|
-
additional_filter_presets: object = None,
|
|
184
|
-
) -> dict[str, object] | None:
|
|
185
|
-
return self._sync.find_one(
|
|
186
|
-
entity_type,
|
|
187
|
-
filters,
|
|
188
|
-
fields,
|
|
189
|
-
order,
|
|
190
|
-
filter_operator,
|
|
191
|
-
retired_only,
|
|
192
|
-
include_archived_projects,
|
|
193
|
-
additional_filter_presets,
|
|
194
|
-
)
|
|
195
|
-
|
|
196
|
-
@classmethod
|
|
197
|
-
async def get_schema_paths(cls) -> tuple[str | None, str | None]:
|
|
198
|
-
"""Return the schema paths configured for mockgun clients.
|
|
199
|
-
|
|
200
|
-
Returns:
|
|
201
|
-
Field-schema and entity-schema paths, in that order.
|
|
202
|
-
"""
|
|
203
|
-
return cls._sync_type.get_schema_paths()
|
|
204
|
-
|
|
205
|
-
async def revive(self, entity_type: str, entity_id: int) -> bool:
|
|
206
|
-
"""Restore a retired entity to active state.
|
|
207
|
-
|
|
208
|
-
Args:
|
|
209
|
-
entity_type: Schema entity type to restore.
|
|
210
|
-
entity_id: ID of the existing entity.
|
|
211
|
-
|
|
212
|
-
Returns:
|
|
213
|
-
`True` when the entity changed state, otherwise `False`.
|
|
214
|
-
|
|
215
|
-
Raises:
|
|
216
|
-
ShotgunError: If the entity type or ID is unknown.
|
|
217
|
-
"""
|
|
218
|
-
return self._sync.revive(entity_type, entity_id)
|
|
219
|
-
|
|
220
|
-
async def schema_entity_read(
|
|
221
|
-
self,
|
|
222
|
-
project_entity: dict[str, Any] | None = None,
|
|
223
|
-
) -> dict[str, object]:
|
|
224
|
-
"""Return the loaded entity schema.
|
|
225
|
-
|
|
226
|
-
Args:
|
|
227
|
-
project_entity: Accepted for public-client compatibility and
|
|
228
|
-
ignored.
|
|
229
|
-
|
|
230
|
-
Returns:
|
|
231
|
-
The live entity-schema dictionary. Mutations affect this client.
|
|
232
|
-
"""
|
|
233
|
-
return self._sync.schema_entity_read(project_entity)
|
|
234
|
-
|
|
235
|
-
async def schema_field_read(
|
|
236
|
-
self,
|
|
237
|
-
entity_type: str,
|
|
238
|
-
field_name: str | None = None,
|
|
239
|
-
project_entity: dict[str, Any] | None = None,
|
|
240
|
-
) -> dict[str, object]:
|
|
241
|
-
"""Return the loaded field schema for an entity or one field.
|
|
242
|
-
|
|
243
|
-
Args:
|
|
244
|
-
entity_type: Entity type whose fields to return.
|
|
245
|
-
field_name: Optional field name to select.
|
|
246
|
-
project_entity: Accepted for public-client compatibility and
|
|
247
|
-
ignored.
|
|
248
|
-
|
|
249
|
-
Returns:
|
|
250
|
-
The live entity field-schema dictionary when no field is selected.
|
|
251
|
-
Otherwise, a new dictionary containing the selected field and its
|
|
252
|
-
shared schema value, or an empty dictionary for an unknown field.
|
|
253
|
-
Mutating shared schema values affects this client.
|
|
254
|
-
|
|
255
|
-
Raises:
|
|
256
|
-
KeyError: If `entity_type` is absent from the loaded schema.
|
|
257
|
-
"""
|
|
258
|
-
return self._sync.schema_field_read(entity_type, field_name, project_entity)
|
|
259
|
-
|
|
260
|
-
async def schema_read(
|
|
261
|
-
self,
|
|
262
|
-
project_entity: dict[str, Any] | None = None,
|
|
263
|
-
) -> dict[str, object]:
|
|
264
|
-
"""Return the loaded field schema.
|
|
265
|
-
|
|
266
|
-
Args:
|
|
267
|
-
project_entity: Accepted for public-client compatibility and
|
|
268
|
-
ignored.
|
|
269
|
-
|
|
270
|
-
Returns:
|
|
271
|
-
The live field-schema dictionary. Mutations affect this client.
|
|
272
|
-
"""
|
|
273
|
-
return self._sync.schema_read(project_entity)
|
|
274
|
-
|
|
275
|
-
@classmethod
|
|
276
|
-
async def set_schema_paths(
|
|
277
|
-
cls,
|
|
278
|
-
schema_path: str,
|
|
279
|
-
schema_entity_path: str,
|
|
280
|
-
) -> None:
|
|
281
|
-
"""Configure the schema files loaded by future mockgun clients.
|
|
282
|
-
|
|
283
|
-
Args:
|
|
284
|
-
schema_path: Path to the field-schema pickle.
|
|
285
|
-
schema_entity_path: Path to the entity-schema pickle.
|
|
286
|
-
"""
|
|
287
|
-
cls._sync_type.set_schema_paths(schema_path, schema_entity_path)
|
|
288
|
-
|
|
289
|
-
async def update(
|
|
290
|
-
self,
|
|
291
|
-
entity_type: str,
|
|
292
|
-
entity_id: int,
|
|
293
|
-
data: dict[str, Any],
|
|
294
|
-
multi_entity_update_modes: dict[str, str] | None = None,
|
|
295
|
-
) -> list[dict[str, object]]:
|
|
296
|
-
"""Update an entity and return the official one-item result list.
|
|
297
|
-
|
|
298
|
-
Args:
|
|
299
|
-
entity_type: Schema entity type to update.
|
|
300
|
-
entity_id: ID of the existing entity.
|
|
301
|
-
data: Replacement field values.
|
|
302
|
-
multi_entity_update_modes: Per-field replacement modes.
|
|
303
|
-
|
|
304
|
-
Returns:
|
|
305
|
-
One updated entity containing identity and submitted fields.
|
|
306
|
-
|
|
307
|
-
Raises:
|
|
308
|
-
ShotgunError: If the entity, fields, or values are invalid.
|
|
309
|
-
"""
|
|
310
|
-
return self._sync.update(
|
|
311
|
-
entity_type,
|
|
312
|
-
entity_id,
|
|
313
|
-
data,
|
|
314
|
-
multi_entity_update_modes,
|
|
315
|
-
)
|