Skip to content

Commit 5a038d7

Browse files
Merge pull request #1593 from gooddata/snapshot-master-88138a31-to-rel/dev
[bot] Merge master/88138a31 into rel/dev
2 parents 8476f0e + 88138a3 commit 5a038d7

16 files changed

Lines changed: 48 additions & 72 deletions

File tree

packages/gooddata-dbt/src/gooddata_dbt/dbt_plugin.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ def create_localized_workspaces(
216216
if data_product.localization is None:
217217
return
218218
try:
219-
from deep_translator import GoogleTranslator
219+
from deep_translator import GoogleTranslator # noqa: PLC0415
220220
except ImportError:
221221
logger.warning(
222222
"create_localized_workspaces: deep_translator module not found, will not be able to localize workspaces"

packages/gooddata-dbt/src/gooddata_dbt/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def report_message_to_merge_request(token: str, merge_request_id: str, text: str
2828

2929
def report_message_to_pull_request(logger: Logger, token: str, pull_request_id: int, text: str) -> None:
3030
try:
31-
from github import Auth, Github
31+
from github import Auth, Github # noqa: PLC0415
3232

3333
auth = Auth.Token(token)
3434
g = Github(auth=auth)

packages/gooddata-fdw/src/gooddata_fdw/environment.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,14 @@
3333
# package-specific global variable would inevitably lead to evaluation of __init__ which imports the FDW code
3434
# which will then try to import from this file before the variable is even set
3535
import sys
36+
from logging import getLevelName
3637

3738
if "pytest" not in sys.modules and "sphinx" not in sys.modules:
3839
# multicorn stuff cannot be imported & the FDW code is not currently under test or as documentation build.
3940
# in that case raise the error normally.
4041
raise e
4142

4243
def _log_to_console(msg: str, level: int) -> None:
43-
from logging import getLevelName
44-
4544
print(f"{getLevelName(level)}: {msg}")
4645

4746
log_to_postgres = _log_to_console

packages/gooddata-flight-server/src/gooddata_flight_server/utils/otel_tracing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,23 @@ def _create_console_span_exporter() -> SpanExporter:
4141

4242

4343
def _create_zipkin_span_exporter() -> SpanExporter:
44-
from opentelemetry.exporter.zipkin.json import (
44+
from opentelemetry.exporter.zipkin.json import ( # noqa: PLC0415
4545
ZipkinExporter,
4646
)
4747

4848
return ZipkinExporter()
4949

5050

5151
def _create_otlp_grpc_exporter() -> SpanExporter:
52-
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
52+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import ( # noqa: PLC0415
5353
OTLPSpanExporter,
5454
)
5555

5656
return OTLPSpanExporter()
5757

5858

5959
def _create_otlp_http_exporter() -> SpanExporter:
60-
from opentelemetry.exporter.otlp.proto.http.trace_exporter import (
60+
from opentelemetry.exporter.otlp.proto.http.trace_exporter import ( # noqa: PLC0415
6161
OTLPSpanExporter,
6262
)
6363

packages/gooddata-pipelines/src/gooddata_pipelines/provisioning/entities/workspaces/workspace_data_filters.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""Module for managing workspace data filter settings in GoodData Cloud."""
44

55
import json
6+
import os
67
from typing import Any
78
from uuid import uuid4
89

@@ -40,8 +41,6 @@ def _create_wdf_setting_dict(
4041
"""Loads a JSON template of a WDF setting and fills it with the given values."""
4142
values = [str(value) for value in wdf_values]
4243

43-
import os
44-
4544
wdf_setting_path = os.path.join(
4645
os.path.dirname(__file__), "../../assets/wdf_setting.json"
4746
)

packages/gooddata-sdk/src/gooddata_sdk/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from __future__ import annotations
55

6+
import os
67
from pathlib import Path
78

89
import gooddata_api_client as api_client
@@ -59,8 +60,6 @@ def __init__(
5960
)
6061

6162
if proxy is None:
62-
import os
63-
6463
proxy = (
6564
os.environ.get("HTTPS_PROXY")
6665
or os.environ.get("https_proxy")

packages/gooddata-sdk/tests/catalog/test_aac.py

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# (C) 2026 GoodData Corporation
22
from __future__ import annotations
33

4+
import shutil
5+
import tempfile
46
from pathlib import Path
57

68
import yaml
@@ -16,6 +18,9 @@
1618
load_aac_workspace_from_disk,
1719
store_aac_workspace_to_disk,
1820
)
21+
from gooddata_sdk.catalog.workspace.declarative_model.workspace.workspace import (
22+
CatalogDeclarativeWorkspaceModel,
23+
)
1924
from gooddata_sdk.config import AacConfig
2025

2126
_FIXTURES_DIR = Path(__file__).parent / "unit_tests" / "aac_tests"
@@ -243,9 +248,6 @@ class TestWorkspaceLoadStore:
243248
def test_load_aac_workspace_from_fixtures(self) -> None:
244249
"""Load fixtures excluding dashboards (WASM crypto limitation)."""
245250
# Use a temp dir with only datasets, metrics, visualizations
246-
import shutil
247-
import tempfile
248-
249251
with tempfile.TemporaryDirectory() as tmp:
250252
tmp_path = Path(tmp)
251253
for subdir in ("datasets", "metrics", "visualisations"):
@@ -280,10 +282,6 @@ def test_store_and_reload_metrics(self, tmp_path: Path) -> None:
280282
metrics_declarative = [aac_metric_to_declarative(m) for m in aac_metrics]
281283

282284
model_dict = {"analytics": {"metrics": metrics_declarative}}
283-
from gooddata_sdk.catalog.workspace.declarative_model.workspace.workspace import (
284-
CatalogDeclarativeWorkspaceModel,
285-
)
286-
287285
model = CatalogDeclarativeWorkspaceModel.from_dict(model_dict)
288286
store_aac_workspace_to_disk(model, tmp_path)
289287

@@ -316,10 +314,6 @@ def test_store_and_reload_visualizations(self, tmp_path: Path) -> None:
316314
vis_declarative = [aac_visualization_to_declarative(aac_vis)]
317315

318316
model_dict = {"analytics": {"visualizationObjects": vis_declarative}}
319-
from gooddata_sdk.catalog.workspace.declarative_model.workspace.workspace import (
320-
CatalogDeclarativeWorkspaceModel,
321-
)
322-
323317
model = CatalogDeclarativeWorkspaceModel.from_dict(model_dict)
324318
store_aac_workspace_to_disk(model, tmp_path)
325319

@@ -334,9 +328,6 @@ def test_store_and_reload_visualizations(self, tmp_path: Path) -> None:
334328

335329
def test_store_and_reload_from_fixtures(self, tmp_path: Path) -> None:
336330
"""Load fixtures, store to disk, reload — full round-trip."""
337-
import shutil
338-
import tempfile
339-
340331
with tempfile.TemporaryDirectory() as tmp:
341332
fixture_path = Path(tmp)
342333
for subdir in ("datasets", "metrics", "visualisations"):

packages/gooddata-sdk/tests/catalog/test_catalog_user_service.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,12 @@
3737
GoodDataApiClient,
3838
GoodDataSdk,
3939
)
40+
from gooddata_sdk.catalog.permission.declarative_model.permission import CatalogDeclarativeWorkspacePermissions
4041
from gooddata_sdk.utils import recreate_directory
4142
from tests_support.file_utils import load_json
4243
from tests_support.vcrpy_utils import get_vcr
4344

44-
from .conftest import safe_delete
45+
from .conftest import load_expected_data_sources, safe_delete
4546

4647
gd_vcr = get_vcr()
4748

@@ -194,17 +195,13 @@ def _restore_demo2_permissions(sdk: GoodDataSdk, test_config: dict) -> None:
194195
Note: This function makes HTTP calls. When used in tests with VCR cassettes,
195196
ensure the cassette includes the restoration calls (in finally blocks).
196197
"""
197-
from .conftest import load_expected_data_sources
198-
199198
# Restore data source permissions
200199
expected_ds_path = _current_dir / "expected" / "declarative_data_sources.json"
201200
credentials_path = _current_dir / "load" / "data_source_credentials" / "data_sources_credentials.yaml"
202201
data_sources = load_expected_data_sources(expected_ds_path, test_config)
203202
sdk.catalog_data_source.put_declarative_data_sources(data_sources, credentials_path)
204203

205204
# Restore workspace permissions
206-
from gooddata_sdk.catalog.permission.declarative_model.permission import CatalogDeclarativeWorkspacePermissions
207-
208205
expected_ws_path = _current_dir / "expected" / "declarative_workspace_permissions.json"
209206
ws_data = load_json(expected_ws_path)
210207
ws_permissions = CatalogDeclarativeWorkspacePermissions.from_dict(ws_data, camel_case=True)

packages/gooddata-sdk/tests/catalog/test_tabbed_dashboard_translations.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from __future__ import annotations
1414

15+
import copy
1516
from unittest.mock import MagicMock
1617

1718
from gooddata_sdk.catalog.workspace.service import CatalogWorkspaceService
@@ -309,7 +310,6 @@ def _service(self):
309310

310311
def test_translates_tab_titles(self):
311312
"""Tab titles are translated."""
312-
import copy
313313

314314
content = {
315315
"tabs": [
@@ -349,7 +349,6 @@ def test_translates_tab_titles(self):
349349

350350
def test_translates_widgets_in_tabs(self):
351351
"""Widget titles/descriptions inside tabs are translated."""
352-
import copy
353352

354353
content = {
355354
"tabs": [
@@ -392,7 +391,6 @@ def test_translates_widgets_in_tabs(self):
392391

393392
def test_legacy_layout_still_works(self):
394393
"""Legacy layout dashboards still get their widgets translated."""
395-
import copy
396394

397395
content = {
398396
"layout": {

packages/gooddata-sdk/tests/compute/test_bare_execution_response.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,14 @@
88

99
pyarrow = pytest.importorskip("pyarrow")
1010

11+
import pyarrow as pa # noqa: E402
12+
from gooddata_sdk.compute.model import execution as _exec_mod # noqa: E402
13+
from gooddata_sdk.compute.model.execution import BareExecutionResponse # noqa: E402
14+
from pyarrow import ipc # noqa: E402
15+
1116

1217
def _make_ipc_stream_bytes() -> bytes:
1318
"""Return minimal Arrow IPC stream bytes for a one-row table."""
14-
import pyarrow as pa
15-
from pyarrow import ipc
16-
1719
table = pa.table({"x": pa.array([1.0])})
1820
buf = io.BytesIO()
1921
with ipc.new_stream(buf, table.schema) as writer:
@@ -44,8 +46,6 @@ def readinto(self, b: bytearray) -> int:
4446

4547
def _make_bare(ipc_bytes: bytes):
4648
"""Return a BareExecutionResponse backed by a mock API client."""
47-
from gooddata_sdk.compute.model.execution import BareExecutionResponse
48-
4949
mock_api_client = MagicMock()
5050
mock_response = _FakeResponse(ipc_bytes)
5151
mock_api_client.actions_api.api_client.call_api.return_value = mock_response
@@ -66,8 +66,6 @@ def _make_bare(ipc_bytes: bytes):
6666

6767
def test_read_result_arrow_returns_table() -> None:
6868
"""read_result_arrow reads the stream from the binary endpoint and returns a pa.Table."""
69-
import pyarrow as pa
70-
7169
ipc_bytes = _make_ipc_stream_bytes()
7270
bare, mock_response = _make_bare(ipc_bytes)
7371

@@ -101,8 +99,6 @@ def test_read_result_arrow_without_cancel_token() -> None:
10199

102100
def test_read_result_arrow_no_pyarrow_raises() -> None:
103101
"""When pyarrow is not installed, read_result_arrow raises ImportError."""
104-
from gooddata_sdk.compute.model import execution as _exec_mod
105-
106102
ipc_bytes = _make_ipc_stream_bytes()
107103
bare, _ = _make_bare(ipc_bytes)
108104

0 commit comments

Comments
 (0)