Commit 444c61ad authored by Carlos Natalino's avatar Carlos Natalino
Browse files

Upgrading the version of the `coverage` package and updating the...

Upgrading the version of the `coverage` package and updating the `common/Tools.py` use of the protobuf package.
parent fe6b7868
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# See the License for the specific language governing permissions and
# limitations under the License.
# limitations under the License.


coverage==6.3
coverage==7.9.*
grpcio==1.73.*
grpcio==1.73.*
grpcio-health-checking==1.73.*
grpcio-health-checking==1.73.*
grpcio-reflection==1.73.*
grpcio-reflection==1.73.*
+20 −1
Original line number Original line Diff line number Diff line
@@ -13,14 +13,33 @@
# limitations under the License.
# limitations under the License.


import json
import json
import warnings
from google.protobuf.json_format import MessageToDict
from google.protobuf.json_format import MessageToDict


def grpc_message_to_json(
def grpc_message_to_json(
        message, including_default_value_fields=True, preserving_proto_field_name=True, use_integers_for_enums=False
        message, including_default_value_fields=True, preserving_proto_field_name=True, use_integers_for_enums=False
    ):
    ):
    """
    Converts a gRPC message to a JSON-compatible dict.

    Args:
        message: The gRPC message to convert.
        including_default_value_fields (bool, deprecated): This argument is deprecated and has no effect.
        preserving_proto_field_name (bool): ...
        use_integers_for_enums (bool): ...

    Returns:
        dict: The message as a JSON-compatible dictionary.
    """
    if including_default_value_fields is not True:
        warnings.warn(
            "The 'including_default_value_fields' argument is deprecated and has no effect.",
            DeprecationWarning,
            stacklevel=2
        )
    if not hasattr(message, 'DESCRIPTOR'): return json.dumps(str(message), sort_keys=True) # not a gRPC message
    if not hasattr(message, 'DESCRIPTOR'): return json.dumps(str(message), sort_keys=True) # not a gRPC message
    return MessageToDict(
    return MessageToDict(
        message, including_default_value_fields=including_default_value_fields,
        message,
        preserving_proto_field_name=preserving_proto_field_name, use_integers_for_enums=use_integers_for_enums)
        preserving_proto_field_name=preserving_proto_field_name, use_integers_for_enums=use_integers_for_enums)


def grpc_message_list_to_json(message_list):
def grpc_message_list_to_json(message_list):