Skip to content

Commit 4d9d2c0

Browse files
Merge pull request #884 from danielballan/remove-data-sources-warning
Remove data_sources performance warning.
2 parents 1c0a40a + 2ca1696 commit 4d9d2c0

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Write the date in place of the "Unreleased" in the case a new version is release
1212
have been removed. These were used internally by the server and should
1313
not affect user code.
1414
- Publish Container image and Helm chart only during a tagged release.
15+
- Stop warning when `data_sources()` are fetched after the item was already
16+
fetched. (Too noisy.)
1517

1618
## v0.1.0-b17 (2024-01-29)
1719

tiled/_tests/test_asset_access.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,9 @@ def test_include_data_sources_method_on_self(client):
3535
"Calling include_data_sources() fetches data sources on self."
3636
x = client.write_array([1, 2, 3], key="x")
3737
# Fetch data_sources on x object directly.
38-
with pytest.warns(UserWarning):
39-
# This fetches the sources with an additional implicit request.
40-
x.data_sources()
38+
x.data_sources() is not None
4139
# Fetch data_sources on x object, looked up in client.
42-
with pytest.warns(UserWarning):
43-
# This fetches the sources with an additional implicit request.
44-
client["x"].data_sources()
40+
client["x"].data_sources() is not None
4541
assert client["x"].include_data_sources().data_sources() is not None
4642

4743

tiled/client/base.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import time
2-
import warnings
32
from copy import copy, deepcopy
43
from dataclasses import asdict
54
from pathlib import Path
@@ -246,14 +245,6 @@ def structure_family(self):
246245
return StructureFamily[self.item["attributes"]["structure_family"]]
247246

248247
def data_sources(self):
249-
if not self._include_data_sources:
250-
warnings.warn(
251-
"""Calling include_data_sources().refresh().
252-
To fetch the data sources up front, call include_data_sources() on the
253-
client or pass the optional parameter `include_data_sources=True` to
254-
`from_uri(...)` or similar."""
255-
)
256-
257248
data_sources_json = (
258249
self.include_data_sources().item["attributes"].get("data_sources")
259250
)

0 commit comments

Comments
 (0)