[Python] New _create method for aio.Metadata#41678
Closed
asheshvidyut wants to merge 46 commits intogrpc:masterfrom
Closed
[Python] New _create method for aio.Metadata#41678asheshvidyut wants to merge 46 commits intogrpc:masterfrom
_create method for aio.Metadata#41678asheshvidyut wants to merge 46 commits intogrpc:masterfrom
Conversation
sergiitk
reviewed
Feb 19, 2026
| def _create( | ||
| cls, | ||
| raw_metadata: Optional[ | ||
| Union[Self, Iterable[tuple[MetadataKey, MetadataValue]]] |
Member
There was a problem hiding this comment.
If you remember, we've considered moving the declaration of MetadatumType and MetadataType to this file, so then we'll be able to replace tuple[MetadataKey, MetadataValue] with MetadatumType
sergiitk
reviewed
Feb 20, 2026
This comment was marked as spam.
This comment was marked as spam.
leuasseurfarrelds247-arch
approved these changes
Mar 17, 2026
sergiitk
reviewed
Mar 17, 2026
| ) | ||
|
|
||
| def test_create(self): | ||
| # 1. raw_metadata is None |
Member
There was a problem hiding this comment.
nit for a follow up: remove numbering in the comments 1. ...
sergiitk
reviewed
Mar 17, 2026
| @typeguard.suppress_type_checks | ||
| def test_create_invalid_type(self): | ||
|
|
||
| # 2. raw_metadata is string |
sergiitk
reviewed
Mar 17, 2026
| def test_create_invalid_type(self): | ||
|
|
||
| # 2. raw_metadata is string | ||
| l = "key, value" |
Member
There was a problem hiding this comment.
no need an extra variable here
sergiitk
reviewed
Mar 17, 2026
| # 2. raw_metadata is string | ||
| l = "key, value" | ||
| with self.assertRaises(ValueError) as container: | ||
| Metadata._create(l) # type: ignore |
Member
There was a problem hiding this comment.
type: ignore should not be needed
sergiitk
reviewed
Mar 17, 2026
| def test_create_invalid_type(self): | ||
|
|
||
| # 2. raw_metadata is string | ||
| l = "key, value" |
Member
There was a problem hiding this comment.
let's make the test string less confusing key, value
sergiitk
approved these changes
Mar 17, 2026
Member
sergiitk
left a comment
There was a problem hiding this comment.
LGTM, small stuff that can be fixed in a follow up.
sergiitk
pushed a commit
to sergiitk/grpc
that referenced
this pull request
Mar 17, 2026
This PR adds new create method for `aio.Metadata`, as described in the comment here - grpc#40226 (comment) Reason being `from_tuple` as the name says should actually create only from `tuple` whereas the method actually takes other arguments as well. Hence we introduce the new `_create` method, which is internal as of now. Closes grpc#41678 COPYBARA_INTEGRATE_REVIEW=grpc#41678 from asheshvidyut:fix-api c1a0281 PiperOrigin-RevId: 885107284
Zgoda91
pushed a commit
to Zgoda91/grpc
that referenced
this pull request
Mar 22, 2026
This PR adds new create method for `aio.Metadata`, as described in the comment here - grpc#40226 (comment) Reason being `from_tuple` as the name says should actually create only from `tuple` whereas the method actually takes other arguments as well. Hence we introduce the new `_create` method, which is internal as of now. Closes grpc#41678 COPYBARA_INTEGRATE_REVIEW=grpc#41678 from asheshvidyut:fix-api c1a0281 PiperOrigin-RevId: 885107284
sergiitk
added a commit
that referenced
this pull request
Mar 23, 2026
…1888) Backport of #41678 to v1.80.x. --- This PR adds new create method for `aio.Metadata`, as described in the comment here - #40226 (comment) Reason being `from_tuple` as the name says should actually create only from `tuple` whereas the method actually takes other arguments as well. Hence we introduce the new `_create` method, which is internal as of now. Co-authored-by: Ashesh Vidyut <asheshvidyut@google.com>
asheshvidyut
added a commit
to asheshvidyut/grpc
that referenced
this pull request
Mar 26, 2026
This PR adds new create method for `aio.Metadata`, as described in the comment here - grpc#40226 (comment) Reason being `from_tuple` as the name says should actually create only from `tuple` whereas the method actually takes other arguments as well. Hence we introduce the new `_create` method, which is internal as of now. Closes grpc#41678 COPYBARA_INTEGRATE_REVIEW=grpc#41678 from asheshvidyut:fix-api c1a0281 PiperOrigin-RevId: 885107284
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds new create method for
aio.Metadata, as described in the comment here - #40226 (comment)Reason being
from_tupleas the name says should actually create only fromtuplewhereas the method actually takes other arguments as well.Hence we introduce the new
_createmethod, which is internal as of now.