Changeset 1b20da0 in mainline for tools/xstruct.py
- Timestamp:
- 2018-02-28T17:52:03Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 3061bc1
- Parents:
- df6ded8
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:26:03)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2018-02-28 17:52:03)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tools/xstruct.py
rdf6ded8 r1b20da0 39 39 40 40 # Ensure that 's' format for struct receives correct data type depending 41 # on Python version (needed due to different way to encode into bytes) 41 # on Python version (needed due to different way to encode into bytes) 42 42 ensure_string = \ 43 43 (lambda value: value if type(value) is str else bytes(value)) \ … … 66 66 (varname, str(type(value)), str(vartype))) 67 67 if value < varmin or value > varmax: 68 raise ValueError('Variable "%s" value %s out of range %s..%s' % 68 raise ValueError('Variable "%s" value %s out of range %s..%s' % 69 69 (varname, repr(value), repr(varmin), repr(varmax))) 70 70 … … 88 88 value = ensure_string(value) 89 89 check_range(variable, fmt, value) 90 args.append(value) 90 args.append(value) 91 91 return struct.pack(self._format_, *args) 92 92
Note:
See TracChangeset
for help on using the changeset viewer.