Skip to content

Commit

Permalink
Merge #11541
Browse files Browse the repository at this point in the history
11541: Fix python lint errors r=aq17 a=aq17

Fixes #11542 

Co-authored-by: aq17 <aqiu@pulumi.com>
  • Loading branch information
bors[bot] and aq17 committed Dec 6, 2022
2 parents 86e7d56 + 05ad756 commit bb1ef96
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions sdk/python/lib/pulumi/runtime/rpc.py
Expand Up @@ -29,6 +29,7 @@
Optional,
Sequence,
Set,
Union,
TYPE_CHECKING,
cast,
)
Expand All @@ -45,7 +46,7 @@

if TYPE_CHECKING:
from ..output import Inputs, Input, Output
from ..resource import CustomResource, Resource, ProviderResource
from ..resource import Resource, CustomResource, ProviderResource
from ..asset import (
FileAsset,
RemoteAsset,
Expand Down Expand Up @@ -518,11 +519,11 @@ def deserialize_properties(
if props_struct[_special_sig_key] == _special_asset_sig:
# This is an asset. Re-hydrate this object into an Asset.
if "path" in props_struct:
return FileAsset(props_struct["path"])
return FileAsset(str(props_struct["path"]))
if "text" in props_struct:
return StringAsset(props_struct["text"])
return StringAsset(str(props_struct["text"]))
if "uri" in props_struct:
return RemoteAsset(props_struct["uri"])
return RemoteAsset(str(props_struct["uri"]))
raise AssertionError(
"Invalid asset encountered when unmarshalling resource property"
)
Expand All @@ -531,9 +532,9 @@ def deserialize_properties(
if "assets" in props_struct:
return AssetArchive(deserialize_property(props_struct["assets"]))
if "path" in props_struct:
return FileArchive(props_struct["path"])
return FileArchive(str(props_struct["path"]))
if "uri" in props_struct:
return RemoteArchive(props_struct["uri"])
return RemoteArchive(str(props_struct["uri"]))
raise AssertionError(
"Invalid archive encountered when unmarshalling resource property"
)
Expand Down Expand Up @@ -570,9 +571,11 @@ def deserialize_properties(

def deserialize_resource(
ref_struct: struct_pb2.Struct, keep_unknowns: Optional[bool] = None
) -> "Resource":
urn = ref_struct["urn"]
version = ref_struct["packageVersion"] if "packageVersion" in ref_struct else ""
) -> Union["Resource", str]:
urn = str(ref_struct["urn"])
version = (
str(ref_struct["packageVersion"]) if "packageVersion" in ref_struct else ""
)

urn_parts = urn_util._parse_urn(urn)
urn_name = urn_parts.urn_name
Expand Down

0 comments on commit bb1ef96

Please sign in to comment.