Skip to content

Commit

Permalink
chore: rename internal functions
Browse files Browse the repository at this point in the history
Signed-off-by: Jesús Fernández <7312236+fernandezcuesta@users.noreply.github.com>
  • Loading branch information
fernandezcuesta committed Nov 4, 2024
1 parent 3edff20 commit 69b1a97
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crossplane/function/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ def dict_to_struct(d: dict) -> structpb.Struct:
return s


def __to_python_native(v: structpb.Value) -> Any:
"""Convert a protobuf Value to a Python native type."""
def __to_python_builtin(v: structpb.Value) -> Any:
"""Convert a protobuf Value to a Python builtin type."""
if isinstance(v, structpb.ListValue):
return __listvalue_to_list(v)
elif isinstance(v, structpb.Struct):
Expand All @@ -74,7 +74,7 @@ def __to_python_native(v: structpb.Value) -> Any:

def __listvalue_to_list(lv: structpb.ListValue) -> list:
"""Convert a protobuf ListValue to a list."""
return [__to_python_native(v) for v in lv]
return [__to_python_builtin(v) for v in lv]


def struct_to_dict(s: structpb.Struct) -> dict:
Expand All @@ -84,7 +84,7 @@ def struct_to_dict(s: structpb.Struct) -> dict:
protobuf struct. This function makes it possible to convert resources to a
dictionary.
"""
return {k: __to_python_native(v) for k, v in s.items()}
return {k: __to_python_builtin(v) for k, v in s.items()}


@dataclasses.dataclass
Expand Down

0 comments on commit 69b1a97

Please sign in to comment.