Commit edafb67
authored
Add type hints and clean up documentation for encoders and decoders (#367)
* Add type hint for _Encoder
* Add type hint for _Decoder
* Rename type aliases to InnerEncoder and InnerDecoder
* Fix docstrings and add some additional type hints.
* Remove Context class
* Fix get_type_default docs
* Remove notes file
* Add WriteFunction type alias
* Rename InnerEncoder to Encoder and InnerDecoder to Decoder
* Rename EncoderFactory to EncoderConstructor and DecoderFactory to DecoderConstructor
* Rename EncoderConstructor to PartialEncoderConstructor and DecoderConstructor to PartialDecoderConstructor
* Add EncoderConstructor and DecoderConstructor and cast where needed
* Only use typing_extensions if less than Python 3.10
* Update some type hints
* Update documentation to stop using factory
* Add Key TypeVar
* Clarify use of new_default
* Type hints for is_packed etc
* Change Key to FieldDescriptor
* Use ValueError instead of Exception.
* Match _vector_decoder return type for _new_default1 parent 4b07aac commit edafb67
4 files changed
Lines changed: 179 additions & 216 deletions
File tree
- ni_measurementlink_service/_internal/parameter
- tests/unit
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
9 | | - | |
10 | | - | |
| 8 | + | |
11 | 9 | | |
12 | 10 | | |
13 | 11 | | |
| |||
60 | 58 | | |
61 | 59 | | |
62 | 60 | | |
63 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
70 | 72 | | |
71 | 73 | | |
72 | 74 | | |
| |||
0 commit comments