From 2a268ea84d7b20eb66475ce16acb47208070b011 Mon Sep 17 00:00:00 2001 From: Maxime Armstrong Date: Fri, 27 Dec 2024 14:47:28 -0500 Subject: [PATCH] Fix pyright and code --- docs/content/integrations/tableau.mdx | 3 ++- .../libraries/dagster-tableau/dagster_tableau/resources.py | 4 ++-- .../dagster_tableau_tests/test_reconstruction.py | 6 +++--- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/content/integrations/tableau.mdx b/docs/content/integrations/tableau.mdx index 2c4ef2c89da6a..1325c7c02e452 100644 --- a/docs/content/integrations/tableau.mdx +++ b/docs/content/integrations/tableau.mdx @@ -143,7 +143,8 @@ class MyCustomTableauTranslator(DagsterTableauTranslator): tableau_specs = load_tableau_asset_specs( - tableau_workspace, dagster_tableau_translator=MyCustomTableauTranslator + tableau_workspace, + dagster_tableau_translator=MyCustomTableauTranslator, ) defs = dg.Definitions(assets=[*tableau_specs], resources={"tableau": tableau_workspace}) ``` diff --git a/python_modules/libraries/dagster-tableau/dagster_tableau/resources.py b/python_modules/libraries/dagster-tableau/dagster_tableau/resources.py index cffe96dac3993..2190165d5c2a7 100644 --- a/python_modules/libraries/dagster-tableau/dagster_tableau/resources.py +++ b/python_modules/libraries/dagster-tableau/dagster_tableau/resources.py @@ -503,7 +503,7 @@ def build_defs( resource_key = "tableau" - asset_specs = load_tableau_asset_specs(self, dagster_tableau_translator) + asset_specs = load_tableau_asset_specs(self, dagster_tableau_translator()) non_executable_asset_specs = [ spec @@ -599,7 +599,7 @@ def build_client(self) -> None: @record class TableauWorkspaceDefsLoader(StateBackedDefinitionsLoader[Mapping[str, Any]]): workspace: BaseTableauWorkspace - translator: Type[DagsterTableauTranslator] + translator: DagsterTableauTranslator @property def defs_key(self) -> str: diff --git a/python_modules/libraries/dagster-tableau/dagster_tableau_tests/test_reconstruction.py b/python_modules/libraries/dagster-tableau/dagster_tableau_tests/test_reconstruction.py index 788f0e261ed29..90db55f90e2f5 100644 --- a/python_modules/libraries/dagster-tableau/dagster_tableau_tests/test_reconstruction.py +++ b/python_modules/libraries/dagster-tableau/dagster_tableau_tests/test_reconstruction.py @@ -17,7 +17,7 @@ from dagster_tableau.asset_utils import parse_tableau_external_and_materializable_asset_specs from dagster_tableau.assets import build_tableau_materializable_assets_definition from dagster_tableau.resources import TableauCloudWorkspace, load_tableau_asset_specs -from dagster_tableau.translator import DagsterTableauTranslator +from dagster_tableau.translator import DagsterTableauTranslator, TableauTranslatorData from dagster_tableau_tests.conftest import ( FAKE_CONNECTED_APP_CLIENT_ID, @@ -67,12 +67,12 @@ def cacheable_asset_defs_refreshable_workbooks(): @lazy_definitions def cacheable_asset_defs_custom_translator(): class MyCoolTranslator(DagsterTableauTranslator): - def get_asset_spec(self, data) -> AssetSpec: + def get_asset_spec(self, data: TableauTranslatorData) -> AssetSpec: default_spec = super().get_asset_spec(data) return default_spec.replace_attributes(key=default_spec.key.with_prefix("my_prefix")) tableau_specs = load_tableau_asset_specs( - workspace=resource, dagster_tableau_translator=MyCoolTranslator + workspace=resource, dagster_tableau_translator=MyCoolTranslator() ) return Definitions(assets=[*tableau_specs], jobs=[define_asset_job("all_asset_job")])