Skip to content

Commit

Permalink
Merge pull request #385 from digital-asset/python-better-interfaces-s…
Browse files Browse the repository at this point in the history
…upport

python: Better support for interfaces.
  • Loading branch information
da-tanabe authored Dec 20, 2022
2 parents 9e2f32d + 7934fe4 commit c6bffeb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.10.2
7.10.3
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

[tool.poetry]
name = "dazl"
version = "7.10.2"
version = "7.10.3"
description = "high-level Ledger API client for Daml ledgers"
license = "Apache-2.0"
authors = ["Davin K. Tanabe <davin.tanabe@digitalasset.com>"]
Expand Down
2 changes: 1 addition & 1 deletion python/dazl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,4 @@
pass


__version__ = "7.10.2"
__version__ = "7.10.3"
4 changes: 2 additions & 2 deletions python/dazl/damlast/daml_lf_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -1808,9 +1808,9 @@ class ExerciseInterface:
interface: TypeConName
cid: Expr
arg: Expr
guard: Expr
guard: Optional[Expr]

def __init__(self, interface: TypeConName, cid: Expr, arg: Expr, guard: Expr):
def __init__(self, interface: TypeConName, cid: Expr, arg: Expr, guard: Optional[Expr]):
self.interface = interface
self.cid = cid
self.arg = arg
Expand Down
2 changes: 1 addition & 1 deletion python/dazl/damlast/pb_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ def parse_Update_ExerciseInterface(
interface=self.parse_TypeConName(pb.interface),
cid=self.parse_Expr(pb.cid),
arg=self.parse_Expr(pb.arg),
guard=self.parse_Expr(pb.guard),
guard=self.parse_Expr(pb.guard) if pb.HasField("guard") else None,
)

def parse_Update_FetchInterface(
Expand Down
6 changes: 4 additions & 2 deletions python/dazl/protocols/v1/pb_parse_metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def _parse_daml_metadata_pb(archive: "Archive") -> "PackageStore":
tt = create_data_type(current_module, dt)
if isinstance(tt, (RecordType, VariantType, EnumType)) and tt.name is not None:
psb.add_type(tt.name.con, tt)
else:
elif tt is not None:
LOG.warning("Unexpected non-complex type will be ignored: %r", tt)

for template_pb in module.templates:
Expand Down Expand Up @@ -325,7 +325,7 @@ def _parse_daml_metadata_pb(archive: "Archive") -> "PackageStore":
# noinspection PyDeprecation
def create_data_type(
current_module_ref: "ModuleRef", dt: "DefDataType"
) -> "Union[RecordType, VariantType, EnumType, ScalarType]":
) -> "Union[None, RecordType, VariantType, EnumType, ScalarType]":
warnings.warn(
"create_data_type is deprecated; there is no replacement.", DeprecationWarning, stacklevel=2
)
Expand Down Expand Up @@ -357,5 +357,7 @@ def create_data_type(
return VariantType(NamedArgumentList(d.items()), tt, type_vars)
elif dt.enum is not None:
return EnumType(tt, dt.enum.constructors)
elif dt.interface is not None:
return None
else:
return SCALAR_TYPE_UNIT

0 comments on commit c6bffeb

Please sign in to comment.