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 — Fix #351: batch updates via context manager by tseaver · Pull Request #352 · googleapis/google-cloud-python

Conversation

@tseaver

@tseaver tseaver commented Nov 7, 2014

Copy link
Copy Markdown
Contributor

See #351.

Add 'batch' property to '_PropertyMixin'.

  • Defers / aggregates repeated calls to '_patch_properties' within the scope of a 'with foo.batch:' block.
  • Issues a single '_patch_properties' call with the aggregated dict, IFF the block exits without an exception.
  • If an exception is raised from the with block, all changes are discarded.

E.g:

with key.batch:
    key.content_type = 'image/jpeg'
    key.content_disposition = 'attachment; filename="photo.jpg"'

results in a single PATCH request, with payload:

{'contentType': 'image/jpeg', 'contentDisposition': 'attachment; filename="photo.jpg"'}

Sorry, something went wrong.

Uh oh!

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

All reactions
tseaver added 2 commits November 6, 2014 19:59
@tseaver
Disable 'too-many'/'too-few' public methods checks.
b19625e
They are opinionated, and not usefully so for our use cases:

- Data mapping objects have methods based on schema, not an a priori
  thumb rule.

- Context managers may have *no* public methods.
@tseaver
Add 'batch' property to '_PropertyMixin'.
0998141
- Defers / aggregates repeated calls to '_patch_properties' within the scope
  of a 'with foo.batch:' block.

- Issues a single '_patch_properties' call with the aggregated dict, IFF
  the block exits without an exception.
@tseaver tseaver added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. api: storage Issues related to the Cloud Storage API. labels Nov 7, 2014
@tseaver tseaver mentioned this pull request Nov 7, 2014
Collect object / bucket updates in batch #351
Closed
dhermes
dhermes reviewed Nov 7, 2014
View reviewed changes
Comment thread gcloud/storage/_helpers.py Outdated

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Nov 7, 2014

Copy link
Copy Markdown
Contributor

This is great!

LGTM except for the Travis lint failure.

Ping me after fixing so I can do a final pass.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented Nov 7, 2014

Copy link
Copy Markdown
Contributor Author

The Travis failure is actually a bug in the "optimize lint" code: because not all files are considered, the 'abstract-class-not-used' warning kicks in. I can "fix" the failure by checking in a spurious change to bucket.py or key.py.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver
Make examples use 'real' APIs which delegate to '_patch_properties.
052dbb5
@dhermes

dhermes commented Nov 7, 2014

Copy link
Copy Markdown
Contributor

Aha! That seems like the easiest get-out-of-jail free card for this PR.

Any ideas for how to fix this going forward? (I know its my hack, but no good ideas come to mind quickly.)

Seems unlikely enough that maybe we just don't waste engineering effort on trying to fix this corner case?

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver
Spurious changes to work around pylint's 'peephole' blindness.
245b0e9
@tseaver

tseaver commented Nov 7, 2014

Copy link
Copy Markdown
Contributor Author

I'd be tempted to just disable the pylint abstract-class-not-used and abstract-class-little-used checks, myself.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Nov 7, 2014

Copy link
Copy Markdown
Contributor

They are helpful in finding dead code. IMO, the more "out-of-the-box" our usage of pylint the better.

All reactions

Sorry, something went wrong.

Uh oh!

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

@dhermes

dhermes commented Nov 7, 2014

Copy link
Copy Markdown
Contributor

@tseaver Green Travis, feel free to merge.

All reactions

Sorry, something went wrong.

Uh oh!

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

@coveralls

coveralls commented Nov 7, 2014

Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 245b0e9 on tseaver:351-batch_updates_via_context_manager into * on GoogleCloudPlatform:master*.

All reactions

Sorry, something went wrong.

Uh oh!

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

@tseaver

tseaver commented Nov 7, 2014

Copy link
Copy Markdown
Contributor Author

I find it over-opinionated, myself.

All reactions

Sorry, something went wrong.

Uh oh!

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

tseaver added a commit that referenced this pull request Nov 7, 2014
@tseaver
Merge pull request #352 from tseaver/351-batch_updates_via_context_ma…
8536991
…nager

