Skip to content

Commit

Permalink
mypy
Browse files Browse the repository at this point in the history
  • Loading branch information
benpankow committed Jan 24, 2023
1 parent 5624005 commit 1638875
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions python_modules/dagster/dagster/_config/structured_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class cached_property: # type: ignore[no-redef]
from dagster._core.definitions.resource_definition import (
ResourceDefinition,
ResourceFunction,
ResourceFunctionWithoutContext,
is_context_provided,
)
from dagster._core.storage.io_manager import IOManager, IOManagerDefinition
Expand Down Expand Up @@ -327,6 +328,7 @@ def _is_fully_configured(resource: ResourceDefinition) -> bool:
)
.resolve_config({})
.success
is True
)


Expand Down Expand Up @@ -605,14 +607,14 @@ def _separate_resource_params(

def _call_resource_fn_with_default(obj: ResourceDefinition, context: InitResourceContext) -> Any:
if isinstance(obj.config_schema, ConfiguredDefinitionConfigSchema):
value = obj.config_schema.resolve_config({}).value
value = cast(Dict[str, Any], obj.config_schema.resolve_config({}).value)
context = context.replace_config(value["config"])
elif obj.config_schema.default_provided:
context = context.replace_config(obj.config_schema.default_value)
if is_context_provided(obj.resource_fn):
return obj.resource_fn(context)
else:
return obj.resource_fn()
return cast(ResourceFunctionWithoutContext, obj.resource_fn)()


_Resource = Resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ def __init__(
required_resource_keys, "required_resource_keys"
)
self._version = check.opt_str_param(version, "version")
self._top_level_key = None
self._top_level_key: Optional[str] = None
if version:
experimental_arg_warning("version", "ResourceDefinition.__init__")

Expand Down

0 comments on commit 1638875

Please sign in to comment.