Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implicit set_ methods should return the values set and raise if not successful #631

Closed
dhermes opened this issue Feb 13, 2015 · 2 comments
Closed
Assignees
Labels
api: storage Issues related to the Cloud Storage API.

Comments

@dhermes
Copy link
Contributor

dhermes commented Feb 13, 2015

See @tseaver comment about returning (and the current storage regression test hacky behavior).

This will likely require doing something like

class Environment(object):
    ....

DEFAULT_ENVIRON = Environment()

def set_default_foo():
    # Do some stuff to DEFAULT_ENVIRON
    return DEFAULT_ENVIRON
@dhermes dhermes added the api: storage Issues related to the Cloud Storage API. label Feb 13, 2015
@dhermes dhermes added this to the Storage Future milestone Feb 13, 2015
@dhermes dhermes changed the title Implict set_ methods should return the values set and raise if not successful Implicit set_ methods should return the values set and raise if not successful Feb 13, 2015
@dhermes
Copy link
Contributor Author

dhermes commented Mar 9, 2015

@tseaver We currently have 7 set_ methods defined:

$ git grep -n 'def set_'
gcloud/datastore/__init__.py:65:def set_defaults(dataset_id=None, connection=None):
gcloud/datastore/_implicit_environ.py:131:def set_default_dataset_id(dataset_id=None):
gcloud/datastore/_implicit_environ.py:185:def set_default_connection(connection=None):
gcloud/storage/__init__.py:56:def set_default_bucket(bucket=None):
gcloud/storage/__init__.py:82:def set_default_project(project=None):
gcloud/storage/__init__.py:101:def set_default_connection(project=None, connection=None):
gcloud/storage/__init__.py:117:def set_defaults(bucket=None, project=None, connection=None):
$ git log -1 --pretty=%H
3c7316ee312a3255fd78aa93d136ec5b19060417

Among what we do have:

  • datastore._implicit_environ.set_default_dataset_id throws an exception if not set but does not return
  • datastore._implicit_environ.set_default_connection neither throws nor returns
  • datastore.__init__.set_defaults just wraps set_default_dataset_id and set_default_connection, so could get exception throwing for free but returning is not simple. We could just remove this since we have the lazy loading now.
  • storage.__init__.set_default_bucket neither returns nor throws
  • storage.__init__.set_default_project neither returns nor throws
  • storage.__init__.set_default_connection neither returns nor throws
  • storage.__init__.set_default_defaults neither returns nor throws

@dhermes
Copy link
Contributor Author

dhermes commented Aug 28, 2015

Irrelevant in Client world

@dhermes dhermes closed this as completed Aug 28, 2015
vchudnov-g pushed a commit that referenced this issue Sep 20, 2023
Source-Link: https://togithub.com/googleapis/synthtool/commit/92006bb3cdc84677aa93c7f5235424ec2b157146
Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:2e247c7bf5154df7f98cce087a20ca7605e236340c7d6d1a14447e5c06791bd6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

No branches or pull requests

1 participant