Skip to content

Pull snippets from docstrings. - #2611

Merged
daspecster merged 1 commit into
googleapis:masterfrom
daspecster:add-storage-snippets
Dec 1, 2016
Merged

Pull snippets from docstrings.#2611
daspecster merged 1 commit into
googleapis:masterfrom
daspecster:add-storage-snippets

Conversation

@daspecster

@daspecsterdaspecster commented Oct 25, 2016

Copy link
Copy Markdown
Contributor

These snippets don't run yet but the docs build and pull them.
@dhermessuggested I could merged this in before getting them to run.

I'm not sure about removing the imports for some snippets. It seems like those a nice to have?

@daspecsterdaspecster added docs api: storage Issues related to the Cloud Storage API. labels Oct 25, 2016
@googlebotgooglebot added the cla: yes This human has signed the Contributor License Agreement. label Oct 25, 2016
@dhermes

Copy link
Copy Markdown
Contributor

@daspecster I have already started a review and noticed a new commit come in. Should I stop reviewing / is it stable?

@daspecster

Copy link
Copy Markdown
ContributorAuthor

@dhermes sorry yeah I was getting travis to pass.

I updated the PR's original description with a question though.

I'm not sure about removing the imports for some snippets. It seems like those a nice to have?

@daspecster

Copy link
Copy Markdown
ContributorAuthor

#stilltryingtogettravistopass....

Comment threaddocs/storage_snippets.py Outdated


def _millis():
return time.time() * 1000

This comment was marked as spam.

This comment was marked as spam.

Comment threaddocs/storage_snippets.py Outdated
need to be deleted during teardown.
"""

import time

This comment was marked as spam.


client = storage.Client(project='my-project')
bucket = client.get_bucket('my-bucket')
encryption_key = 'aa426195405adee2c8081bb9e7e74b19'

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

print(bucket.get_blob('/path/to/blob.txt'))
# <Blob: my-bucket, /path/to/blob.txt>
print(bucket.get_blob('/does-not-exist.txt'))
# None

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment threaddocs/storage_snippets.py Outdated
except AssertionError as e:
print(' FAIL: %s' % (e,))
except Exception as e: # pylint: disable=broad-except
print(' ERROR: %r' % (e,))

This comment was marked as spam.

@dhermes

Copy link
Copy Markdown
Contributor

RE:

#stilltryingtogettravistopass....

Why can't you run these on your local machine?

@daspecster

daspecster commented Oct 25, 2016

Copy link
Copy Markdown
ContributorAuthor

They passed on my local machine(falsely). I keep having to delete my .tox folder for lint and docs to pick up changes and I forget sometimes.

@dhermesdhermes left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ah shucks. Many of those asserts ended up being not so useful, in particular the isinstance ones.

Hold off on this until I get the Pub/Sub rewrite proof-of-concept going?

Comment threaddocs/storage_snippets.py Outdated
blob = bucket.get_blob('/remote/path/to/file.txt')
print(blob.download_as_string())

(blob.download_as_string())

This comment was marked as spam.

This comment was marked as spam.

@daspecster

Copy link
Copy Markdown
ContributorAuthor

@dhermes am I good to go on this then?

@dhermes

Copy link
Copy Markdown
Contributor

@daspecster Not sure what you are referring to. You should definitely rebase and get the CIs green before merging..


If you are asking about the assets, I said before

Yeah, don't block this PR based on the ongoing discussion. But you should be uniform and use assert instead

@daspecster
daspecsterforce-pushed the add-storage-snippets branch 2 times, most recently from 47b0ec8 to a589a13CompareNovember 14, 2016 18:47
@daspecster

Copy link
Copy Markdown
ContributorAuthor

Ok, squashed and we'll see if Travis runs it in a timely fashion.

@daspecster
daspecster merged commit ce6756f into googleapis:masterDec 1, 2016
@daspecster
daspecster deleted the add-storage-snippets branch December 1, 2016 15:16
richkadel pushed a commit to richkadel/google-cloud-python that referenced this pull request May 6, 2017
parthea pushed a commit that referenced this pull request Mar 9, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storageIssues related to the Cloud Storage API.cla: yesThis human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@daspecster@dhermes@tseaver@googlebot