Skip to content

Commit

Permalink
Fix strict python typing errors in py_matter_idl
Browse files Browse the repository at this point in the history
  • Loading branch information
andreilitvin committed Jul 11, 2023
1 parent 12b6383 commit 6325eee
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,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

0 comments on commit 6325eee

Please sign in to comment.