Skip to content

Commit

Permalink
Bump version, fix test, remove unnecessary _ASCII_SET
Browse files Browse the repository at this point in the history
  • Loading branch information
silverv committed Sep 9, 2022
1 parent 0a75645 commit 0f8d036
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pycyphal/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.10.1"
__version__ = "1.10.2"
6 changes: 0 additions & 6 deletions pycyphal/dsdl/_builtin_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ def to_builtin(obj: object) -> typing.Dict[str, typing.Any]:
return out


ascii_set = set(string.printable)


def _to_builtin_impl(
obj: typing.Union[object, NDArray[typing.Any], str, bool, int, float], model: pydsdl.SerializableType
) -> typing.Union[typing.Dict[str, typing.Any], typing.List[typing.Any], str, bool, int, float]:
Expand All @@ -63,9 +60,6 @@ def _to_builtin_impl(

if isinstance(model, pydsdl.ArrayType):
assert isinstance(obj, numpy.ndarray)
is_every_character_in_obj_printable = (obj.dtype == numpy.uint8 or isinstance(obj, int)) and all(
chr(c) in ascii_set for c in obj
)
# TODO: drop this special case when strings are natively supported in DSDL.
printable = set(map(ord, string.printable))
if model.string_like and all(map(lambda x: x in printable, obj.tobytes())):
Expand Down
2 changes: 1 addition & 1 deletion tests/dsdl/_builtin_form.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def _unittest_slow_builtin_form_manual(compiled: typing.List[pycyphal.dsdl.Gener
"name": "org.node.my",
"software_image_crc": [0x0DDDEADB16B00B5],
# The following will have to be changed when strings are supported natively in DSDL:
"certificate_of_authenticity": bytes(range(100)).decode(),
"certificate_of_authenticity": list(range(100)),
}

bi = pycyphal.dsdl.to_builtin(
Expand Down

0 comments on commit 0f8d036

Please sign in to comment.