Skip to content

Commit

Permalink
fixing linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
AsherGlick committed Nov 1, 2023
1 parent 2e9bdd5 commit b9208b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion xml_converter/generators/generate_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 3 additions & 2 deletions xml_converter/generators/protobuf_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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)

Expand All @@ -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)

Expand All @@ -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

0 comments on commit b9208b5

Please sign in to comment.