From b9208b5c907bf1240ad3d48b4e913b5dac87c19e Mon Sep 17 00:00:00 2001 From: Asher Glick Date: Tue, 31 Oct 2023 23:35:43 -0500 Subject: [PATCH] fixing linter errors --- xml_converter/generators/generate_cpp.py | 2 +- xml_converter/generators/protobuf_types.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/xml_converter/generators/generate_cpp.py b/xml_converter/generators/generate_cpp.py index af37fe7b..d4a473c1 100644 --- a/xml_converter/generators/generate_cpp.py +++ b/xml_converter/generators/generate_cpp.py @@ -368,7 +368,7 @@ def write_attribute(output_directory: str, data: Dict[str, Document]) -> None: proto_field_type = new_type new_prototype = get_proto_field_cpp_prototype(marker_type, metadata[filepath]["protobuf_field"]) - if proto_field_prototype != None and proto_field_prototype != new_prototype: + if proto_field_prototype is not None and proto_field_prototype != new_prototype: print("Proto Field prototype differes between different marker types for ", metadata[filepath]["protobuf_field"]) proto_field_prototype = new_prototype diff --git a/xml_converter/generators/protobuf_types.py b/xml_converter/generators/protobuf_types.py index 646acd53..691470fb 100644 --- a/xml_converter/generators/protobuf_types.py +++ b/xml_converter/generators/protobuf_types.py @@ -49,7 +49,7 @@ # Define transformer class ProtoDictTransformer(Transformer): # type: ignore def start(self, items: List): # type: ignore - messages = {} + messages = {} # type: ignore for item in items: if type(item) is dict: for key, value in item.items(): @@ -167,6 +167,7 @@ def get_proto_field_type(message: str, field: str) -> str: "bytes": "std::string", } + def get_proto_field_cpp_type(message: str, field: str) -> str: value = get_proto_field_type(message, field) @@ -189,6 +190,7 @@ def get_proto_field_cpp_prototype(message: str, field: str) -> Optional[str]: proto_field_type=value, ) + def is_proto_field_scalar(message: str, field: str) -> bool: value = get_proto_field_type(message, field) @@ -198,5 +200,4 @@ def is_proto_field_scalar(message: str, field: str) -> bool: if value in proto_field_types["_enums_"]: return True - return False