GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Add additional parameters to `to_json()` and `to_dict()` methods by holtskinner · Pull Request #384 · googleapis/proto-plus-python

This repository was archived by the owner on Feb 23, 2026. It is now read-only.

Conversation

@holtskinner

@holtskinner holtskinner commented Aug 3, 2023

Copy link
Copy Markdown
Contributor
  • These parameters are just passthroughs to MessageToJson and MessageToDict

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@holtskinner
feat: Add additional parameters to to_json() and to_dict() methods
9522581
- These parameters are just passthroughs to [`MessageToJson`][1] and [`MessageToDict`][2]

[1]: https://googleapis.dev/python/protobuf/latest/google/protobuf/json_format.html#google.protobuf.json_format.MessageToJson

[2]: https://googleapis.dev/python/protobuf/latest/google/protobuf/json_format.html#google.protobuf.json_format.MessageToDict
@holtskinner
holtskinner requested review from a team August 3, 2023 18:02
@parthea
parthea marked this pull request as draft August 3, 2023 18:17
holtskinner added 2 commits August 4, 2023 11:54
@holtskinner
chore: Update min protobuf version to 3.20.0 to support ensure_ascii
a81ee7c
@holtskinner
Removed ensure_ascii to prevent version compatibility errors
4b54464
@holtskinner
holtskinner marked this pull request as ready for review August 4, 2023 17:00
@holtskinner

holtskinner commented Aug 4, 2023

Copy link
Copy Markdown
Contributor Author

I think Owlbot has to be force run by adding the tag. I don't have permission to do that.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 6, 2023
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Aug 6, 2023
@holtskinner

holtskinner commented Aug 15, 2023

Copy link
Copy Markdown
Contributor Author

Is this good for review?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@parthea parthea self-assigned this Sep 1, 2023
parthea
parthea suggested changes Sep 1, 2023
View reviewed changes

@parthea parthea left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I apologize for the delay. The changes look good. Please can you also add tests, similar to the ones added in #164 and #213

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread proto/message.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@parthea parthea assigned holtskinner and unassigned parthea Sep 1, 2023
@holtskinner @parthea
Update proto/message.py
c9a990c
Co-authored-by: Anthonios Partheniou <[email protected]>
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 1, 2023
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 1, 2023
holtskinner added 6 commits September 5, 2023 10:22
@holtskinner
test: Add tests for sort_keys and float_precision
c843a77
@holtskinner
Fix test checks
ec014f6
@holtskinner
Remove indent from float_precision test and add re.compile to sortkey…
f890177
…s regex
@holtskinner
Add spaces to float precision check, add dotall to sortkeys check
0137ab3
@holtskinner
Remove indent from sort_keys test, add space to float precision test
eaf901b
@holtskinner
Changed match to search
4b7b1e2
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 6, 2023
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 6, 2023
@holtskinner
test: Add test for to_dict() with float_precision
eea1fe6
@holtskinner
holtskinner requested a review from parthea September 6, 2023 15:25
parthea
parthea reviewed Sep 6, 2023
View reviewed changes
Comment thread tests/test_message.py
s = Squid(mass_kg=3.14159265)

s_dict = Squid.to_dict(s, float_precision=3)
assert s_dict["mass_kg"] == 3.14

@parthea parthea Sep 6, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have expected this to be 3.141 or 3.142 since float_precision=3. If you agree, can you file a bug and add a comment?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@holtskinner holtskinner Sep 6, 2023

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I filed https://github.com/googleapis/proto-plus-python/issues/390

Should it block this PR?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

parthea reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@holtskinner
Added TODOs for float_precision issue
5456326
parthea
parthea approved these changes Sep 8, 2023
View reviewed changes
@parthea parthea added the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 8, 2023
@gcf-owl-bot gcf-owl-bot Bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label Sep 8, 2023
@parthea
parthea enabled auto-merge (squash) September 8, 2023 16:05
@parthea
parthea merged commit 8f13a46 into googleapis:main Sep 8, 2023
@release-please release-please Bot mentioned this pull request Sep 8, 2023
chore(main): release 1.23.0 #391
Merged
@parthea parthea mentioned this pull request Dec 4, 2023
chore(main): Release candidate v1.23.0rc2 #416
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@parthea parthea parthea approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@holtskinner holtskinner

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@holtskinner @parthea
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.