Skip to content

Commit

Permalink
pw_protobuf: update to use typing module for Set
Browse files Browse the repository at this point in the history
I'm not a python expert, but our build was failing due to python being
confused about the syntax "set[str]". I'm guessing support for this was
added in some later version of python, but ours (3.7) doesn't seem to
support it, so this change updates it to import Set from the typing
module and use that instead.

Change-Id: I59435bab9375f70adb1053eb6709f3cea1336cd8
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/100720
Commit-Queue: Aaron Okano <aaronokano@google.com>
Reviewed-by: Ted Pudlik <tpudlik@google.com>
  • Loading branch information
aaronokano authored and CQ Bot Account committed Jul 4, 2022
1 parent bd65ffe commit 81460c6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pw_protobuf/py/pw_protobuf/symbol_name_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
# the License.
"""Fixes identifiers that would cause compiler errors in generated C++ code."""

from typing import Set

# Set of words that can't be used as identifiers in the generated code. Many of
# these are valid identifiers in proto syntax, but they need special handling in
# the generated C++ code.
#
# Note: This is primarily used for "if x in y" operations, hence the use of a
# set rather than a list.
PW_PROTO_CODEGEN_RESERVED_WORDS: set[str] = {
PW_PROTO_CODEGEN_RESERVED_WORDS: Set[str] = {
# Identifiers that conflict with the codegen internals when used in certain
# contexts:
"Fields",
Expand Down

0 comments on commit 81460c6

Please sign in to comment.