Fix #351: batch updates via context manager
@tseaver
tseaver merged commit 8536991 into googleapis:master Nov 7, 2014
@tseaver
tseaver deleted the 351-batch_updates_via_context_manager branch November 7, 2014 01:27
@tseaver tseaver mentioned this pull request Nov 8, 2014
Add support for batch requests in gcloud.storage #15
Closed
parthea pushed a commit that referenced this pull request Jun 4, 2023
@gcf-owl-bot
chore: resolve issue with prerelease presubmit [autoapprove] (#352)
9b74006
Source-Link: googleapis/synthtool@1b9ad76
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:9db98b055a7f8bd82351238ccaacfd3cda58cdf73012ab58b8da146368330021
parthea pushed a commit that referenced this pull request Jun 4, 2023
@gcf-owl-bot
docs: Fix formatting of request arg in docstring (#352)
9c1eeab
* docs: Fix formatting of request arg in docstring

chore: Update gapic-generator-python to v1.9.1
PiperOrigin-RevId: 518604533

Source-Link: googleapis/googleapis@8a085ae

Source-Link: googleapis/googleapis-gen@b2ab4b0
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYjJhYjRiMGEwYWUyOTA3ZTgxMmMyMDkxOThhNzRlMDg5OGFmY2IwNCJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Jun 4, 2023
@renovate-bot
chore(deps): update dependency google-cloud-bigquery to v3.1.0 (#352)
0ddcce9
parthea pushed a commit that referenced this pull request Jun 4, 2023
@gcf-owl-bot
chore(python): allow client documentation to be customized in README (#…
9ccbef8
…352)

Source-Link: googleapis/synthtool@95d9289
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c8878270182edaab99f2927969d4f700c3af265accd472c3425deedff2b7fd93

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Jul 6, 2023
@renovate-bot @parthea
chore(deps): update dependency numpy to v1.23.2 (#352)
3415840
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Sep 20, 2023
@renovate-bot
chore(deps): update dependency google-cloud-retail to v1.10.1 (#352)
e94ff24
parthea pushed a commit that referenced this pull request Sep 22, 2023
@gcf-owl-bot
docs: minor clarifications (#352)
e89c6eb
* docs: mention that some fields are deprecated

PiperOrigin-RevId: 519755058

Source-Link: googleapis/googleapis@26b4d27

Source-Link: googleapis/googleapis-gen@7ad7fcf
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2FkN2ZjZjllNWQyYThiMjQzOTM1ZWMyMDk1NGZiMjkwMTg1ODkxNSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Sep 22, 2023
@gcf-owl-bot @parthea
chore(python): upgrade gcp-releasetool in .kokoro [autoapprove] (#352)
f1d1abf
Source-Link: googleapis/synthtool@5f2a608
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:8555f0e37e6261408f792bfd6635102d2da5ad73f8f09bcb24f25e6afb5fac97

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Sep 22, 2023
@release-please
chore(main): release 2.13.2 (#352)
aab86c7
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Sep 22, 2023
@gcf-owl-bot @parthea
chore(python): add support for python 3.11 [autoapprove] (#352)
04ea0b1
* chore(python): add support for python 3.11

Source-Link: googleapis/synthtool@7197a00
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:c43f1d918bcf817d337aa29ff833439494a158a0831508fda4ec75dc4c0d0320

* trigger CI

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Sep 22, 2023
@release-please
chore(main): release 2.8.1 (#352)
4719e60
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Oct 21, 2023
@renovate-bot @parthea
chore(deps): update all dependencies (#352)
b2ec836
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Oct 21, 2023
@renovate-bot
chore(deps): update dependency black to v22.10.0 (#352)
d758ccd
parthea pushed a commit that referenced this pull request Oct 21, 2023
@renovate-bot
chore(deps): update all dependencies (#352)
29444ea
parthea pushed a commit that referenced this pull request Oct 21, 2023
@renovate-bot
chore(deps): update all dependencies (#352)
561fc22
parthea added a commit that referenced this pull request Oct 21, 2023
@gcf-owl-bot @parthea
chore: use gapic-generator-python 0.65.2 (#352)
f02e450
* chore: use gapic-generator-python 0.65.2

PiperOrigin-RevId: 444333013

Source-Link: googleapis/googleapis@f91b6cf

Source-Link: googleapis/googleapis-gen@16eb360
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMTZlYjM2MDk1YzI5NGU3MTJjNzRhMWJmMjM1NTA4MTdiNDIxNzRlNSJ9

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea added a commit that referenced this pull request Oct 21, 2023
@renovate-bot @parthea
chore(deps): update all dependencies (#352)
e4228aa
Co-authored-by: Anthonios Partheniou <[email protected]>
parthea pushed a commit that referenced this pull request Oct 21, 2023
@renovate-bot
chore(deps): update dependency pytest to v7.3.1 (#352)
684fa77
parthea pushed a commit that referenced this pull request Oct 21, 2023
@release-please
chore(main): release 3.10.0 (#352)
4922815
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Aug 21, 2025
@release-please
chore: release 2.10.1 (#352)
022158b
🤖 I have created a release \*beep\* \*boop\*
---
### [2.10.1](https://www.github.com/googleapis/python-bigquery-storage/compare/v2.10.0...v2.10.1) (2021-11-11)


### Documentation

* show that Python 3.9 and 3.10 are supported in classifiers ([#351](https://www.github.com/googleapis/python-bigquery-storage/issues/351)) ([1faa16f](https://www.github.com/googleapis/python-bigquery-storage/commit/1faa16f4dbeac461ebc816949a3f88f5da97540b))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this pull request Sep 16, 2025
@release-please @parthea
chore: release 2.10.1 (#352)
bbc6d7f
🤖 I have created a release \*beep\* \*boop\*
---
### [2.10.1](https://www.github.com/googleapis/python-bigquery-storage/compare/v2.10.0...v2.10.1) (2021-11-11)


### Documentation

* show that Python 3.9 and 3.10 are supported in classifiers ([#351](https://www.github.com/googleapis/python-bigquery-storage/issues/351)) ([1faa16f](https://www.github.com/googleapis/python-bigquery-storage/commit/1faa16f4dbeac461ebc816949a3f88f5da97540b))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
parthea pushed a commit that referenced this pull request Nov 22, 2025
@kolea2
deps(samples): update google-cloud-bigtable to 2.3.1 (#375)
d079eea
Closes #352.
parthea pushed a commit that referenced this pull request Nov 24, 2025
@software-dov
Remove 'proof-of-concept' (#352)
b4b16b5
parthea pushed a commit that referenced this pull request Nov 24, 2025
@release-please
chore(main): release 2.6.1 (#352)
6c54703
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot
chore(python): Add kokoro configs for python 3.10 samples testing (#352)
5aaf110
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot @chalmerlowe
chore(python): remove configure_previous_major_version_branches (#352)
bae1aff
Source-Link: googleapis/synthtool@6702a34
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:fbbc8db67afd8b7d71bf694c5081a32da0c528eba166fbcffb3b6e56ddf907d5

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Co-authored-by: Chalmer Lowe <[email protected]>
parthea pushed a commit that referenced this pull request Nov 24, 2025
@renovate-bot @gcf-owl-bot
chore(deps): update all dependencies (#352)
8bb7344
* chore(deps): update all dependencies

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
parthea added a commit that referenced this pull request Nov 24, 2025
@parthea
chore: migrate to owl bot (#352)
c6351e2
This PR migrates from autosynth to [owl bot](https://github.com/googleapis/repo-automation-bots/tree/master/packages/owl-bot).  owl bot will save time for maintainers as it will automatically open PRs when there are updates in [googleapis-gen](https://github.com/googleapis/googleapis-gen/tree/master/google) without requiring maintainers to run `synthtool` to build the client from protos. Additionally, similar to autosynth, PRs will be automatically opened when there are template updates.
parthea added a commit that referenced this pull request Nov 24, 2025
@parthea
chore: s.remove_staging_dirs() should only be called once (#362)
59b4c03
There is [an issue](https://github.com/googleapis/python-firestore/blob/master/owlbot.py#L60) in the `owlbot.py` file added in #352 in that [s.remove_staging_dirs()](https://github.com/googleapis/synthtool/blob/master/synthtool/transforms.py#L309) should only be called once after all the files are copied over.  [get_staging_dirs()](https://github.com/googleapis/synthtool/blob/master/synthtool/transforms.py#L280) will only return staging directories that exist.
parthea pushed a commit that referenced this pull request Nov 24, 2025
@gcf-owl-bot
build(python): exit with success status if no samples found (#352)
833c6d5
Source-Link: googleapis/synthtool@53ea389
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:e1793a23ae0ee9aafb2e3a53b564a351f74790dbe3c2d75f8fc3b8c43e5c036c
parthea pushed a commit that referenced this pull request Nov 24, 2025
@release-please
chore: release 1.1.0 (#352)
5ce40ba
* updated CHANGELOG.md [ci skip]

* updated setup.py [ci skip]
parthea pushed a commit that referenced this pull request Nov 25, 2025
@gcf-owl-bot
build(python): exit with success status if no samples found (#352)
036d6f2
Source-Link: googleapis/synthtool@53ea389
Post-Processor: gcr.io/repo-automation-bots/owlbot-python:latest@sha256:e1793a23ae0ee9aafb2e3a53b564a351f74790dbe3c2d75f8fc3b8c43e5c036c
parthea pushed a commit that referenced this pull request Nov 26, 2025
@JordanP @busunkim96
setup.py: set an upper bound on dependencies version (#352)
2ec4ee2
This should make this library more robust in case of breaking changes in one of
its dependencies.
parthea pushed a commit that referenced this pull request Mar 9, 2026
@HemangChothani
fix: expose num_retries parameter for blob upload methods (#353)
436c7f9
Fixes #352
parthea pushed a commit that referenced this pull request Mar 9, 2026
@dandhlee
build: temporarily disable golden tests (#352)
14098c5
* build: temporarily disable golden tests

* build: remove golden test from tests/ directory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

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

Assignees

No one assigned

Labels

api: storage Issues related to the Cloud Storage API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

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.

3 participants

@tseaver @dhermes @coveralls
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.