You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-4Lines changed: 13 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -101,6 +101,7 @@ See [Changelog](CHANGELOG.md) for full listing
101
101
*`mypy-protobuf` generates correctly typed constructors dependinding on field presence.
102
102
*`mypy-protobuf` generates correctly typed `HasField`, `WhichOneof`, and `ClearField` methods.
103
103
* There are differences in how `mypy-protobuf` and `pyi_out` generate enums. See [this issue](https://github.com/protocolbuffers/protobuf/issues/8175) for details
104
+
* Type aliases exported for `HasField`, `WhichOneof` and `ClearField` arguments
104
105
105
106
#### Examples
106
107
@@ -370,20 +371,28 @@ protoc \
370
371
Note that generated code for grpc will work only together with code for python and locations should be the same.
371
372
If you need stubs for grpc internal code we suggest using this package https://github.com/shabbyrobe/grpc-stubs
372
373
373
-
### `_ClearFieldNamesType` and `_HasFieldNamesType` aliases
374
+
### `_ClearFieldArgType` and `_HasFieldArgType` aliases
374
375
375
-
Where applicable, type aliases are generated for the arguments to `ClearField` and `HasField`. These can be used to create typed functions for field manipulation:
376
+
Where applicable, type aliases are generated for the arguments to `ClearField`, `WhichOneof` and `HasField`. These can be used to create typed functions for field manipulation:
376
377
377
378
```python
378
379
from testproto.edition2024_pb2 import Editions2024Test
Note the deferred evaluation (string reference, or `from __future__ import annotations`. This bypasses the fact that the alias does not exist on the stub)
395
+
Note the deferred evaluation (string reference, or `from __future__ import annotations`. This bypasses the fact that the alias does not exist on the runtime class)
0 commit comments