Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix py matter idl types #27897

Merged
merged 2 commits into from
Jul 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,8 @@ def GenerateTables(self) -> Generator[Table, None, None]:
code="ConstantValueTag(0x%X)" % entry.code,
name=entry.name,
reference=None,
real_type="%s::%s::%s" % (self.cluster.name, e.name, entry.name)
real_type="%s::%s::%s" % (
self.cluster.name, e.name, entry.name)
)
for entry in e.entries
]
Expand All @@ -214,7 +215,8 @@ def GenerateTables(self) -> Generator[Table, None, None]:
code="ConstantValueTag(0x%X)" % entry.code,
name=entry.name,
reference=None,
real_type="%s::%s::%s" % (self.cluster.name, e.name, entry.name)
real_type="%s::%s::%s" % (
self.cluster.name, e.name, entry.name)
)
for entry in e.entries
]
Expand Down Expand Up @@ -245,7 +247,7 @@ def IndexInTable(name: Optional[str], table: List[Table]) -> str:
for idx, t in enumerate(table):
if t.full_name == name:
# Index skipping hard-coded items
return idx + 2
return "%d" % (idx + 2)

raise Exception("Name %r not found in table" % name)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ def GlobalEncodableValueFrom(typeName: str, context: TypeLookupContext) -> Encod
"""
Filter to convert a global type name to an encodable value
"""
return EncodableValue(context, DataType(name=typeName), {})
return EncodableValue(context, DataType(name=typeName), set())


def EncodableValueFrom(field: Field, context: TypeLookupContext) -> EncodableValue:
Expand Down
4 changes: 3 additions & 1 deletion scripts/py_matter_idl/matter_idl/zapxml/handlers/parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from typing import Optional

from matter_idl.generators.types import GetDataTypeSizeInBits, IsSignedDataType
from matter_idl.matter_idl_types import AccessPrivilege, Attribute, AttributeQuality, DataType, Field, FieldQuality


def ParseInt(value: str, data_type: DataType = None) -> int:
def ParseInt(value: str, data_type: Optional[DataType] = None) -> int:
"""
Convert a string that is a known integer into an actual number.

Expand Down